From 0fa84ca6310720062ddc59281c6d566620bf6e35 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 15:54:05 +0800 Subject: [PATCH 01/71] Refresh maintained examples from generator v4.2.0 (qualification candidate) --- examples/conformance/AGENTS.md | 60 +- examples/conformance/RUNTIME_CUSTOM_GUIDE.md | 11 + examples/conformance/STANDARD_TELEMETRY.md | 45 + examples/conformance/lib/pom.xml | 4 +- .../runtimeexampleconformanceservice/E.java | 5 +- .../EntityMetaRegistry.java | 134 +- .../GeneratedRuntimeModule.java | 14 + .../runtimeexampleconformanceservice/Q.java | 2 + .../platform/Platform.java | 43 +- .../platform/PlatformChecker.java | 4 + .../platform/PlatformExpression.java | 4 +- .../platform/PlatformRequest.java | 81 +- .../workitem/WorkItem.java | 44 +- .../workitem/WorkItemChecker.java | 10 +- .../workitem/WorkItemExpression.java | 6 +- .../workitem/WorkItemRequest.java | 93 +- .../automatic-fixture/evaluation.json | 111 +- .../automatic-fixture/generated-files.json | 48 +- .../automatic-fixture/generation.json | 43 +- .../automatic-fixture/lib/pom.xml | 4 +- .../EntityMetaRegistry.java | 149 +- .../catalog/CatalogRequest.java | 44 + .../entry/EntryRequest.java | 75 +- .../automatic-fixture/model.xml | 2 +- .../teaql/model-provenance.json | 2 +- .../conformance/natural-messages/model.xml | 2 +- examples/conformance/teaql/checker-model.json | 1 + .../conformance/teaql/model-provenance.json | 1 + .../fix-e-alignment/fixture-manifest.json | 78 +- .../fix-e-alignment/generated/lib/pom.xml | 4 +- .../EntityMetaRegistry.java | 270 ++- .../GeneratedRuntimeModule.java | 1 + .../orderitem/OrderItem.java | 13 +- .../orderitem/OrderItemChecker.java | 27 +- .../orderitem/OrderItemRequest.java | 98 +- .../purchaseorder/PurchaseOrder.java | 17 +- .../purchaseorder/PurchaseOrderChecker.java | 27 +- .../purchaseorder/PurchaseOrderRequest.java | 83 +- .../checkerfixadvanced/tenant/Tenant.java | 18 +- .../tenant/TenantChecker.java | 1 + .../tenant/TenantRequest.java | 44 + .../generated/teaql/checker-model.json | 1 + .../generated/teaql/model-provenance.json | 1 + examples/generator-v420.json | 1826 +++++++++++++++++ .../inheritance-save/generated-files.json | 88 +- examples/inheritance-save/lib/pom.xml | 2 +- .../EntityMetaRegistry.java | 2 - .../academy/Academy.java | 4 +- .../trainingacademy/TrainingAcademy.java | 4 +- examples/inheritance-save/model.xml | 2 +- .../teaql/model-provenance.json | 2 +- .../java-lib-core/lib/pom.xml | 6 +- .../ordermanagementservice/Constants.java | 6 +- .../com/teaql/ordermanagementservice/E.java | 15 +- .../EntityMetaRegistry.java | 899 +++++++- .../GeneratedRuntimeModule.java | 82 + .../com/teaql/ordermanagementservice/Q.java | 7 + .../commerceplatform/CommercePlatform.java | 135 +- .../CommercePlatformChecker.java | 82 +- .../CommercePlatformExpression.java | 18 +- .../CommercePlatformRequest.java | 600 +++++- .../customer/Customer.java | 88 +- .../customer/CustomerChecker.java | 94 +- .../customer/CustomerExpression.java | 12 +- .../customer/CustomerRequest.java | 372 +++- .../customerorder/CustomerOrder.java | 146 +- .../customerorder/CustomerOrderChecker.java | 123 +- .../CustomerOrderExpression.java | 28 +- .../customerorder/CustomerOrderRequest.java | 458 ++++- .../orderline/OrderLine.java | 93 +- .../orderline/OrderLineChecker.java | 96 +- .../orderline/OrderLineExpression.java | 14 +- .../orderline/OrderLineRequest.java | 311 ++- .../ordersearchpreset/OrderSearchPreset.java | 105 +- .../OrderSearchPresetChecker.java | 114 +- .../OrderSearchPresetExpression.java | 14 +- .../OrderSearchPresetRequest.java | 321 ++- .../orderstatus/OrderStatus.java | 82 +- .../orderstatus/OrderStatusChecker.java | 67 +- .../orderstatus/OrderStatusExpression.java | 12 +- .../orderstatus/OrderStatusRequest.java | 380 +++- .../product/Product.java | 100 +- .../product/ProductChecker.java | 104 +- .../product/ProductExpression.java | 14 +- .../product/ProductRequest.java | 404 +++- .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/order-management/model.xml | 13 + .../scalar-type-probe/fixture-manifest.json | 66 +- .../scalar-type-probe/generated/lib/pom.xml | 4 +- .../EntityMetaRegistry.java | 500 ++++- .../GeneratedRuntimeModule.java | 1 + .../scalartypeprobe/ScalarTypeProbe.java | 83 +- .../ScalarTypeProbeChecker.java | 29 +- .../ScalarTypeProbeRequest.java | 235 ++- .../typeplatform/TypePlatform.java | 19 +- .../typeplatform/TypePlatformChecker.java | 3 + .../typeplatform/TypePlatformRequest.java | 44 + .../generated/teaql/checker-model.json | 1 + .../generated/teaql/model-provenance.json | 1 + .../json-profiles/PascalCase/lib/pom.xml | 4 +- .../EntityMetaRegistry.java | 500 ++++- .../GeneratedRuntimeModule.java | 1 + .../scalartypeprobe/ScalarTypeProbe.java | 31 +- .../ScalarTypeProbeChecker.java | 27 +- .../ScalarTypeProbeRequest.java | 235 ++- .../typeplatform/TypePlatform.java | 13 +- .../typeplatform/TypePlatformChecker.java | 1 + .../typeplatform/TypePlatformRequest.java | 44 + .../PascalCase/teaql/checker-model.json | 1 + .../PascalCase/teaql/model-provenance.json | 1 + .../json-profiles/camelCase/lib/pom.xml | 4 +- .../EntityMetaRegistry.java | 500 ++++- .../GeneratedRuntimeModule.java | 1 + .../scalartypeprobe/ScalarTypeProbe.java | 31 +- .../ScalarTypeProbeChecker.java | 27 +- .../ScalarTypeProbeRequest.java | 235 ++- .../typeplatform/TypePlatform.java | 13 +- .../typeplatform/TypePlatformChecker.java | 1 + .../typeplatform/TypePlatformRequest.java | 44 + .../camelCase/teaql/checker-model.json | 1 + .../camelCase/teaql/model-provenance.json | 1 + .../json-profiles/provenance.json | 158 +- .../json-profiles/snake_case/lib/pom.xml | 4 +- .../EntityMetaRegistry.java | 500 ++++- .../GeneratedRuntimeModule.java | 1 + .../scalartypeprobe/ScalarTypeProbe.java | 31 +- .../ScalarTypeProbeChecker.java | 27 +- .../ScalarTypeProbeRequest.java | 235 ++- .../typeplatform/TypePlatform.java | 13 +- .../typeplatform/TypePlatformChecker.java | 1 + .../typeplatform/TypePlatformRequest.java | 44 + .../snake_case/teaql/checker-model.json | 1 + .../snake_case/teaql/model-provenance.json | 1 + examples/school-management/AGENTS.md | 60 +- .../school-management/RUNTIME_CUSTOM_GUIDE.md | 11 + .../school-management/STANDARD_TELEMETRY.md | 45 + examples/school-management/lib/pom.xml | 4 +- .../example/schoolmanagementservice/E.java | 7 +- .../EntityMetaRegistry.java | 375 +++- .../GeneratedRuntimeModule.java | 15 + .../example/schoolmanagementservice/Q.java | 3 + .../platform/Platform.java | 90 +- .../platform/PlatformChecker.java | 39 +- .../platform/PlatformExpression.java | 12 +- .../platform/PlatformRequest.java | 319 ++- .../school/School.java | 110 +- .../school/SchoolChecker.java | 54 +- .../school/SchoolExpression.java | 18 +- .../school/SchoolRequest.java | 160 +- .../schooltype/SchoolType.java | 67 +- .../schooltype/SchoolTypeChecker.java | 13 +- .../schooltype/SchoolTypeExpression.java | 10 +- .../schooltype/SchoolTypeRequest.java | 217 +- .../teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + examples/standard-order/generated/lib/pom.xml | 6 +- .../example/requesttreeorderservice/E.java | 11 +- .../EntityMetaRegistry.java | 405 +++- .../GeneratedRuntimeModule.java | 1 + .../customer/Customer.java | 30 +- .../customer/CustomerChecker.java | 3 + .../customer/CustomerExpression.java | 6 +- .../customer/CustomerRequest.java | 59 +- .../customerorder/CustomerOrder.java | 57 +- .../customerorder/CustomerOrderChecker.java | 9 +- .../CustomerOrderExpression.java | 12 +- .../customerorder/CustomerOrderRequest.java | 90 +- .../orderitem/OrderItem.java | 41 +- .../orderitem/OrderItemChecker.java | 9 +- .../orderitem/OrderItemExpression.java | 8 +- .../orderitem/OrderItemRequest.java | 75 +- .../orderstatus/OrderStatus.java | 45 +- .../orderstatus/OrderStatusChecker.java | 5 +- .../orderstatus/OrderStatusExpression.java | 12 +- .../orderstatus/OrderStatusRequest.java | 83 +- .../platform/Platform.java | 38 +- .../platform/PlatformChecker.java | 3 + .../platform/PlatformExpression.java | 6 +- .../platform/PlatformRequest.java | 44 + .../generated/teaql/checker-model.json | 1 + .../generated/teaql/model-provenance.json | 1 + examples/standard-order/models/model.xml | 3 +- examples/trace-chain/AGENTS.md | 60 +- examples/trace-chain/DOMAIN_API_GUIDE.md | 33 + examples/trace-chain/RUNTIME_CUSTOM_GUIDE.md | 25 + examples/trace-chain/STANDARD_TELEMETRY.md | 45 + examples/trace-chain/TOOL_API_GUIDE.md | 31 + examples/trace-chain/lib/pom.xml | 4 +- .../java/com/teaql/tracechainservice/E.java | 13 +- .../tracechainservice/EntityMetaRegistry.java | 355 +++- .../GeneratedRuntimeModule.java | 1 + .../customerorder/CustomerOrder.java | 73 +- .../customerorder/CustomerOrderChecker.java | 5 +- .../CustomerOrderExpression.java | 12 +- .../customerorder/CustomerOrderRequest.java | 149 +- .../orderitem/OrderItem.java | 39 +- .../orderitem/OrderItemChecker.java | 5 +- .../orderitem/OrderItemExpression.java | 4 +- .../orderitem/OrderItemRequest.java | 83 +- .../tracechainservice/payment/Payment.java | 56 +- .../payment/PaymentChecker.java | 7 +- .../payment/PaymentExpression.java | 6 +- .../payment/PaymentRequest.java | 102 +- .../paymentattempt/PaymentAttempt.java | 37 +- .../paymentattempt/PaymentAttemptChecker.java | 5 +- .../PaymentAttemptExpression.java | 4 +- .../paymentattempt/PaymentAttemptRequest.java | 83 +- .../tracechainservice/platform/Platform.java | 39 +- .../platform/PlatformChecker.java | 3 + .../platform/PlatformExpression.java | 4 +- .../platform/PlatformRequest.java | 80 +- .../tracechainservice/shipment/Shipment.java | 45 +- .../shipment/ShipmentChecker.java | 7 +- .../shipment/ShipmentExpression.java | 4 +- .../shipment/ShipmentRequest.java | 83 +- examples/trace-chain/model.xml | 3 +- examples/trace-chain/teaql/checker-model.json | 1 + .../trace-chain/teaql/model-provenance.json | 1 + 219 files changed, 14833 insertions(+), 2158 deletions(-) create mode 100644 examples/conformance/STANDARD_TELEMETRY.md create mode 100644 examples/conformance/teaql/checker-model.json create mode 100644 examples/conformance/teaql/model-provenance.json create mode 100644 examples/fix-e-alignment/generated/teaql/checker-model.json create mode 100644 examples/fix-e-alignment/generated/teaql/model-provenance.json create mode 100644 examples/generator-v420.json create mode 100644 examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java create mode 100644 examples/order-management/java-lib-core/teaql/checker-model.json create mode 100644 examples/order-management/java-lib-core/teaql/model-provenance.json create mode 100644 examples/order-management/model.xml create mode 100644 examples/scalar-type-probe/generated/teaql/checker-model.json create mode 100644 examples/scalar-type-probe/generated/teaql/model-provenance.json create mode 100644 examples/scalar-type-probe/json-profiles/PascalCase/teaql/checker-model.json create mode 100644 examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json create mode 100644 examples/scalar-type-probe/json-profiles/camelCase/teaql/checker-model.json create mode 100644 examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json create mode 100644 examples/scalar-type-probe/json-profiles/snake_case/teaql/checker-model.json create mode 100644 examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json create mode 100644 examples/school-management/STANDARD_TELEMETRY.md create mode 100644 examples/school-management/teaql/checker-model.json create mode 100644 examples/school-management/teaql/model-provenance.json create mode 100644 examples/standard-order/generated/teaql/checker-model.json create mode 100644 examples/standard-order/generated/teaql/model-provenance.json create mode 100644 examples/trace-chain/DOMAIN_API_GUIDE.md create mode 100644 examples/trace-chain/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/trace-chain/STANDARD_TELEMETRY.md create mode 100644 examples/trace-chain/TOOL_API_GUIDE.md create mode 100644 examples/trace-chain/teaql/checker-model.json create mode 100644 examples/trace-chain/teaql/model-provenance.json diff --git a/examples/conformance/AGENTS.md b/examples/conformance/AGENTS.md index 07780e5f8..0fc0b95fd 100644 --- a/examples/conformance/AGENTS.md +++ b/examples/conformance/AGENTS.md @@ -2,6 +2,31 @@ # TeaQL Java Agent Instructions +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + > [!WARNING] > **IGNORE GENERIC ORM EXPERIENCE** > @@ -13,29 +38,7 @@ > > Do **not** guess TeaQL method names. -## How to Write Domain Code - -To get the exact API usage and query examples for the entity you are working on, execute the following command: - -```bash -cargo teaql --input models/runtime-example-conformance-service.xml java-assist-[action]/[entity-name] -``` - -> `models/runtime-example-conformance-service.xml` is the default model path. If the model file is located elsewhere, adjust the `--input` path to match the actual file location in this project. - -Replace `[action]` with one of the following: - -| action | when-to-use | -|--------|-------------| -| query | Read/find records from the database using Q. | -| create | Insert a new record into the database | -| update | Modify and save an existing record | -| delete | Remove or soft-delete a record | -| expression | Safely extract nested relation values using E. | -| list-page | Implement a paginated query returning SmartList | -| debug | View instructions for enabling SQL logging and debugging | - -Replace `[entity-name]` with the exact entity-name from the table below: +## Model entities | entity-name | display-name | |-------------|--------------| @@ -43,9 +46,10 @@ Replace `[entity-name]` with the exact entity-name from the table below: | work_item | Work Item | -Once the command succeeds, read its output. Use the printed code as a template to write your logic. +## Application entry and context -If the command cannot be executed, stop and report the missing context. Do not invent APIs. +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. ## Additional References @@ -55,4 +59,8 @@ Read these only when the task requires them: Framework runtime references and context handling. * **`RUNTIME_CUSTOM_GUIDE.md`** - Runtime setup, debugging, and project-specific restrictions. \ No newline at end of file + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/conformance/RUNTIME_CUSTOM_GUIDE.md b/examples/conformance/RUNTIME_CUSTOM_GUIDE.md index 6812d1e8b..b1f92619e 100644 --- a/examples/conformance/RUNTIME_CUSTOM_GUIDE.md +++ b/examples/conformance/RUNTIME_CUSTOM_GUIDE.md @@ -1,6 +1,17 @@ # TeaQL Runtime Customization Guide +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + > [!WARNING] > **DO NOT GUESS RUNTIME CONFIGURATION** > Do not guess how to configure the runtime, connection pools, or schema generation. diff --git a/examples/conformance/STANDARD_TELEMETRY.md b/examples/conformance/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/conformance/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/conformance/lib/pom.xml b/examples/conformance/lib/pom.xml index 0eabc1b7e..45181c5ca 100644 --- a/examples/conformance/lib/pom.xml +++ b/examples/conformance/lib/pom.xml @@ -82,7 +82,7 @@ cn.hutool hutool-all - 5.8.47 + 5.8.20 @@ -139,4 +139,4 @@ https://maven.teaql.io/repository/maven-releases/ - + \ No newline at end of file diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java index 24859372a..68fd537c5 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java @@ -5,13 +5,14 @@ import com.teaql.runtimeexampleconformanceservice.platform.PlatformExpression; import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; import io.teaql.core.value.ValueExpression; public class E { public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform)); + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); } public static WorkItemExpression workItem(WorkItem workItem){ - return new WorkItemExpression(new ValueExpression(workItem)); + return new WorkItemExpression(new ValueExpression(workItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.workItem()")); } } \ No newline at end of file diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java index 7f50f27f5..4f01a8f47 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java @@ -1,6 +1,7 @@ package com.teaql.runtimeexampleconformanceservice; +import io.teaql.core.FieldLayout; import io.teaql.core.meta.EntityDescriptor; import io.teaql.core.meta.EntityMetaAssembler; import io.teaql.core.meta.EntityMetaFactory; @@ -16,14 +17,19 @@ public void assemble(EntityMetaFactory factory) { registerWorkItem(); } private void registerPlatform() { + FieldLayout.installGenerated(com.teaql.runtimeexampleconformanceservice.platform.Platform.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.runtimeexampleconformanceservice.platform.Platform.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.runtimeexampleconformanceservice.platform.Platform.class); entityDescriptor.setEntitySupplier(com.teaql.runtimeexampleconformanceservice.platform.Platform::new); entityDescriptor.with("name", "Platform") + .with("module", "Example") - .with("module_key", "example"); + .with("module_key", "example") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY, Long.class) ; @@ -35,66 +41,116 @@ private void registerPlatform() { ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Runtime Example") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerWorkItem() { + FieldLayout.installGenerated(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class); entityDescriptor.setEntitySupplier(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem::new); entityDescriptor.with("name", "Work Item") + .with("module", "Example") - .with("module_key", "example"); + .with("module_key", "example") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY, Long.class) ; @@ -112,72 +168,132 @@ private void registerWorkItem() { ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY).with("isPassword", "false") + .with("max", "80") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.DESCRIPTION_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java index 356776084..4a8cb2488 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java @@ -4,11 +4,25 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.teaql.runtimeexampleconformanceservice.platform.PlatformChecker(), new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:f026153870cc54db18171cbbe02db1db174f3dea513e9d21e0ffe8af787ebaed\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]},{\"name\":\"work_item_list\",\"targetType\":\"WorkItem\",\"labels\":{\"en\":\"Work Item\"},\"aliases\":[\"WorkItemList\",\"workItemList\"]}]},\"WorkItem\":{\"labels\":{\"en\":\"Work Item\"},\"fields\":[{\"name\":\"description\",\"labels\":{\"en\":\"description\"},\"aliases\":[\"Description\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"title\",\"labels\":{\"en\":\"title\"},\"aliases\":[\"Title\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} public static io.teaql.core.RuntimeModule module() { return MODULE; } + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("WorkItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("title", "title"), java.util.Map.entry("description", "description"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); com.teaql.runtimeexampleconformanceservice.platform.Platform domainRoot; diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java index 0656d1832..488630449 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java @@ -12,6 +12,7 @@ public static com.teaql.runtimeexampleconformanceservice.platform.PlatformReques } + public static com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest workItems(){ return new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -20,4 +21,5 @@ public static com.teaql.runtimeexampleconformanceservice.workitem.WorkItemReques } + } \ No newline at end of file diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java index a7338dd5f..b65672c65 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java @@ -5,9 +5,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -21,33 +23,52 @@ public class Platform extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "Platform"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e5c9f1d176ea19c50ebeacae413fa8885a3403d4d9ac9775fe79aecd0d931638"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "work_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; - public static final String WORK_ITEM_LIST_PROPERTY = "workItemList"; + public static final String WORK_ITEM_LIST_PROPERTY = "work_item_list"; private String name; + private SmartList workItemList; public String getName(){ return this.name; } + public SmartList getWorkItemList(){ - return this.workItemList; + return this.workItemList == null ? SmartList.unloaded() : this.workItemList; } public Platform updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public Platform addWorkItem(WorkItem workItem){ if (workItem == null){ return this; } if(null == this.workItemList){ - this.workItemList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.workItemList = teaqlUnloadedItems.map(value -> value); } this.workItemList.add(workItem); @@ -74,7 +95,7 @@ public Platform comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -85,7 +106,7 @@ public void __internalSet(String property, Object value) { switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "workItemList": this.workItemList = (SmartList) value; break; + case "work_item_list": this.workItemList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -95,8 +116,14 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "name": return this.name; - case "workItemList": return this.workItemList; - default: return super.__internalGet(property); + case "work_item_list": return this.workItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java index 396a0d24c..54ee11319 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java @@ -24,11 +24,15 @@ public void doCheck(UserContext _context, Platform platform, ObjectLocation _par if((platform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } if(platform.newItem()){ }else if(platform.updateItem()){ if(!platform.isPropertyLoaded("name")){ invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); } + } checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); for(int i = 0; platform.getWorkItemList() != null && i < platform.getWorkItemList().size(); i++){ diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java index 6d18dc2ba..4622a5e9d 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java @@ -36,14 +36,14 @@ public boolean isNull() { public Expression getName(){ - return loaded("name", Platform::getName); + return loaded("name", "getName", Platform::getName); } public PlatformExpression updateName(String name){ return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); } public WorkItemListExpression getWorkItemList(){ - return new WorkItemListExpression(loaded("workItemList", Platform::getWorkItemList)); + return new WorkItemListExpression(loaded("work_item_list", "getWorkItemList", Platform::getWorkItemList)); } public PlatformExpression addWorkItem(WorkItem workItem){ return new PlatformExpression(this, $it -> ((Platform)$it).addWorkItem(workItem)); diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java index efc95dde1..0c64a37b9 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class PlatformRequest extends BaseRequest { @@ -21,7 +22,11 @@ public class PlatformRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public PlatformRequest(Class returnType){ - super(returnType, () -> (T) new Platform()); + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -31,6 +36,19 @@ public PlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PlatformRequest returnType(Class returnType){ @@ -98,6 +116,12 @@ public PlatformRequest matchingAnyOf(PlatformRequest platform){ return this; } + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + public PlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -121,6 +145,15 @@ public PlatformRequest selectSelfFields(){ return selectSelf(); } + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectAll(){ super.selectAll(); return selectId().selectName().selectVersion(); @@ -189,7 +222,8 @@ public PlatformRequest selectWorkItemList(){ } public PlatformRequest selectWorkItemListWith(WorkItemRequest workItemList){ - enhanceRelation(Platform.WORK_ITEM_LIST_PROPERTY, workItemList); + enhanceRelation(Platform.WORK_ITEM_LIST_PROPERTY, workItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectWorkItemListWith", null, Platform.WORK_ITEM_LIST_PROPERTY)); return this; } @@ -362,6 +396,7 @@ public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVers return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public PlatformRequest withWorkItemListMatching(WorkItemRequest workItemRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, workItemRequest, WorkItem.PLATFORM_PROPERTY)); } @@ -380,10 +415,36 @@ public PlatformRequest haveNoWorkItems(){ public PlatformRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public PlatformRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); return this; } public PlatformRequest groupByWorkItemsWithDetails(WorkItemRequest subRequest){ @@ -482,8 +543,8 @@ public PlatformRequest statsFromWorkItemsAs(String name, WorkItemRequest subR } public PlatformRequest statsFromWorkItemsAs(String name, WorkItemRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(WorkItem.PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, WorkItem.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromWorkItemsAs", name, Platform.WORK_ITEM_LIST_PROPERTY)); return this; } @@ -491,15 +552,21 @@ public PlatformRequest statsFromWorkItems(WorkItemRequest subRequest){ return statsFromWorkItemsAs(REFINEMENTS, subRequest); } public PlatformRequest countWorkItems(){ - return countWorkItemsAs("Count"); + addRelationCount("Count", Q.workItems().unlimited(), WorkItem.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItems", null, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; } public PlatformRequest countWorkItemsAs(String name){ - return countWorkItemsWith(name, Q.workItems().unlimited()); + addRelationCount(name, Q.workItems().unlimited(), WorkItem.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItemsAs", name, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; } public PlatformRequest countWorkItemsWith(String name, WorkItemRequest subRequest){ - return statsFromWorkItemsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, WorkItem.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItemsWith", name, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; } diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java index 98be7fdec..e558c6cca 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java @@ -5,8 +5,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -20,42 +22,65 @@ public class WorkItem extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "WorkItem"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "ff6df6930613256f676f63204201b7b20d7ecd9fa363bae51492c66e562f023c"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("title", 1), java.util.Map.entry("description", 2), java.util.Map.entry("platform", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("title", java.util.List.of("title", "title")), java.util.Map.entry("description", java.util.List.of("description", "description")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + WorkItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String TITLE_PROPERTY = "title"; public static final String DESCRIPTION_PROPERTY = "description"; public static final String PLATFORM_PROPERTY = "platform"; private String title; + private String description; + private Platform platform; + public String getTitle(){ return this.title; } + public String getDescription(){ return this.description; } + public Platform getPlatform(){ return this.platform; } + public WorkItem updateTitle(String title){ title = (title == null ? null : title.trim()); - if(Objects.equals(this.title, title)){ + if(isPropertyLoaded(TITLE_PROPERTY) && Objects.equals(this.title, title)){ return this; } handleUpdate(TITLE_PROPERTY, getTitle(), title); this.title = title; return this; } + public WorkItem updateDescription(String description){ description = (description == null ? null : description.trim()); - if(Objects.equals(this.description, description)){ + if(isPropertyLoaded(DESCRIPTION_PROPERTY) && Objects.equals(this.description, description)){ return this; } handleUpdate(DESCRIPTION_PROPERTY, getDescription(), description); this.description = description; return this; } + public WorkItem updatePlatform(Platform platform){ - if(Objects.equals(this.platform, platform)){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ return this; } handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); @@ -63,6 +88,7 @@ public WorkItem updatePlatform(Platform platform){ return this; } + public static WorkItem refer(Long id){ WorkItem refer = new WorkItem(); refer.__internalSet("id", id); @@ -82,7 +108,7 @@ public WorkItem comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -108,7 +134,15 @@ public Object __internalGet(String property) { case "title": return this.title; case "description": return this.description; case "platform": return this.platform; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "title": return this.title; + case "description": return this.description; + case "platform": return this.platform; + default: return super.__internalGet(property); + } } } diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java index c5978a7aa..bddd860d4 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java @@ -24,15 +24,21 @@ public void doCheck(UserContext _context, WorkItem workItem, ObjectLocation _par if((workItem == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, workItem); + if(workItem.needPersist()){ + } if(workItem.newItem()){ }else if(workItem.updateItem()){ if(!workItem.isPropertyLoaded("title")){ invalidTypeCheck(_context, newLocation(_parentLocation, "title"), "Mutation requires a fully loaded entity"); - }if(!workItem.isPropertyLoaded("description")){ + } + if(!workItem.isPropertyLoaded("description")){ invalidTypeCheck(_context, newLocation(_parentLocation, "description"), "Mutation requires a fully loaded entity"); - }if(!workItem.isPropertyLoaded("platform")){ + } + if(!workItem.isPropertyLoaded("platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); } + } checkTitle(_context, workItem.getProperty(WorkItem.TITLE_PROPERTY), newLocation(_parentLocation, "title")); checkDescription(_context, workItem.getProperty(WorkItem.DESCRIPTION_PROPERTY), newLocation(_parentLocation, "description")); diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java index 2441dc23c..89a84b043 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java @@ -36,21 +36,21 @@ public boolean isNull() { public Expression getTitle(){ - return loaded("title", WorkItem::getTitle); + return loaded("title", "getTitle", WorkItem::getTitle); } public WorkItemExpression updateTitle(String title){ return new WorkItemExpression(this, $it -> ((WorkItem)$it).updateTitle(title)); } public Expression getDescription(){ - return loaded("description", WorkItem::getDescription); + return loaded("description", "getDescription", WorkItem::getDescription); } public WorkItemExpression updateDescription(String description){ return new WorkItemExpression(this, $it -> ((WorkItem)$it).updateDescription(description)); } public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", WorkItem::getPlatform)); + return new PlatformExpression(loaded("platform", "getPlatform", WorkItem::getPlatform)); } public WorkItemExpression updatePlatform(Platform platform){ diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java index 2d76b24da..fdbdc329c 100644 --- a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java +++ b/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class WorkItemRequest extends BaseRequest { @@ -21,7 +22,11 @@ public class WorkItemRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public WorkItemRequest(Class returnType){ - super(returnType, () -> (T) new WorkItem()); + this(returnType, () -> (T) new WorkItem()); + } + + protected WorkItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -31,6 +36,19 @@ public WorkItemRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public WorkItemRequest copy(){ + return (WorkItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new WorkItemRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public WorkItemRequest returnType(Class returnType){ @@ -98,6 +116,12 @@ public WorkItemRequest matchingAnyOf(WorkItemRequest workItem){ return this; } + public WorkItemRequest matchingIdsOf(WorkItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + WorkItem.ID_PROPERTY, request, WorkItem.ID_PROPERTY)); + } + public WorkItemRequest enhanceChildrenIfNeeded(){ return this; } @@ -121,6 +145,17 @@ public WorkItemRequest selectSelfFields(){ return selectSelf(); } + public WorkItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(WorkItem.ID_PROPERTY); + selectProperty(WorkItem.TITLE_PROPERTY); + selectProperty(WorkItem.DESCRIPTION_PROPERTY); + selectProperty(WorkItem.PLATFORM_PROPERTY); + selectProperty(WorkItem.VERSION_PROPERTY); + return this; + } + public WorkItemRequest selectAll(){ super.selectAll(); return selectId().selectTitle().selectDescription().selectPlatform().selectVersion(); @@ -194,7 +229,8 @@ public WorkItemRequest selectPlatform(){ public WorkItemRequest selectPlatformWith(PlatformRequest platform){ selectProperty(WorkItem.PLATFORM_PROPERTY); - enhanceRelation(WorkItem.PLATFORM_PROPERTY, platform); + enhanceRelation(WorkItem.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, WorkItem.PLATFORM_PROPERTY)); return this; } @@ -514,12 +550,15 @@ public WorkItemRequest withVersionBetween(Long startOfVersion, Long endOfVers } + public WorkItemRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public WorkItemRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public WorkItemRequest groupByPlatformWithDetails(){ @@ -532,6 +571,46 @@ public WorkItemRequest groupByPlatformWithDetails(PlatformRequest subRequest) } + public WorkItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public WorkItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, WorkItem.ID_PROPERTY); + return this; + } + public WorkItemRequest countDistinctTitle(){ + return countDistinctTitleAs("title_distinct_count"); + } + + public WorkItemRequest countDistinctTitleAs(String alias){ + super.countDistinctProperty(alias, WorkItem.TITLE_PROPERTY); + return this; + } + public WorkItemRequest countDistinctDescription(){ + return countDistinctDescriptionAs("description_distinct_count"); + } + + public WorkItemRequest countDistinctDescriptionAs(String alias){ + super.countDistinctProperty(alias, WorkItem.DESCRIPTION_PROPERTY); + return this; + } + public WorkItemRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public WorkItemRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, WorkItem.PLATFORM_PROPERTY); + return this; + } + public WorkItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public WorkItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, WorkItem.VERSION_PROPERTY); + return this; + } public WorkItemRequest groupById(){ groupBy(WorkItem.ID_PROPERTY); @@ -578,7 +657,8 @@ public WorkItemRequest groupByDescriptionWithFunction(String retName, AggrFun return this; } public WorkItemRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(WorkItem.PLATFORM_PROPERTY, subRequest); + groupBy(WorkItem.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); return this; } public WorkItemRequest groupByPlatform(){ @@ -682,8 +762,8 @@ public WorkItemRequest orderByVersionDescending(){ public PlatformRequest rollUpToPlatform(){ PlatformRequest platform = Q.platforms().unlimited(); - this.withPlatformMatching(platform) - .groupByPlatformWith(platform); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); return platform; } @@ -694,7 +774,8 @@ public WorkItemRequest facetByPlatformAs(String facetName, PlatformRequest pl } public WorkItemRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, WorkItem.PLATFORM_PROPERTY, platform, includeAllFacets); + addFacet(facetName, WorkItem.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, WorkItem.PLATFORM_PROPERTY)); return this; } diff --git a/examples/conformance/natural-messages/automatic-fixture/evaluation.json b/examples/conformance/natural-messages/automatic-fixture/evaluation.json index 23caa7479..ba40e6686 100644 --- a/examples/conformance/natural-messages/automatic-fixture/evaluation.json +++ b/examples/conformance/natural-messages/automatic-fixture/evaluation.json @@ -1,108 +1,7 @@ { - "solids" : [ { - "ruleId" : "KSML-UPLOAD-001", - "title" : "Model upload is non-empty", - "message" : "The upload contains 1 files.", - "path" : "model.zip", - "objectName" : null, - "fieldName" : null, - "xmlPath" : null, - "lineNumber" : null, - "reportTarget" : "model.zip", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-UPLOAD-005", - "title" : "Valid entrypoint found", - "message" : "Resolved entrypoint: model.xml", - "path" : "model.xml", - "objectName" : null, - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 1, - "reportTarget" : "model.xml", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-XML-002", - "title" : "XML is well-formed", - "message" : "The XML document model.xml was parsed successfully.", - "path" : "model.xml", - "objectName" : null, - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 1, - "reportTarget" : "model.xml", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-ROOT-003", - "title" : "Standard root name", - "message" : "Root name 'checker-natural-message-service' is well-formed.", - "path" : "/root", - "objectName" : null, - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 1, - "reportTarget" : "/root", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-ROOT-008", - "title" : "Default JSON field naming", - "message" : "External JSON business fields use the default camelCase profile.", - "path" : "/root", - "objectName" : null, - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 1, - "reportTarget" : "/root", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-REFERENCE-003", - "title" : "Reference target exists", - "message" : "Reference 'catalog' in 'entry' successfully resolves to target object 'catalog'.", - "path" : "/root/entry/catalog", - "objectName" : "entry", - "fieldName" : "catalog", - "xmlPath" : "model.xml", - "lineNumber" : 3, - "reportTarget" : "entry.catalog", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-DOMAIN-ROOT-003", - "title" : "One domain root found", - "message" : "Exactly one domain root candidate 'catalog' was found.", - "path" : "/root", - "objectName" : null, - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 1, - "reportTarget" : "/root", - "action" : "Check agents/ERROR-FIX.md" - } ], - "warnings" : [ { - "ruleId" : "KSML-OBJECT-001", - "title" : "Missing object display metadata", - "message" : "Object 'catalog' is missing display metadata: _module, _module_key", - "path" : "/root/catalog", - "objectName" : "catalog", - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 2, - "reportTarget" : "catalog", - "action" : "Check agents/ERROR-FIX.md" - }, { - "ruleId" : "KSML-OBJECT-001", - "title" : "Missing object display metadata", - "message" : "Object 'entry' is missing display metadata: _module, _module_key", - "path" : "/root/entry", - "objectName" : "entry", - "fieldName" : null, - "xmlPath" : "model.xml", - "lineNumber" : 3, - "reportTarget" : "entry", - "action" : "Check agents/ERROR-FIX.md" - } ], - "suggestions" : [ ], - "errors" : [ ], - "privacyFindings" : [ ], - "privacyRegions" : [ ], - "errorSummaries" : [ ] + "errorCount": 0, + "errors": [], + "markdownSHA256": "898f40bd7d8475763d927f70bcca1e116abd30c898414b9fec937cf79814a69c", + "schema": "teaql.evaluation-summary-from-markdown/v1", + "warningCount": 2 } diff --git a/examples/conformance/natural-messages/automatic-fixture/generated-files.json b/examples/conformance/natural-messages/automatic-fixture/generated-files.json index 71da0366a..a1d24f6d9 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generated-files.json +++ b/examples/conformance/natural-messages/automatic-fixture/generated-files.json @@ -1,26 +1,26 @@ { - "lib/pom.xml" : "479e713e132cfa183e781202098f84e0b74a44a6a535837aa8d92da01ffb00e1", - "lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java" : "2d2f927741f43badf499995f1b1715e7132856b9b495ab5392e31404b272d68e", - "lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java" : "0a3f386cf80db0789aa7f49f4490643e598dff29c093f3ba36efb408b38dc34c", - "lib/src/main/java/com/example/checkernaturalmessageservice/E.java" : "01b3a1dc741ed939a0f6f7ccecdbe80f26ff96c6994ad0ea79ae0aff6d0d41e6", - "lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java" : "dd804b5fc295c1d2afa3ec7567f3912b48f5bcbb40da2824cd4fbe1d4358c73b", - "lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java" : "4c95cb099a8ce1ab7236f6053f697f1a4a51ce99bc29a078f6a514aff41bf244", - "lib/src/main/java/com/example/checkernaturalmessageservice/Q.java" : "8c7a515a0258aa1c2e14f409b39593662fea7f70469604d00fec37d5ab4639ce", - "lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java" : "e0da39fe42d25ed3bf188707608d2902ca832db884d829e572f4ab18a4d4698e", - "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java" : "eca4ca4a74652d673dec8474df6bf84b3962e2ed0bc100e1ff65a6cb9258bbc6", - "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java" : "4dd395c2be2af0d42cff8cef266ee8558579075a0af93c078d65b0490c727a75", - "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java" : "29e679c28f5a44fed2128801f482fe24c2d282f13aaccf7e8c5b97d399436ac2", - "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java" : "4c2503727bad7b9802f6ce241ba4e049a02bd895606481e341679c03a0597d20", - "lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java" : "6e004619e98d31cdcfcffe82dfd9a94c5207e04efca5346ff8fd15a4aa22547c", - "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java" : "d6c13306e3d1460045be65bc784877feb42965d3ba13553c7042a70a26b4ac36", - "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java" : "a9f23feb178ab004742193070857a988154cb1a320bd8aef099c9f6756b98bf0", - "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java" : "c5c16734297e776337278c1f8df2371a4df5f51103f6cf2c0b0b7975b2f805b9", - "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java" : "07924f164eee9f3d812f18346ee278d300381d8d1822712aeed1d45deacd01fd", - "lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler" : "e7343d1366c418947fc058200104a8748265db5763f3861de9cda088cdb9dbce", - "teaql/checker-model.json" : "dbac03cd54b294e3e60a62752aeb170ad1ad722a7dfb8feb639c569ff3e73b1a", - "teaql/model-provenance.json" : "b0a02c87ec8602c39a345acb2082a4ac15645b4596ce81b6e014ee753813cde4" + "lib/pom.xml": "347a095ed81296d0277594cf121719bc5d27f515373c762dd6cdb3ec9498f40d", + "lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java": "2d2f927741f43badf499995f1b1715e7132856b9b495ab5392e31404b272d68e", + "lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java": "0a3f386cf80db0789aa7f49f4490643e598dff29c093f3ba36efb408b38dc34c", + "lib/src/main/java/com/example/checkernaturalmessageservice/E.java": "01b3a1dc741ed939a0f6f7ccecdbe80f26ff96c6994ad0ea79ae0aff6d0d41e6", + "lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java": "da12aacb3fce39a2c6dd015935b90f42872466771daa52275c03f399423445b5", + "lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java": "4c95cb099a8ce1ab7236f6053f697f1a4a51ce99bc29a078f6a514aff41bf244", + "lib/src/main/java/com/example/checkernaturalmessageservice/Q.java": "8c7a515a0258aa1c2e14f409b39593662fea7f70469604d00fec37d5ab4639ce", + "lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java": "e0da39fe42d25ed3bf188707608d2902ca832db884d829e572f4ab18a4d4698e", + "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java": "eca4ca4a74652d673dec8474df6bf84b3962e2ed0bc100e1ff65a6cb9258bbc6", + "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java": "4dd395c2be2af0d42cff8cef266ee8558579075a0af93c078d65b0490c727a75", + "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java": "29e679c28f5a44fed2128801f482fe24c2d282f13aaccf7e8c5b97d399436ac2", + "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java": "1b37405c34f51a0b99ea00d03b9d0a25232522679dabd7898cb90266f6f82098", + "lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java": "6e004619e98d31cdcfcffe82dfd9a94c5207e04efca5346ff8fd15a4aa22547c", + "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java": "d6c13306e3d1460045be65bc784877feb42965d3ba13553c7042a70a26b4ac36", + "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java": "a9f23feb178ab004742193070857a988154cb1a320bd8aef099c9f6756b98bf0", + "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java": "c5c16734297e776337278c1f8df2371a4df5f51103f6cf2c0b0b7975b2f805b9", + "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java": "954839230e25c444c776ebe74755d4203beb244e8a5d7c2895733ed867e6d27d", + "lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "e7343d1366c418947fc058200104a8748265db5763f3861de9cda088cdb9dbce", + "teaql/checker-model.json": "dbac03cd54b294e3e60a62752aeb170ad1ad722a7dfb8feb639c569ff3e73b1a", + "teaql/model-provenance.json": "713092d98415609d6c111ab9d9cc57cdcf5961842078197bb8f88573e4987e39" } diff --git a/examples/conformance/natural-messages/automatic-fixture/generation.json b/examples/conformance/natural-messages/automatic-fixture/generation.json index d874e93d3..705b5fd18 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generation.json +++ b/examples/conformance/natural-messages/automatic-fixture/generation.json @@ -1,13 +1,36 @@ { - "schema": "teaql.generated-example-provenance/v1", - "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", - "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest", - "fixtureOutputProperty": "teaql.java.natural.fixture.output", - "scope": "java-lib-core", - "runtimeDependency": "local repository source", - "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", - "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", - "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", "implementationHandEdited": false, - "publicPublication": false + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "fixtureOutputProperty": "teaql.java.natural.fixture.output", + "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", + "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", + "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "implementationHandEdited": false, + "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core", + "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + }, + "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + }, + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core" } diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/pom.xml b/examples/conformance/natural-messages/automatic-fixture/lib/pom.xml index c4d841499..ab91a9b0f 100644 --- a/examples/conformance/natural-messages/automatic-fixture/lib/pom.xml +++ b/examples/conformance/natural-messages/automatic-fixture/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.557-SNAPSHOT + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.557-SNAPSHOT + ${teaql.version} io.teaql diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java b/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java index 05b22f6d0..c10ac24e6 100644 --- a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java +++ b/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java @@ -24,7 +24,9 @@ private void registerCatalog() { entityDescriptor.setTargetType(com.example.checkernaturalmessageservice.catalog.Catalog.class); entityDescriptor.setEntitySupplier(com.example.checkernaturalmessageservice.catalog.Catalog::new); entityDescriptor.with("name", "catalog") - .with("zh_CN", "目录"); + + .with("zh_CN", "目录") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -38,55 +40,101 @@ private void registerCatalog() { ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Catalog") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("zh_CN", "名称") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -97,8 +145,11 @@ private void registerEntry() { entityDescriptor.setTargetType(com.example.checkernaturalmessageservice.entry.Entry.class); entityDescriptor.setEntitySupplier(com.example.checkernaturalmessageservice.entry.Entry::new); entityDescriptor.with("name", "entry") + .with("zh_CN", "明细") - .with("audit_mask_fields", "name"); + + .with("audit_mask_fields", "name") + ; entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY)); PropertyDescriptor id = @@ -121,93 +172,171 @@ private void registerEntry() { ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CATALOG_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("zh_CN", "名称") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java b/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java index e18c4afc2..475feb3c0 100644 --- a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java +++ b/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class CatalogRequest extends BaseRequest { @@ -35,6 +36,19 @@ public CatalogRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CatalogRequest copy(){ + return (CatalogRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CatalogRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CatalogRequest returnType(Class returnType){ @@ -102,6 +116,12 @@ public CatalogRequest matchingAnyOf(CatalogRequest catalog){ return this; } + public CatalogRequest matchingIdsOf(CatalogRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Catalog.ID_PROPERTY, request, Catalog.ID_PROPERTY)); + } + public CatalogRequest enhanceChildrenIfNeeded(){ return this; } @@ -403,6 +423,30 @@ public CatalogRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public CatalogRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CatalogRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Catalog.ID_PROPERTY); + return this; + } + public CatalogRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CatalogRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CatalogRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Catalog.VERSION_PROPERTY); + return this; + } public CatalogRequest groupByEntriesWithDetails(EntryRequest subRequest){ aggregate(Catalog.ENTRY_LIST_PROPERTY, subRequest); return this; diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java b/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java index 399f03b55..8363f39bd 100644 --- a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java +++ b/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java @@ -13,6 +13,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class EntryRequest extends BaseRequest { @@ -37,6 +38,19 @@ public EntryRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public EntryRequest copy(){ + return (EntryRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new EntryRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public EntryRequest returnType(Class returnType){ @@ -104,6 +118,12 @@ public EntryRequest matchingAnyOf(EntryRequest entry){ return this; } + public EntryRequest matchingIdsOf(EntryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Entry.ID_PROPERTY, request, Entry.ID_PROPERTY)); + } + public EntryRequest enhanceChildrenIfNeeded(){ return this; } @@ -648,6 +668,54 @@ public EntryRequest groupByCatalogWithDetails(CatalogRequest subRequest){ + public EntryRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public EntryRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Entry.ID_PROPERTY); + return this; + } + public EntryRequest countDistinctCatalog(){ + return countDistinctCatalogAs("catalog_distinct_count"); + } + + public EntryRequest countDistinctCatalogAs(String alias){ + super.countDistinctProperty(alias, Entry.CATALOG_PROPERTY); + return this; + } + public EntryRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public EntryRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Entry.NAME_PROPERTY); + return this; + } + public EntryRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public EntryRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Entry.CREATE_TIME_PROPERTY); + return this; + } + public EntryRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public EntryRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Entry.UPDATE_TIME_PROPERTY); + return this; + } + public EntryRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public EntryRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Entry.VERSION_PROPERTY); + return this; + } public EntryRequest groupById(){ groupBy(Entry.ID_PROPERTY); @@ -664,7 +732,8 @@ public EntryRequest groupByIdWithFunction(String retName, AggrFunction functi return this; } public EntryRequest groupByCatalogWith(CatalogRequest subRequest){ - groupBy(Entry.CATALOG_PROPERTY, subRequest); + groupBy(Entry.CATALOG_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCatalogWith", null, "catalog")); return this; } public EntryRequest groupByCatalog(){ @@ -815,8 +884,8 @@ public EntryRequest orderByVersionDescending(){ public CatalogRequest rollUpToCatalog(){ CatalogRequest catalog = Q.catalogs().unlimited(); - this.withCatalogMatching(catalog) - .groupByCatalogWith(catalog); + this.internalRollUpTo("catalog", catalog, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCatalog", null, "catalog")); return catalog; } diff --git a/examples/conformance/natural-messages/automatic-fixture/model.xml b/examples/conformance/natural-messages/automatic-fixture/model.xml index 20e7bd802..b0bed4d50 100644 --- a/examples/conformance/natural-messages/automatic-fixture/model.xml +++ b/examples/conformance/natural-messages/automatic-fixture/model.xml @@ -1,4 +1,4 @@ - + diff --git a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json index 725e88115..3bbf5d668 100644 --- a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json +++ b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:b7fe340e07a920295caf8233b44cc229e2d72411969218dc902350a9d047dc49","generatorVersion":"unknown"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/conformance/natural-messages/model.xml b/examples/conformance/natural-messages/model.xml index 20e7bd802..b0bed4d50 100644 --- a/examples/conformance/natural-messages/model.xml +++ b/examples/conformance/natural-messages/model.xml @@ -1,4 +1,4 @@ - + diff --git a/examples/conformance/teaql/checker-model.json b/examples/conformance/teaql/checker-model.json new file mode 100644 index 000000000..e5e26ed57 --- /dev/null +++ b/examples/conformance/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:f026153870cc54db18171cbbe02db1db174f3dea513e9d21e0ffe8af787ebaed","entities":{"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]},{"name":"work_item_list","targetType":"WorkItem","labels":{"en":"Work Item"},"aliases":["WorkItemList","workItemList"]}]},"WorkItem":{"labels":{"en":"Work Item"},"fields":[{"name":"description","labels":{"en":"description"},"aliases":["Description"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"title","labels":{"en":"title"},"aliases":["Title"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/conformance/teaql/model-provenance.json b/examples/conformance/teaql/model-provenance.json new file mode 100644 index 000000000..26c59767c --- /dev/null +++ b/examples/conformance/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/fix-e-alignment/fixture-manifest.json b/examples/fix-e-alignment/fixture-manifest.json index 3c9b3f9d2..7f60bae80 100644 --- a/examples/fix-e-alignment/fixture-manifest.json +++ b/examples/fix-e-alignment/fixture-manifest.json @@ -1,45 +1,55 @@ { - "schema": "teaql.generated-example-fixture/v1", - "language": "java", - "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "generatedManifestSha256": "e15383d75949d87ec5c8f1dc7007b6c7d191cc5d028c41c8170b498805d89a03", - "producerReceiptSha256": "d521abd42de7b783e25ed775b883dd97fd217b61060945b4ad9096985768f053", - "producerSource": { - "commit": "e776e14adfd215512faa1961e0f8adb371d3a2ae", - "diff": "4be236084a3599770907f796885c2f718b2f3507be541136640b3ed74031bf5d", - "status": "c8ce30fc42924a698d1c1b33806144774f457d5abd38129d36d2d0c8f52eac08", - "sourceContentsSha256": "9b803af5eef454981b06c6b99b384e5cce503080cf452d6916445b2ba4a31d68" - }, "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 4, "files": { - "lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": "1f485bccf6c28ccef60f0b6220d87e30b2135599c2e42840893549ed0c5c0ba2", - "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java": "6cc1f14e73294d30589fc3d911fd7c74b4e56d7150e988f7356a5be4452e7dea", - "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java": "720f8fa4d518c0926c6beb1d6bd4687a5854b6709eb687e301fd5edfdfde2852", + "lib/pom.xml": "af5afa26a1d4942219495ab5a6a47a85fdf2aa4749efb33fea05b37fde7c556b", "lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c", + "lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java": "13bd28eaa0b207f409b99a0cb7d5fdfd6eb646b5be4f063175d0792449fa5551", "lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java": "f48ef9116244bd114f9335095334e2090404a71e7aec6e4fc4952c3e2d62b133", - "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java": "d1d66e7c91d0bf50febb551c79acb2a7cfa3bf470a745606a143877f504caacf", - "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java": "0f20dfe18779ad411ac9d3848fbf163090b091e44fd05bf563f18a474f15ff98", - "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java": "d6f02514a43866feb38fe121384083203f0eb85a944e4a83d2eec3f07ab51e6b", - "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java": "758175bbb1694344e892cabdd5cdedf3e785e533b9780e368607ddae93f8a0c3", - "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java": "6c37ba6ab252b50f5b520ac048b714f491ff73c2333f9480245e78dea3e7fce2", - "lib/src/main/java/com/teaql/checkerfixadvanced/E.java": "866a318903fe482396ff28d529c14a827872d2fd7457cda57af5ffdaf1671cd1", - "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java": "5446849fcb34da25e1ce3a984fd8930d11d363f5454b94cc81de18a29eb80161", - "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java": "3ff0b93627835982e58293ccfcaccbeae321900d7546cbdaa2ac50450ac15659", - "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java": "38ed52b714534d7a96ff550fb4e1f78acb8a9522522c58b7e12eb5d00796dcc3", "lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java": "69732def8bf31885c5a15fab50e002cdd5f722581b26cafd55fd09beaa95a4c2", + "lib/src/main/java/com/teaql/checkerfixadvanced/E.java": "866a318903fe482396ff28d529c14a827872d2fd7457cda57af5ffdaf1671cd1", + "lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java": "a84c4a6831ca7a3ddcd6b9f3b4c9fbc8d752e2cf8fd5cc2d7db36d5521911434", + "lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java": "53ac9265c060116fef838ea7989b579302fb567d8d182c2d4fa6e9da2dd7f62f", "lib/src/main/java/com/teaql/checkerfixadvanced/Q.java": "1d20fed9963ce79b3b229a799dfb6210c9ad15a2ee408900d613ad9d9bd2dcb8", + "lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java": "8dbab969b5d31f567e689aa03b901dd729ced9e3fcd770cb7086a60a147a4087", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java": "05a96a52d1815cde70f37d6f06299674ef7854d0e94575bc44840533930e95d4", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java": "38ed52b714534d7a96ff550fb4e1f78acb8a9522522c58b7e12eb5d00796dcc3", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java": "6c37ba6ab252b50f5b520ac048b714f491ff73c2333f9480245e78dea3e7fce2", + "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java": "a3513d6e1696e83a29b68b811d3e1ab2663a4528cf80a6e93183183135b3c4d7", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java": "571703659d7e66ba7f9ef936c7ef458a246935ad651b968ab169e9ba98b563ad", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java": "799a961a1f6c086bf1519cfafedf94331bad225f84de4a36f2bfba2d16181b1b", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java": "3ff0b93627835982e58293ccfcaccbeae321900d7546cbdaa2ac50450ac15659", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java": "758175bbb1694344e892cabdd5cdedf3e785e533b9780e368607ddae93f8a0c3", + "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java": "f3fb7c6197f8dbeb5bea6751284584321c46cf23928e6d8143f4cd6adf01214f", "lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java": "13bd28eaa0b207f409b99a0cb7d5fdfd6eb646b5be4f063175d0792449fa5551", - "lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java": "96ca920d9dfcf9502e97ff9ba2c4bb11c9e65d8dd889d5a8844ade4799f19dab", - "lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java": "4d59b88226da8f98578508bbf89fc8bc9ddb49befbdce56ae16d625a819de368", - "lib/pom.xml": "639b421130265f58e4c51404a03a4c3a4dedf59cd4e06d9258f0537374149ed1", - "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java": "06c8a404d600cdef9396a49ad58377d876fce388ff3eeaba00e91c70f9c2df1a", - "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java": "d634b613c64c8a74d01b84f17743af34667dbab4a03e4b6fad7311ac9c98e96e", - "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java": "1bfe964e5553b3d4b0097eaa259def4be1b16611baed05f326f9d842c32c8204" - } + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java": "34412c091331c303e4d7b55c634e15acf84a2439f202cdaa9091a1c456e92f6b", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java": "485ae02b8fb871638836ad27f70f9282b6a3033892edf581aafb19be8fc9359c", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java": "5446849fcb34da25e1ce3a984fd8930d11d363f5454b94cc81de18a29eb80161", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java": "d6f02514a43866feb38fe121384083203f0eb85a944e4a83d2eec3f07ab51e6b", + "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": "512a9f6ee04a8a27e9164c46e0ef799ce4e0cb90f7729699def1175a485449c9", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c", + "teaql/checker-model.json": "92144f0d6092e143784685a82a9dd67c1672665bbe50fa6ca57b9ad441325b45", + "teaql/model-provenance.json": "79aa8ed9ea90394fb39f6a20a880522c85bbe02559877679c8637653bff3547a" + }, + "generatedManifestSha256": "0acae340953ca731128da9b542106bb74a13f4b9baacaf284d60151bd1b6a5dd", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "language": "java", + "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", + "previousFixtureManifestSha256": "825ca006bef60ad6db424d704d27d85b4e1b34361af4337eeaf3a98ba967f268", + "previousOrigin": { + "commit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "path": "examples/fix-e-alignment/fixture-manifest.json" + }, + "producerReceiptSha256": "af4c8dbce6f9bf2c3490fccf30d9c917b9d70a196cab9653ff899377e7805f1f", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + }, + "schema": "teaql.generated-example-fixture/v1" } diff --git a/examples/fix-e-alignment/generated/lib/pom.xml b/examples/fix-e-alignment/generated/lib/pom.xml index 342fd2ddd..55573a500 100644 --- a/examples/fix-e-alignment/generated/lib/pom.xml +++ b/examples/fix-e-alignment/generated/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + ${teaql.version} io.teaql diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java index ace38c54d..b173f7b31 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java @@ -37,55 +37,101 @@ private void registerTenant() { ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("isPassword", "false") + .with("max", "80") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Tenant Name") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -119,110 +165,204 @@ private void registerPurchaseOrder() { ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("contextRoot", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("contextRoot", "true") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("isPassword", "false") + .with("max", "32") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -259,115 +399,211 @@ private void registerOrderItem() { ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("contextRoot", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("contextRoot", "true") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + .with("max", "80") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("min", "1") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") + .with("max", "1000000") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("min", "0.01") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java index dfd32d430..5a86c62ad 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.teaql.checkerfixadvanced.tenant.TenantChecker(), new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker(), new com.teaql.checkerfixadvanced.orderitem.OrderItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:cbc03c71084d5ff17fe312ca583e790e692d2ecb065fe3a55ec2398eb9189248\",\"entities\":{\"OrderItem\":{\"labels\":{\"en\":\"order item\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"purchase_order\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrder\",\"purchaseOrder\"]},{\"name\":\"tenant\",\"targetType\":\"Tenant\",\"labels\":{\"en\":\"tenant\"},\"aliases\":[\"Tenant\"]},{\"name\":\"unit_price\",\"labels\":{\"en\":\"unit price\"},\"aliases\":[\"UnitPrice\",\"unitPrice\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PurchaseOrder\":{\"labels\":{\"en\":\"purchase order\"},\"fields\":[{\"name\":\"contact_phone\",\"labels\":{\"en\":\"contact phone\"},\"aliases\":[\"ContactPhone\",\"contactPhone\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"internal_note\",\"labels\":{\"en\":\"internal note\"},\"aliases\":[\"InternalNote\",\"internalNote\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"tenant\",\"targetType\":\"Tenant\",\"labels\":{\"en\":\"tenant\"},\"aliases\":[\"Tenant\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Tenant\":{\"labels\":{\"en\":\"tenant\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"purchase_order_list\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrderList\",\"purchaseOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java index 7b7b028a8..894c1a9aa 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java @@ -193,7 +193,18 @@ public Object __internalGet(String property) { case "unit_price": return this.unitPrice; case "create_time": return this.createTime; case "update_time": return this.updateTime; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "purchaseOrder": return this.purchaseOrder; + case "tenant": return this.tenant; + case "productName": return this.productName; + case "unitPrice": return this.unitPrice; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java index 2bd7f558a..03b568650 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java @@ -28,6 +28,7 @@ public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _p if((orderItem == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderItem); if(orderItem.needPersist()){ verifyContextRoot(_context, orderItem, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); @@ -39,16 +40,30 @@ public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _p }else{ _context.verifyActiveRoot("Tenant", orderItem.getTenant().getId()); } - if(orderItem.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { orderItem.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(orderItem.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { orderItem.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(orderItem.updateItem()){ - orderItem.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderItem.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!orderItem.isPropertyLoaded("purchase_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "purchase_order"), "Mutation requires a fully loaded entity"); } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java index cc63277e4..16b7677f5 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java @@ -16,6 +16,7 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class OrderItemRequest extends BaseRequest { @@ -40,6 +41,19 @@ public OrderItemRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderItemRequest returnType(Class returnType){ @@ -107,6 +121,12 @@ public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ return this; } + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + public OrderItemRequest enhanceChildrenIfNeeded(){ return this; } @@ -870,6 +890,70 @@ public OrderItemRequest groupByTenantWithDetails(TenantRequest subRequest){ + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctPurchaseOrder(){ + return countDistinctPurchaseOrderAs("purchase_order_distinct_count"); + } + + public OrderItemRequest countDistinctPurchaseOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctTenant(){ + return countDistinctTenantAs("tenant_distinct_count"); + } + + public OrderItemRequest countDistinctTenantAs(String alias){ + super.countDistinctProperty(alias, OrderItem.TENANT_PROPERTY); + return this; + } + public OrderItemRequest countDistinctProductName(){ + return countDistinctProductNameAs("product_name_distinct_count"); + } + + public OrderItemRequest countDistinctProductNameAs(String alias){ + super.countDistinctProperty(alias, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctUnitPrice(){ + return countDistinctUnitPriceAs("unit_price_distinct_count"); + } + + public OrderItemRequest countDistinctUnitPriceAs(String alias){ + super.countDistinctProperty(alias, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public OrderItemRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderItem.CREATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public OrderItemRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } public OrderItemRequest groupById(){ groupBy(OrderItem.ID_PROPERTY); @@ -886,7 +970,8 @@ public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction fu return this; } public OrderItemRequest groupByPurchaseOrderWith(PurchaseOrderRequest subRequest){ - groupBy(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest); + groupBy(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPurchaseOrderWith", null, "purchase_order")); return this; } public OrderItemRequest groupByPurchaseOrder(){ @@ -904,7 +989,8 @@ public OrderItemRequest groupByPurchaseOrderWithFunction(String retName, Aggr return this; } public OrderItemRequest groupByTenantWith(TenantRequest subRequest){ - groupBy(OrderItem.TENANT_PROPERTY, subRequest); + groupBy(OrderItem.TENANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTenantWith", null, "tenant")); return this; } public OrderItemRequest groupByTenant(){ @@ -1090,15 +1176,15 @@ public OrderItemRequest orderByVersionDescending(){ public PurchaseOrderRequest rollUpToPurchaseOrder(){ PurchaseOrderRequest purchaseOrder = Q.purchaseOrders().unlimited(); - this.withPurchaseOrderMatching(purchaseOrder) - .groupByPurchaseOrderWith(purchaseOrder); + this.internalRollUpTo("purchase_order", purchaseOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPurchaseOrder", null, "purchase_order")); return purchaseOrder; } public TenantRequest rollUpToTenant(){ TenantRequest tenant = Q.tenants().unlimited(); - this.withTenantMatching(tenant) - .groupByTenantWith(tenant); + this.internalRollUpTo("tenant", tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTenant", null, "tenant")); return tenant; } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java index 466012e5b..c6a8dee57 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java @@ -79,7 +79,7 @@ public LocalDateTime getUpdateTime(){ } public SmartList getOrderItemList(){ - return this.orderItemList; + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; } PurchaseOrder updateTenant(Tenant tenant){ if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ @@ -134,7 +134,8 @@ public PurchaseOrder addOrderItem(OrderItem orderItem){ } if(null == this.orderItemList){ - this.orderItemList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); } this.orderItemList.add(orderItem); @@ -195,7 +196,17 @@ public Object __internalGet(String property) { case "create_time": return this.createTime; case "update_time": return this.updateTime; case "order_item_list": return this.orderItemList; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "tenant": return this.tenant; + case "contactPhone": return this.contactPhone; + case "internalNote": return this.internalNote; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java index 5b578889b..8b7a23cb1 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java @@ -27,6 +27,7 @@ public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLoc if((purchaseOrder == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, purchaseOrder); if(purchaseOrder.needPersist()){ verifyContextRoot(_context, purchaseOrder, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); @@ -38,16 +39,30 @@ public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLoc }else{ _context.verifyActiveRoot("Tenant", purchaseOrder.getTenant().getId()); } - if(purchaseOrder.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { purchaseOrder.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(purchaseOrder.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { purchaseOrder.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(purchaseOrder.updateItem()){ - purchaseOrder.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + purchaseOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!purchaseOrder.isPropertyLoaded("tenant")){ invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java index f736c5bd9..f3b954456 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java @@ -15,6 +15,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class PurchaseOrderRequest extends BaseRequest { @@ -39,6 +40,19 @@ public PurchaseOrderRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PurchaseOrderRequest copy(){ + return (PurchaseOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PurchaseOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PurchaseOrderRequest returnType(Class returnType){ @@ -106,6 +120,12 @@ public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder) return this; } + public PurchaseOrderRequest matchingIdsOf(PurchaseOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + PurchaseOrder.ID_PROPERTY, request, PurchaseOrder.ID_PROPERTY)); + } + public PurchaseOrderRequest enhanceChildrenIfNeeded(){ return this; } @@ -780,6 +800,62 @@ public PurchaseOrderRequest groupByTenantWithDetails(TenantRequest subRequest + public PurchaseOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PurchaseOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctTenant(){ + return countDistinctTenantAs("tenant_distinct_count"); + } + + public PurchaseOrderRequest countDistinctTenantAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.TENANT_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctContactPhone(){ + return countDistinctContactPhoneAs("contact_phone_distinct_count"); + } + + public PurchaseOrderRequest countDistinctContactPhoneAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctInternalNote(){ + return countDistinctInternalNoteAs("internal_note_distinct_count"); + } + + public PurchaseOrderRequest countDistinctInternalNoteAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public PurchaseOrderRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public PurchaseOrderRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PurchaseOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.VERSION_PROPERTY); + return this; + } public PurchaseOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ aggregate(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); return this; @@ -800,7 +876,8 @@ public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunctio return this; } public PurchaseOrderRequest groupByTenantWith(TenantRequest subRequest){ - groupBy(PurchaseOrder.TENANT_PROPERTY, subRequest); + groupBy(PurchaseOrder.TENANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTenantWith", null, "tenant")); return this; } public PurchaseOrderRequest groupByTenant(){ @@ -997,8 +1074,8 @@ public PurchaseOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ } public TenantRequest rollUpToTenant(){ TenantRequest tenant = Q.tenants().unlimited(); - this.withTenantMatching(tenant) - .groupByTenantWith(tenant); + this.internalRollUpTo("tenant", tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTenant", null, "tenant")); return tenant; } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java index 1fd71c084..34e03207b 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java @@ -52,10 +52,10 @@ public String getName(){ } public SmartList getPurchaseOrderList(){ - return this.purchaseOrderList; + return this.purchaseOrderList == null ? SmartList.unloaded() : this.purchaseOrderList; } public SmartList getOrderItemList(){ - return this.orderItemList; + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; } public Tenant updateName(String name){ name = (name == null ? null : name.trim()); @@ -73,7 +73,8 @@ public Tenant addPurchaseOrder(PurchaseOrder purchaseOrder){ } if(null == this.purchaseOrderList){ - this.purchaseOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.purchaseOrderList = teaqlUnloadedItems.map(value -> value); } this.purchaseOrderList.add(purchaseOrder); @@ -86,7 +87,8 @@ public Tenant addOrderItem(OrderItem orderItem){ } if(null == this.orderItemList){ - this.orderItemList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); } this.orderItemList.add(orderItem); @@ -137,7 +139,13 @@ public Object __internalGet(String property) { case "name": return this.name; case "purchase_order_list": return this.purchaseOrderList; case "order_item_list": return this.orderItemList; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java index 38973dd24..bdbdfcfdc 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java @@ -26,6 +26,7 @@ public void doCheck(UserContext _context, Tenant tenant, ObjectLocation _parentL if((tenant == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, tenant); if(tenant.needPersist()){ } if(tenant.newItem()){ diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java index f481fff40..4a339d57f 100644 --- a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java +++ b/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java @@ -13,6 +13,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class TenantRequest extends BaseRequest { @@ -37,6 +38,19 @@ public TenantRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TenantRequest copy(){ + return (TenantRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TenantRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public TenantRequest returnType(Class returnType){ @@ -104,6 +118,12 @@ public TenantRequest matchingAnyOf(TenantRequest tenant){ return this; } + public TenantRequest matchingIdsOf(TenantRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Tenant.ID_PROPERTY, request, Tenant.ID_PROPERTY)); + } + public TenantRequest enhanceChildrenIfNeeded(){ return this; } @@ -429,6 +449,30 @@ public TenantRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public TenantRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TenantRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Tenant.ID_PROPERTY); + return this; + } + public TenantRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TenantRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TenantRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Tenant.VERSION_PROPERTY); + return this; + } public TenantRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ aggregate(Tenant.PURCHASE_ORDER_LIST_PROPERTY, subRequest); return this; diff --git a/examples/fix-e-alignment/generated/teaql/checker-model.json b/examples/fix-e-alignment/generated/teaql/checker-model.json new file mode 100644 index 000000000..12eef25eb --- /dev/null +++ b/examples/fix-e-alignment/generated/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:cbc03c71084d5ff17fe312ca583e790e692d2ecb065fe3a55ec2398eb9189248","entities":{"OrderItem":{"labels":{"en":"order item"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"product_name","labels":{"en":"product name"},"aliases":["ProductName","productName"]},{"name":"purchase_order","targetType":"PurchaseOrder","labels":{"en":"purchase order"},"aliases":["PurchaseOrder","purchaseOrder"]},{"name":"tenant","targetType":"Tenant","labels":{"en":"tenant"},"aliases":["Tenant"]},{"name":"unit_price","labels":{"en":"unit price"},"aliases":["UnitPrice","unitPrice"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"PurchaseOrder":{"labels":{"en":"purchase order"},"fields":[{"name":"contact_phone","labels":{"en":"contact phone"},"aliases":["ContactPhone","contactPhone"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"internal_note","labels":{"en":"internal note"},"aliases":["InternalNote","internalNote"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"order item"},"aliases":["OrderItemList","orderItemList"]},{"name":"tenant","targetType":"Tenant","labels":{"en":"tenant"},"aliases":["Tenant"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Tenant":{"labels":{"en":"tenant"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"order item"},"aliases":["OrderItemList","orderItemList"]},{"name":"purchase_order_list","targetType":"PurchaseOrder","labels":{"en":"purchase order"},"aliases":["PurchaseOrderList","purchaseOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/teaql/model-provenance.json b/examples/fix-e-alignment/generated/teaql/model-provenance.json new file mode 100644 index 000000000..79ec96f57 --- /dev/null +++ b/examples/fix-e-alignment/generated/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/generator-v420.json b/examples/generator-v420.json new file mode 100644 index 000000000..6d24e0308 --- /dev/null +++ b/examples/generator-v420.json @@ -0,0 +1,1826 @@ +{ + "generator": { + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "releaseURL": "https://github.com/teaql/teaql-code-gen/releases/tag/v4.2.0", + "sourceCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "tag": "v4.2.0" + }, + "installationReceiptSHA256": "ddf103df0daa060962986e92d230cc201fcc78293198a4c5b107cdbe09346680", + "libraries": [ + { + "archiveSHA256": "3419da661d921a4a84a1f08ea5ad6a83527405e49386d871fef75609c57f77ca", + "destination": "examples/conformance", + "generatedFiles": { + "examples/conformance/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "c7c15fd63a700b39684aab7aded3adab299e59f880c5dca7deaf4b0dda5f17aa" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java", + "sha256": "9cf2b2e56b82fb37e2c656b36c55633eadebad04b15b4c1f3fc1d433046d6e69" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java", + "sha256": "2139dfd49f76bcb2fd4bfd66f8a44e9c38c54265e2e5b27bc56a73a13f517d06" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java", + "sha256": "c51e74637fd34af25e978a1ec12c62d5f9bbcbf67dbb25ca88b5fdcb3d076bd4" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java", + "sha256": "bb14176d4d40533b69967602af37e12661c437d506d4612c6f47f7f9ecfdbe02" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java", + "sha256": "bdc639e797f71baaea2b46d6645f5c3b35ec445e032af7c21a226be9b3b797e3" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java", + "sha256": "14e5bcd9d13b37f278b9ba7999237f6b4d41c0dcaab028c04ee29524504468ab" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java", + "sha256": "9d428a2437e16c237c345b082e7387048d0db58394d94a2b4a89fc27cdea9acf" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java", + "sha256": "5dc2354116a18386d5a95e18327a35faf8dc9ffb28bf30ca55beae27187dc4a2" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java", + "sha256": "c676ca5341a79d436649695f3a04f80ae378ed8923a3d3d74363d480378c7b0c" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java", + "sha256": "9599500a66d7fbca8183f9b2c83795e3c38fadfc261ffa89cb81b2cf773c2e4b" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java", + "sha256": "8edcd13cee303e8c9c621157fad07744b8cbc56ad0abd34030e8c2f87d90a48e" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java", + "sha256": "46babb02d82c9ff3fc4e496bd8e6aef68a61ff1a0e16c7e152c0297cf3a8fbf6" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java", + "sha256": "4bb18dc772555a69d98598f8a53162dafc06d4dc5812eed327d147e32f1be78b" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java", + "sha256": "956acd1b090dbee2cdffaa8b6f469c7231bfe56349a4b35a2f965ea451dc0004" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java", + "sha256": "592ad23def55d9e2c7c80a29d3f430a865436285bde951957f208091efe4d677" + }, + "examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java", + "sha256": "ed164767c0290cf95b8bed2870c58e110587c5302bbc0e2bee91e39ffffa4c19" + }, + "examples/conformance/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "33a51a8a85d8d9d4ef8b7c67ab4e4a3c4c8944b243dd36796cf5fe6579b31dae" + }, + "examples/conformance/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "4824e2986933569c4d827ca44cae7e3a028012aec1e7dbacd245fff5fd5ffe1b" + }, + "examples/conformance/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "6710ca9864c596bf2413ab1eee0ba59b94cc73b57e7fec6ad4a13f482a3cdfea" + } + }, + "model": "examples/conformance/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "c43025f9044a73a4c38d6d9f14ed0e84aa52f8da8a7273657f37666a9f8e1c18", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "0a59f66db2487fdd0430087dd5985ae780225c088ad800679cb57c593c6bcee7", + "producerReceiptSha256": "ec16b389c68d4b2c7cb2b308f62d29b5e2a1e68627d9a49e7304dbec46bc066e", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "0096a2df360c2c35eee20c9f0e1a09e35b1a335b91fe2372e0eade81913a659c", + "destination": "examples/conformance/natural-messages/automatic-fixture", + "generatedFiles": { + "examples/conformance/natural-messages/automatic-fixture/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "347a095ed81296d0277594cf121719bc5d27f515373c762dd6cdb3ec9498f40d" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java", + "sha256": "2d2f927741f43badf499995f1b1715e7132856b9b495ab5392e31404b272d68e" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java", + "sha256": "0a3f386cf80db0789aa7f49f4490643e598dff29c093f3ba36efb408b38dc34c" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/E.java", + "sha256": "01b3a1dc741ed939a0f6f7ccecdbe80f26ff96c6994ad0ea79ae0aff6d0d41e6" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java", + "sha256": "da12aacb3fce39a2c6dd015935b90f42872466771daa52275c03f399423445b5" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java", + "sha256": "4c95cb099a8ce1ab7236f6053f697f1a4a51ce99bc29a078f6a514aff41bf244" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/Q.java", + "sha256": "8c7a515a0258aa1c2e14f409b39593662fea7f70469604d00fec37d5ab4639ce" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java", + "sha256": "e0da39fe42d25ed3bf188707608d2902ca832db884d829e572f4ab18a4d4698e" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java", + "sha256": "eca4ca4a74652d673dec8474df6bf84b3962e2ed0bc100e1ff65a6cb9258bbc6" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java", + "sha256": "4dd395c2be2af0d42cff8cef266ee8558579075a0af93c078d65b0490c727a75" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java", + "sha256": "29e679c28f5a44fed2128801f482fe24c2d282f13aaccf7e8c5b97d399436ac2" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java", + "sha256": "1b37405c34f51a0b99ea00d03b9d0a25232522679dabd7898cb90266f6f82098" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java", + "sha256": "6e004619e98d31cdcfcffe82dfd9a94c5207e04efca5346ff8fd15a4aa22547c" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java", + "sha256": "d6c13306e3d1460045be65bc784877feb42965d3ba13553c7042a70a26b4ac36" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java", + "sha256": "a9f23feb178ab004742193070857a988154cb1a320bd8aef099c9f6756b98bf0" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java", + "sha256": "c5c16734297e776337278c1f8df2371a4df5f51103f6cf2c0b0b7975b2f805b9" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java", + "sha256": "954839230e25c444c776ebe74755d4203beb244e8a5d7c2895733ed867e6d27d" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/conformance/natural-messages/automatic-fixture/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "e7343d1366c418947fc058200104a8748265db5763f3861de9cda088cdb9dbce" + }, + "examples/conformance/natural-messages/automatic-fixture/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "dbac03cd54b294e3e60a62752aeb170ad1ad722a7dfb8feb639c569ff3e73b1a" + }, + "examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "713092d98415609d6c111ab9d9cc57cdcf5961842078197bb8f88573e4987e39" + } + }, + "model": "examples/conformance/natural-messages/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "f7203a6661b7024af44be139c55be95827c9126690baaa008085549b60e58164", + "destination": "examples/fix-e-alignment/generated", + "generatedFiles": { + "examples/fix-e-alignment/generated/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "af5afa26a1d4942219495ab5a6a47a85fdf2aa4749efb33fea05b37fde7c556b" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java", + "sha256": "13bd28eaa0b207f409b99a0cb7d5fdfd6eb646b5be4f063175d0792449fa5551" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java", + "sha256": "69732def8bf31885c5a15fab50e002cdd5f722581b26cafd55fd09beaa95a4c2" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/E.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/E.java", + "sha256": "866a318903fe482396ff28d529c14a827872d2fd7457cda57af5ffdaf1671cd1" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java", + "sha256": "a84c4a6831ca7a3ddcd6b9f3b4c9fbc8d752e2cf8fd5cc2d7db36d5521911434" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java", + "sha256": "53ac9265c060116fef838ea7989b579302fb567d8d182c2d4fa6e9da2dd7f62f" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/Q.java", + "sha256": "1d20fed9963ce79b3b229a799dfb6210c9ad15a2ee408900d613ad9d9bd2dcb8" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java", + "sha256": "8dbab969b5d31f567e689aa03b901dd729ced9e3fcd770cb7086a60a147a4087" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java", + "sha256": "05a96a52d1815cde70f37d6f06299674ef7854d0e94575bc44840533930e95d4" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java", + "sha256": "38ed52b714534d7a96ff550fb4e1f78acb8a9522522c58b7e12eb5d00796dcc3" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java", + "sha256": "6c37ba6ab252b50f5b520ac048b714f491ff73c2333f9480245e78dea3e7fce2" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java", + "sha256": "a3513d6e1696e83a29b68b811d3e1ab2663a4528cf80a6e93183183135b3c4d7" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java", + "sha256": "571703659d7e66ba7f9ef936c7ef458a246935ad651b968ab169e9ba98b563ad" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java", + "sha256": "799a961a1f6c086bf1519cfafedf94331bad225f84de4a36f2bfba2d16181b1b" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java", + "sha256": "3ff0b93627835982e58293ccfcaccbeae321900d7546cbdaa2ac50450ac15659" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java", + "sha256": "758175bbb1694344e892cabdd5cdedf3e785e533b9780e368607ddae93f8a0c3" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java", + "sha256": "f3fb7c6197f8dbeb5bea6751284584321c46cf23928e6d8143f4cd6adf01214f" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java", + "sha256": "34412c091331c303e4d7b55c634e15acf84a2439f202cdaa9091a1c456e92f6b" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java", + "sha256": "485ae02b8fb871638836ad27f70f9282b6a3033892edf581aafb19be8fc9359c" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java", + "sha256": "5446849fcb34da25e1ce3a984fd8930d11d363f5454b94cc81de18a29eb80161" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java", + "sha256": "d6f02514a43866feb38fe121384083203f0eb85a944e4a83d2eec3f07ab51e6b" + }, + "examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java", + "sha256": "512a9f6ee04a8a27e9164c46e0ef799ce4e0cb90f7729699def1175a485449c9" + }, + "examples/fix-e-alignment/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c" + }, + "examples/fix-e-alignment/generated/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "92144f0d6092e143784685a82a9dd67c1672665bbe50fa6ca57b9ad441325b45" + }, + "examples/fix-e-alignment/generated/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "79aa8ed9ea90394fb39f6a20a880522c85bbe02559877679c8637653bff3547a" + } + }, + "model": "examples/fix-e-alignment/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 4, + "generatedManifestSha256": "0acae340953ca731128da9b542106bb74a13f4b9baacaf284d60151bd1b6a5dd", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", + "producerReceiptSha256": "af4c8dbce6f9bf2c3490fccf30d9c917b9d70a196cab9653ff899377e7805f1f", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "63ba90219166efd74d62b57f9b55a2a77f026a7ba65f3067b05454897d38852d", + "destination": "examples/inheritance-save", + "generatedFiles": { + "examples/inheritance-save/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "b005d331eb709ab62bbab5e035e7e142b815505351e7e79e1856bdfb89915f6c" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/Constants.java", + "sha256": "916f41797ceeeb89650ed3df3c69f744baaaadf69273ac1a5ef5df7c23210dba" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/E.java", + "sha256": "8259d4ff7302a5cb632dd6f54654a363a381d7cf4b4768cb69ac7f0b5e0d8ec1" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java", + "sha256": "868fb313b930e27224e95bd0316440c6e60913c7b8e0a23924f209bc4c3d8548" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java", + "sha256": "693701578b8c35182dfe78ffdf1be8a28078e9a598ee0fed003fd30d29b61e9a" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java", + "sha256": "97b48694df0e8ea0757e3ad11768dfbf8c0bc74c459784860d16c8e1ae8dd937" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/Q.java", + "sha256": "f8c44522ddaeebf36a6a0428fac2500224c02bb0ec23c141b1f2a81737bd7666" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java", + "sha256": "286844c23da99af8108df1647d6253c74e8a1149dd9e5bd4cff92aa46c399636" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java", + "sha256": "1e0187a88488e968d93cd180dfd84e10330a9011cb4fe3edf5b60a8898b45708" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java", + "sha256": "8370df1fe82550fe482581d296c1e31876c65038e3b3082c41a1e0af61936b13" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java", + "sha256": "6a2ca94ca8e7343a2ab074580ced5a4494bcacd5afd66d175f72837248fd4ecb" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java", + "sha256": "22bac4800a50da9f944d7adf744c95effc2f6368d3f40a0913eaf9b91d961ccd" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/College.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/college/College.java", + "sha256": "9bdb82ee2d16ac37faacafc35bb8212e7a530b7e46335e06257f058374461c05" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java", + "sha256": "e8edd9178db335cbad64504e7f94d60bf83f719d119ac01a00d16932c5e57d63" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java", + "sha256": "f21d4bb04ec6f36aebc11c86552052dee53f2b02808d839d7058e51310461abd" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java", + "sha256": "a89b341c3c2d55ef8650d7dfe75cb5d954b16e3b392b959f8d6c585223ca74d0" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java", + "sha256": "27588840f5de0800c406bf6ec142c64423d93954f175ece95954aa7236f96d9a" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java", + "sha256": "2d0347e54ca56a14edfdd7781b34db313dd263736e60518dc0af2443d706665d" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java", + "sha256": "297a063a3dc563562ee3ac4581b48072a793b7bbd748552682f080e8cafb4f79" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java", + "sha256": "e8c00499b35b4e62ee357629653644e2634bb3d7bec45961763ab791dcc73cd5" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java", + "sha256": "c1d13f123bab9409a9b6e1133d0fb8de06f8235322afe5c550e8a24204d07bff" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java", + "sha256": "18c6b2b7d319bbfff05bc3946c2e92e536c9a891cdc46d49694404a00f4968ab" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/School.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/school/School.java", + "sha256": "3ba2a4ad5f4220ead5f9dadfb7a720fad4407e0046382d9daf41346b9c9c5d92" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java", + "sha256": "d5fbbad3eadf1baed8f8e61e90cbcf6f95eb6756e22786ba1488ed95c4e976a9" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java", + "sha256": "f668134245f8392fecaf18b979516b6d60aa0af5b9922325720f2e666e417095" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java", + "sha256": "67e482d8be45be9d6f23c206dc7564cff7da1b2ccd69205d3df109c2e6c77749" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java", + "sha256": "f826a9b55aa8fbcd4d78e7c6499930c19d01d0e3a635fd35b973b8a6926fdc3b" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java", + "sha256": "eb3e51a859272074c1cf7ed27b001db49b6dd3e649f3d748c59951af7fe2ec94" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java", + "sha256": "3be09b35400e494a050d687ac746a19f5abc863aa6abe0d2356993d3c3a0df35" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java", + "sha256": "fc23cff73051d98628fab7f060bc6309f01403d6f11939d8fd02d2e9dc6c9c97" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java", + "sha256": "cd36a4d43c5e0d775e84998504f7ca3625516ce6fa87fbe7aa2f74cdd295287a" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java", + "sha256": "25075ebfc9217aff119603328924d02584c285228917a267b6d4195093e5b9b4" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java", + "sha256": "76a5fa64a2f1d26a764d69de7144081f4f4414ce36192c5c5e35e84a142de69a" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java", + "sha256": "a42c0eaae62ce9375e9e4563bbc9c11674331180c49969a3c5d2a5ba70ea7a17" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java", + "sha256": "a4afe5f0732e93b7428d1d34fb5484274555f968b42fecd0e41923405952be22" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java", + "sha256": "2184e87b2b4ec812738d871c840eee3ab46aeb764fa92e0ed40cac76733d2f8f" + }, + "examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java": { + "emittedPath": "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java", + "sha256": "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7" + }, + "examples/inheritance-save/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7" + }, + "examples/inheritance-save/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242" + }, + "examples/inheritance-save/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "f7e0e14b0905e8c83b54559464ef0a2a3763daee625b0696769ff4fc18b39c49" + } + }, + "model": "examples/inheritance-save/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 1, + "generatedManifestSha256": "b20380c0f82114c25114ae9ccc9c34adde1bf59d134dd432f059950287141056", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/inheritance-save/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "9ed75f14ac524f18ccaba59be8c7261da203d2472bbe5d1f88dfc16d8b203d01", + "producerReceiptSha256": "2439bd4d0a2ea091d626d6a81f979ed35f32be85062cd0440cc1a61041d852b5", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "9e5db531452dfda719da54ce0667bbf08fcffa6862f87faea8c3aa6f3a1bc357", + "destination": "examples/scalar-type-probe/json-profiles/PascalCase", + "generatedFiles": { + "examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java", + "sha256": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/E.java", + "sha256": "897af4eeaa2235e2fd4cf3665977ba6326aae246d659f8f12a87cf98083c0e68" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java", + "sha256": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java", + "sha256": "f219e3a5eb0ac5d6fa44717f9db083d91befc1d4c7c623cb7e3f18ac93d0741c" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java", + "sha256": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java", + "sha256": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java", + "sha256": "6c1a64b50196d7701518a1820f61e38de837372e7d0fa04ee7e87e0f655eddc5" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java", + "sha256": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java", + "sha256": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java", + "sha256": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java", + "sha256": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java", + "sha256": "0a2c88bf2e955240e090e8921f3c711ab38beb2352426fdd212a25a53989e9e1" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java", + "sha256": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java", + "sha256": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java", + "sha256": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java", + "sha256": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab" + }, + "examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "ae427ef988d132abf6690f6dd0988e045249b7897a9ab1e3adee5c6ff789157b" + } + }, + "model": "examples/scalar-type-probe/json-profiles/PascalCase/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "25c379dc3025ebcafa49055475e3dd1187f3a5e7283952beebf0245cbc7e3f71", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", + "producerReceiptSha256": "b71a9a18267311a0c17816d9c60181b80dd13be6acaf3413295ba946edd82fe1", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "81d6cfccb9573007e089f8d87fa6ca4bf55ef777039a53ecff7d98f542bc6c41", + "destination": "examples/scalar-type-probe/json-profiles/camelCase", + "generatedFiles": { + "examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java", + "sha256": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/E.java", + "sha256": "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java", + "sha256": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java", + "sha256": "2ca2464dbc834c0a6be263a8313552ffacc7ed3a59b6f8c2b7a54329024ed796" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java", + "sha256": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java", + "sha256": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java", + "sha256": "04158167dbfc7a0a6afa4655597f7070b06ba7f1db828c99df59350489812daa" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java", + "sha256": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java", + "sha256": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java", + "sha256": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java", + "sha256": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java", + "sha256": "b177989e4a5fec42f98de8374eccc93d398288f16605751fd0cc789388690b54" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java", + "sha256": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java", + "sha256": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java", + "sha256": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java", + "sha256": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b" + }, + "examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629" + }, + "examples/scalar-type-probe/json-profiles/camelCase/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab" + }, + "examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e" + } + }, + "model": "examples/scalar-type-probe/json-profiles/camelCase/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "f38220297d6c482d8eb916cfccfbe2cc6fdcc3e177c151c7fddb54c43ac26147", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "producerReceiptSha256": "32de91eee5a0ac8fd0260063b2f5419c61486cfab551711e1ad858075d358df0", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "081151eef5273550e1f8b5737b82df3206162c1367d64115ff8bef52930b0ed3", + "destination": "examples/scalar-type-probe/json-profiles/snake_case", + "generatedFiles": { + "examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java", + "sha256": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/E.java", + "sha256": "07bda7cfc1c24acea406381d33150f44bf6c32c7a5e9485abbdda5fdc3cec4d1" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java", + "sha256": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java", + "sha256": "50928e3ee1fb00938f4759b69a2c09ca2f9334465081d2d6bc0205ae7a1fffa0" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java", + "sha256": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java", + "sha256": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java", + "sha256": "da3fe55f44510b3b54d4eb6fd081f19964ed825025be8c0c245824a13d9ab3c8" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java", + "sha256": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java", + "sha256": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java", + "sha256": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java", + "sha256": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java", + "sha256": "9152e4dd26331cc7950b21fc1bc3c343968ae0cb702ba3f3aeb970201a99d205" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java", + "sha256": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java", + "sha256": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java", + "sha256": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java", + "sha256": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b" + }, + "examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629" + }, + "examples/scalar-type-probe/json-profiles/snake_case/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab" + }, + "examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "aae97b2ed5d87ede29d03b620225b0cd242b8e088d6ec9fc8cdf7629ff200a98" + } + }, + "model": "examples/scalar-type-probe/json-profiles/snake_case/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "642d8577b4379a11e9e55e5585c126bdb7f7c03634c3f68636c0ec90ecbb83c7", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", + "producerReceiptSha256": "cae8fc7833271365c96c843108f60e0ee11ae4648c06c655715145cba81cfb2c", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "81d6cfccb9573007e089f8d87fa6ca4bf55ef777039a53ecff7d98f542bc6c41", + "destination": "examples/scalar-type-probe/generated", + "generatedFiles": { + "examples/scalar-type-probe/generated/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java", + "sha256": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/E.java", + "sha256": "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java", + "sha256": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java", + "sha256": "2ca2464dbc834c0a6be263a8313552ffacc7ed3a59b6f8c2b7a54329024ed796" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java", + "sha256": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java", + "sha256": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java", + "sha256": "04158167dbfc7a0a6afa4655597f7070b06ba7f1db828c99df59350489812daa" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java", + "sha256": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java", + "sha256": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java", + "sha256": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java", + "sha256": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java", + "sha256": "b177989e4a5fec42f98de8374eccc93d398288f16605751fd0cc789388690b54" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java", + "sha256": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java", + "sha256": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java", + "sha256": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a" + }, + "examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java", + "sha256": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b" + }, + "examples/scalar-type-probe/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629" + }, + "examples/scalar-type-probe/generated/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab" + }, + "examples/scalar-type-probe/generated/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e" + } + }, + "model": "examples/scalar-type-probe/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "f38220297d6c482d8eb916cfccfbe2cc6fdcc3e177c151c7fddb54c43ac26147", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "aa05156776f942dedc0b86498baf5ef098d9704b9895729cf63e293cb010f339", + "destination": "examples/school-management", + "generatedFiles": { + "examples/school-management/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "23fb23e3bd4956cf0708210611325be12e67065e0f4d673b3fde63576465d17b" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Constants.java", + "sha256": "c146bba14760bcc83958d8b5b71a0e2136db3a16254c28ab9ae5a1a1643910c5" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/E.java", + "sha256": "a2fe4f80b5ea3aada0267c717a6c9b0913715d2ed2bdee959042ec8d62958da8" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java", + "sha256": "cf04c850db5199d6a6d30a6c5181526e09c068f9266a7dd9e982f07206dfc0c0" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java", + "sha256": "fda202b9ed21f87bf65d6688ae167d2dc3e7982f2757a9f5fcbfc3513cf8d96d" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Q.java", + "sha256": "db51bb72ee4e7c0752e6256b25a65d890b3750f63d24ff839d6b158f0cdfee49" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java", + "sha256": "b924a8e1b890211486785b9d076e0ef81eb0f94558bf2b31e3a497d0a61509a0" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java", + "sha256": "2bf78b74003d5dafe571f3e20f5a91d0e6a5a38785d705a45d30f9849c15dcf3" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java", + "sha256": "312df235674b87518fa3e5af3f2f1475c71d86f2c6a7499c9db20b2f7fcd8de5" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java", + "sha256": "b5f09cbe63ff1f63fb9c94e1b5c81ba78465bd0c78602ddf8ce97667c980c12f" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java", + "sha256": "5dcf6781878f69ae68760d6767ccb8f036e5aec5cec2446a6006e20ed7684da9" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java", + "sha256": "0e3e1a8bcdadee4008cdfe139d2f0a1db7ccf4920064c9544eac2afb81c9929a" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/School.java", + "sha256": "4de7fb018260149c521226f002beb9084a68e9c3ff233dc361bc9c5f07998528" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java", + "sha256": "eade01d79d598870b87949866e2ff15e09596bbbe6e67f3e3c288e5384e9eb9a" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java", + "sha256": "29a8f0af8c19c488ea5facf3e18b35fc4500e305960e0f1dd50e239d4b84ccea" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java", + "sha256": "f8ebc48aec4c099a9c32c01dac825e2f6efa1918a437c6c617013e752fd754e7" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java", + "sha256": "78328172cc2d31caf70df4c7f80ce0c825fece345b39002475fb614a50db6292" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java", + "sha256": "6d2d2ba18e5fd8865a5c573ca222872fa2b79fe6670f8589c28d41327b27660f" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java", + "sha256": "4b3e29551b77290a7fc0b3d90bd30c04ec918e424dfec48e13740ea1d1618d6d" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java", + "sha256": "5aa66ba48667373431c297b9b4e72d9d7e64df475f66808eb3c427219c0554f4" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java", + "sha256": "cf40825a8ec01a22ae698d26d586ce1e1fd1dd5ac7b9762addc84f84233d3263" + }, + "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java": { + "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java", + "sha256": "b706b4336e1c5b1591b7a7f94227225bb096645a97fbeabf877e9a6374513d2d" + }, + "examples/school-management/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "bacf17c0f620b2ddac37a9b549f0835af0d85e625b36c7c3a44f668001ee310a" + }, + "examples/school-management/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "8e28ee16cddc21191816ed05999142fccb870bf42795f5a1f21268ebd4469e71" + }, + "examples/school-management/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "e71643a0e395daf060883f2fb6752d0c6645884dffabd2934e2cabb6c90f0f92" + } + }, + "model": "examples/school-management/models/school-model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "6e9fe414c95041edd0548548583560827b305a9cf05b489b514390def6b3f824", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/school-management/models/school-model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "b5cd06ae44464fc29ed24de82654b47c80f546110496756aa15923cee1c511b4", + "producerReceiptSha256": "af212bfca6565258cc4d575b5f5ce1c09ba504937857282f70bbad29e07f276f", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "27779fca2dc258b16c11779bd69ea6ff05e17d0fb1b237523607a8a7a7bbad31", + "destination": "examples/standard-order/generated", + "generatedFiles": { + "examples/standard-order/generated/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "aa3d20c43f253d8b54b465d3f7efc25794e642795c735f18afdbf4e6aefcf649" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/Constants.java", + "sha256": "6616fd2e2688db16e668dc44e1c04181e0e09ba6235f1626e25f3ba075beb44f" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/E.java", + "sha256": "4702c8b91a9a24bc319472aedb97697b6ec0e8551571402cb4724b88a6be51b1" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java", + "sha256": "88b93f17283d9c59d97a3c703faececd96160e1c944030da6d605a7e319b8def" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java", + "sha256": "0bff7cd3b404a5720bcffbd3821a9d5a8a205100a107c15e7cb7ee3c323da68f" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Q.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/Q.java", + "sha256": "da1a4bc7d477878877cd275b4ea0ad31ccded12894a3c26741ce7af394e1ad45" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java", + "sha256": "1bc0a93d370f90faaa13ec7f3333a13bf788754c6ed3a499ac3d6a3f41f3f03b" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java", + "sha256": "e32fe91d9c4d0c9dd737d76009d9a517e14a86d74cc4b9656f1c4109fa68a1d5" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java", + "sha256": "dd111fa5c9be48380e1cf2dec94c1ffa0b21683da563ffe890964ecca004b352" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java", + "sha256": "0aae219b9e565560155beb078e710d0b97c584a563f1add175ca4373374c77b5" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java", + "sha256": "7d017d7c8752f068504b7c57d0c758af1ef7fa5582b2335a54a95d6d263cb95b" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java", + "sha256": "96d6745f2a6e008966eda59234b840a25bbff6ebdc379129ec883998de0f4463" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java", + "sha256": "5b0e33d3bf7a5c3c6368e17f648d89cd1bf2c933248b4221814ed611b1a2d7a7" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java", + "sha256": "2d7fd6fed2d3cb5e40fa351f7801f5fb329552c3e98e118c2b2bb1575f1c7090" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java", + "sha256": "1b0ed544f79c7bc7aaf74a901d75569ab81a955535f83e55e80fb7d570a24bdd" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java", + "sha256": "213d88c60048a94671bdcef3748bb82306cb3ed08397cbd21717200d0f18a071" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java", + "sha256": "08e32011edc586af0ca014b5ff647f813b918342522a82a1f919b0375cc12e66" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java", + "sha256": "2110b97c87669e11dcddf7f977178260b1a30c07a21e6d6402fdb2e073d5bea3" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java", + "sha256": "28d270f7023a57cd69254e4ac03dc20b59d527b7bb13bc57813fa69ce792598c" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java", + "sha256": "ec132615f09ff24ae45e24d6ded880a86c80eddc309072f8ac9f5874ffc56faa" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java", + "sha256": "2da9ca5c069e11f4247455920273fbbcde9db184e6cf23c950f5ba88c224a8a0" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java", + "sha256": "25ee269243d8766fafa86253adbfc919f8982da8eebc6792c5eaa015514a9cc1" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java", + "sha256": "72b874ae0065c3afd136ffcae4112c1d1aa4b5e5d97ecd8048405f05bd021c82" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java", + "sha256": "8b20927853e782791c91eabee5bd76b124a770d5c69c467db1f8d1b1c51b2978" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java", + "sha256": "b7ed6147399c07e0041a44caf3da0e61d06ec63cabce0f7d56b3875c9203efaf" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java", + "sha256": "999f6f0fdb1f46511f1990fc15ec8fbc25a72d10935ee49ee2e22360fe64b32f" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java", + "sha256": "49046e050ed7dba860a6147016918f16ed63fa25356676c261048b2d2d16f1d3" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java", + "sha256": "3740dd9b56d421949d0fc465a14432ab1aae86aab23b656ecccc95d1993c7d97" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java", + "sha256": "b8e7666030f2300ae57fc5c3e4d99c62dcd2c3c9e9fc1e0fccd8799094d323f7" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java", + "sha256": "fd6e515d30839dd5c0f6b012fd3d39ad988a8e465dbe70d7c01aa39639209b33" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java", + "sha256": "4efc0af02ee6f5a5eb1a3500707e4027c6029a9ab7f9a4437210a494832a2a94" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java", + "sha256": "fcb23d9bd5215a530226da2a7f1e253a24f14a3e8cbe2c19cbfb1d2ae18f21cb" + }, + "examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/standard-order/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "1ccbac54ea338ecd530e99d5436a006c999e5fb9c7a851020ed85710016a8091" + }, + "examples/standard-order/generated/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "11e9102d94684fd30e13941514301d2cf6f20522c275cfa36eece9842ff1014e" + }, + "examples/standard-order/generated/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "383452529a7be408d6ec9e8162bca8d2a92c2681879cf79ef4209a9edc781046" + } + }, + "model": "examples/standard-order/models/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "82d3dab59287c704c92638424deead1be2788526410eabe83d7f9506bfe0eafd", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/standard-order/models/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "455a5b60e571859a68586678da4bd8c9f13120132dc7ecf95f0554d98af6d674", + "producerReceiptSha256": "ee30a0f1619c7bc1b5196668848b22feef008461ef9f52f6e199c9eb7e1e9fb2", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "e2dae2be506ef2354fd57ffd360d1fd53febb330be65546f4c8480d45095bab3", + "destination": "examples/trace-chain", + "generatedFiles": { + "examples/trace-chain/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "0fee7388b4b98cea713fdb836bbc82605bb95c84748f815dd0dc88cd529f8dfb" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/Constants.java", + "sha256": "7c4c4322c7bd699b3b0bd6408ec6697a696e676f323c885725d924d4680d7d84" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/E.java", + "sha256": "c94315e814895c4a634d471cf95385b6399aaadb1e2f072a3b7c01bc72f6d39a" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java", + "sha256": "b2bfc4bed3d662b6498770ea4fbe7b95b922794f657e986b0189951441070a71" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java", + "sha256": "ba88b1d63497019158af4b1e9c18fffdb0beb5c55a59579ef8aa3e9f25e6ac6e" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Q.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/Q.java", + "sha256": "2179c15d8d5990b1d275a4777a6d8ff1879a0015871cd15821a3b614632acac3" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java", + "sha256": "02aad8535d1292690cc7fd6e8000035e42aca040c7b3a1ea9d293776acab9262" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java", + "sha256": "61dab24aa7a168a204e4032588d62fe2b921e8e7bb23232fa0c1c1e2581df22b" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java", + "sha256": "cd79d40a84c017032168d03e5d4479f3de03f308785303427022e7c4f6cbc1ca" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java", + "sha256": "87fdd314bdd4b2bdc22f7e7d2dbf5dac000a19aa98cd9c3fe9a0e84ff3b9ad2b" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java", + "sha256": "ae19af3c6b2d03d3be333e2d640c59d0ff5dca1e14a1d7c3e6e5c6ed1b775c45" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java", + "sha256": "2f401c8ac35998595af563b97be9f7c166e1b915948dc35c4ab7fdccb04c92c4" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java", + "sha256": "3c9372ced32e32c20ccdcc2f76f5d8d4f7594c4c45f2839ddbe288b76c3b524d" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java", + "sha256": "477efa373106fd1483708977669d6cd0ead2a6f521446f0e7a842d656cd9554f" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java", + "sha256": "a1f9fc8557a29ccef9b0662741b1491dc59cf441f35fcb5bf8b82b63a34cab49" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java", + "sha256": "1cb7ead158a0ef4acb2bce76a36687b4dd2a4d572f288ccf9c0ec04a0728f317" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java", + "sha256": "72999e60668e4c58f2585f0bb4952422b810b3061735168782ba0a520c369232" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java", + "sha256": "6836a6b6c566530633ccc353433a8b47ec010f5513ed554e6848284c587de848" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java", + "sha256": "e44d6bb79a8e9284eeccfea04376c298a39dd6beb0a705667608ef246a3514af" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java", + "sha256": "00874e5e70da06d62e9f1341b094f4b3f9e00c2ffc08103284068e0896fad167" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java", + "sha256": "af31ed30d7e80e96458fdbdfcb0775deebe42a25216f876049d928f25b60fd3e" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java", + "sha256": "d09d871d11aea0d4f248c7fefbce58d9a2a3850f2d707ee70d663307eeef3085" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java", + "sha256": "14b2cdca50d110b4f5b5b21ab171d52d0f53d4003b8c71dc3ce805a194f41bfa" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java", + "sha256": "0d347175a739fe2c06f42be0c753ee321df7662cede476c910e1669bb292ae59" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java", + "sha256": "235adc079946b468741fa2744e76af2a7ed7ee567c8c01a4b0dc3eb27d9bc17d" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java", + "sha256": "cbb5df62a779664ff82da8f34c0739823b5ee219df8d257b0ba60dfa9e14a6b9" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java", + "sha256": "89bf66d5f74e1ed59f69e594da5b78205fb1b258d110a11e4608115bc2c1ec2b" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java", + "sha256": "432fb08ddc4fa197294646b4001057fc91a99dee84b9519db952eaab7736d68b" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java", + "sha256": "114b16bbc115d78b49f379bbfa6b56b0be6addf3e60147906be6004c387e24f8" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java", + "sha256": "0fd9ca4e9d677bd9f7b656b6f11f8a5ea3aee975bd09d8f856981ebcf86282ea" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java", + "sha256": "6ee2c88507f9f3152b325e1daed2dad77817c2cc782240a4ce48ca84f95e8c58" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java", + "sha256": "a612f83d861d5d0a4821447285059aa34aaa33976afed9795676f27b850a87b2" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java", + "sha256": "b45c3f3138982558f41dfed31a6b67e827292512731d386b3ba1aad83ffb369b" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java", + "sha256": "d0ea2d86009ffd8f66059171b98cb95d6be766583460e8732d10a0f3c393fc31" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java", + "sha256": "4d26c4420927ad33175655164944af87d0dfc5b3b21ae7f5fe4d7c69f8168bba" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java", + "sha256": "5ad66968d1979255432fcb92d2611b57b1eca94854fb92293cdf2eed8e145247" + }, + "examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java", + "sha256": "4e1d004e804103baf2d2fdc1f61c869f08a07076d49bf632e7de56620e594bb0" + }, + "examples/trace-chain/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "ffd19eb50d0ebd6fba4ff3a18940bd13dc4df1d77ff0ffb23e8e6b2c5a834fee" + }, + "examples/trace-chain/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "4e3a105f6a25a68a4565f8bb5addf7bb560cc2d53f113c300689986959ad8ec0" + }, + "examples/trace-chain/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "5267c6d37e108c1392e71d2bd7b15264e00ae97a989d98c4391d87c80c3843d4" + } + }, + "model": "examples/trace-chain/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, + "generatedManifestSha256": "7d5d4b7cb978bc5c649fc9cf111236cf1143abd5dde053d29ed00941240a4a65", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/trace-chain/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "c9743d776718c7b27c97792f75f492fdc99bf427e4bd0c24bf3492de6520c9a2", + "producerReceiptSha256": "3081b854805f8829dc8d468b31cd6d8294867111588bd5088b4ef06a676c048e", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + }, + { + "archiveSHA256": "aab038b915b19c068e25398081eaba84908a4ecd5db0997a2b40b3b17b046476", + "destination": "examples/order-management/java-lib-core", + "generatedFiles": { + "examples/order-management/java-lib-core/lib/pom.xml": { + "emittedPath": "lib/pom.xml", + "sha256": "ebc33330e0d8bea91c8a68eb9e0806006619f9e223129274d2b460a0ed0874de" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/Constants.java", + "sha256": "0ead4d99d80a3bc4a6891ce9ef00deffd60b9d5395a9f34df55c2e7af3e99d13" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/E.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/E.java", + "sha256": "1aae139e962d37be1eda53dc8ec41ab69c4d58537b96488587e292918e9b0c46" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java", + "sha256": "72c4c025ef7c82deeea841ee7cb84feac2a62e3cdba670d79a8abd7ca9e23a21" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java", + "sha256": "f745d8cf1e0bf7a7989362680df4e7f83d962210a91e04ac7aba24c1edf3726e" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java", + "sha256": "e3b18c77a767e68d4585aa6fbb2708c935944a0d305c756b42f2217d1bbdbc62" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Q.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/Q.java", + "sha256": "331df52f4327e1465374a6b5c2061c6ff7a81d6d1d4e9ce17aba5e61904939ea" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java", + "sha256": "4871537e392a02ff60b20a6a4a304c7888369a42de2d62aa26891cd6100e17bf" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java", + "sha256": "fcbcf78eae49bf297476c03ac9454ad9b8d2376de6b33d661c0bdf144bfcf500" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java", + "sha256": "fe59124058e9405cbc7865410a0b5191b9fe260d66423d52751f246033af0e14" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java", + "sha256": "17b46a2615a0418a2d611eebf59f2d33383b0bb2cd4a7736788d9b18208a2ca1" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java", + "sha256": "ecc0881171e10758d1fdc9fa543837c343db59dcbe6b147ee86dbbac9f264666" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java", + "sha256": "0a84f29455b7458c680270799f531b337fa720b022723f15f957a6f6e093205d" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java", + "sha256": "be0a752623e3873999edbf7728851ac2bfb8cad06eefa3f81fa6ce4425e772a1" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java", + "sha256": "0a740cb0c86aca68ac7df5f4acf401ab093ae01f4394c7e50276de7b1c478791" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java", + "sha256": "49c40ce00a7f49e0b52c9b0a00ac13cdda6cc2ec294df310b9cbacf494c32a2b" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java", + "sha256": "e32e82a5c0cd929cf88bba063bf8e17080fca7d7f9fa3bbcf15e69cdbc9bf967" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java", + "sha256": "1b67e2c2646fa192b4ecb0e32e249f94833a96f1c96e421dcf62d7a4aa317835" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java", + "sha256": "88763b09c8a9c49dc246491bac935d59a8ad1d270578f20fbeff3d23548d13ba" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java", + "sha256": "8cec54d3f6865b0d2ea690f141499b5f22f05f78624afc3f4a83eb4495d58370" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java", + "sha256": "07b967017411961a96cd406977a094ae9c59727a8b652d0068202ef1803a713a" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java", + "sha256": "cea4c876d2bad93619507151766f604b798727dbc5ec47c97a847965b2b70418" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java", + "sha256": "1efba1e35f311ed96d0c16f4464dbcbefd5edc550cc640fc504e7db7c1344987" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java", + "sha256": "264dc06f179f176930b29b134357fda9b5490dd03362fdddf923c49aa857d659" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java", + "sha256": "7e9fa5d0a12547a6f38f8b851c25a16d2a41253df0b6560da312888aabcd709b" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java", + "sha256": "5dc82764d4d94ac3b786e48b4aa46120296aca02ae10045301e0b92b9e85e523" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java", + "sha256": "06fdb11c9d3fedd893ffe6ece0a54bbb0a144ee8bd7fb2ac0ac8c4e274055413" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java", + "sha256": "2bc72303845ecc923fb60fbf19b3317f418f67aaf901529a2b5b92f063699772" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java", + "sha256": "3f475c27c129caf0b267c760d550c1ce6b4504315df3c31c43c2d37775f2e091" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java", + "sha256": "35ae3815d8cabaa55e1ef35690533271f0cf3c2244eefb9d23d37cd649f99aad" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java", + "sha256": "2cbe1b83006c81b2c221f4551747f329ecaa9da2e0816ed93a8086b21a03a86f" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java", + "sha256": "00395a3b18753befa78750e1a8a59af7b8715d29a47299083dba6593c6b62866" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java", + "sha256": "7d9e9738eb52b7ffbaec1ffa92d02e48a6af946f7671b16a6a8e1d0a2c66c300" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java", + "sha256": "2ac058241c9afe0993b81959e6d08ea79071bca38702e98e21a6154bd0fecebe" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java", + "sha256": "144eda5eec2d95e4ccf622c80c4e993b08436385e3ac1ab916cd261545bb98ce" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java", + "sha256": "2d4e1a76ef69b8853c43043fb0d340417b55656f7345357b876df629c655f05f" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java", + "sha256": "316741cc5436441e03fb6f4babe82e85413fe91dfe49ee79111833c6988c466d" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java", + "sha256": "166a688f1ec6b78a6da091e6f8fad662b50af0e48df1d667eed23e0bbd8636f0" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java", + "sha256": "689c2e5187d2a8298ef644a1e29cc26266a01d006820ae1060e62a49901fdbcf" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java", + "sha256": "609df2656ee902e76f7ffe8cc5f7e3dab76ff6a1399df2d9ee0a1ad5d57228de" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java", + "sha256": "1480416326ebd28041a408355a8bb2f87b25f6cb8f40c98d01e8648f32949fac" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java", + "sha256": "a2a9d3d7e0423f9375e23436a22f91074f9b1b44c47dae25f49935a79e19cc31" + }, + "examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java": { + "emittedPath": "lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java", + "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "examples/order-management/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", + "sha256": "7b4edfdeca872586554a76b412cd8124386a70c3c7377a62ce867e5271e5003b" + }, + "examples/order-management/java-lib-core/teaql/checker-model.json": { + "emittedPath": "teaql/checker-model.json", + "sha256": "82f1556c56fd3ed10f2e947da68d0defb73215bf2192ccd213cc9c7e8eae9b95" + }, + "examples/order-management/java-lib-core/teaql/model-provenance.json": { + "emittedPath": "teaql/model-provenance.json", + "sha256": "31405751e4401502c2c62606fbef4bf7319675863392872f90e3903a2d0f51a1" + } + }, + "model": "examples/order-management/model.xml", + "origin": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 8, + "generatedManifestSha256": "824b44c1d120e20da7e17344bcea9b15c7720a777be4d857d4692e6a755215e1", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-followup/java/order-management/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "8b11ee844c2be184e194d8116994fb5fe95299dd593bfed83ec06d71ada0411d", + "producerReceiptSha256": "2b4b1118897e08d70507908cb5167c56422ad1f3f2416588cbf12baa6f297044", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + } + }, + "preservedApplicationFiles": {} + } + ], + "runtimeBaseCommit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "schema": "teaql.runtime-current-generated-examples/v1", + "sourceCodeHandEdited": false +} diff --git a/examples/inheritance-save/generated-files.json b/examples/inheritance-save/generated-files.json index a931a5d92..4b31c572a 100644 --- a/examples/inheritance-save/generated-files.json +++ b/examples/inheritance-save/generated-files.json @@ -1,46 +1,46 @@ { - "lib/pom.xml" : "f47c6cfdb931a1943eca1fd24f92fd360819d3d1d8faeffab18fb00ebffc0048", - "lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/inheritancematchingservice/Checkers.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/inheritancematchingservice/Constants.java" : "916f41797ceeeb89650ed3df3c69f744baaaadf69273ac1a5ef5df7c23210dba", - "lib/src/main/java/com/example/inheritancematchingservice/E.java" : "8259d4ff7302a5cb632dd6f54654a363a381d7cf4b4768cb69ac7f0b5e0d8ec1", - "lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java" : "a406851aabc74afb74ec5cda54a59bf816a67ba3c5022e911116032bef2be3b3", - "lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java" : "693701578b8c35182dfe78ffdf1be8a28078e9a598ee0fed003fd30d29b61e9a", - "lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java" : "97b48694df0e8ea0757e3ad11768dfbf8c0bc74c459784860d16c8e1ae8dd937", - "lib/src/main/java/com/example/inheritancematchingservice/Q.java" : "f8c44522ddaeebf36a6a0428fac2500224c02bb0ec23c141b1f2a81737bd7666", - "lib/src/main/java/com/example/inheritancematchingservice/Repositories.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java" : "f3266a95e74172fb50c64aacdab6381c8e0d4ac49ebaf15358e6dfe67b487e3e", - "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java" : "1e0187a88488e968d93cd180dfd84e10330a9011cb4fe3edf5b60a8898b45708", - "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java" : "8370df1fe82550fe482581d296c1e31876c65038e3b3082c41a1e0af61936b13", - "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java" : "6a2ca94ca8e7343a2ab074580ced5a4494bcacd5afd66d175f72837248fd4ecb", - "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java" : "22bac4800a50da9f944d7adf744c95effc2f6368d3f40a0913eaf9b91d961ccd", - "lib/src/main/java/com/example/inheritancematchingservice/college/College.java" : "9bdb82ee2d16ac37faacafc35bb8212e7a530b7e46335e06257f058374461c05", - "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java" : "e8edd9178db335cbad64504e7f94d60bf83f719d119ac01a00d16932c5e57d63", - "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java" : "f21d4bb04ec6f36aebc11c86552052dee53f2b02808d839d7058e51310461abd", - "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java" : "a89b341c3c2d55ef8650d7dfe75cb5d954b16e3b392b959f8d6c585223ca74d0", - "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java" : "27588840f5de0800c406bf6ec142c64423d93954f175ece95954aa7236f96d9a", - "lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java" : "2d0347e54ca56a14edfdd7781b34db313dd263736e60518dc0af2443d706665d", - "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java" : "297a063a3dc563562ee3ac4581b48072a793b7bbd748552682f080e8cafb4f79", - "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java" : "e8c00499b35b4e62ee357629653644e2634bb3d7bec45961763ab791dcc73cd5", - "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java" : "c1d13f123bab9409a9b6e1133d0fb8de06f8235322afe5c550e8a24204d07bff", - "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java" : "18c6b2b7d319bbfff05bc3946c2e92e536c9a891cdc46d49694404a00f4968ab", - "lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java" : "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/inheritancematchingservice/school/School.java" : "3ba2a4ad5f4220ead5f9dadfb7a720fad4407e0046382d9daf41346b9c9c5d92", - "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java" : "d5fbbad3eadf1baed8f8e61e90cbcf6f95eb6756e22786ba1488ed95c4e976a9", - "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java" : "f668134245f8392fecaf18b979516b6d60aa0af5b9922325720f2e666e417095", - "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java" : "67e482d8be45be9d6f23c206dc7564cff7da1b2ccd69205d3df109c2e6c77749", - "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java" : "f826a9b55aa8fbcd4d78e7c6499930c19d01d0e3a635fd35b973b8a6926fdc3b", - "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java" : "eb3e51a859272074c1cf7ed27b001db49b6dd3e649f3d748c59951af7fe2ec94", - "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java" : "3be09b35400e494a050d687ac746a19f5abc863aa6abe0d2356993d3c3a0df35", - "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java" : "fc23cff73051d98628fab7f060bc6309f01403d6f11939d8fd02d2e9dc6c9c97", - "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java" : "cd36a4d43c5e0d775e84998504f7ca3625516ce6fa87fbe7aa2f74cdd295287a", - "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java" : "25075ebfc9217aff119603328924d02584c285228917a267b6d4195093e5b9b4", - "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java" : "1af9893df0aa522b60e7ceb7ab1d84c917c4f54873e638013cc020788e873f6d", - "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java" : "a42c0eaae62ce9375e9e4563bbc9c11674331180c49969a3c5d2a5ba70ea7a17", - "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java" : "a4afe5f0732e93b7428d1d34fb5484274555f968b42fecd0e41923405952be22", - "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java" : "2184e87b2b4ec812738d871c840eee3ab46aeb764fa92e0ed40cac76733d2f8f", - "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java" : "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7", - "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler" : "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7", - "teaql/checker-model.json" : "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242", - "teaql/model-provenance.json" : "ee193bbe93b52415aac7c5064b3df8304ca51521a006f7a0e8a79ebc4c9cd780" + "lib/pom.xml": "b005d331eb709ab62bbab5e035e7e142b815505351e7e79e1856bdfb89915f6c", + "lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/inheritancematchingservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/inheritancematchingservice/Constants.java": "916f41797ceeeb89650ed3df3c69f744baaaadf69273ac1a5ef5df7c23210dba", + "lib/src/main/java/com/example/inheritancematchingservice/E.java": "8259d4ff7302a5cb632dd6f54654a363a381d7cf4b4768cb69ac7f0b5e0d8ec1", + "lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java": "868fb313b930e27224e95bd0316440c6e60913c7b8e0a23924f209bc4c3d8548", + "lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java": "693701578b8c35182dfe78ffdf1be8a28078e9a598ee0fed003fd30d29b61e9a", + "lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java": "97b48694df0e8ea0757e3ad11768dfbf8c0bc74c459784860d16c8e1ae8dd937", + "lib/src/main/java/com/example/inheritancematchingservice/Q.java": "f8c44522ddaeebf36a6a0428fac2500224c02bb0ec23c141b1f2a81737bd7666", + "lib/src/main/java/com/example/inheritancematchingservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java": "286844c23da99af8108df1647d6253c74e8a1149dd9e5bd4cff92aa46c399636", + "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java": "1e0187a88488e968d93cd180dfd84e10330a9011cb4fe3edf5b60a8898b45708", + "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java": "8370df1fe82550fe482581d296c1e31876c65038e3b3082c41a1e0af61936b13", + "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java": "6a2ca94ca8e7343a2ab074580ced5a4494bcacd5afd66d175f72837248fd4ecb", + "lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java": "22bac4800a50da9f944d7adf744c95effc2f6368d3f40a0913eaf9b91d961ccd", + "lib/src/main/java/com/example/inheritancematchingservice/college/College.java": "9bdb82ee2d16ac37faacafc35bb8212e7a530b7e46335e06257f058374461c05", + "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java": "e8edd9178db335cbad64504e7f94d60bf83f719d119ac01a00d16932c5e57d63", + "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java": "f21d4bb04ec6f36aebc11c86552052dee53f2b02808d839d7058e51310461abd", + "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java": "a89b341c3c2d55ef8650d7dfe75cb5d954b16e3b392b959f8d6c585223ca74d0", + "lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java": "27588840f5de0800c406bf6ec142c64423d93954f175ece95954aa7236f96d9a", + "lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java": "2d0347e54ca56a14edfdd7781b34db313dd263736e60518dc0af2443d706665d", + "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java": "297a063a3dc563562ee3ac4581b48072a793b7bbd748552682f080e8cafb4f79", + "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java": "e8c00499b35b4e62ee357629653644e2634bb3d7bec45961763ab791dcc73cd5", + "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java": "c1d13f123bab9409a9b6e1133d0fb8de06f8235322afe5c550e8a24204d07bff", + "lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java": "18c6b2b7d319bbfff05bc3946c2e92e536c9a891cdc46d49694404a00f4968ab", + "lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/inheritancematchingservice/school/School.java": "3ba2a4ad5f4220ead5f9dadfb7a720fad4407e0046382d9daf41346b9c9c5d92", + "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java": "d5fbbad3eadf1baed8f8e61e90cbcf6f95eb6756e22786ba1488ed95c4e976a9", + "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java": "f668134245f8392fecaf18b979516b6d60aa0af5b9922325720f2e666e417095", + "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java": "67e482d8be45be9d6f23c206dc7564cff7da1b2ccd69205d3df109c2e6c77749", + "lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java": "f826a9b55aa8fbcd4d78e7c6499930c19d01d0e3a635fd35b973b8a6926fdc3b", + "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java": "eb3e51a859272074c1cf7ed27b001db49b6dd3e649f3d748c59951af7fe2ec94", + "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java": "3be09b35400e494a050d687ac746a19f5abc863aa6abe0d2356993d3c3a0df35", + "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java": "fc23cff73051d98628fab7f060bc6309f01403d6f11939d8fd02d2e9dc6c9c97", + "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java": "cd36a4d43c5e0d775e84998504f7ca3625516ce6fa87fbe7aa2f74cdd295287a", + "lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java": "25075ebfc9217aff119603328924d02584c285228917a267b6d4195093e5b9b4", + "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java": "76a5fa64a2f1d26a764d69de7144081f4f4414ce36192c5c5e35e84a142de69a", + "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java": "a42c0eaae62ce9375e9e4563bbc9c11674331180c49969a3c5d2a5ba70ea7a17", + "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java": "a4afe5f0732e93b7428d1d34fb5484274555f968b42fecd0e41923405952be22", + "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java": "2184e87b2b4ec812738d871c840eee3ab46aeb764fa92e0ed40cac76733d2f8f", + "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java": "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7", + "teaql/checker-model.json": "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242", + "teaql/model-provenance.json": "f7e0e14b0905e8c83b54559464ef0a2a3763daee625b0696769ff4fc18b39c49" } diff --git a/examples/inheritance-save/lib/pom.xml b/examples/inheritance-save/lib/pom.xml index c533a0130..f136984ca 100644 --- a/examples/inheritance-save/lib/pom.xml +++ b/examples/inheritance-save/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.557-SNAPSHOT + 6.3.0 UTF-8 true diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java b/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java index 9223f1614..bb71dcdbf 100644 --- a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java +++ b/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java @@ -573,8 +573,6 @@ private void registerAcademy() { .with("max", "100") - .with("column", "Legacy Campus Code") - .with("columnName", "Legacy Campus Code") .with("isVersion", "false") .with("javaType", "java.lang.String") diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java b/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java index 9ad63d6af..4113fda2b 100644 --- a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java +++ b/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java @@ -23,11 +23,11 @@ public class Academy extends School implements RemoteInput { public static String INTERNAL_TYPE = "Academy"; // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "cd7f0bf3e8a453342d310c02c751feb21ed2383f4c58932743069e1be291b526"; + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "042b18ec3ea3b22c05808e3810639d71dca129f54216d83d86b7b5b85841cc0f"; public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("campus_code", 6)); public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "Legacy Campus Code"))); + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "campus_code"))); public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( ); public static final FieldLayout __TEAQL_FIELD_LAYOUT = diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java b/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java index bde31f315..cab9db2a2 100644 --- a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java +++ b/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java @@ -23,11 +23,11 @@ public class TrainingAcademy extends Academy implements RemoteInput { public static String INTERNAL_TYPE = "TrainingAcademy"; // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "febc19f1547b3c9d17b9acd2ae34f398323bbe38ad635615cf4c19a534590fbc"; + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "d5c47f287adcf434556be4564044800fdadd56e6914079eb97fedf380ef46cc2"; public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("campus_code", 6), java.util.Map.entry("specialty", 7)); public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "Legacy Campus Code")), java.util.Map.entry("specialty", java.util.List.of("specialty", "specialty"))); + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "campus_code")), java.util.Map.entry("specialty", java.util.List.of("specialty", "specialty"))); public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( ); public static final FieldLayout __TEAQL_FIELD_LAYOUT = diff --git a/examples/inheritance-save/model.xml b/examples/inheritance-save/model.xml index 0e11303a8..c4f01d2a9 100644 --- a/examples/inheritance-save/model.xml +++ b/examples/inheritance-save/model.xml @@ -1,5 +1,5 @@ - + com.teaql order-management-service-core - 1.0.0 + 0.0.1-SNAPSHOT jar @@ -82,7 +82,7 @@ cn.hutool hutool-all - 5.8.47 + 5.8.20 @@ -139,4 +139,4 @@ https://maven.teaql.io/repository/maven-releases/ - + \ No newline at end of file diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java index da49a27ab..83c69ad5c 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java @@ -8,8 +8,6 @@ public interface Constants { public static final long COMMERCE_PLATFORM_ID = 1l; public static final CommercePlatform COMMERCE_PLATFORM = CommercePlatform.refer(COMMERCE_PLATFORM_ID); public static final long ORDER_STATUS_PENDING_ID = 1001l ; - public static final OrderStatus ORDER_STATUS_PENDING = OrderStatus.refer(ORDER_STATUS_PENDING_ID);public static final long ORDER_STATUS_PROCESSING_ID = 1002l ; - public static final OrderStatus ORDER_STATUS_PROCESSING = OrderStatus.refer(ORDER_STATUS_PROCESSING_ID);public static final long ORDER_STATUS_SHIPPED_ID = 1003l ; - public static final OrderStatus ORDER_STATUS_SHIPPED = OrderStatus.refer(ORDER_STATUS_SHIPPED_ID);public static final long ORDER_STATUS_COMPLETED_ID = 1004l ; - public static final OrderStatus ORDER_STATUS_COMPLETED = OrderStatus.refer(ORDER_STATUS_COMPLETED_ID); + public static final OrderStatus ORDER_STATUS_PENDING = OrderStatus.refer(ORDER_STATUS_PENDING_ID);public static final long ORDER_STATUS_CONFIRMED_ID = 1002l ; + public static final OrderStatus ORDER_STATUS_CONFIRMED = OrderStatus.refer(ORDER_STATUS_CONFIRMED_ID); } \ No newline at end of file diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/E.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/E.java index 9352e30aa..8e27c74fc 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/E.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/E.java @@ -15,28 +15,29 @@ import com.teaql.ordermanagementservice.orderstatus.OrderStatusExpression; import com.teaql.ordermanagementservice.product.Product; import com.teaql.ordermanagementservice.product.ProductExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; import io.teaql.core.value.ValueExpression; public class E { public static CommercePlatformExpression commercePlatform(CommercePlatform commercePlatform){ - return new CommercePlatformExpression(new ValueExpression(commercePlatform)); + return new CommercePlatformExpression(new ValueExpression(commercePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.commercePlatform()")); } public static CustomerExpression customer(Customer customer){ - return new CustomerExpression(new ValueExpression(customer)); + return new CustomerExpression(new ValueExpression(customer, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customer()")); } public static OrderStatusExpression orderStatus(OrderStatus orderStatus){ - return new OrderStatusExpression(new ValueExpression(orderStatus)); + return new OrderStatusExpression(new ValueExpression(orderStatus, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderStatus()")); } public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder)); + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); } public static ProductExpression product(Product product){ - return new ProductExpression(new ValueExpression(product)); + return new ProductExpression(new ValueExpression(product, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.product()")); } public static OrderLineExpression orderLine(OrderLine orderLine){ - return new OrderLineExpression(new ValueExpression(orderLine)); + return new OrderLineExpression(new ValueExpression(orderLine, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderLine()")); } public static OrderSearchPresetExpression orderSearchPreset(OrderSearchPreset orderSearchPreset){ - return new OrderSearchPresetExpression(new ValueExpression(orderSearchPreset)); + return new OrderSearchPresetExpression(new ValueExpression(orderSearchPreset, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderSearchPreset()")); } } \ No newline at end of file diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java index 53edd751e..d855d7fe5 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java @@ -1,6 +1,7 @@ package com.teaql.ordermanagementservice; +import io.teaql.core.FieldLayout; import io.teaql.core.meta.EntityDescriptor; import io.teaql.core.meta.EntityMetaAssembler; import io.teaql.core.meta.EntityMetaFactory; @@ -24,14 +25,12 @@ public void assemble(EntityMetaFactory factory) { registerOrderSearchPreset(); } private void registerCommercePlatform() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform::new); - entityDescriptor.with("name", "Commerce Platform") - .with("module", "Platform") - .with("module_key", "platform"); - + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY, Long.class) ; @@ -47,103 +46,185 @@ private void registerCommercePlatform() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Northwind Demo") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("candidates", "createTime()") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("candidates", "updateTime()") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerCustomer() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.customer.Customer.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.customer.Customer.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.customer.Customer.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.customer.Customer::new); - entityDescriptor.with("audit_mask_fields", "name,email") - .with("name", "Customer") - .with("module", "Commerce") - .with("module_key", "commerce"); - + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY, Long.class) ; @@ -165,119 +246,216 @@ private void registerCustomer() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.COMMERCE_PLATFORM_PROPERTY).with("context", "true"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerOrderStatus() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.orderstatus.OrderStatus.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.orderstatus.OrderStatus.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.orderstatus.OrderStatus::new); - entityDescriptor.with("features", "status") + entityDescriptor.with("constant", "true") + .with("identifier", "code") - .with("constant", "true") - .with("name", "Order Status") - .with("module", "Order") - .with("module_key", "order"); + ; + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY, Long.class) ; @@ -299,118 +477,219 @@ private void registerOrderStatus() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") - .with("candidates", "1001,1002,1003,1004") + + .with("candidates", "1001,1002") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") - .with("candidates", "Pending,Processing,Shipped,Completed") + + .with("candidates", "Pending,Confirmed") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY).with("identifier", "true") + .with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") - .with("candidates", "PENDING,PROCESSING,SHIPPED,COMPLETED") + + .with("candidates", "PENDING,CONFIRMED") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + + .with("optional", "true") + .with("javaType", "java.lang.String") - .with("candidates", "#F97316,#2563EB,#16A34A,#334155") + + .with("candidates", "#F59E0B,#10B981") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") - .with("candidates", "10,20,30,40") + + .with("candidates", "1,2") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("candidates", "commerce_platform()"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("candidates", "1,1") + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.customerorder.CustomerOrder.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.customerorder.CustomerOrder::new); - entityDescriptor.with("name", "Customer Order") - .with("module", "Order") - .with("module_key", "order"); - + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) ; @@ -441,133 +720,245 @@ private void registerCustomerOrder() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.STATUS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("context", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerProduct() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.product.Product.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.product.Product.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.product.Product.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.product.Product::new); - entityDescriptor.with("name", "Product") - .with("module", "Commerce") - .with("module_key", "commerce"); - + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY, Long.class) ; @@ -592,132 +983,242 @@ private void registerProduct() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.IMAGE_URL_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") - .with("zh_CN", "https") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.COMMERCE_PLATFORM_PROPERTY).with("context", "true"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerOrderLine() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.orderline.OrderLine.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.orderline.OrderLine.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.orderline.OrderLine.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.orderline.OrderLine::new); - entityDescriptor.with("name", "Order Line") - .with("module", "Order") - .with("module_key", "order"); - + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY, Long.class) ; @@ -745,118 +1246,213 @@ private void registerOrderLine() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.COMMERCE_PLATFORM_PROPERTY).with("context", "true"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerOrderSearchPreset() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class); entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset::new); - entityDescriptor.with("audit_mask_fields", "filter_json") - .with("name", "Order Search Preset") - .with("module", "Order") - .with("module_key", "order"); - + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY, Long.class) ; @@ -884,134 +1480,261 @@ private void registerOrderSearchPreset() { PropertyDescriptor version = entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY, Long.class) ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY).with("context", "true"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..098165a55 --- /dev/null +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java @@ -0,0 +1,82 @@ +package com.teaql.ordermanagementservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker(), new com.teaql.ordermanagementservice.customer.CustomerChecker(), new com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker(), new com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker(), new com.teaql.ordermanagementservice.product.ProductChecker(), new com.teaql.ordermanagementservice.orderline.OrderLineChecker(), new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:feb0a6c97f37d35282317bf77fbd60ffde5a4dc18d6f6a371fd40d2c37d6c975\",\"entities\":{\"CommercePlatform\":{\"labels\":{\"en\":\"commerce platform\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_list\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"customer\"},\"aliases\":[\"CustomerList\",\"customerList\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"order_search_preset_list\",\"targetType\":\"OrderSearchPreset\",\"labels\":{\"en\":\"order search preset\"},\"aliases\":[\"OrderSearchPresetList\",\"orderSearchPresetList\"]},{\"name\":\"order_status_list\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"order status\"},\"aliases\":[\"OrderStatusList\",\"orderStatusList\"]},{\"name\":\"product_list\",\"targetType\":\"Product\",\"labels\":{\"en\":\"product\"},\"aliases\":[\"ProductList\",\"productList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Customer\":{\"labels\":{\"en\":\"customer\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"email\",\"labels\":{\"en\":\"email\"},\"aliases\":[\"Email\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"customer order\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"customer\"},\"aliases\":[\"Customer\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_date\",\"labels\":{\"en\":\"order date\"},\"aliases\":[\"OrderDate\",\"orderDate\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"status\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"status\"},\"aliases\":[\"Status\"]},{\"name\":\"total_amount\",\"labels\":{\"en\":\"total amount\"},\"aliases\":[\"TotalAmount\",\"totalAmount\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderLine\":{\"labels\":{\"en\":\"order line\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product\",\"targetType\":\"Product\",\"labels\":{\"en\":\"product\"},\"aliases\":[\"Product\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderSearchPreset\":{", "\"labels\":{\"en\":\"order search preset\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"filter_json\",\"labels\":{\"en\":\"filter json\"},\"aliases\":[\"FilterJson\",\"filterJson\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"owner_user_id\",\"labels\":{\"en\":\"owner user id\"},\"aliases\":[\"OwnerUserId\",\"ownerUserId\"]},{\"name\":\"request_id\",\"labels\":{\"en\":\"request id\"},\"aliases\":[\"RequestId\",\"requestId\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderStatus\":{\"labels\":{\"en\":\"order status\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"color\",\"labels\":{\"en\":\"color\"},\"aliases\":[\"Color\"]},{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Product\":{\"labels\":{\"en\":\"product\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"image_url\",\"labels\":{\"en\":\"image url\"},\"aliases\":[\"ImageUrl\",\"imageUrl\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("CommercePlatform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Customer", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("email", "email"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderStatus", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("color", "color"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("order_date", "orderDate"), java.util.Map.entry("total_amount", "totalAmount"), java.util.Map.entry("status", "status"), java.util.Map.entry("customer", "customer"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Product", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("image_url", "imageUrl"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderLine", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("product", "product"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderSearchPreset", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("filter_json", "filterJson"), java.util.Map.entry("request_id", "requestId"), java.util.Map.entry("owner_user_id", "ownerUserId"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.commercePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.ordermanagementservice.commerceplatform.CommercePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.ordermanagementservice.commerceplatform.CommercePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Northwind Demo"); + domainRoot.auditAs("create generated Domain Root CommercePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("CommercePlatform", domainRoot.getId())); + var constantOrderStatus1001Rows = Q.orderStatuses().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1001Rows.isEmpty()) { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1001 = new com.teaql.ordermanagementservice.orderstatus.OrderStatus(); + constantOrderStatus1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1001, 1001L); + constantOrderStatus1001.updateName("Pending"); + constantOrderStatus1001.updateCode("PENDING"); + constantOrderStatus1001.updateColor("#F59E0B"); + constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); + constantOrderStatus1001.updateCommercePlatform(domainRoot); + constantOrderStatus1001.auditAs("create model constant OrderStatus(1001)").save(context); + } else { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1001 = constantOrderStatus1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1001.getName(), "Pending"))) { constantOrderStatus1001.updateName("Pending"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getCode(), "PENDING"))) { constantOrderStatus1001.updateCode("PENDING"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getColor(), "#F59E0B"))) { constantOrderStatus1001.updateColor("#F59E0B"); changed = true; } + if (!((constantOrderStatus1001.getDisplayOrder() != null && constantOrderStatus1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getCommercePlatform().getId(), domainRoot.getId()))) { constantOrderStatus1001.updateCommercePlatform(domainRoot); changed = true; } + if (changed) constantOrderStatus1001.auditAs("reconcile model constant OrderStatus(1001)").save(context); + } + var constantOrderStatus1002Rows = Q.orderStatuses().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1002Rows.isEmpty()) { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1002 = new com.teaql.ordermanagementservice.orderstatus.OrderStatus(); + constantOrderStatus1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1002, 1002L); + constantOrderStatus1002.updateName("Confirmed"); + constantOrderStatus1002.updateCode("CONFIRMED"); + constantOrderStatus1002.updateColor("#10B981"); + constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); + constantOrderStatus1002.updateCommercePlatform(domainRoot); + constantOrderStatus1002.auditAs("create model constant OrderStatus(1002)").save(context); + } else { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1002 = constantOrderStatus1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1002.getName(), "Confirmed"))) { constantOrderStatus1002.updateName("Confirmed"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getCode(), "CONFIRMED"))) { constantOrderStatus1002.updateCode("CONFIRMED"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getColor(), "#10B981"))) { constantOrderStatus1002.updateColor("#10B981"); changed = true; } + if (!((constantOrderStatus1002.getDisplayOrder() != null && constantOrderStatus1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getCommercePlatform().getId(), domainRoot.getId()))) { constantOrderStatus1002.updateCommercePlatform(domainRoot); changed = true; } + if (changed) constantOrderStatus1002.auditAs("reconcile model constant OrderStatus(1002)").save(context); + } + } +} diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Q.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Q.java index f5e5dbcca..0cdd1f62a 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Q.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/Q.java @@ -12,6 +12,7 @@ public static com.teaql.ordermanagementservice.commerceplatform.CommercePlatform } + public static com.teaql.ordermanagementservice.customer.CustomerRequest customers(){ return new com.teaql.ordermanagementservice.customer.CustomerRequest(com.teaql.ordermanagementservice.customer.Customer.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -20,6 +21,7 @@ public static com.teaql.ordermanagementservice.customer.CustomerRequest orderStatuses(){ return new com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -28,6 +30,7 @@ public static com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest customerOrders(){ return new com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -36,6 +39,7 @@ public static com.teaql.ordermanagementservice.customerorder.CustomerOrderReques } + public static com.teaql.ordermanagementservice.product.ProductRequest products(){ return new com.teaql.ordermanagementservice.product.ProductRequest(com.teaql.ordermanagementservice.product.Product.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -44,6 +48,7 @@ public static com.teaql.ordermanagementservice.product.ProductRequest orderLines(){ return new com.teaql.ordermanagementservice.orderline.OrderLineRequest(com.teaql.ordermanagementservice.orderline.OrderLine.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -52,6 +57,7 @@ public static com.teaql.ordermanagementservice.orderline.OrderLineRequest orderSearchPresets(){ return new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -60,4 +66,5 @@ public static com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPres } + } \ No newline at end of file diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java index 25431fb71..ccc71faac 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java @@ -10,9 +10,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.time.LocalDateTime; import java.util.Objects; @@ -27,18 +29,36 @@ public class CommercePlatform extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "CommercePlatform"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "67294964fa1d025f37e472895a7b4548e18b1d34e91dd854877dbc11d0367f28"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("create_time", 2), java.util.Map.entry("update_time", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_list", "order_status_list", "customer_order_list", "product_list", "order_line_list", "order_search_preset_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CommercePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; - public static final String CUSTOMER_LIST_PROPERTY = "customerList"; - public static final String ORDER_STATUS_LIST_PROPERTY = "orderStatusList"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customerOrderList"; - public static final String PRODUCT_LIST_PROPERTY = "productList"; - public static final String ORDER_LINE_LIST_PROPERTY = "orderLineList"; - public static final String ORDER_SEARCH_PRESET_LIST_PROPERTY = "orderSearchPresetList"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String CUSTOMER_LIST_PROPERTY = "customer_list"; + public static final String ORDER_STATUS_LIST_PROPERTY = "order_status_list"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + public static final String PRODUCT_LIST_PROPERTY = "product_list"; + public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; + public static final String ORDER_SEARCH_PRESET_LIST_PROPERTY = "order_search_preset_list"; private String name; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private SmartList customerList; private SmartList orderStatusList; private SmartList customerOrderList; @@ -49,66 +69,73 @@ public class CommercePlatform extends BaseEntity implements RemoteInput { public String getName(){ return this.name; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public SmartList getCustomerList(){ - return this.customerList; + return this.customerList == null ? SmartList.unloaded() : this.customerList; } public SmartList getOrderStatusList(){ - return this.orderStatusList; + return this.orderStatusList == null ? SmartList.unloaded() : this.orderStatusList; } public SmartList getCustomerOrderList(){ - return this.customerOrderList; + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; } public SmartList getProductList(){ - return this.productList; + return this.productList == null ? SmartList.unloaded() : this.productList; } public SmartList getOrderLineList(){ - return this.orderLineList; + return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; } public SmartList getOrderSearchPresetList(){ - return this.orderSearchPresetList; + return this.orderSearchPresetList == null ? SmartList.unloaded() : this.orderSearchPresetList; } public CommercePlatform updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public CommercePlatform updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public CommercePlatform updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); this.updateTime = updateTime; return this; } + public CommercePlatform addCustomer(Customer customer){ if (customer == null){ return this; } if(null == this.customerList){ - this.customerList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerList = teaqlUnloadedItems.map(value -> value); } this.customerList.add(customer); - customer.cacheRelation(Customer.COMMERCE_PLATFORM_PROPERTY, this); + customer.updateCommercePlatform(this); return this; } public CommercePlatform addOrderStatus(OrderStatus orderStatus){ @@ -117,11 +144,12 @@ public CommercePlatform addOrderStatus(OrderStatus orderStatus){ } if(null == this.orderStatusList){ - this.orderStatusList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderStatusList = teaqlUnloadedItems.map(value -> value); } this.orderStatusList.add(orderStatus); - orderStatus.cacheRelation(OrderStatus.COMMERCE_PLATFORM_PROPERTY, this); + orderStatus.updateCommercePlatform(this); return this; } public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ @@ -130,11 +158,12 @@ public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ } if(null == this.customerOrderList){ - this.customerOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); } this.customerOrderList.add(customerOrder); - customerOrder.cacheRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, this); + customerOrder.updateCommercePlatform(this); return this; } public CommercePlatform addProduct(Product product){ @@ -143,11 +172,12 @@ public CommercePlatform addProduct(Product product){ } if(null == this.productList){ - this.productList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.productList = teaqlUnloadedItems.map(value -> value); } this.productList.add(product); - product.cacheRelation(Product.COMMERCE_PLATFORM_PROPERTY, this); + product.updateCommercePlatform(this); return this; } public CommercePlatform addOrderLine(OrderLine orderLine){ @@ -156,11 +186,12 @@ public CommercePlatform addOrderLine(OrderLine orderLine){ } if(null == this.orderLineList){ - this.orderLineList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderLineList = teaqlUnloadedItems.map(value -> value); } this.orderLineList.add(orderLine); - orderLine.cacheRelation(OrderLine.COMMERCE_PLATFORM_PROPERTY, this); + orderLine.updateCommercePlatform(this); return this; } public CommercePlatform addOrderSearchPreset(OrderSearchPreset orderSearchPreset){ @@ -169,11 +200,12 @@ public CommercePlatform addOrderSearchPreset(OrderSearchPreset orderSearchPreset } if(null == this.orderSearchPresetList){ - this.orderSearchPresetList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderSearchPresetList = teaqlUnloadedItems.map(value -> value); } this.orderSearchPresetList.add(orderSearchPreset); - orderSearchPreset.cacheRelation(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, this); + orderSearchPreset.updateCommercePlatform(this); return this; } @@ -196,26 +228,27 @@ public CommercePlatform comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; - case "customerList": this.customerList = (SmartList) value; break; - case "orderStatusList": this.orderStatusList = (SmartList) value; break; - case "customerOrderList": this.customerOrderList = (SmartList) value; break; - case "productList": this.productList = (SmartList) value; break; - case "orderLineList": this.orderLineList = (SmartList) value; break; - case "orderSearchPresetList": this.orderSearchPresetList = (SmartList) value; break; + case "customer_list": this.customerList = (SmartList) value; break; + case "order_status_list": this.orderStatusList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + case "product_list": this.productList = (SmartList) value; break; + case "order_line_list": this.orderLineList = (SmartList) value; break; + case "order_search_preset_list": this.orderSearchPresetList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -225,15 +258,23 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "name": return this.name; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - case "customerList": return this.customerList; - case "orderStatusList": return this.orderStatusList; - case "customerOrderList": return this.customerOrderList; - case "productList": return this.productList; - case "orderLineList": return this.orderLineList; - case "orderSearchPresetList": return this.orderSearchPresetList; - default: return super.__internalGet(property); + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "customer_list": return this.customerList; + case "order_status_list": return this.orderStatusList; + case "customer_order_list": return this.customerOrderList; + case "product_list": return this.productList; + case "order_line_list": return this.orderLineList; + case "order_search_preset_list": return this.orderSearchPresetList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java index 55ad98feb..51cc24171 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java @@ -24,71 +24,101 @@ public String type(){ return CommercePlatform.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - if(needCheck(_ctx, commercePlatform)){ - markAsChecked(_ctx, commercePlatform); - doCheck(_ctx, commercePlatform, _parentLocation); + public void checkAndFix(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, commercePlatform)){ + markAsChecked(_context, commercePlatform); + doCheck(_context, commercePlatform, _parentLocation); } } - public void doCheck(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ if((commercePlatform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, commercePlatform); + if(commercePlatform.needPersist()){ + } if(commercePlatform.newItem()){ - if(commercePlatform.getCreateTime() == null){ - commercePlatform.updateCreateTime(java.time.LocalDateTime.now()); - }if(commercePlatform.getUpdateTime() == null){ - commercePlatform.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + commercePlatform.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + commercePlatform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(commercePlatform.updateItem()){ - commercePlatform.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + commercePlatform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!commercePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!commercePlatform.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!commercePlatform.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + } - checkName(_ctx, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, CommercePlatform.NAME_PROPERTY)); - checkCreateTime(_ctx, commercePlatform.getProperty(CommercePlatform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, CommercePlatform.CREATE_TIME_PROPERTY)); - checkUpdateTime(_ctx, commercePlatform.getProperty(CommercePlatform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, CommercePlatform.UPDATE_TIME_PROPERTY)); + checkName(_context, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCreateTime(_context, commercePlatform.getProperty(CommercePlatform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, commercePlatform.getProperty(CommercePlatform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); for(int i = 0; commercePlatform.getCustomerList() != null && i < commercePlatform.getCustomerList().size(); i++){ Customer customer = commercePlatform.getCustomerList().get(i); - new CustomerChecker().checkAndFix(_ctx, customer, newLocation(_parentLocation, CommercePlatform.CUSTOMER_LIST_PROPERTY, i)); + new CustomerChecker().checkAndFix(_context, customer, newLocation(_parentLocation, "customer_list", i)); } for(int i = 0; commercePlatform.getOrderStatusList() != null && i < commercePlatform.getOrderStatusList().size(); i++){ OrderStatus orderStatus = commercePlatform.getOrderStatusList().get(i); - new OrderStatusChecker().checkAndFix(_ctx, orderStatus, newLocation(_parentLocation, CommercePlatform.ORDER_STATUS_LIST_PROPERTY, i)); + new OrderStatusChecker().checkAndFix(_context, orderStatus, newLocation(_parentLocation, "order_status_list", i)); } for(int i = 0; commercePlatform.getCustomerOrderList() != null && i < commercePlatform.getCustomerOrderList().size(); i++){ CustomerOrder customerOrder = commercePlatform.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_ctx, customerOrder, newLocation(_parentLocation, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, i)); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); } for(int i = 0; commercePlatform.getProductList() != null && i < commercePlatform.getProductList().size(); i++){ Product product = commercePlatform.getProductList().get(i); - new ProductChecker().checkAndFix(_ctx, product, newLocation(_parentLocation, CommercePlatform.PRODUCT_LIST_PROPERTY, i)); + new ProductChecker().checkAndFix(_context, product, newLocation(_parentLocation, "product_list", i)); } for(int i = 0; commercePlatform.getOrderLineList() != null && i < commercePlatform.getOrderLineList().size(); i++){ OrderLine orderLine = commercePlatform.getOrderLineList().get(i); - new OrderLineChecker().checkAndFix(_ctx, orderLine, newLocation(_parentLocation, CommercePlatform.ORDER_LINE_LIST_PROPERTY, i)); + new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); } for(int i = 0; commercePlatform.getOrderSearchPresetList() != null && i < commercePlatform.getOrderSearchPresetList().size(); i++){ OrderSearchPreset orderSearchPreset = commercePlatform.getOrderSearchPresetList().get(i); - new OrderSearchPresetChecker().checkAndFix(_ctx, orderSearchPreset, newLocation(_parentLocation, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, i)); + new OrderSearchPresetChecker().checkAndFix(_context, orderSearchPreset, newLocation(_parentLocation, "order_search_preset_list", i)); } } - public void checkName(UserContext _ctx, String name, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, name); + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); if((name == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, name); + maxStringCheck(_context, _parentLocation, 100, name); } - public void checkCreateTime(UserContext _ctx, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, createTime); + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); if((createTime == null)){ return; } } - public void checkUpdateTime(UserContext _ctx, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, updateTime); + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); if((updateTime == null)){ return; } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java index 2c212ca5c..9bd17a4b3 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java @@ -47,43 +47,43 @@ public boolean isNull() { public Expression getName(){ - return apply(CommercePlatform::getName); + return loaded("name", "getName", CommercePlatform::getName); } public CommercePlatformExpression updateName(String name){ return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateName(name)); } public Expression getCreateTime(){ - return apply(CommercePlatform::getCreateTime); + return loaded("create_time", "getCreateTime", CommercePlatform::getCreateTime); } public CommercePlatformExpression updateCreateTime(LocalDateTime createTime){ return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return apply(CommercePlatform::getUpdateTime); + return loaded("update_time", "getUpdateTime", CommercePlatform::getUpdateTime); } public CommercePlatformExpression updateUpdateTime(LocalDateTime updateTime){ return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateUpdateTime(updateTime)); } public CustomerListExpression getCustomerList(){ - return new CustomerListExpression(this, $it -> ((CommercePlatform)$it).getCustomerList()); + return new CustomerListExpression(loaded("customer_list", "getCustomerList", CommercePlatform::getCustomerList)); } public OrderStatusListExpression getOrderStatusList(){ - return new OrderStatusListExpression(this, $it -> ((CommercePlatform)$it).getOrderStatusList()); + return new OrderStatusListExpression(loaded("order_status_list", "getOrderStatusList", CommercePlatform::getOrderStatusList)); } public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(this, $it -> ((CommercePlatform)$it).getCustomerOrderList()); + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CommercePlatform::getCustomerOrderList)); } public ProductListExpression getProductList(){ - return new ProductListExpression(this, $it -> ((CommercePlatform)$it).getProductList()); + return new ProductListExpression(loaded("product_list", "getProductList", CommercePlatform::getProductList)); } public OrderLineListExpression getOrderLineList(){ - return new OrderLineListExpression(this, $it -> ((CommercePlatform)$it).getOrderLineList()); + return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", CommercePlatform::getOrderLineList)); } public OrderSearchPresetListExpression getOrderSearchPresetList(){ - return new OrderSearchPresetListExpression(this, $it -> ((CommercePlatform)$it).getOrderSearchPresetList()); + return new OrderSearchPresetListExpression(loaded("order_search_preset_list", "getOrderSearchPresetList", CommercePlatform::getOrderSearchPresetList)); } public CommercePlatformExpression addCustomer(Customer customer){ return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomer(customer)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java index 56b3031da..9d87e3de1 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java @@ -23,6 +23,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class CommercePlatformRequest extends BaseRequest { @@ -31,8 +32,13 @@ public class CommercePlatformRequest extends BaseReq * instead of constructing request builders directly. */ @Deprecated + @SuppressWarnings("unchecked") public CommercePlatformRequest(Class returnType){ - super(returnType); + this(returnType, () -> (T) new CommercePlatform()); + } + + protected CommercePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -42,6 +48,19 @@ public CommercePlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CommercePlatformRequest copy(){ + return (CommercePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CommercePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CommercePlatformRequest returnType(Class returnType){ @@ -65,6 +84,36 @@ public CommercePlatformRequest propagateAggregationCache(long cacheExpiredMil return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CommercePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CommercePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CommercePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public CommercePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (CommercePlatformRequest)super.appendSearchCriteria(searchCriteria); } @@ -79,6 +128,12 @@ public CommercePlatformRequest matchingAnyOf(CommercePlatformRequest commerce return this; } + public CommercePlatformRequest matchingIdsOf(CommercePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CommercePlatform.ID_PROPERTY, request, CommercePlatform.ID_PROPERTY)); + } + public CommercePlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -102,6 +157,17 @@ public CommercePlatformRequest selectSelfFields(){ return selectSelf(); } + public CommercePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CommercePlatform.ID_PROPERTY); + selectProperty(CommercePlatform.NAME_PROPERTY); + selectProperty(CommercePlatform.CREATE_TIME_PROPERTY); + selectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest selectAll(){ super.selectAll(); return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); @@ -204,7 +270,8 @@ public CommercePlatformRequest selectCustomerList(){ } public CommercePlatformRequest selectCustomerListWith(CustomerRequest customerList){ - enhanceRelation(CommercePlatform.CUSTOMER_LIST_PROPERTY, customerList); + enhanceRelation(CommercePlatform.CUSTOMER_LIST_PROPERTY, customerList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerListWith", null, CommercePlatform.CUSTOMER_LIST_PROPERTY)); return this; } public CommercePlatformRequest selectOrderStatusList(){ @@ -212,7 +279,8 @@ public CommercePlatformRequest selectOrderStatusList(){ } public CommercePlatformRequest selectOrderStatusListWith(OrderStatusRequest orderStatusList){ - enhanceRelation(CommercePlatform.ORDER_STATUS_LIST_PROPERTY, orderStatusList); + enhanceRelation(CommercePlatform.ORDER_STATUS_LIST_PROPERTY, orderStatusList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderStatusListWith", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); return this; } public CommercePlatformRequest selectCustomerOrderList(){ @@ -220,7 +288,8 @@ public CommercePlatformRequest selectCustomerOrderList(){ } public CommercePlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList); + enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } public CommercePlatformRequest selectProductList(){ @@ -228,7 +297,8 @@ public CommercePlatformRequest selectProductList(){ } public CommercePlatformRequest selectProductListWith(ProductRequest productList){ - enhanceRelation(CommercePlatform.PRODUCT_LIST_PROPERTY, productList); + enhanceRelation(CommercePlatform.PRODUCT_LIST_PROPERTY, productList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectProductListWith", null, CommercePlatform.PRODUCT_LIST_PROPERTY)); return this; } public CommercePlatformRequest selectOrderLineList(){ @@ -236,7 +306,8 @@ public CommercePlatformRequest selectOrderLineList(){ } public CommercePlatformRequest selectOrderLineListWith(OrderLineRequest orderLineList){ - enhanceRelation(CommercePlatform.ORDER_LINE_LIST_PROPERTY, orderLineList); + enhanceRelation(CommercePlatform.ORDER_LINE_LIST_PROPERTY, orderLineList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); return this; } public CommercePlatformRequest selectOrderSearchPresetList(){ @@ -244,7 +315,8 @@ public CommercePlatformRequest selectOrderSearchPresetList(){ } public CommercePlatformRequest selectOrderSearchPresetListWith(OrderSearchPresetRequest orderSearchPresetList){ - enhanceRelation(CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, orderSearchPresetList); + enhanceRelation(CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, orderSearchPresetList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderSearchPresetListWith", null, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); return this; } @@ -256,11 +328,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(CommercePlatform.ID_PROPERTY, operator, values); } - public CommercePlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public CommercePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public CommercePlatformRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public CommercePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CommercePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -288,6 +368,17 @@ public SearchCriteria createNameCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(CommercePlatform.NAME_PROPERTY, operator, values); } + public CommercePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CommercePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CommercePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } public CommercePlatformRequest withNameGreaterThan(String name){ return withName(Operator.GREATER_THAN, name); } @@ -314,10 +405,22 @@ public CommercePlatformRequest withNameContaining(String name){ return withName(Operator.CONTAIN, name); } + public CommercePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CommercePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + public CommercePlatformRequest withNameEndingWith(String name){ return withName(Operator.END_WITH, name); } + public CommercePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + public CommercePlatformRequest withNameIs(String name){ return withName(Operator.EQUAL, name); } @@ -351,6 +454,21 @@ public SearchCriteria createCreateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(CommercePlatform.CREATE_TIME_PROPERTY, operator, values); } + public CommercePlatformRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public CommercePlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public CommercePlatformRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public CommercePlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } public CommercePlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ return withCreateTime(Operator.GREATER_THAN, createTime); } @@ -416,6 +534,21 @@ public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(CommercePlatform.UPDATE_TIME_PROPERTY, operator, values); } + public CommercePlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public CommercePlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public CommercePlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public CommercePlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } public CommercePlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ return withUpdateTime(Operator.GREATER_THAN, updateTime); } @@ -481,6 +614,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(CommercePlatform.VERSION_PROPERTY, operator, values); } + public CommercePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CommercePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CommercePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CommercePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public CommercePlatformRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -501,6 +649,7 @@ public CommercePlatformRequest withVersionBetween(Long startOfVersion, Long e return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public CommercePlatformRequest withCustomerListMatching(CustomerRequest customerRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerRequest, Customer.COMMERCE_PLATFORM_PROPERTY)); } @@ -594,10 +743,52 @@ public CommercePlatformRequest haveNoOrderSearchPresets(){ public CommercePlatformRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public CommercePlatformRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CommercePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CommercePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CommercePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public CommercePlatformRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public CommercePlatformRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CommercePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.VERSION_PROPERTY); return this; } public CommercePlatformRequest groupByCustomersWithDetails(CustomerRequest subRequest){ @@ -766,8 +957,8 @@ public CommercePlatformRequest statsFromCustomersAs(String name, CustomerRequ } public CommercePlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(Customer.COMMERCE_PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, Customer.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomersAs", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); return this; } @@ -779,8 +970,8 @@ public CommercePlatformRequest statsFromOrderStatusesAs(String name, OrderSta } public CommercePlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); return this; } @@ -792,8 +983,8 @@ public CommercePlatformRequest statsFromCustomerOrdersAs(String name, Custome } public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -805,8 +996,8 @@ public CommercePlatformRequest statsFromProductsAs(String name, ProductReques } public CommercePlatformRequest statsFromProductsAs(String name, ProductRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(Product.COMMERCE_PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, Product.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromProductsAs", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); return this; } @@ -818,8 +1009,8 @@ public CommercePlatformRequest statsFromOrderLinesAs(String name, OrderLineRe } public CommercePlatformRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); return this; } @@ -831,8 +1022,8 @@ public CommercePlatformRequest statsFromOrderSearchPresetsAs(String name, Ord } public CommercePlatformRequest statsFromOrderSearchPresetsAs(String name, OrderSearchPresetRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderSearchPresetsAs", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); return this; } @@ -840,73 +1031,113 @@ public CommercePlatformRequest statsFromOrderSearchPresets(OrderSearchPresetR return statsFromOrderSearchPresetsAs(REFINEMENTS, subRequest); } public CommercePlatformRequest countCustomers(){ - return countCustomersAs("Count"); + addRelationCount("Count", Q.customers().unlimited(), Customer.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomers", null, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countCustomersAs(String name){ - return countCustomersWith(name, Q.customers().unlimited()); + addRelationCount(name, Q.customers().unlimited(), Customer.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersAs", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countCustomersWith(String name, CustomerRequest subRequest){ - return statsFromCustomersAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, Customer.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersWith", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderStatuses(){ - return countOrderStatusesAs("Count"); + addRelationCount("Count", Q.orderStatuses().unlimited(), OrderStatus.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderStatusesAs(String name){ - return countOrderStatusesWith(name, Q.orderStatuses().unlimited()); + addRelationCount(name, Q.orderStatuses().unlimited(), OrderStatus.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderStatusesWith(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesWith", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countCustomerOrders(){ - return countCustomerOrdersAs("Count"); + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countCustomerOrdersAs(String name){ - return countCustomerOrdersWith(name, Q.customerOrders().unlimited()); + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countProducts(){ - return countProductsAs("Count"); + addRelationCount("Count", Q.products().unlimited(), Product.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProducts", null, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countProductsAs(String name){ - return countProductsWith(name, Q.products().unlimited()); + addRelationCount(name, Q.products().unlimited(), Product.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProductsAs", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countProductsWith(String name, ProductRequest subRequest){ - return statsFromProductsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, Product.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProductsWith", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderLines(){ - return countOrderLinesAs("Count"); + addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderLinesAs(String name){ - return countOrderLinesWith(name, Q.orderLines().unlimited()); + addRelationCount(name, Q.orderLines().unlimited(), OrderLine.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderSearchPresets(){ - return countOrderSearchPresetsAs("Count"); + addRelationCount("Count", Q.orderSearchPresets().unlimited(), OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresets", null, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderSearchPresetsAs(String name){ - return countOrderSearchPresetsWith(name, Q.orderSearchPresets().unlimited()); + addRelationCount(name, Q.orderSearchPresets().unlimited(), OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresetsAs", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; } public CommercePlatformRequest countOrderSearchPresetsWith(String name, OrderSearchPresetRequest subRequest){ - return statsFromOrderSearchPresetsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresetsWith", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; } public CommercePlatformRequest minDisplayOrderOfOrderStatuses(){ - return minDisplayOrderOfOrderStatusesAs("minDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("minDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name){ @@ -914,10 +1145,18 @@ public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name){ } public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.minDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest maxDisplayOrderOfOrderStatuses(){ - return maxDisplayOrderOfOrderStatusesAs("maxDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("maxDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name){ @@ -925,10 +1164,18 @@ public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name){ } public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.maxDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sumDisplayOrderOfOrderStatuses(){ - return sumDisplayOrderOfOrderStatusesAs("sumDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("sumDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name){ @@ -936,10 +1183,18 @@ public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name){ } public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.sumDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest avgDisplayOrderOfOrderStatuses(){ - return avgDisplayOrderOfOrderStatusesAs("avgDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("avgDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name){ @@ -947,10 +1202,18 @@ public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name){ } public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.avgDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatuses(){ - return standardDeviationDisplayOrderOfOrderStatusesAs("stdDevDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("stdDevDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name){ @@ -958,10 +1221,18 @@ public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs } public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.standardDeviationDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses(){ - return squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs("stdDevPopDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("stdDevPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name){ @@ -969,10 +1240,18 @@ public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplay } public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.squareRootOfPopulationStandardDeviationDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatuses(){ - return sampleVarianceDisplayOrderOfOrderStatusesAs("varSampDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("varSampDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name){ @@ -980,10 +1259,18 @@ public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(St } public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.sampleVarianceDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatuses(){ - return samplePopulationVarianceDisplayOrderOfOrderStatusesAs("varPopDisplayOrderOfOrderStatuses"); + addRelationScalarAggregate("varPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name){ @@ -991,10 +1278,18 @@ public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderSta } public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest.samplePopulationVarianceDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; } public CommercePlatformRequest minTotalAmountOfCustomerOrders(){ - return minTotalAmountOfCustomerOrdersAs("minTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name){ @@ -1002,10 +1297,18 @@ public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name){ } public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.minTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest maxTotalAmountOfCustomerOrders(){ - return maxTotalAmountOfCustomerOrdersAs("maxTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name){ @@ -1013,10 +1316,18 @@ public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name){ } public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.maxTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sumTotalAmountOfCustomerOrders(){ - return sumTotalAmountOfCustomerOrdersAs("sumTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name){ @@ -1024,10 +1335,18 @@ public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name){ } public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.sumTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest avgTotalAmountOfCustomerOrders(){ - return avgTotalAmountOfCustomerOrdersAs("avgTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name){ @@ -1035,10 +1354,18 @@ public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name){ } public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.avgTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrders(){ - return standardDeviationTotalAmountOfCustomerOrdersAs("stdDevTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ @@ -1046,10 +1373,18 @@ public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs } public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.standardDeviationTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs("stdDevPopTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ @@ -1057,10 +1392,18 @@ public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAm } public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.squareRootOfPopulationStandardDeviationTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrders(){ - return sampleVarianceTotalAmountOfCustomerOrdersAs("varSampTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ @@ -1068,10 +1411,18 @@ public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(St } public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.sampleVarianceTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs("varPopTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ @@ -1079,10 +1430,18 @@ public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerO } public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.samplePopulationVarianceTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CommercePlatformRequest minQuantityOfOrderLines(){ - return minQuantityOfOrderLinesAs("minQuantityOfOrderLines"); + addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest minQuantityOfOrderLinesAs(String name){ @@ -1090,10 +1449,18 @@ public CommercePlatformRequest minQuantityOfOrderLinesAs(String name){ } public CommercePlatformRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.minQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest maxQuantityOfOrderLines(){ - return maxQuantityOfOrderLinesAs("maxQuantityOfOrderLines"); + addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name){ @@ -1101,10 +1468,18 @@ public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name){ } public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.maxQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sumQuantityOfOrderLines(){ - return sumQuantityOfOrderLinesAs("sumQuantityOfOrderLines"); + addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name){ @@ -1112,10 +1487,18 @@ public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name){ } public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.sumQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest avgQuantityOfOrderLines(){ - return avgQuantityOfOrderLinesAs("avgQuantityOfOrderLines"); + addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name){ @@ -1123,10 +1506,18 @@ public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name){ } public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.avgQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest standardDeviationQuantityOfOrderLines(){ - return standardDeviationQuantityOfOrderLinesAs("stdDevQuantityOfOrderLines"); + addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String name){ @@ -1134,10 +1525,18 @@ public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String } public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.standardDeviationQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs("stdDevPopQuantityOfOrderLines"); + addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ @@ -1145,10 +1544,18 @@ public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantit } public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.squareRootOfPopulationStandardDeviationQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sampleVarianceQuantityOfOrderLines(){ - return sampleVarianceQuantityOfOrderLinesAs("varSampQuantityOfOrderLines"); + addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String name){ @@ -1156,10 +1563,18 @@ public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String na } public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.sampleVarianceQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLines(){ - return samplePopulationVarianceQuantityOfOrderLinesAs("varPopQuantityOfOrderLines"); + addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ @@ -1167,7 +1582,11 @@ public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs } public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.samplePopulationVarianceQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; } @@ -1181,6 +1600,11 @@ public CommercePlatformRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public CommercePlatformRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java index e7b18bf65..eb9a12f4a 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java @@ -6,9 +6,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.time.LocalDateTime; import java.util.Objects; @@ -23,90 +25,121 @@ public class Customer extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "Customer"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "829c8ab79820e41e3f9a3fb0b12d364d33e0a9a3f50ea30186dd727937701a39"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("email", 2), java.util.Map.entry("commerce_platform", 3), java.util.Map.entry("create_time", 4), java.util.Map.entry("update_time", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("email", java.util.List.of("email", "email")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Customer.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; public static final String EMAIL_PROPERTY = "email"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commercePlatform"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customerOrderList"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; private String name; + private String email; + private CommercePlatform commercePlatform; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private SmartList customerOrderList; public String getName(){ return this.name; } + public String getEmail(){ return this.email; } + public CommercePlatform getCommercePlatform(){ return this.commercePlatform; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public SmartList getCustomerOrderList(){ - return this.customerOrderList; + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; } public Customer updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public Customer updateEmail(String email){ email = (email == null ? null : email.trim()); - if(Objects.equals(this.email, email)){ + if(isPropertyLoaded(EMAIL_PROPERTY) && Objects.equals(this.email, email)){ return this; } handleUpdate(EMAIL_PROPERTY, getEmail(), email); this.email = email; return this; } + public Customer updateCommercePlatform(CommercePlatform commercePlatform){ - if(Objects.equals(this.commercePlatform, commercePlatform)){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ return this; } handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); this.commercePlatform = commercePlatform; return this; } + public Customer updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public Customer updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); this.updateTime = updateTime; return this; } + public Customer addCustomerOrder(CustomerOrder customerOrder){ if (customerOrder == null){ return this; } if(null == this.customerOrderList){ - this.customerOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); } this.customerOrderList.add(customerOrder); - customerOrder.cacheRelation(CustomerOrder.CUSTOMER_PROPERTY, this); + customerOrder.updateCustomer(this); return this; } @@ -129,25 +162,26 @@ public Customer comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; case "email": this.email = (value == null ? null : ((String)value).trim()); break; - case "commercePlatform": this.commercePlatform = (CommercePlatform) value; break; + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; - case "customerOrderList": this.customerOrderList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -158,11 +192,21 @@ public Object __internalGet(String property) { switch (property) { case "name": return this.name; case "email": return this.email; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - case "customerOrderList": return this.customerOrderList; - default: return super.__internalGet(property); + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "email": return this.email; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java index 7c024d667..99635a77e 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java @@ -16,68 +16,104 @@ public String type(){ return Customer.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, Customer customer, ObjectLocation _parentLocation){ - if(needCheck(_ctx, customer)){ - markAsChecked(_ctx, customer); - doCheck(_ctx, customer, _parentLocation); + public void checkAndFix(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + if(needCheck(_context, customer)){ + markAsChecked(_context, customer); + doCheck(_context, customer, _parentLocation); } } - public void doCheck(UserContext _ctx, Customer customer, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, Customer customer, ObjectLocation _parentLocation){ if((customer == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, customer); + if(customer.needPersist()){ + } if(customer.newItem()){ - if(customer.getCreateTime() == null){ - customer.updateCreateTime(java.time.LocalDateTime.now()); - }if(customer.getUpdateTime() == null){ - customer.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + customer.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customer.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(customer.updateItem()){ - customer.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customer.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!customer.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("email")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "email"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + } - checkName(_ctx, customer.getProperty(Customer.NAME_PROPERTY), newLocation(_parentLocation, Customer.NAME_PROPERTY)); - checkEmail(_ctx, customer.getProperty(Customer.EMAIL_PROPERTY), newLocation(_parentLocation, Customer.EMAIL_PROPERTY)); - checkCommercePlatform(_ctx, customer.getProperty(Customer.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, Customer.COMMERCE_PLATFORM_PROPERTY)); - checkCreateTime(_ctx, customer.getProperty(Customer.CREATE_TIME_PROPERTY), newLocation(_parentLocation, Customer.CREATE_TIME_PROPERTY)); - checkUpdateTime(_ctx, customer.getProperty(Customer.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, Customer.UPDATE_TIME_PROPERTY)); + checkName(_context, customer.getProperty(Customer.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkEmail(_context, customer.getProperty(Customer.EMAIL_PROPERTY), newLocation(_parentLocation, "email")); + checkCommercePlatform(_context, customer.getProperty(Customer.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, customer.getProperty(Customer.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, customer.getProperty(Customer.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); for(int i = 0; customer.getCustomerOrderList() != null && i < customer.getCustomerOrderList().size(); i++){ CustomerOrder customerOrder = customer.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_ctx, customerOrder, newLocation(_parentLocation, Customer.CUSTOMER_ORDER_LIST_PROPERTY, i)); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); } } - public void checkName(UserContext _ctx, String name, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, name); + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); if((name == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, name); + maxStringCheck(_context, _parentLocation, 100, name); } - public void checkEmail(UserContext _ctx, String email, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, email); + public void checkEmail(UserContext _context, String email, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, email); if((email == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, email); + maxStringCheck(_context, _parentLocation, 100, email); } - public void checkCommercePlatform(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, commercePlatform); + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); if((commercePlatform == null)){ return; } - new CommercePlatformChecker().checkAndFix(_ctx, commercePlatform, _parentLocation); + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); } - public void checkCreateTime(UserContext _ctx, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, createTime); + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); if((createTime == null)){ return; } } - public void checkUpdateTime(UserContext _ctx, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, updateTime); + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); if((updateTime == null)){ return; } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java index 563d6bade..a2731bc84 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java @@ -39,21 +39,21 @@ public boolean isNull() { public Expression getName(){ - return apply(Customer::getName); + return loaded("name", "getName", Customer::getName); } public CustomerExpression updateName(String name){ return new CustomerExpression(this, $it -> ((Customer)$it).updateName(name)); } public Expression getEmail(){ - return apply(Customer::getEmail); + return loaded("email", "getEmail", Customer::getEmail); } public CustomerExpression updateEmail(String email){ return new CustomerExpression(this, $it -> ((Customer)$it).updateEmail(email)); } public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(this, $it -> ((Customer)$it).getCommercePlatform()); + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", Customer::getCommercePlatform)); } public CustomerExpression updateCommercePlatform(CommercePlatform commercePlatform){ @@ -61,21 +61,21 @@ public CustomerExpression updateCommercePlatform(CommercePlatform comme } public Expression getCreateTime(){ - return apply(Customer::getCreateTime); + return loaded("create_time", "getCreateTime", Customer::getCreateTime); } public CustomerExpression updateCreateTime(LocalDateTime createTime){ return new CustomerExpression(this, $it -> ((Customer)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return apply(Customer::getUpdateTime); + return loaded("update_time", "getUpdateTime", Customer::getUpdateTime); } public CustomerExpression updateUpdateTime(LocalDateTime updateTime){ return new CustomerExpression(this, $it -> ((Customer)$it).updateUpdateTime(updateTime)); } public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(this, $it -> ((Customer)$it).getCustomerOrderList()); + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Customer::getCustomerOrderList)); } public CustomerExpression addCustomerOrder(CustomerOrder customerOrder){ return new CustomerExpression(this, $it -> ((Customer)$it).addCustomerOrder(customerOrder)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java index 3781f6903..114b51337 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java @@ -15,6 +15,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class CustomerRequest extends BaseRequest { @@ -23,8 +24,13 @@ public class CustomerRequest extends BaseRequest { * instead of constructing request builders directly. */ @Deprecated + @SuppressWarnings("unchecked") public CustomerRequest(Class returnType){ - super(returnType); + this(returnType, () -> (T) new Customer()); + } + + protected CustomerRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -34,6 +40,19 @@ public CustomerRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerRequest copy(){ + return (CustomerRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CustomerRequest returnType(Class returnType){ @@ -57,6 +76,36 @@ public CustomerRequest propagateAggregationCache(long cacheExpiredMillis){ return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public CustomerRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (CustomerRequest)super.appendSearchCriteria(searchCriteria); } @@ -71,6 +120,12 @@ public CustomerRequest matchingAnyOf(CustomerRequest customer){ return this; } + public CustomerRequest matchingIdsOf(CustomerRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Customer.ID_PROPERTY, request, Customer.ID_PROPERTY)); + } + public CustomerRequest enhanceChildrenIfNeeded(){ return this; } @@ -94,6 +149,19 @@ public CustomerRequest selectSelfFields(){ return selectSelf(); } + public CustomerRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Customer.ID_PROPERTY); + selectProperty(Customer.NAME_PROPERTY); + selectProperty(Customer.EMAIL_PROPERTY); + selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); + selectProperty(Customer.CREATE_TIME_PROPERTY); + selectProperty(Customer.UPDATE_TIME_PROPERTY); + selectProperty(Customer.VERSION_PROPERTY); + return this; + } + public CustomerRequest selectAll(){ super.selectAll(); return selectId().selectName().selectEmail().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); @@ -168,7 +236,8 @@ public CustomerRequest selectCommercePlatform(){ public CustomerRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform); + enhanceRelation(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, Customer.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -232,7 +301,8 @@ public CustomerRequest selectCustomerOrderList(){ } public CustomerRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(Customer.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList); + enhanceRelation(Customer.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -244,11 +314,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(Customer.ID_PROPERTY, operator, values); } - public CustomerRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public CustomerRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public CustomerRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public CustomerRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -276,6 +354,17 @@ public SearchCriteria createNameCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(Customer.NAME_PROPERTY, operator, values); } + public CustomerRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CustomerRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CustomerRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } public CustomerRequest withNameGreaterThan(String name){ return withName(Operator.GREATER_THAN, name); } @@ -302,10 +391,22 @@ public CustomerRequest withNameContaining(String name){ return withName(Operator.CONTAIN, name); } + public CustomerRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CustomerRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + public CustomerRequest withNameEndingWith(String name){ return withName(Operator.END_WITH, name); } + public CustomerRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + public CustomerRequest withNameIs(String name){ return withName(Operator.EQUAL, name); } @@ -339,6 +440,17 @@ public SearchCriteria createEmailCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(Customer.EMAIL_PROPERTY, operator, values); } + public CustomerRequest withEmailIsNot(String email){ + return withEmail(Operator.NOT_EQUAL, email); + } + + public CustomerRequest withEmailIn(String... email){ + return withEmail(Operator.IN, (Object[])email); + } + + public CustomerRequest withEmailNotIn(String... email){ + return withEmail(Operator.NOT_IN, (Object[])email); + } public CustomerRequest withEmailGreaterThan(String email){ return withEmail(Operator.GREATER_THAN, email); } @@ -365,10 +477,22 @@ public CustomerRequest withEmailContaining(String email){ return withEmail(Operator.CONTAIN, email); } + public CustomerRequest withEmailNotContaining(String email){ + return withEmail(Operator.NOT_CONTAIN, email); + } + + public CustomerRequest withEmailNotStartingWith(String email){ + return withEmail(Operator.NOT_BEGIN_WITH, email); + } + public CustomerRequest withEmailEndingWith(String email){ return withEmail(Operator.END_WITH, email); } + public CustomerRequest withEmailNotEndingWith(String email){ + return withEmail(Operator.NOT_END_WITH, email); + } + public CustomerRequest withEmailIs(String email){ return withEmail(Operator.EQUAL, email); } @@ -412,6 +536,11 @@ public CustomerRequest withCommercePlatformMatching(CommercePlatformRequest c return appendSearchCriteria(new SubQuerySearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); } + public CustomerRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + public CustomerRequest filterByCreateTime(LocalDateTime... createTime){ if (createTime == null || createTime.length == 0) { throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); @@ -435,6 +564,21 @@ public SearchCriteria createCreateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(Customer.CREATE_TIME_PROPERTY, operator, values); } + public CustomerRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public CustomerRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public CustomerRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public CustomerRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } public CustomerRequest withCreateTimeGreaterThan(LocalDateTime createTime){ return withCreateTime(Operator.GREATER_THAN, createTime); } @@ -500,6 +644,21 @@ public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(Customer.UPDATE_TIME_PROPERTY, operator, values); } + public CustomerRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public CustomerRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public CustomerRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public CustomerRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } public CustomerRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ return withUpdateTime(Operator.GREATER_THAN, updateTime); } @@ -565,6 +724,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(Customer.VERSION_PROPERTY, operator, values); } + public CustomerRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public CustomerRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -585,6 +759,7 @@ public CustomerRequest withVersionBetween(Long startOfVersion, Long endOfVers return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public CustomerRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY)); } @@ -603,10 +778,12 @@ public CustomerRequest haveNoCustomerOrders(){ public CustomerRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public CustomerRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public CustomerRequest groupByCommercePlatformWithDetails(){ @@ -621,6 +798,62 @@ public CustomerRequest groupByCommercePlatformWithDetails(CommercePlatformReq + public CustomerRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Customer.ID_PROPERTY); + return this; + } + public CustomerRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CustomerRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest countDistinctEmail(){ + return countDistinctEmailAs("email_distinct_count"); + } + + public CustomerRequest countDistinctEmailAs(String alias){ + super.countDistinctProperty(alias, Customer.EMAIL_PROPERTY); + return this; + } + public CustomerRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public CustomerRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public CustomerRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Customer.CREATE_TIME_PROPERTY); + return this; + } + public CustomerRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public CustomerRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Customer.UPDATE_TIME_PROPERTY); + return this; + } + public CustomerRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Customer.VERSION_PROPERTY); + return this; + } public CustomerRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ aggregate(Customer.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); return this; @@ -671,7 +904,8 @@ public CustomerRequest groupByEmailWithFunction(String retName, AggrFunction return this; } public CustomerRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(Customer.COMMERCE_PLATFORM_PROPERTY, subRequest); + groupBy(Customer.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); return this; } public CustomerRequest groupByCommercePlatform(){ @@ -828,8 +1062,8 @@ public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRe } public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(CustomerOrder.CUSTOMER_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -838,8 +1072,8 @@ public CustomerRequest statsFromCustomerOrders(CustomerOrderRequest subReques } public CommercePlatformRequest rollUpToCommercePlatform(){ CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.withCommercePlatformMatching(commercePlatform) - .groupByCommercePlatformWith(commercePlatform); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); return commercePlatform; } @@ -847,18 +1081,28 @@ public CommercePlatformRequest rollUpToCommercePlatform(){ public CustomerRequest countCustomerOrders(){ - return countCustomerOrdersAs("Count"); + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest countCustomerOrdersAs(String name){ - return countCustomerOrdersWith(name, Q.customerOrders().unlimited()); + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest minTotalAmountOfCustomerOrders(){ - return minTotalAmountOfCustomerOrdersAs("minTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name){ @@ -866,10 +1110,18 @@ public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name){ } public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.minTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest maxTotalAmountOfCustomerOrders(){ - return maxTotalAmountOfCustomerOrdersAs("maxTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name){ @@ -877,10 +1129,18 @@ public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name){ } public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.maxTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest sumTotalAmountOfCustomerOrders(){ - return sumTotalAmountOfCustomerOrdersAs("sumTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name){ @@ -888,10 +1148,18 @@ public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name){ } public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.sumTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest avgTotalAmountOfCustomerOrders(){ - return avgTotalAmountOfCustomerOrdersAs("avgTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name){ @@ -899,10 +1167,18 @@ public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name){ } public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.avgTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest standardDeviationTotalAmountOfCustomerOrders(){ - return standardDeviationTotalAmountOfCustomerOrdersAs("stdDevTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ @@ -910,10 +1186,18 @@ public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String } public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.standardDeviationTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs("stdDevPopTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ @@ -921,10 +1205,18 @@ public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCu } public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.squareRootOfPopulationStandardDeviationTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest sampleVarianceTotalAmountOfCustomerOrders(){ - return sampleVarianceTotalAmountOfCustomerOrdersAs("varSampTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ @@ -932,10 +1224,18 @@ public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String nam } public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.sampleVarianceTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs("varPopTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ @@ -943,7 +1243,11 @@ public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs( } public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.samplePopulationVarianceTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ @@ -951,7 +1255,8 @@ public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePl } public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets); + addFacet(facetName, Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, Customer.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -965,6 +1270,11 @@ public CustomerRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public CustomerRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java index b04bb71be..7a35c0d41 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java @@ -9,9 +9,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; @@ -28,128 +30,168 @@ public class CustomerOrder extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "CustomerOrder"; - public static final String ORDER_NUMBER_PROPERTY = "orderNumber"; - public static final String ORDER_DATE_PROPERTY = "orderDate"; - public static final String TOTAL_AMOUNT_PROPERTY = "totalAmount"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e844b19b098f340a5ae18e4091f4a6d55afb35cd5a53ec24155bd4de2601988d"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("order_number", 1), java.util.Map.entry("order_date", 2), java.util.Map.entry("total_amount", 3), java.util.Map.entry("status", 4), java.util.Map.entry("customer", 5), java.util.Map.entry("commerce_platform", 6), java.util.Map.entry("create_time", 7), java.util.Map.entry("update_time", 8), java.util.Map.entry("version", 9)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("order_date", java.util.List.of("orderDate", "order_date")), java.util.Map.entry("total_amount", java.util.List.of("totalAmount", "total_amount")), java.util.Map.entry("status", java.util.List.of("status", "status")), java.util.Map.entry("customer", java.util.List.of("customer", "customer")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_line_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String ORDER_DATE_PROPERTY = "order_date"; + public static final String TOTAL_AMOUNT_PROPERTY = "total_amount"; public static final String STATUS_PROPERTY = "status"; public static final String CUSTOMER_PROPERTY = "customer"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commercePlatform"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; - public static final String ORDER_LINE_LIST_PROPERTY = "orderLineList"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; private String orderNumber; + private LocalDate orderDate; + private BigDecimal totalAmount; + private OrderStatus status; + private Customer customer; + private CommercePlatform commercePlatform; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private SmartList orderLineList; public String getOrderNumber(){ return this.orderNumber; } + public LocalDate getOrderDate(){ return this.orderDate; } + public BigDecimal getTotalAmount(){ return this.totalAmount; } + public OrderStatus getStatus(){ return this.status; } + public Customer getCustomer(){ return this.customer; } + public CommercePlatform getCommercePlatform(){ return this.commercePlatform; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public SmartList getOrderLineList(){ - return this.orderLineList; + return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; } public CustomerOrder updateOrderNumber(String orderNumber){ orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(Objects.equals(this.orderNumber, orderNumber)){ + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ return this; } handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); this.orderNumber = orderNumber; return this; } + public CustomerOrder updateOrderDate(LocalDate orderDate){ - if(Objects.equals(this.orderDate, orderDate)){ + if(isPropertyLoaded(ORDER_DATE_PROPERTY) && Objects.equals(this.orderDate, orderDate)){ return this; } handleUpdate(ORDER_DATE_PROPERTY, getOrderDate(), orderDate); this.orderDate = orderDate; return this; } + public CustomerOrder updateTotalAmount(BigDecimal totalAmount){ - if(Objects.equals(this.totalAmount, totalAmount)){ + if(isPropertyLoaded(TOTAL_AMOUNT_PROPERTY) && Objects.equals(this.totalAmount, totalAmount)){ return this; } handleUpdate(TOTAL_AMOUNT_PROPERTY, getTotalAmount(), totalAmount); this.totalAmount = totalAmount; return this; } + protected CustomerOrder updateStatus(OrderStatus status){ - if(Objects.equals(this.status, status)){ + if(isPropertyLoaded(STATUS_PROPERTY) && Objects.equals(this.status, status)){ return this; } handleUpdate(STATUS_PROPERTY, getStatus(), status); this.status = status; return this; } + public CustomerOrder updateCustomer(Customer customer){ - if(Objects.equals(this.customer, customer)){ + if(isPropertyLoaded(CUSTOMER_PROPERTY) && Objects.equals(this.customer, customer)){ return this; } handleUpdate(CUSTOMER_PROPERTY, getCustomer(), customer); this.customer = customer; return this; } + public CustomerOrder updateCommercePlatform(CommercePlatform commercePlatform){ - if(Objects.equals(this.commercePlatform, commercePlatform)){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ return this; } handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); this.commercePlatform = commercePlatform; return this; } + public CustomerOrder updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public CustomerOrder updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); this.updateTime = updateTime; return this; } + public CustomerOrder addOrderLine(OrderLine orderLine){ if (orderLine == null){ return this; } if(null == this.orderLineList){ - this.orderLineList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderLineList = teaqlUnloadedItems.map(value -> value); } this.orderLineList.add(orderLine); - orderLine.cacheRelation(OrderLine.CUSTOMER_ORDER_PROPERTY, this); + orderLine.updateCustomerOrder(this); return this; } public boolean isStatusPending(){ @@ -159,26 +201,12 @@ public boolean isStatusPending(){ public CustomerOrder updateStatusToPending(){ return updateStatus(Constants.ORDER_STATUS_PENDING); } - public boolean isStatusProcessing(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_PROCESSING); - } - - public CustomerOrder updateStatusToProcessing(){ - return updateStatus(Constants.ORDER_STATUS_PROCESSING); - } - public boolean isStatusShipped(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_SHIPPED); - } - - public CustomerOrder updateStatusToShipped(){ - return updateStatus(Constants.ORDER_STATUS_SHIPPED); - } - public boolean isStatusCompleted(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_COMPLETED); + public boolean isStatusConfirmed(){ + return Objects.equals(getStatus(), Constants.ORDER_STATUS_CONFIRMED); } - public CustomerOrder updateStatusToCompleted(){ - return updateStatus(Constants.ORDER_STATUS_COMPLETED); + public CustomerOrder updateStatusToConfirmed(){ + return updateStatus(Constants.ORDER_STATUS_CONFIRMED); } public static CustomerOrder refer(Long id){ @@ -200,31 +228,32 @@ public CustomerOrder comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { - case "orderNumber": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - case "orderDate": this.orderDate = (LocalDate) value; break; + case "order_date": this.orderDate = (LocalDate) value; break; - case "totalAmount": this.totalAmount = (BigDecimal) value; break; + case "total_amount": this.totalAmount = (BigDecimal) value; break; case "status": this.status = (OrderStatus) value; break; case "customer": this.customer = (Customer) value; break; - case "commercePlatform": this.commercePlatform = (CommercePlatform) value; break; + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; - case "orderLineList": this.orderLineList = (SmartList) value; break; + case "order_line_list": this.orderLineList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -233,16 +262,29 @@ public void __internalSet(String property, Object value) { @FrameworkInternal public Object __internalGet(String property) { switch (property) { - case "orderNumber": return this.orderNumber; - case "orderDate": return this.orderDate; - case "totalAmount": return this.totalAmount; + case "order_number": return this.orderNumber; + case "order_date": return this.orderDate; + case "total_amount": return this.totalAmount; case "status": return this.status; case "customer": return this.customer; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - case "orderLineList": return this.orderLineList; - default: return super.__internalGet(property); + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "order_line_list": return this.orderLineList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "orderNumber": return this.orderNumber; + case "orderDate": return this.orderDate; + case "totalAmount": return this.totalAmount; + case "status": return this.status; + case "customer": return this.customer; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java index 230b98415..04b7ef192 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java @@ -22,89 +22,134 @@ public String type(){ return CustomerOrder.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if(needCheck(_ctx, customerOrder)){ - markAsChecked(_ctx, customerOrder); - doCheck(_ctx, customerOrder, _parentLocation); + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); } } - public void doCheck(UserContext _ctx, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ if((customerOrder == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } if(customerOrder.newItem()){ - if(customerOrder.getCreateTime() == null){ - customerOrder.updateCreateTime(java.time.LocalDateTime.now()); - }if(customerOrder.getUpdateTime() == null){ - customerOrder.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + customerOrder.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customerOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(customerOrder.updateItem()){ - customerOrder.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customerOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_date"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("total_amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "total_amount"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "status"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("customer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + } - checkOrderNumber(_ctx, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, CustomerOrder.ORDER_NUMBER_PROPERTY)); - checkOrderDate(_ctx, customerOrder.getProperty(CustomerOrder.ORDER_DATE_PROPERTY), newLocation(_parentLocation, CustomerOrder.ORDER_DATE_PROPERTY)); - checkTotalAmount(_ctx, customerOrder.getProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY), newLocation(_parentLocation, CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - checkStatus(_ctx, customerOrder.getProperty(CustomerOrder.STATUS_PROPERTY), newLocation(_parentLocation, CustomerOrder.STATUS_PROPERTY)); - checkCustomer(_ctx, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROPERTY), newLocation(_parentLocation, CustomerOrder.CUSTOMER_PROPERTY)); - checkCommercePlatform(_ctx, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - checkCreateTime(_ctx, customerOrder.getProperty(CustomerOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, CustomerOrder.CREATE_TIME_PROPERTY)); - checkUpdateTime(_ctx, customerOrder.getProperty(CustomerOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, CustomerOrder.UPDATE_TIME_PROPERTY)); + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkOrderDate(_context, customerOrder.getProperty(CustomerOrder.ORDER_DATE_PROPERTY), newLocation(_parentLocation, "order_date")); + checkTotalAmount(_context, customerOrder.getProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY), newLocation(_parentLocation, "total_amount")); + checkStatus(_context, customerOrder.getProperty(CustomerOrder.STATUS_PROPERTY), newLocation(_parentLocation, "status")); + checkCustomer(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROPERTY), newLocation(_parentLocation, "customer")); + checkCommercePlatform(_context, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, customerOrder.getProperty(CustomerOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, customerOrder.getProperty(CustomerOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); for(int i = 0; customerOrder.getOrderLineList() != null && i < customerOrder.getOrderLineList().size(); i++){ OrderLine orderLine = customerOrder.getOrderLineList().get(i); - new OrderLineChecker().checkAndFix(_ctx, orderLine, newLocation(_parentLocation, CustomerOrder.ORDER_LINE_LIST_PROPERTY, i)); + new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); } } - public void checkOrderNumber(UserContext _ctx, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, orderNumber); + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); if((orderNumber == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, orderNumber); + maxStringCheck(_context, _parentLocation, 100, orderNumber); } - public void checkOrderDate(UserContext _ctx, LocalDate orderDate, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, orderDate); + public void checkOrderDate(UserContext _context, LocalDate orderDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderDate); if((orderDate == null)){ return; } } - public void checkTotalAmount(UserContext _ctx, BigDecimal totalAmount, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, totalAmount); + public void checkTotalAmount(UserContext _context, BigDecimal totalAmount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, totalAmount); if((totalAmount == null)){ return; } } - public void checkStatus(UserContext _ctx, OrderStatus status, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, status); + public void checkStatus(UserContext _context, OrderStatus status, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, status); if((status == null)){ return; } - new OrderStatusChecker().checkAndFix(_ctx, status, _parentLocation); + new OrderStatusChecker().checkAndFix(_context, status, _parentLocation); } - public void checkCustomer(UserContext _ctx, Customer customer, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, customer); + public void checkCustomer(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customer); if((customer == null)){ return; } - new CustomerChecker().checkAndFix(_ctx, customer, _parentLocation); + new CustomerChecker().checkAndFix(_context, customer, _parentLocation); } - public void checkCommercePlatform(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, commercePlatform); + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); if((commercePlatform == null)){ return; } - new CommercePlatformChecker().checkAndFix(_ctx, commercePlatform, _parentLocation); + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); } - public void checkCreateTime(UserContext _ctx, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, createTime); + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); if((createTime == null)){ return; } } - public void checkUpdateTime(UserContext _ctx, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, updateTime); + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); if((updateTime == null)){ return; } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java index c304b33b1..68f35772a 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java @@ -45,45 +45,39 @@ public boolean isNull() { public Expression getOrderNumber(){ - return apply(CustomerOrder::getOrderNumber); + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); } public CustomerOrderExpression updateOrderNumber(String orderNumber){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); } public Expression getOrderDate(){ - return apply(CustomerOrder::getOrderDate); + return loaded("order_date", "getOrderDate", CustomerOrder::getOrderDate); } public CustomerOrderExpression updateOrderDate(LocalDate orderDate){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderDate(orderDate)); } public Expression getTotalAmount(){ - return apply(CustomerOrder::getTotalAmount); + return loaded("total_amount", "getTotalAmount", CustomerOrder::getTotalAmount); } public CustomerOrderExpression updateTotalAmount(BigDecimal totalAmount){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateTotalAmount(totalAmount)); } public OrderStatusExpression getStatus(){ - return new OrderStatusExpression(this, $it -> ((CustomerOrder)$it).getStatus()); + return new OrderStatusExpression(loaded("status", "getStatus", CustomerOrder::getStatus)); } public CustomerOrderExpression updateStatusToPending(){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToPending()); } - public CustomerOrderExpression updateStatusToProcessing(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToProcessing()); - } - public CustomerOrderExpression updateStatusToShipped(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToShipped()); - } - public CustomerOrderExpression updateStatusToCompleted(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToCompleted()); + public CustomerOrderExpression updateStatusToConfirmed(){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToConfirmed()); } public CustomerExpression getCustomer(){ - return new CustomerExpression(this, $it -> ((CustomerOrder)$it).getCustomer()); + return new CustomerExpression(loaded("customer", "getCustomer", CustomerOrder::getCustomer)); } public CustomerOrderExpression updateCustomer(Customer customer){ @@ -91,7 +85,7 @@ public CustomerOrderExpression updateCustomer(Customer customer){ } public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(this, $it -> ((CustomerOrder)$it).getCommercePlatform()); + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", CustomerOrder::getCommercePlatform)); } public CustomerOrderExpression updateCommercePlatform(CommercePlatform commercePlatform){ @@ -99,21 +93,21 @@ public CustomerOrderExpression updateCommercePlatform(CommercePlatform } public Expression getCreateTime(){ - return apply(CustomerOrder::getCreateTime); + return loaded("create_time", "getCreateTime", CustomerOrder::getCreateTime); } public CustomerOrderExpression updateCreateTime(LocalDateTime createTime){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return apply(CustomerOrder::getUpdateTime); + return loaded("update_time", "getUpdateTime", CustomerOrder::getUpdateTime); } public CustomerOrderExpression updateUpdateTime(LocalDateTime updateTime){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateUpdateTime(updateTime)); } public OrderLineListExpression getOrderLineList(){ - return new OrderLineListExpression(this, $it -> ((CustomerOrder)$it).getOrderLineList()); + return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", CustomerOrder::getOrderLineList)); } public CustomerOrderExpression addOrderLine(OrderLine orderLine){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderLine(orderLine)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java index 5f3e081a5..cad513172 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java @@ -21,6 +21,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class CustomerOrderRequest extends BaseRequest { @@ -29,8 +30,13 @@ public class CustomerOrderRequest extends BaseRequest returnType){ - super(returnType); + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -40,6 +46,19 @@ public CustomerOrderRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CustomerOrderRequest returnType(Class returnType){ @@ -63,6 +82,36 @@ public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); } @@ -77,6 +126,12 @@ public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder) return this; } + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + public CustomerOrderRequest enhanceChildrenIfNeeded(){ return this; } @@ -100,6 +155,22 @@ public CustomerOrderRequest selectSelfFields(){ return selectSelf(); } + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + selectProperty(CustomerOrder.STATUS_PROPERTY); + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + selectProperty(CustomerOrder.CREATE_TIME_PROPERTY); + selectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectAll(){ super.selectAll(); return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatus().selectCustomer().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); @@ -199,7 +270,8 @@ public CustomerOrderRequest selectStatus(){ public CustomerOrderRequest selectStatusWith(OrderStatusRequest status){ selectProperty(CustomerOrder.STATUS_PROPERTY); - enhanceRelation(CustomerOrder.STATUS_PROPERTY, status); + enhanceRelation(CustomerOrder.STATUS_PROPERTY, status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectStatusWith", null, CustomerOrder.STATUS_PROPERTY)); return this; } @@ -218,7 +290,8 @@ public CustomerOrderRequest selectCustomer(){ public CustomerOrderRequest selectCustomerWith(CustomerRequest customer){ selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - enhanceRelation(CustomerOrder.CUSTOMER_PROPERTY, customer); + enhanceRelation(CustomerOrder.CUSTOMER_PROPERTY, customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerWith", null, CustomerOrder.CUSTOMER_PROPERTY)); return this; } @@ -237,7 +310,8 @@ public CustomerOrderRequest selectCommercePlatform(){ public CustomerOrderRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform); + enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -301,7 +375,8 @@ public CustomerOrderRequest selectOrderLineList(){ } public CustomerOrderRequest selectOrderLineListWith(OrderLineRequest orderLineList){ - enhanceRelation(CustomerOrder.ORDER_LINE_LIST_PROPERTY, orderLineList); + enhanceRelation(CustomerOrder.ORDER_LINE_LIST_PROPERTY, orderLineList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); return this; } @@ -313,11 +388,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); } - public CustomerOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public CustomerOrderRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -345,6 +428,17 @@ public SearchCriteria createOrderNumberCriteria(Operator operator, Object... val return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); } + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ return withOrderNumber(Operator.GREATER_THAN, orderNumber); } @@ -371,10 +465,22 @@ public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ return withOrderNumber(Operator.CONTAIN, orderNumber); } + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ return withOrderNumber(Operator.END_WITH, orderNumber); } + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ return withOrderNumber(Operator.EQUAL, orderNumber); } @@ -408,6 +514,21 @@ public SearchCriteria createOrderDateCriteria(Operator operator, Object... value return createBasicSearchCriteria(CustomerOrder.ORDER_DATE_PROPERTY, operator, values); } + public CustomerOrderRequest withOrderDateIs(LocalDate orderDate){ + return withOrderDate(Operator.EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateIsNot(LocalDate orderDate){ + return withOrderDate(Operator.NOT_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateIn(LocalDate... orderDate){ + return withOrderDate(Operator.IN, (Object[])orderDate); + } + + public CustomerOrderRequest withOrderDateNotIn(LocalDate... orderDate){ + return withOrderDate(Operator.NOT_IN, (Object[])orderDate); + } public CustomerOrderRequest withOrderDateGreaterThan(LocalDate orderDate){ return withOrderDate(Operator.GREATER_THAN, orderDate); } @@ -473,6 +594,21 @@ public SearchCriteria createTotalAmountCriteria(Operator operator, Object... val return createBasicSearchCriteria(CustomerOrder.TOTAL_AMOUNT_PROPERTY, operator, values); } + public CustomerOrderRequest withTotalAmountIs(BigDecimal totalAmount){ + return withTotalAmount(Operator.EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountIsNot(BigDecimal totalAmount){ + return withTotalAmount(Operator.NOT_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountIn(BigDecimal... totalAmount){ + return withTotalAmount(Operator.IN, (Object[])totalAmount); + } + + public CustomerOrderRequest withTotalAmountNotIn(BigDecimal... totalAmount){ + return withTotalAmount(Operator.NOT_IN, (Object[])totalAmount); + } public CustomerOrderRequest withTotalAmountGreaterThan(BigDecimal totalAmount){ return withTotalAmount(Operator.GREATER_THAN, totalAmount); } @@ -528,6 +664,11 @@ public CustomerOrderRequest withStatusMatching(OrderStatusRequest status){ return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY)); } + public CustomerOrderRequest withoutStatusMatching(OrderStatusRequest status){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY))); + } + public CustomerOrderRequest filterByCustomer(Customer... customer){ if (customer == null || customer.length == 0) { throw new IllegalArgumentException("filterByCustomer parameter customer cannot be empty"); @@ -561,6 +702,11 @@ public CustomerOrderRequest withCustomerMatching(CustomerRequest customer){ return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY)); } + public CustomerOrderRequest withoutCustomerMatching(CustomerRequest customer){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY))); + } + public CustomerOrderRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ if (commercePlatform == null || commercePlatform.length == 0) { throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); @@ -594,6 +740,11 @@ public CustomerOrderRequest withCommercePlatformMatching(CommercePlatformRequ return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); } + public CustomerOrderRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + public CustomerOrderRequest filterByCreateTime(LocalDateTime... createTime){ if (createTime == null || createTime.length == 0) { throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); @@ -617,6 +768,21 @@ public SearchCriteria createCreateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(CustomerOrder.CREATE_TIME_PROPERTY, operator, values); } + public CustomerOrderRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public CustomerOrderRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public CustomerOrderRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public CustomerOrderRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } public CustomerOrderRequest withCreateTimeGreaterThan(LocalDateTime createTime){ return withCreateTime(Operator.GREATER_THAN, createTime); } @@ -682,6 +848,21 @@ public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(CustomerOrder.UPDATE_TIME_PROPERTY, operator, values); } + public CustomerOrderRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public CustomerOrderRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public CustomerOrderRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public CustomerOrderRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } public CustomerOrderRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ return withUpdateTime(Operator.GREATER_THAN, updateTime); } @@ -747,6 +928,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); } + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public CustomerOrderRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -767,6 +963,7 @@ public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endO return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public CustomerOrderRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderLineRequest, OrderLine.CUSTOMER_ORDER_PROPERTY)); } @@ -785,10 +982,12 @@ public CustomerOrderRequest haveNoOrderLines(){ public CustomerOrderRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public CustomerOrderRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public CustomerOrderRequest minTotalAmount(){ @@ -885,6 +1084,86 @@ public CustomerOrderRequest groupByCommercePlatformWithDetails(CommercePlatfo + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderDate(){ + return countDistinctOrderDateAs("order_date_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderDateAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctTotalAmount(){ + return countDistinctTotalAmountAs("total_amount_distinct_count"); + } + + public CustomerOrderRequest countDistinctTotalAmountAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctStatus(){ + return countDistinctStatusAs("status_distinct_count"); + } + + public CustomerOrderRequest countDistinctStatusAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCustomer(){ + return countDistinctCustomerAs("customer_distinct_count"); + } + + public CustomerOrderRequest countDistinctCustomerAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public CustomerOrderRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public CustomerOrderRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public CustomerOrderRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } public CustomerOrderRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ aggregate(CustomerOrder.ORDER_LINE_LIST_PROPERTY, subRequest); return this; @@ -950,7 +1229,8 @@ public CustomerOrderRequest groupByTotalAmountWithFunction(String retName, Ag return this; } public CustomerOrderRequest groupByStatusWith(OrderStatusRequest subRequest){ - groupBy(CustomerOrder.STATUS_PROPERTY, subRequest); + groupBy(CustomerOrder.STATUS_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByStatusWith", null, "status")); return this; } public CustomerOrderRequest groupByStatus(){ @@ -968,7 +1248,8 @@ public CustomerOrderRequest groupByStatusWithFunction(String retName, AggrFun return this; } public CustomerOrderRequest groupByCustomerWith(CustomerRequest subRequest){ - groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest); + groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerWith", null, "customer")); return this; } public CustomerOrderRequest groupByCustomer(){ @@ -986,7 +1267,8 @@ public CustomerOrderRequest groupByCustomerWithFunction(String retName, AggrF return this; } public CustomerOrderRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest); + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); return this; } public CustomerOrderRequest groupByCommercePlatform(){ @@ -1055,20 +1337,8 @@ public CustomerOrderRequest withStatusIsPending(){ } - public CustomerOrderRequest withStatusIsProcessing(){ - filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_PROCESSING); - return this; - } - - - public CustomerOrderRequest withStatusIsShipped(){ - filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_SHIPPED); - return this; - } - - - public CustomerOrderRequest withStatusIsCompleted(){ - filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_COMPLETED); + public CustomerOrderRequest withStatusIsConfirmed(){ + filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_CONFIRMED); return this; } @@ -1189,8 +1459,8 @@ public CustomerOrderRequest statsFromOrderLinesAs(String name, OrderLineReque } public CustomerOrderRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); return this; } @@ -1199,22 +1469,22 @@ public CustomerOrderRequest statsFromOrderLines(OrderLineRequest subRequest){ } public OrderStatusRequest rollUpToStatus(){ OrderStatusRequest status = Q.orderStatuses().unlimited(); - this.withStatusMatching(status) - .groupByStatusWith(status); + this.internalRollUpTo("status", status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToStatus", null, "status")); return status; } public CustomerRequest rollUpToCustomer(){ CustomerRequest customer = Q.customers().unlimited(); - this.withCustomerMatching(customer) - .groupByCustomerWith(customer); + this.internalRollUpTo("customer", customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomer", null, "customer")); return customer; } public CommercePlatformRequest rollUpToCommercePlatform(){ CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.withCommercePlatformMatching(commercePlatform) - .groupByCommercePlatformWith(commercePlatform); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); return commercePlatform; } @@ -1222,18 +1492,28 @@ public CommercePlatformRequest rollUpToCommercePlatform(){ public CustomerOrderRequest countOrderLines(){ - return countOrderLinesAs("Count"); + addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countOrderLinesAs(String name){ - return countOrderLinesWith(name, Q.orderLines().unlimited()); + addRelationCount(name, Q.orderLines().unlimited(), OrderLine.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest minQuantityOfOrderLines(){ - return minQuantityOfOrderLinesAs("minQuantityOfOrderLines"); + addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest minQuantityOfOrderLinesAs(String name){ @@ -1241,10 +1521,18 @@ public CustomerOrderRequest minQuantityOfOrderLinesAs(String name){ } public CustomerOrderRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.minQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest maxQuantityOfOrderLines(){ - return maxQuantityOfOrderLinesAs("maxQuantityOfOrderLines"); + addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name){ @@ -1252,10 +1540,18 @@ public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name){ } public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.maxQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest sumQuantityOfOrderLines(){ - return sumQuantityOfOrderLinesAs("sumQuantityOfOrderLines"); + addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name){ @@ -1263,10 +1559,18 @@ public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name){ } public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.sumQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest avgQuantityOfOrderLines(){ - return avgQuantityOfOrderLinesAs("avgQuantityOfOrderLines"); + addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name){ @@ -1274,10 +1578,18 @@ public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name){ } public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.avgQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest standardDeviationQuantityOfOrderLines(){ - return standardDeviationQuantityOfOrderLinesAs("stdDevQuantityOfOrderLines"); + addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String name){ @@ -1285,10 +1597,18 @@ public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String na } public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.standardDeviationQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs("stdDevPopQuantityOfOrderLines"); + addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ @@ -1296,10 +1616,18 @@ public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOf } public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.squareRootOfPopulationStandardDeviationQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest sampleVarianceQuantityOfOrderLines(){ - return sampleVarianceQuantityOfOrderLinesAs("varSampQuantityOfOrderLines"); + addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name){ @@ -1307,10 +1635,18 @@ public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name) } public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.sampleVarianceQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLines(){ - return samplePopulationVarianceQuantityOfOrderLinesAs("varPopQuantityOfOrderLines"); + addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ @@ -1318,7 +1654,11 @@ public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(St } public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.samplePopulationVarianceQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; } public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status){ @@ -1326,7 +1666,8 @@ public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequ } public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.STATUS_PROPERTY, status, includeAllFacets); + addFacet(facetName, CustomerOrder.STATUS_PROPERTY, status, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByStatusAs", facetName, CustomerOrder.STATUS_PROPERTY)); return this; } public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer){ @@ -1334,7 +1675,8 @@ public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerReque } public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.CUSTOMER_PROPERTY, customer, includeAllFacets); + addFacet(facetName, CustomerOrder.CUSTOMER_PROPERTY, customer, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerAs", facetName, CustomerOrder.CUSTOMER_PROPERTY)); return this; } public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ @@ -1342,7 +1684,8 @@ public CustomerOrderRequest facetByCommercePlatformAs(String facetName, Comme } public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets); + addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -1356,6 +1699,11 @@ public CustomerOrderRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java index cfab39ff4..00d93ae47 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java @@ -7,8 +7,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.time.LocalDateTime; import java.util.Objects; @@ -23,94 +25,129 @@ public class OrderLine extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "OrderLine"; - public static final String CUSTOMER_ORDER_PROPERTY = "customerOrder"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "561e1330c3f6785b4b09c99056d83367e88ffa0c3bc41bf7be5a42ba53982496"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("product", 2), java.util.Map.entry("product_name", 3), java.util.Map.entry("sku", 4), java.util.Map.entry("quantity", 5), java.util.Map.entry("commerce_platform", 6), java.util.Map.entry("create_time", 7), java.util.Map.entry("version", 8)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("product", java.util.List.of("product", "product")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderLine.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; public static final String PRODUCT_PROPERTY = "product"; - public static final String PRODUCT_NAME_PROPERTY = "productName"; + public static final String PRODUCT_NAME_PROPERTY = "product_name"; public static final String SKU_PROPERTY = "sku"; public static final String QUANTITY_PROPERTY = "quantity"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commercePlatform"; - public static final String CREATE_TIME_PROPERTY = "createTime"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; private CustomerOrder customerOrder; + private Product product; + private String productName; + private String sku; + private Integer quantity; + private CommercePlatform commercePlatform; + private LocalDateTime createTime; + public CustomerOrder getCustomerOrder(){ return this.customerOrder; } + public Product getProduct(){ return this.product; } + public String getProductName(){ return this.productName; } + public String getSku(){ return this.sku; } + public Integer getQuantity(){ return this.quantity; } + public CommercePlatform getCommercePlatform(){ return this.commercePlatform; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public OrderLine updateCustomerOrder(CustomerOrder customerOrder){ - if(Objects.equals(this.customerOrder, customerOrder)){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ return this; } handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); this.customerOrder = customerOrder; return this; } + public OrderLine updateProduct(Product product){ - if(Objects.equals(this.product, product)){ + if(isPropertyLoaded(PRODUCT_PROPERTY) && Objects.equals(this.product, product)){ return this; } handleUpdate(PRODUCT_PROPERTY, getProduct(), product); this.product = product; return this; } + public OrderLine updateProductName(String productName){ productName = (productName == null ? null : productName.trim()); - if(Objects.equals(this.productName, productName)){ + if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ return this; } handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); this.productName = productName; return this; } + public OrderLine updateSku(String sku){ sku = (sku == null ? null : sku.trim()); - if(Objects.equals(this.sku, sku)){ + if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ return this; } handleUpdate(SKU_PROPERTY, getSku(), sku); this.sku = sku; return this; } + public OrderLine updateQuantity(Integer quantity){ - if(Objects.equals(this.quantity, quantity)){ + if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ return this; } handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); this.quantity = quantity; return this; } + public OrderLine updateCommercePlatform(CommercePlatform commercePlatform){ - if(Objects.equals(this.commercePlatform, commercePlatform)){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ return this; } handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); this.commercePlatform = commercePlatform; return this; } + public OrderLine updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); @@ -118,6 +155,7 @@ public OrderLine updateCreateTime(LocalDateTime createTime){ return this; } + public static OrderLine refer(Long id){ OrderLine refer = new OrderLine(); refer.__internalSet("id", id); @@ -137,27 +175,28 @@ public OrderLine comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { - case "customerOrder": this.customerOrder = (CustomerOrder) value; break; + case "customer_order": this.customerOrder = (CustomerOrder) value; break; case "product": this.product = (Product) value; break; - case "productName": this.productName = (value == null ? null : ((String)value).trim()); break; + case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; case "quantity": this.quantity = (Integer) value; break; - case "commercePlatform": this.commercePlatform = (CommercePlatform) value; break; + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; default: super.__internalSet(property, value); } @@ -167,14 +206,26 @@ public void __internalSet(String property, Object value) { @FrameworkInternal public Object __internalGet(String property) { switch (property) { - case "customerOrder": return this.customerOrder; + case "customer_order": return this.customerOrder; case "product": return this.product; - case "productName": return this.productName; + case "product_name": return this.productName; case "sku": return this.sku; case "quantity": return this.quantity; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - default: return super.__internalGet(property); + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "product": return this.product; + case "productName": return this.productName; + case "sku": return this.sku; + case "quantity": return this.quantity; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java index e5a14f8d6..299ce5191 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java @@ -18,77 +18,107 @@ public String type(){ return OrderLine.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, OrderLine orderLine, ObjectLocation _parentLocation){ - if(needCheck(_ctx, orderLine)){ - markAsChecked(_ctx, orderLine); - doCheck(_ctx, orderLine, _parentLocation); + public void checkAndFix(UserContext _context, OrderLine orderLine, ObjectLocation _parentLocation){ + if(needCheck(_context, orderLine)){ + markAsChecked(_context, orderLine); + doCheck(_context, orderLine, _parentLocation); } } - public void doCheck(UserContext _ctx, OrderLine orderLine, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, OrderLine orderLine, ObjectLocation _parentLocation){ if((orderLine == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderLine); + if(orderLine.needPersist()){ + } if(orderLine.newItem()){ - if(orderLine.getCreateTime() == null){ - orderLine.updateCreateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + orderLine.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(orderLine.updateItem()){ + if(!orderLine.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("product")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("product_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("sku")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("quantity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + } - checkCustomerOrder(_ctx, orderLine.getProperty(OrderLine.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, OrderLine.CUSTOMER_ORDER_PROPERTY)); - checkProduct(_ctx, orderLine.getProperty(OrderLine.PRODUCT_PROPERTY), newLocation(_parentLocation, OrderLine.PRODUCT_PROPERTY)); - checkProductName(_ctx, orderLine.getProperty(OrderLine.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, OrderLine.PRODUCT_NAME_PROPERTY)); - checkSku(_ctx, orderLine.getProperty(OrderLine.SKU_PROPERTY), newLocation(_parentLocation, OrderLine.SKU_PROPERTY)); - checkQuantity(_ctx, orderLine.getProperty(OrderLine.QUANTITY_PROPERTY), newLocation(_parentLocation, OrderLine.QUANTITY_PROPERTY)); - checkCommercePlatform(_ctx, orderLine.getProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, OrderLine.COMMERCE_PLATFORM_PROPERTY)); - checkCreateTime(_ctx, orderLine.getProperty(OrderLine.CREATE_TIME_PROPERTY), newLocation(_parentLocation, OrderLine.CREATE_TIME_PROPERTY)); + checkCustomerOrder(_context, orderLine.getProperty(OrderLine.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkProduct(_context, orderLine.getProperty(OrderLine.PRODUCT_PROPERTY), newLocation(_parentLocation, "product")); + checkProductName(_context, orderLine.getProperty(OrderLine.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); + checkSku(_context, orderLine.getProperty(OrderLine.SKU_PROPERTY), newLocation(_parentLocation, "sku")); + checkQuantity(_context, orderLine.getProperty(OrderLine.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); + checkCommercePlatform(_context, orderLine.getProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, orderLine.getProperty(OrderLine.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); } - public void checkCustomerOrder(UserContext _ctx, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, customerOrder); + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); if((customerOrder == null)){ return; } - new CustomerOrderChecker().checkAndFix(_ctx, customerOrder, _parentLocation); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); } - public void checkProduct(UserContext _ctx, Product product, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, product); + public void checkProduct(UserContext _context, Product product, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, product); if((product == null)){ return; } - new ProductChecker().checkAndFix(_ctx, product, _parentLocation); + new ProductChecker().checkAndFix(_context, product, _parentLocation); } - public void checkProductName(UserContext _ctx, String productName, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, productName); + public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, productName); if((productName == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, productName); + maxStringCheck(_context, _parentLocation, 100, productName); } - public void checkSku(UserContext _ctx, String sku, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, sku); + public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sku); if((sku == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, sku); + maxStringCheck(_context, _parentLocation, 100, sku); } - public void checkQuantity(UserContext _ctx, Integer quantity, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, quantity); + public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quantity); if((quantity == null)){ return; } } - public void checkCommercePlatform(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, commercePlatform); + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); if((commercePlatform == null)){ return; } - new CommercePlatformChecker().checkAndFix(_ctx, commercePlatform, _parentLocation); + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); } - public void checkCreateTime(UserContext _ctx, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, createTime); + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); if((createTime == null)){ return; } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java index 6b8216c8c..4b0e96834 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java @@ -41,7 +41,7 @@ public boolean isNull() { public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(this, $it -> ((OrderLine)$it).getCustomerOrder()); + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderLine::getCustomerOrder)); } public OrderLineExpression updateCustomerOrder(CustomerOrder customerOrder){ @@ -49,7 +49,7 @@ public OrderLineExpression updateCustomerOrder(CustomerOrder customerOr } public ProductExpression getProduct(){ - return new ProductExpression(this, $it -> ((OrderLine)$it).getProduct()); + return new ProductExpression(loaded("product", "getProduct", OrderLine::getProduct)); } public OrderLineExpression updateProduct(Product product){ @@ -57,28 +57,28 @@ public OrderLineExpression updateProduct(Product product){ } public Expression getProductName(){ - return apply(OrderLine::getProductName); + return loaded("product_name", "getProductName", OrderLine::getProductName); } public OrderLineExpression updateProductName(String productName){ return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateProductName(productName)); } public Expression getSku(){ - return apply(OrderLine::getSku); + return loaded("sku", "getSku", OrderLine::getSku); } public OrderLineExpression updateSku(String sku){ return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateSku(sku)); } public Expression getQuantity(){ - return apply(OrderLine::getQuantity); + return loaded("quantity", "getQuantity", OrderLine::getQuantity); } public OrderLineExpression updateQuantity(Integer quantity){ return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateQuantity(quantity)); } public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(this, $it -> ((OrderLine)$it).getCommercePlatform()); + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderLine::getCommercePlatform)); } public OrderLineExpression updateCommercePlatform(CommercePlatform commercePlatform){ @@ -86,7 +86,7 @@ public OrderLineExpression updateCommercePlatform(CommercePlatform comm } public Expression getCreateTime(){ - return apply(OrderLine::getCreateTime); + return loaded("create_time", "getCreateTime", OrderLine::getCreateTime); } public OrderLineExpression updateCreateTime(LocalDateTime createTime){ return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCreateTime(createTime)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java index f06523fda..420e2e78d 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java @@ -17,6 +17,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class OrderLineRequest extends BaseRequest { @@ -25,8 +26,13 @@ public class OrderLineRequest extends BaseRequest { * instead of constructing request builders directly. */ @Deprecated + @SuppressWarnings("unchecked") public OrderLineRequest(Class returnType){ - super(returnType); + this(returnType, () -> (T) new OrderLine()); + } + + protected OrderLineRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -36,6 +42,19 @@ public OrderLineRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderLineRequest copy(){ + return (OrderLineRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderLineRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderLineRequest returnType(Class returnType){ @@ -59,6 +78,36 @@ public OrderLineRequest propagateAggregationCache(long cacheExpiredMillis){ return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderLineRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderLineRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderLineRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderLineRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderLineRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public OrderLineRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (OrderLineRequest)super.appendSearchCriteria(searchCriteria); } @@ -73,6 +122,12 @@ public OrderLineRequest matchingAnyOf(OrderLineRequest orderLine){ return this; } + public OrderLineRequest matchingIdsOf(OrderLineRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderLine.ID_PROPERTY, request, OrderLine.ID_PROPERTY)); + } + public OrderLineRequest enhanceChildrenIfNeeded(){ return this; } @@ -96,6 +151,21 @@ public OrderLineRequest selectSelfFields(){ return selectSelf(); } + public OrderLineRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderLine.ID_PROPERTY); + selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderLine.PRODUCT_PROPERTY); + selectProperty(OrderLine.PRODUCT_NAME_PROPERTY); + selectProperty(OrderLine.SKU_PROPERTY); + selectProperty(OrderLine.QUANTITY_PROPERTY); + selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); + selectProperty(OrderLine.CREATE_TIME_PROPERTY); + selectProperty(OrderLine.VERSION_PROPERTY); + return this; + } + public OrderLineRequest selectAll(){ super.selectAll(); return selectId().selectCustomerOrder().selectProduct().selectProductName().selectSku().selectQuantity().selectCommercePlatform().selectCreateTime().selectVersion(); @@ -135,7 +205,8 @@ public OrderLineRequest selectCustomerOrder(){ public OrderLineRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder); + enhanceRelation(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderLine.CUSTOMER_ORDER_PROPERTY)); return this; } @@ -154,7 +225,8 @@ public OrderLineRequest selectProduct(){ public OrderLineRequest selectProductWith(ProductRequest product){ selectProperty(OrderLine.PRODUCT_PROPERTY); - enhanceRelation(OrderLine.PRODUCT_PROPERTY, product); + enhanceRelation(OrderLine.PRODUCT_PROPERTY, product, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectProductWith", null, OrderLine.PRODUCT_PROPERTY)); return this; } @@ -232,7 +304,8 @@ public OrderLineRequest selectCommercePlatform(){ public OrderLineRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform); + enhanceRelation(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderLine.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -283,11 +356,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderLine.ID_PROPERTY, operator, values); } - public OrderLineRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public OrderLineRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public OrderLineRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public OrderLineRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderLineRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -325,6 +406,11 @@ public OrderLineRequest withCustomerOrderMatching(CustomerOrderRequest custom return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); } + public OrderLineRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + public OrderLineRequest filterByProduct(Product... product){ if (product == null || product.length == 0) { throw new IllegalArgumentException("filterByProduct parameter product cannot be empty"); @@ -358,6 +444,11 @@ public OrderLineRequest withProductMatching(ProductRequest product){ return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.PRODUCT_PROPERTY, product, Product.ID_PROPERTY)); } + public OrderLineRequest withoutProductMatching(ProductRequest product){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderLine.PRODUCT_PROPERTY, product, Product.ID_PROPERTY))); + } + public OrderLineRequest filterByProductName(String... productName){ if (productName == null || productName.length == 0) { throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); @@ -381,6 +472,17 @@ public SearchCriteria createProductNameCriteria(Operator operator, Object... val return createBasicSearchCriteria(OrderLine.PRODUCT_NAME_PROPERTY, operator, values); } + public OrderLineRequest withProductNameIsNot(String productName){ + return withProductName(Operator.NOT_EQUAL, productName); + } + + public OrderLineRequest withProductNameIn(String... productName){ + return withProductName(Operator.IN, (Object[])productName); + } + + public OrderLineRequest withProductNameNotIn(String... productName){ + return withProductName(Operator.NOT_IN, (Object[])productName); + } public OrderLineRequest withProductNameGreaterThan(String productName){ return withProductName(Operator.GREATER_THAN, productName); } @@ -407,10 +509,22 @@ public OrderLineRequest withProductNameContaining(String productName){ return withProductName(Operator.CONTAIN, productName); } + public OrderLineRequest withProductNameNotContaining(String productName){ + return withProductName(Operator.NOT_CONTAIN, productName); + } + + public OrderLineRequest withProductNameNotStartingWith(String productName){ + return withProductName(Operator.NOT_BEGIN_WITH, productName); + } + public OrderLineRequest withProductNameEndingWith(String productName){ return withProductName(Operator.END_WITH, productName); } + public OrderLineRequest withProductNameNotEndingWith(String productName){ + return withProductName(Operator.NOT_END_WITH, productName); + } + public OrderLineRequest withProductNameIs(String productName){ return withProductName(Operator.EQUAL, productName); } @@ -444,6 +558,17 @@ public SearchCriteria createSkuCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderLine.SKU_PROPERTY, operator, values); } + public OrderLineRequest withSkuIsNot(String sku){ + return withSku(Operator.NOT_EQUAL, sku); + } + + public OrderLineRequest withSkuIn(String... sku){ + return withSku(Operator.IN, (Object[])sku); + } + + public OrderLineRequest withSkuNotIn(String... sku){ + return withSku(Operator.NOT_IN, (Object[])sku); + } public OrderLineRequest withSkuGreaterThan(String sku){ return withSku(Operator.GREATER_THAN, sku); } @@ -470,10 +595,22 @@ public OrderLineRequest withSkuContaining(String sku){ return withSku(Operator.CONTAIN, sku); } + public OrderLineRequest withSkuNotContaining(String sku){ + return withSku(Operator.NOT_CONTAIN, sku); + } + + public OrderLineRequest withSkuNotStartingWith(String sku){ + return withSku(Operator.NOT_BEGIN_WITH, sku); + } + public OrderLineRequest withSkuEndingWith(String sku){ return withSku(Operator.END_WITH, sku); } + public OrderLineRequest withSkuNotEndingWith(String sku){ + return withSku(Operator.NOT_END_WITH, sku); + } + public OrderLineRequest withSkuIs(String sku){ return withSku(Operator.EQUAL, sku); } @@ -507,6 +644,21 @@ public SearchCriteria createQuantityCriteria(Operator operator, Object... values return createBasicSearchCriteria(OrderLine.QUANTITY_PROPERTY, operator, values); } + public OrderLineRequest withQuantityIs(Integer quantity){ + return withQuantity(Operator.EQUAL, quantity); + } + + public OrderLineRequest withQuantityIsNot(Integer quantity){ + return withQuantity(Operator.NOT_EQUAL, quantity); + } + + public OrderLineRequest withQuantityIn(Integer... quantity){ + return withQuantity(Operator.IN, (Object[])quantity); + } + + public OrderLineRequest withQuantityNotIn(Integer... quantity){ + return withQuantity(Operator.NOT_IN, (Object[])quantity); + } public OrderLineRequest withQuantityGreaterThan(Integer quantity){ return withQuantity(Operator.GREATER_THAN, quantity); } @@ -562,6 +714,11 @@ public OrderLineRequest withCommercePlatformMatching(CommercePlatformRequest return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); } + public OrderLineRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + public OrderLineRequest filterByCreateTime(LocalDateTime... createTime){ if (createTime == null || createTime.length == 0) { throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); @@ -585,6 +742,21 @@ public SearchCriteria createCreateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(OrderLine.CREATE_TIME_PROPERTY, operator, values); } + public OrderLineRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public OrderLineRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public OrderLineRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public OrderLineRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } public OrderLineRequest withCreateTimeGreaterThan(LocalDateTime createTime){ return withCreateTime(Operator.GREATER_THAN, createTime); } @@ -650,6 +822,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(OrderLine.VERSION_PROPERTY, operator, values); } + public OrderLineRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderLineRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderLineRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderLineRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public OrderLineRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -671,12 +858,15 @@ public OrderLineRequest withVersionBetween(Long startOfVersion, Long endOfVer } + public OrderLineRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public OrderLineRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public OrderLineRequest minQuantity(){ @@ -775,6 +965,78 @@ public OrderLineRequest groupByCommercePlatformWithDetails(CommercePlatformRe + public OrderLineRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderLineRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderLine.ID_PROPERTY); + return this; + } + public OrderLineRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderLineRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderLineRequest countDistinctProduct(){ + return countDistinctProductAs("product_distinct_count"); + } + + public OrderLineRequest countDistinctProductAs(String alias){ + super.countDistinctProperty(alias, OrderLine.PRODUCT_PROPERTY); + return this; + } + public OrderLineRequest countDistinctProductName(){ + return countDistinctProductNameAs("product_name_distinct_count"); + } + + public OrderLineRequest countDistinctProductNameAs(String alias){ + super.countDistinctProperty(alias, OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderLineRequest countDistinctSku(){ + return countDistinctSkuAs("sku_distinct_count"); + } + + public OrderLineRequest countDistinctSkuAs(String alias){ + super.countDistinctProperty(alias, OrderLine.SKU_PROPERTY); + return this; + } + public OrderLineRequest countDistinctQuantity(){ + return countDistinctQuantityAs("quantity_distinct_count"); + } + + public OrderLineRequest countDistinctQuantityAs(String alias){ + super.countDistinctProperty(alias, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public OrderLineRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderLineRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public OrderLineRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderLine.CREATE_TIME_PROPERTY); + return this; + } + public OrderLineRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderLineRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderLine.VERSION_PROPERTY); + return this; + } public OrderLineRequest groupById(){ groupBy(OrderLine.ID_PROPERTY); @@ -791,7 +1053,8 @@ public OrderLineRequest groupByIdWithFunction(String retName, AggrFunction fu return this; } public OrderLineRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderLine.CUSTOMER_ORDER_PROPERTY, subRequest); + groupBy(OrderLine.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); return this; } public OrderLineRequest groupByCustomerOrder(){ @@ -809,7 +1072,8 @@ public OrderLineRequest groupByCustomerOrderWithFunction(String retName, Aggr return this; } public OrderLineRequest groupByProductWith(ProductRequest subRequest){ - groupBy(OrderLine.PRODUCT_PROPERTY, subRequest); + groupBy(OrderLine.PRODUCT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByProductWith", null, "product")); return this; } public OrderLineRequest groupByProduct(){ @@ -872,7 +1136,8 @@ public OrderLineRequest groupByQuantityWithFunction(String retName, AggrFunct return this; } public OrderLineRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(OrderLine.COMMERCE_PLATFORM_PROPERTY, subRequest); + groupBy(OrderLine.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); return this; } public OrderLineRequest groupByCommercePlatform(){ @@ -1031,15 +1296,15 @@ public OrderLineRequest orderByVersionDescending(){ public CustomerOrderRequest rollUpToCustomerOrder(){ CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.withCustomerOrderMatching(customerOrder) - .groupByCustomerOrderWith(customerOrder); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); return customerOrder; } public ProductRequest rollUpToProduct(){ ProductRequest product = Q.products().unlimited(); - this.withProductMatching(product) - .groupByProductWith(product); + this.internalRollUpTo("product", product, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToProduct", null, "product")); return product; } @@ -1048,8 +1313,8 @@ public ProductRequest rollUpToProduct(){ public CommercePlatformRequest rollUpToCommercePlatform(){ CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.withCommercePlatformMatching(commercePlatform) - .groupByCommercePlatformWith(commercePlatform); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); return commercePlatform; } @@ -1061,7 +1326,8 @@ public OrderLineRequest facetByCustomerOrderAs(String facetName, CustomerOrde } public OrderLineRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets); + addFacet(facetName, OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderLine.CUSTOMER_ORDER_PROPERTY)); return this; } public OrderLineRequest facetByProductAs(String facetName, ProductRequest product){ @@ -1069,7 +1335,8 @@ public OrderLineRequest facetByProductAs(String facetName, ProductRequest pro } public OrderLineRequest facetByProductAs(String facetName, ProductRequest product, boolean includeAllFacets){ - addFacet(facetName, OrderLine.PRODUCT_PROPERTY, product, includeAllFacets); + addFacet(facetName, OrderLine.PRODUCT_PROPERTY, product, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByProductAs", facetName, OrderLine.PRODUCT_PROPERTY)); return this; } public OrderLineRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ @@ -1077,7 +1344,8 @@ public OrderLineRequest facetByCommercePlatformAs(String facetName, CommerceP } public OrderLineRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets); + addFacet(facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -1091,6 +1359,11 @@ public OrderLineRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public OrderLineRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java index 8bbdc5858..69f4b3ab6 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java @@ -5,8 +5,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.time.LocalDateTime; import java.util.Objects; @@ -21,96 +23,131 @@ public class OrderSearchPreset extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "OrderSearchPreset"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7370ba923091e78805facef9877cc6c566871604f4974bb9d2fb39be83dcdf83"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("filter_json", 2), java.util.Map.entry("request_id", 3), java.util.Map.entry("owner_user_id", 4), java.util.Map.entry("commerce_platform", 5), java.util.Map.entry("create_time", 6), java.util.Map.entry("update_time", 7), java.util.Map.entry("version", 8)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("filter_json", java.util.List.of("filterJson", "filter_json")), java.util.Map.entry("request_id", java.util.List.of("requestId", "request_id")), java.util.Map.entry("owner_user_id", java.util.List.of("ownerUserId", "owner_user_id")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderSearchPreset.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; - public static final String FILTER_JSON_PROPERTY = "filterJson"; - public static final String REQUEST_ID_PROPERTY = "requestId"; - public static final String OWNER_USER_ID_PROPERTY = "ownerUserId"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commercePlatform"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; + public static final String FILTER_JSON_PROPERTY = "filter_json"; + public static final String REQUEST_ID_PROPERTY = "request_id"; + public static final String OWNER_USER_ID_PROPERTY = "owner_user_id"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; private String name; + private String filterJson; + private String requestId; + private String ownerUserId; + private CommercePlatform commercePlatform; + private LocalDateTime createTime; + private LocalDateTime updateTime; + public String getName(){ return this.name; } + public String getFilterJson(){ return this.filterJson; } + public String getRequestId(){ return this.requestId; } + public String getOwnerUserId(){ return this.ownerUserId; } + public CommercePlatform getCommercePlatform(){ return this.commercePlatform; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public OrderSearchPreset updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public OrderSearchPreset updateFilterJson(String filterJson){ filterJson = (filterJson == null ? null : filterJson.trim()); - if(Objects.equals(this.filterJson, filterJson)){ + if(isPropertyLoaded(FILTER_JSON_PROPERTY) && Objects.equals(this.filterJson, filterJson)){ return this; } handleUpdate(FILTER_JSON_PROPERTY, getFilterJson(), filterJson); this.filterJson = filterJson; return this; } + public OrderSearchPreset updateRequestId(String requestId){ requestId = (requestId == null ? null : requestId.trim()); - if(Objects.equals(this.requestId, requestId)){ + if(isPropertyLoaded(REQUEST_ID_PROPERTY) && Objects.equals(this.requestId, requestId)){ return this; } handleUpdate(REQUEST_ID_PROPERTY, getRequestId(), requestId); this.requestId = requestId; return this; } + public OrderSearchPreset updateOwnerUserId(String ownerUserId){ ownerUserId = (ownerUserId == null ? null : ownerUserId.trim()); - if(Objects.equals(this.ownerUserId, ownerUserId)){ + if(isPropertyLoaded(OWNER_USER_ID_PROPERTY) && Objects.equals(this.ownerUserId, ownerUserId)){ return this; } handleUpdate(OWNER_USER_ID_PROPERTY, getOwnerUserId(), ownerUserId); this.ownerUserId = ownerUserId; return this; } + public OrderSearchPreset updateCommercePlatform(CommercePlatform commercePlatform){ - if(Objects.equals(this.commercePlatform, commercePlatform)){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ return this; } handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); this.commercePlatform = commercePlatform; return this; } + public OrderSearchPreset updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public OrderSearchPreset updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); @@ -118,6 +155,7 @@ public OrderSearchPreset updateUpdateTime(LocalDateTime updateTime){ return this; } + public static OrderSearchPreset refer(Long id){ OrderSearchPreset refer = new OrderSearchPreset(); refer.__internalSet("id", id); @@ -137,27 +175,28 @@ public OrderSearchPreset comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "filterJson": this.filterJson = (value == null ? null : ((String)value).trim()); break; + case "filter_json": this.filterJson = (value == null ? null : ((String)value).trim()); break; - case "requestId": this.requestId = (value == null ? null : ((String)value).trim()); break; + case "request_id": this.requestId = (value == null ? null : ((String)value).trim()); break; - case "ownerUserId": this.ownerUserId = (value == null ? null : ((String)value).trim()); break; + case "owner_user_id": this.ownerUserId = (value == null ? null : ((String)value).trim()); break; - case "commercePlatform": this.commercePlatform = (CommercePlatform) value; break; + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; default: super.__internalSet(property, value); } @@ -168,13 +207,25 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "name": return this.name; - case "filterJson": return this.filterJson; - case "requestId": return this.requestId; - case "ownerUserId": return this.ownerUserId; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); + case "filter_json": return this.filterJson; + case "request_id": return this.requestId; + case "owner_user_id": return this.ownerUserId; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "filterJson": return this.filterJson; + case "requestId": return this.requestId; + case "ownerUserId": return this.ownerUserId; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java index fb4aec062..566a351c7 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java @@ -14,82 +14,124 @@ public String type(){ return OrderSearchPreset.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ - if(needCheck(_ctx, orderSearchPreset)){ - markAsChecked(_ctx, orderSearchPreset); - doCheck(_ctx, orderSearchPreset, _parentLocation); + public void checkAndFix(UserContext _context, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ + if(needCheck(_context, orderSearchPreset)){ + markAsChecked(_context, orderSearchPreset); + doCheck(_context, orderSearchPreset, _parentLocation); } } - public void doCheck(UserContext _ctx, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ if((orderSearchPreset == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderSearchPreset); + if(orderSearchPreset.needPersist()){ + } if(orderSearchPreset.newItem()){ - if(orderSearchPreset.getCreateTime() == null){ - orderSearchPreset.updateCreateTime(java.time.LocalDateTime.now()); - }if(orderSearchPreset.getUpdateTime() == null){ - orderSearchPreset.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + orderSearchPreset.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderSearchPreset.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(orderSearchPreset.updateItem()){ - orderSearchPreset.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderSearchPreset.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!orderSearchPreset.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("filter_json")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "filter_json"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("request_id")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "request_id"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("owner_user_id")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "owner_user_id"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + } - checkName(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.NAME_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.NAME_PROPERTY)); - checkFilterJson(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.FILTER_JSON_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.FILTER_JSON_PROPERTY)); - checkRequestId(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.REQUEST_ID_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.REQUEST_ID_PROPERTY)); - checkOwnerUserId(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.OWNER_USER_ID_PROPERTY)); - checkCommercePlatform(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); - checkCreateTime(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.CREATE_TIME_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.CREATE_TIME_PROPERTY)); - checkUpdateTime(_ctx, orderSearchPreset.getProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, OrderSearchPreset.UPDATE_TIME_PROPERTY)); + checkName(_context, orderSearchPreset.getProperty(OrderSearchPreset.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkFilterJson(_context, orderSearchPreset.getProperty(OrderSearchPreset.FILTER_JSON_PROPERTY), newLocation(_parentLocation, "filter_json")); + checkRequestId(_context, orderSearchPreset.getProperty(OrderSearchPreset.REQUEST_ID_PROPERTY), newLocation(_parentLocation, "request_id")); + checkOwnerUserId(_context, orderSearchPreset.getProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY), newLocation(_parentLocation, "owner_user_id")); + checkCommercePlatform(_context, orderSearchPreset.getProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, orderSearchPreset.getProperty(OrderSearchPreset.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, orderSearchPreset.getProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); } - public void checkName(UserContext _ctx, String name, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, name); + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); if((name == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, name); + maxStringCheck(_context, _parentLocation, 100, name); } - public void checkFilterJson(UserContext _ctx, String filterJson, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, filterJson); + public void checkFilterJson(UserContext _context, String filterJson, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, filterJson); if((filterJson == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, filterJson); + maxStringCheck(_context, _parentLocation, 100, filterJson); } - public void checkRequestId(UserContext _ctx, String requestId, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, requestId); + public void checkRequestId(UserContext _context, String requestId, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requestId); if((requestId == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, requestId); + maxStringCheck(_context, _parentLocation, 100, requestId); } - public void checkOwnerUserId(UserContext _ctx, String ownerUserId, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, ownerUserId); + public void checkOwnerUserId(UserContext _context, String ownerUserId, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, ownerUserId); if((ownerUserId == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, ownerUserId); + maxStringCheck(_context, _parentLocation, 100, ownerUserId); } - public void checkCommercePlatform(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, commercePlatform); + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); if((commercePlatform == null)){ return; } - new CommercePlatformChecker().checkAndFix(_ctx, commercePlatform, _parentLocation); + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); } - public void checkCreateTime(UserContext _ctx, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, createTime); + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); if((createTime == null)){ return; } } - public void checkUpdateTime(UserContext _ctx, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, updateTime); + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); if((updateTime == null)){ return; } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java index 06ed92d67..91c9653dc 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java @@ -37,35 +37,35 @@ public boolean isNull() { public Expression getName(){ - return apply(OrderSearchPreset::getName); + return loaded("name", "getName", OrderSearchPreset::getName); } public OrderSearchPresetExpression updateName(String name){ return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateName(name)); } public Expression getFilterJson(){ - return apply(OrderSearchPreset::getFilterJson); + return loaded("filter_json", "getFilterJson", OrderSearchPreset::getFilterJson); } public OrderSearchPresetExpression updateFilterJson(String filterJson){ return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateFilterJson(filterJson)); } public Expression getRequestId(){ - return apply(OrderSearchPreset::getRequestId); + return loaded("request_id", "getRequestId", OrderSearchPreset::getRequestId); } public OrderSearchPresetExpression updateRequestId(String requestId){ return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateRequestId(requestId)); } public Expression getOwnerUserId(){ - return apply(OrderSearchPreset::getOwnerUserId); + return loaded("owner_user_id", "getOwnerUserId", OrderSearchPreset::getOwnerUserId); } public OrderSearchPresetExpression updateOwnerUserId(String ownerUserId){ return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateOwnerUserId(ownerUserId)); } public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(this, $it -> ((OrderSearchPreset)$it).getCommercePlatform()); + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderSearchPreset::getCommercePlatform)); } public OrderSearchPresetExpression updateCommercePlatform(CommercePlatform commercePlatform){ @@ -73,14 +73,14 @@ public OrderSearchPresetExpression updateCommercePlatform(CommercePlatf } public Expression getCreateTime(){ - return apply(OrderSearchPreset::getCreateTime); + return loaded("create_time", "getCreateTime", OrderSearchPreset::getCreateTime); } public OrderSearchPresetExpression updateCreateTime(LocalDateTime createTime){ return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return apply(OrderSearchPreset::getUpdateTime); + return loaded("update_time", "getUpdateTime", OrderSearchPreset::getUpdateTime); } public OrderSearchPresetExpression updateUpdateTime(LocalDateTime updateTime){ return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateUpdateTime(updateTime)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java index 1276dfe71..8ca8b107f 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java @@ -13,6 +13,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class OrderSearchPresetRequest extends BaseRequest { @@ -21,8 +22,13 @@ public class OrderSearchPresetRequest extends BaseR * instead of constructing request builders directly. */ @Deprecated + @SuppressWarnings("unchecked") public OrderSearchPresetRequest(Class returnType){ - super(returnType); + this(returnType, () -> (T) new OrderSearchPreset()); + } + + protected OrderSearchPresetRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -32,6 +38,19 @@ public OrderSearchPresetRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderSearchPresetRequest copy(){ + return (OrderSearchPresetRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderSearchPresetRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderSearchPresetRequest returnType(Class returnType){ @@ -55,6 +74,36 @@ public OrderSearchPresetRequest propagateAggregationCache(long cacheExpiredMi return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderSearchPresetRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderSearchPresetRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderSearchPresetRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderSearchPresetRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderSearchPresetRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public OrderSearchPresetRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (OrderSearchPresetRequest)super.appendSearchCriteria(searchCriteria); } @@ -69,6 +118,12 @@ public OrderSearchPresetRequest matchingAnyOf(OrderSearchPresetRequest orderS return this; } + public OrderSearchPresetRequest matchingIdsOf(OrderSearchPresetRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderSearchPreset.ID_PROPERTY, request, OrderSearchPreset.ID_PROPERTY)); + } + public OrderSearchPresetRequest enhanceChildrenIfNeeded(){ return this; } @@ -92,6 +147,21 @@ public OrderSearchPresetRequest selectSelfFields(){ return selectSelf(); } + public OrderSearchPresetRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderSearchPreset.ID_PROPERTY); + selectProperty(OrderSearchPreset.NAME_PROPERTY); + selectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); + selectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); + selectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + selectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); + selectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); + selectProperty(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectAll(){ super.selectAll(); return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); @@ -199,7 +269,8 @@ public OrderSearchPresetRequest selectCommercePlatform(){ public OrderSearchPresetRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform); + enhanceRelation(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -267,11 +338,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderSearchPreset.ID_PROPERTY, operator, values); } - public OrderSearchPresetRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public OrderSearchPresetRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public OrderSearchPresetRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public OrderSearchPresetRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderSearchPresetRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -299,6 +378,17 @@ public SearchCriteria createNameCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderSearchPreset.NAME_PROPERTY, operator, values); } + public OrderSearchPresetRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public OrderSearchPresetRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public OrderSearchPresetRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } public OrderSearchPresetRequest withNameGreaterThan(String name){ return withName(Operator.GREATER_THAN, name); } @@ -325,10 +415,22 @@ public OrderSearchPresetRequest withNameContaining(String name){ return withName(Operator.CONTAIN, name); } + public OrderSearchPresetRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public OrderSearchPresetRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + public OrderSearchPresetRequest withNameEndingWith(String name){ return withName(Operator.END_WITH, name); } + public OrderSearchPresetRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + public OrderSearchPresetRequest withNameIs(String name){ return withName(Operator.EQUAL, name); } @@ -362,6 +464,17 @@ public SearchCriteria createFilterJsonCriteria(Operator operator, Object... valu return createBasicSearchCriteria(OrderSearchPreset.FILTER_JSON_PROPERTY, operator, values); } + public OrderSearchPresetRequest withFilterJsonIsNot(String filterJson){ + return withFilterJson(Operator.NOT_EQUAL, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonIn(String... filterJson){ + return withFilterJson(Operator.IN, (Object[])filterJson); + } + + public OrderSearchPresetRequest withFilterJsonNotIn(String... filterJson){ + return withFilterJson(Operator.NOT_IN, (Object[])filterJson); + } public OrderSearchPresetRequest withFilterJsonGreaterThan(String filterJson){ return withFilterJson(Operator.GREATER_THAN, filterJson); } @@ -388,10 +501,22 @@ public OrderSearchPresetRequest withFilterJsonContaining(String filterJson){ return withFilterJson(Operator.CONTAIN, filterJson); } + public OrderSearchPresetRequest withFilterJsonNotContaining(String filterJson){ + return withFilterJson(Operator.NOT_CONTAIN, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonNotStartingWith(String filterJson){ + return withFilterJson(Operator.NOT_BEGIN_WITH, filterJson); + } + public OrderSearchPresetRequest withFilterJsonEndingWith(String filterJson){ return withFilterJson(Operator.END_WITH, filterJson); } + public OrderSearchPresetRequest withFilterJsonNotEndingWith(String filterJson){ + return withFilterJson(Operator.NOT_END_WITH, filterJson); + } + public OrderSearchPresetRequest withFilterJsonIs(String filterJson){ return withFilterJson(Operator.EQUAL, filterJson); } @@ -425,6 +550,17 @@ public SearchCriteria createRequestIdCriteria(Operator operator, Object... value return createBasicSearchCriteria(OrderSearchPreset.REQUEST_ID_PROPERTY, operator, values); } + public OrderSearchPresetRequest withRequestIdIsNot(String requestId){ + return withRequestId(Operator.NOT_EQUAL, requestId); + } + + public OrderSearchPresetRequest withRequestIdIn(String... requestId){ + return withRequestId(Operator.IN, (Object[])requestId); + } + + public OrderSearchPresetRequest withRequestIdNotIn(String... requestId){ + return withRequestId(Operator.NOT_IN, (Object[])requestId); + } public OrderSearchPresetRequest withRequestIdGreaterThan(String requestId){ return withRequestId(Operator.GREATER_THAN, requestId); } @@ -451,10 +587,22 @@ public OrderSearchPresetRequest withRequestIdContaining(String requestId){ return withRequestId(Operator.CONTAIN, requestId); } + public OrderSearchPresetRequest withRequestIdNotContaining(String requestId){ + return withRequestId(Operator.NOT_CONTAIN, requestId); + } + + public OrderSearchPresetRequest withRequestIdNotStartingWith(String requestId){ + return withRequestId(Operator.NOT_BEGIN_WITH, requestId); + } + public OrderSearchPresetRequest withRequestIdEndingWith(String requestId){ return withRequestId(Operator.END_WITH, requestId); } + public OrderSearchPresetRequest withRequestIdNotEndingWith(String requestId){ + return withRequestId(Operator.NOT_END_WITH, requestId); + } + public OrderSearchPresetRequest withRequestIdIs(String requestId){ return withRequestId(Operator.EQUAL, requestId); } @@ -488,6 +636,17 @@ public SearchCriteria createOwnerUserIdCriteria(Operator operator, Object... val return createBasicSearchCriteria(OrderSearchPreset.OWNER_USER_ID_PROPERTY, operator, values); } + public OrderSearchPresetRequest withOwnerUserIdIsNot(String ownerUserId){ + return withOwnerUserId(Operator.NOT_EQUAL, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdIn(String... ownerUserId){ + return withOwnerUserId(Operator.IN, (Object[])ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdNotIn(String... ownerUserId){ + return withOwnerUserId(Operator.NOT_IN, (Object[])ownerUserId); + } public OrderSearchPresetRequest withOwnerUserIdGreaterThan(String ownerUserId){ return withOwnerUserId(Operator.GREATER_THAN, ownerUserId); } @@ -514,10 +673,22 @@ public OrderSearchPresetRequest withOwnerUserIdContaining(String ownerUserId) return withOwnerUserId(Operator.CONTAIN, ownerUserId); } + public OrderSearchPresetRequest withOwnerUserIdNotContaining(String ownerUserId){ + return withOwnerUserId(Operator.NOT_CONTAIN, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdNotStartingWith(String ownerUserId){ + return withOwnerUserId(Operator.NOT_BEGIN_WITH, ownerUserId); + } + public OrderSearchPresetRequest withOwnerUserIdEndingWith(String ownerUserId){ return withOwnerUserId(Operator.END_WITH, ownerUserId); } + public OrderSearchPresetRequest withOwnerUserIdNotEndingWith(String ownerUserId){ + return withOwnerUserId(Operator.NOT_END_WITH, ownerUserId); + } + public OrderSearchPresetRequest withOwnerUserIdIs(String ownerUserId){ return withOwnerUserId(Operator.EQUAL, ownerUserId); } @@ -561,6 +732,11 @@ public OrderSearchPresetRequest withCommercePlatformMatching(CommercePlatform return appendSearchCriteria(new SubQuerySearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); } + public OrderSearchPresetRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + public OrderSearchPresetRequest filterByCreateTime(LocalDateTime... createTime){ if (createTime == null || createTime.length == 0) { throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); @@ -584,6 +760,21 @@ public SearchCriteria createCreateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(OrderSearchPreset.CREATE_TIME_PROPERTY, operator, values); } + public OrderSearchPresetRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public OrderSearchPresetRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public OrderSearchPresetRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public OrderSearchPresetRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } public OrderSearchPresetRequest withCreateTimeGreaterThan(LocalDateTime createTime){ return withCreateTime(Operator.GREATER_THAN, createTime); } @@ -649,6 +840,21 @@ public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(OrderSearchPreset.UPDATE_TIME_PROPERTY, operator, values); } + public OrderSearchPresetRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } public OrderSearchPresetRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ return withUpdateTime(Operator.GREATER_THAN, updateTime); } @@ -714,6 +920,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(OrderSearchPreset.VERSION_PROPERTY, operator, values); } + public OrderSearchPresetRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderSearchPresetRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderSearchPresetRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderSearchPresetRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public OrderSearchPresetRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -735,12 +956,15 @@ public OrderSearchPresetRequest withVersionBetween(Long startOfVersion, Long } + public OrderSearchPresetRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public OrderSearchPresetRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public OrderSearchPresetRequest groupByCommercePlatformWithDetails(){ @@ -755,6 +979,78 @@ public OrderSearchPresetRequest groupByCommercePlatformWithDetails(CommercePl + public OrderSearchPresetRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.NAME_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctFilterJson(){ + return countDistinctFilterJsonAs("filter_json_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctFilterJsonAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctRequestId(){ + return countDistinctRequestIdAs("request_id_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctRequestIdAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctOwnerUserId(){ + return countDistinctOwnerUserIdAs("owner_user_id_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctOwnerUserIdAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.VERSION_PROPERTY); + return this; + } public OrderSearchPresetRequest groupById(){ groupBy(OrderSearchPreset.ID_PROPERTY); @@ -831,7 +1127,8 @@ public OrderSearchPresetRequest groupByOwnerUserIdWithFunction(String retName return this; } public OrderSearchPresetRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, subRequest); + groupBy(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); return this; } public OrderSearchPresetRequest groupByCommercePlatform(){ @@ -1021,8 +1318,8 @@ public OrderSearchPresetRequest orderByVersionDescending(){ public CommercePlatformRequest rollUpToCommercePlatform(){ CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.withCommercePlatformMatching(commercePlatform) - .groupByCommercePlatformWith(commercePlatform); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); return commercePlatform; } @@ -1035,7 +1332,8 @@ public OrderSearchPresetRequest facetByCommercePlatformAs(String facetName, C } public OrderSearchPresetRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets); + addFacet(facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -1049,6 +1347,11 @@ public OrderSearchPresetRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public OrderSearchPresetRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java index b42414fa1..e44b5a8a9 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java @@ -6,9 +6,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.util.Objects; @@ -23,91 +25,122 @@ public class OrderStatus extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "OrderStatus"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f26f586dd82cdacffeee3bb7fe1ac1ef7385535d6ef257cd764ee435607e21c9"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("code", 2), java.util.Map.entry("color", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("commerce_platform", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("color", java.util.List.of("color", "color")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderStatus.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; public static final String CODE_PROPERTY = "code"; public static final String COLOR_PROPERTY = "color"; - public static final String DISPLAY_ORDER_PROPERTY = "displayOrder"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commercePlatform"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customerOrderList"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; private String name; + private String code; + private String color; + private BigDecimal displayOrder; + private CommercePlatform commercePlatform; + private SmartList customerOrderList; public String getName(){ return this.name; } + public String getCode(){ return this.code; } + public String getColor(){ return this.color; } + public BigDecimal getDisplayOrder(){ return this.displayOrder; } + public CommercePlatform getCommercePlatform(){ return this.commercePlatform; } + public SmartList getCustomerOrderList(){ - return this.customerOrderList; + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; } public OrderStatus updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public OrderStatus updateCode(String code){ code = (code == null ? null : code.trim()); - if(Objects.equals(this.code, code)){ + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ return this; } handleUpdate(CODE_PROPERTY, getCode(), code); this.code = code; return this; } + public OrderStatus updateColor(String color){ color = (color == null ? null : color.trim()); - if(Objects.equals(this.color, color)){ + if(isPropertyLoaded(COLOR_PROPERTY) && Objects.equals(this.color, color)){ return this; } handleUpdate(COLOR_PROPERTY, getColor(), color); this.color = color; return this; } + public OrderStatus updateDisplayOrder(BigDecimal displayOrder){ - if(Objects.equals(this.displayOrder, displayOrder)){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ return this; } handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); this.displayOrder = displayOrder; return this; } + public OrderStatus updateCommercePlatform(CommercePlatform commercePlatform){ - if(Objects.equals(this.commercePlatform, commercePlatform)){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ return this; } handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); this.commercePlatform = commercePlatform; return this; } + public OrderStatus addCustomerOrder(CustomerOrder customerOrder){ if (customerOrder == null){ return this; } if(null == this.customerOrderList){ - this.customerOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); } this.customerOrderList.add(customerOrder); - customerOrder.cacheRelation(CustomerOrder.STATUS_PROPERTY, this); + customerOrder.updateProperty(CustomerOrder.STATUS_PROPERTY, this); return this; } @@ -130,13 +163,14 @@ public OrderStatus comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; @@ -144,11 +178,11 @@ public void __internalSet(String property, Object value) { case "color": this.color = (value == null ? null : ((String)value).trim()); break; - case "displayOrder": this.displayOrder = (BigDecimal) value; break; + case "display_order": this.displayOrder = (BigDecimal) value; break; - case "commercePlatform": this.commercePlatform = (CommercePlatform) value; break; + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - case "customerOrderList": this.customerOrderList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -160,10 +194,20 @@ public Object __internalGet(String property) { case "name": return this.name; case "code": return this.code; case "color": return this.color; - case "displayOrder": return this.displayOrder; - case "commercePlatform": return this.commercePlatform; - case "customerOrderList": return this.customerOrderList; - default: return super.__internalGet(property); + case "display_order": return this.displayOrder; + case "commerce_platform": return this.commercePlatform; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "code": return this.code; + case "color": return this.color; + case "displayOrder": return this.displayOrder; + case "commercePlatform": return this.commercePlatform; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java index bb8bdb48d..8ef805422 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java @@ -16,66 +16,83 @@ public String type(){ return OrderStatus.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, OrderStatus orderStatus, ObjectLocation _parentLocation){ - if(needCheck(_ctx, orderStatus)){ - markAsChecked(_ctx, orderStatus); - doCheck(_ctx, orderStatus, _parentLocation); + public void checkAndFix(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ + if(needCheck(_context, orderStatus)){ + markAsChecked(_context, orderStatus); + doCheck(_context, orderStatus, _parentLocation); } } - public void doCheck(UserContext _ctx, OrderStatus orderStatus, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ if((orderStatus == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderStatus); + if(orderStatus.needPersist()){ + } if(orderStatus.newItem()){ }else if(orderStatus.updateItem()){ + if(!orderStatus.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("color")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "color"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("display_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + } - checkName(_ctx, orderStatus.getProperty(OrderStatus.NAME_PROPERTY), newLocation(_parentLocation, OrderStatus.NAME_PROPERTY)); - checkCode(_ctx, orderStatus.getProperty(OrderStatus.CODE_PROPERTY), newLocation(_parentLocation, OrderStatus.CODE_PROPERTY)); - checkColor(_ctx, orderStatus.getProperty(OrderStatus.COLOR_PROPERTY), newLocation(_parentLocation, OrderStatus.COLOR_PROPERTY)); - checkDisplayOrder(_ctx, orderStatus.getProperty(OrderStatus.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, OrderStatus.DISPLAY_ORDER_PROPERTY)); - checkCommercePlatform(_ctx, orderStatus.getProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); + checkName(_context, orderStatus.getProperty(OrderStatus.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, orderStatus.getProperty(OrderStatus.CODE_PROPERTY), newLocation(_parentLocation, "code")); + checkColor(_context, orderStatus.getProperty(OrderStatus.COLOR_PROPERTY), newLocation(_parentLocation, "color")); + checkDisplayOrder(_context, orderStatus.getProperty(OrderStatus.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); + checkCommercePlatform(_context, orderStatus.getProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); for(int i = 0; orderStatus.getCustomerOrderList() != null && i < orderStatus.getCustomerOrderList().size(); i++){ CustomerOrder customerOrder = orderStatus.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_ctx, customerOrder, newLocation(_parentLocation, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, i)); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); } } - public void checkName(UserContext _ctx, String name, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, name); + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); if((name == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, name); + maxStringCheck(_context, _parentLocation, 100, name); } - public void checkCode(UserContext _ctx, String code, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, code); + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); if((code == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, code); + maxStringCheck(_context, _parentLocation, 100, code); } - public void checkColor(UserContext _ctx, String color, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, color); + public void checkColor(UserContext _context, String color, ObjectLocation _parentLocation){ if((color == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, color); + maxStringCheck(_context, _parentLocation, 100, color); } - public void checkDisplayOrder(UserContext _ctx, BigDecimal displayOrder, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, displayOrder); + public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ if((displayOrder == null)){ return; } } - public void checkCommercePlatform(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, commercePlatform); + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); if((commercePlatform == null)){ return; } - new CommercePlatformChecker().checkAndFix(_ctx, commercePlatform, _parentLocation); + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); } } \ No newline at end of file diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java index 8dcebb34c..0b3343d3a 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java @@ -39,35 +39,35 @@ public boolean isNull() { public Expression getName(){ - return apply(OrderStatus::getName); + return loaded("name", "getName", OrderStatus::getName); } public OrderStatusExpression updateName(String name){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateName(name)); } public Expression getCode(){ - return apply(OrderStatus::getCode); + return loaded("code", "getCode", OrderStatus::getCode); } public OrderStatusExpression updateCode(String code){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCode(code)); } public Expression getColor(){ - return apply(OrderStatus::getColor); + return loaded("color", "getColor", OrderStatus::getColor); } public OrderStatusExpression updateColor(String color){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateColor(color)); } public Expression getDisplayOrder(){ - return apply(OrderStatus::getDisplayOrder); + return loaded("display_order", "getDisplayOrder", OrderStatus::getDisplayOrder); } public OrderStatusExpression updateDisplayOrder(BigDecimal displayOrder){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateDisplayOrder(displayOrder)); } public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(this, $it -> ((OrderStatus)$it).getCommercePlatform()); + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderStatus::getCommercePlatform)); } public OrderStatusExpression updateCommercePlatform(CommercePlatform commercePlatform){ @@ -75,7 +75,7 @@ public OrderStatusExpression updateCommercePlatform(CommercePlatform co } public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(this, $it -> ((OrderStatus)$it).getCustomerOrderList()); + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", OrderStatus::getCustomerOrderList)); } public OrderStatusExpression addCustomerOrder(CustomerOrder customerOrder){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).addCustomerOrder(customerOrder)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java index f9612e826..7196f1575 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java @@ -14,6 +14,7 @@ import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; import java.math.BigDecimal; +import java.util.Objects; public class OrderStatusRequest extends BaseRequest { @@ -22,8 +23,13 @@ public class OrderStatusRequest extends BaseRequest { * instead of constructing request builders directly. */ @Deprecated + @SuppressWarnings("unchecked") public OrderStatusRequest(Class returnType){ - super(returnType); + this(returnType, () -> (T) new OrderStatus()); + } + + protected OrderStatusRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -33,6 +39,19 @@ public OrderStatusRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderStatusRequest copy(){ + return (OrderStatusRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderStatusRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderStatusRequest returnType(Class returnType){ @@ -56,6 +75,36 @@ public OrderStatusRequest propagateAggregationCache(long cacheExpiredMillis){ return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderStatusRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderStatusRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderStatusRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderStatusRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderStatusRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public OrderStatusRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (OrderStatusRequest)super.appendSearchCriteria(searchCriteria); } @@ -70,6 +119,12 @@ public OrderStatusRequest matchingAnyOf(OrderStatusRequest orderStatus){ return this; } + public OrderStatusRequest matchingIdsOf(OrderStatusRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderStatus.ID_PROPERTY, request, OrderStatus.ID_PROPERTY)); + } + public OrderStatusRequest enhanceChildrenIfNeeded(){ return this; } @@ -93,6 +148,19 @@ public OrderStatusRequest selectSelfFields(){ return selectSelf(); } + public OrderStatusRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderStatus.ID_PROPERTY); + selectProperty(OrderStatus.NAME_PROPERTY); + selectProperty(OrderStatus.CODE_PROPERTY); + selectProperty(OrderStatus.COLOR_PROPERTY); + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + selectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + public OrderStatusRequest selectAll(){ super.selectAll(); return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatform().selectVersion(); @@ -209,7 +277,8 @@ public OrderStatusRequest selectCommercePlatform(){ public OrderStatusRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform); + enhanceRelation(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -239,7 +308,8 @@ public OrderStatusRequest selectCustomerOrderList(){ } public OrderStatusRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList); + enhanceRelation(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -251,11 +321,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderStatus.ID_PROPERTY, operator, values); } - public OrderStatusRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public OrderStatusRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public OrderStatusRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public OrderStatusRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderStatusRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -283,6 +361,17 @@ public SearchCriteria createNameCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderStatus.NAME_PROPERTY, operator, values); } + public OrderStatusRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public OrderStatusRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public OrderStatusRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } public OrderStatusRequest withNameGreaterThan(String name){ return withName(Operator.GREATER_THAN, name); } @@ -309,10 +398,22 @@ public OrderStatusRequest withNameContaining(String name){ return withName(Operator.CONTAIN, name); } + public OrderStatusRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public OrderStatusRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + public OrderStatusRequest withNameEndingWith(String name){ return withName(Operator.END_WITH, name); } + public OrderStatusRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + public OrderStatusRequest withNameIs(String name){ return withName(Operator.EQUAL, name); } @@ -346,6 +447,17 @@ public SearchCriteria createCodeCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderStatus.CODE_PROPERTY, operator, values); } + public OrderStatusRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public OrderStatusRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public OrderStatusRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } public OrderStatusRequest withCodeGreaterThan(String code){ return withCode(Operator.GREATER_THAN, code); } @@ -372,10 +484,22 @@ public OrderStatusRequest withCodeContaining(String code){ return withCode(Operator.CONTAIN, code); } + public OrderStatusRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public OrderStatusRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + public OrderStatusRequest withCodeEndingWith(String code){ return withCode(Operator.END_WITH, code); } + public OrderStatusRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + public OrderStatusRequest withCodeIs(String code){ return withCode(Operator.EQUAL, code); } @@ -409,6 +533,17 @@ public SearchCriteria createColorCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(OrderStatus.COLOR_PROPERTY, operator, values); } + public OrderStatusRequest withColorIsNot(String color){ + return withColor(Operator.NOT_EQUAL, color); + } + + public OrderStatusRequest withColorIn(String... color){ + return withColor(Operator.IN, (Object[])color); + } + + public OrderStatusRequest withColorNotIn(String... color){ + return withColor(Operator.NOT_IN, (Object[])color); + } public OrderStatusRequest withColorGreaterThan(String color){ return withColor(Operator.GREATER_THAN, color); } @@ -435,10 +570,22 @@ public OrderStatusRequest withColorContaining(String color){ return withColor(Operator.CONTAIN, color); } + public OrderStatusRequest withColorNotContaining(String color){ + return withColor(Operator.NOT_CONTAIN, color); + } + + public OrderStatusRequest withColorNotStartingWith(String color){ + return withColor(Operator.NOT_BEGIN_WITH, color); + } + public OrderStatusRequest withColorEndingWith(String color){ return withColor(Operator.END_WITH, color); } + public OrderStatusRequest withColorNotEndingWith(String color){ + return withColor(Operator.NOT_END_WITH, color); + } + public OrderStatusRequest withColorIs(String color){ return withColor(Operator.EQUAL, color); } @@ -472,6 +619,21 @@ public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... va return createBasicSearchCriteria(OrderStatus.DISPLAY_ORDER_PROPERTY, operator, values); } + public OrderStatusRequest withDisplayOrderIs(BigDecimal displayOrder){ + return withDisplayOrder(Operator.EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderIsNot(BigDecimal displayOrder){ + return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.IN, (Object[])displayOrder); + } + + public OrderStatusRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); + } public OrderStatusRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ return withDisplayOrder(Operator.GREATER_THAN, displayOrder); } @@ -527,6 +689,11 @@ public OrderStatusRequest withCommercePlatformMatching(CommercePlatformReques return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); } + public OrderStatusRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + public OrderStatusRequest filterByVersion(Long... version){ if (version == null || version.length == 0) { throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); @@ -550,6 +717,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(OrderStatus.VERSION_PROPERTY, operator, values); } + public OrderStatusRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderStatusRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderStatusRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderStatusRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public OrderStatusRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -570,6 +752,7 @@ public OrderStatusRequest withVersionBetween(Long startOfVersion, Long endOfV return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public OrderStatusRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY)); } @@ -588,10 +771,12 @@ public OrderStatusRequest haveNoCustomerOrders(){ public OrderStatusRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public OrderStatusRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public OrderStatusRequest minDisplayOrder(){ @@ -668,6 +853,62 @@ public OrderStatusRequest groupByCommercePlatformWithDetails(CommercePlatform } + public OrderStatusRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderStatusRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.ID_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderStatusRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public OrderStatusRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctColor(){ + return countDistinctColorAs("color_distinct_count"); + } + + public OrderStatusRequest countDistinctColorAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public OrderStatusRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public OrderStatusRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderStatusRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.VERSION_PROPERTY); + return this; + } public OrderStatusRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ aggregate(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); return this; @@ -748,7 +989,8 @@ public OrderStatusRequest groupByDisplayOrderWithFunction(String retName, Agg return this; } public OrderStatusRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(OrderStatus.COMMERCE_PLATFORM_PROPERTY, subRequest); + groupBy(OrderStatus.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); return this; } public OrderStatusRequest groupByCommercePlatform(){ @@ -883,8 +1125,8 @@ public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrde } public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(CustomerOrder.STATUS_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -893,25 +1135,35 @@ public OrderStatusRequest statsFromCustomerOrders(CustomerOrderRequest subReq } public CommercePlatformRequest rollUpToCommercePlatform(){ CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.withCommercePlatformMatching(commercePlatform) - .groupByCommercePlatformWith(commercePlatform); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); return commercePlatform; } public OrderStatusRequest countCustomerOrders(){ - return countCustomerOrdersAs("Count"); + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest countCustomerOrdersAs(String name){ - return countCustomerOrdersWith(name, Q.customerOrders().unlimited()); + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest minTotalAmountOfCustomerOrders(){ - return minTotalAmountOfCustomerOrdersAs("minTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name){ @@ -919,10 +1171,18 @@ public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name){ } public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.minTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest maxTotalAmountOfCustomerOrders(){ - return maxTotalAmountOfCustomerOrdersAs("maxTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name){ @@ -930,10 +1190,18 @@ public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name){ } public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.maxTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest sumTotalAmountOfCustomerOrders(){ - return sumTotalAmountOfCustomerOrdersAs("sumTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name){ @@ -941,10 +1209,18 @@ public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name){ } public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.sumTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest avgTotalAmountOfCustomerOrders(){ - return avgTotalAmountOfCustomerOrdersAs("avgTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name){ @@ -952,10 +1228,18 @@ public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name){ } public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.avgTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrders(){ - return standardDeviationTotalAmountOfCustomerOrdersAs("stdDevTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ @@ -963,10 +1247,18 @@ public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(Stri } public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.standardDeviationTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs("stdDevPopTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ @@ -974,10 +1266,18 @@ public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountO } public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.squareRootOfPopulationStandardDeviationTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrders(){ - return sampleVarianceTotalAmountOfCustomerOrdersAs("varSampTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ @@ -985,10 +1285,18 @@ public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String } public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.sampleVarianceTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs("varPopTotalAmountOfCustomerOrders"); + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ @@ -996,7 +1304,11 @@ public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrders } public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.samplePopulationVarianceTotalAmount(), true); + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public OrderStatusRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ @@ -1004,7 +1316,8 @@ public OrderStatusRequest facetByCommercePlatformAs(String facetName, Commerc } public OrderStatusRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets); + addFacet(facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -1018,6 +1331,11 @@ public OrderStatusRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public OrderStatusRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java index 9fa350d37..f7dddf0e5 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java @@ -6,9 +6,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.time.LocalDateTime; import java.util.Objects; @@ -23,104 +25,138 @@ public class Product extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "Product"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "53d713469d480508489d19bea0bdb683bf3d6b9b5c37b81ba4c247b0200f2d0d"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("sku", 2), java.util.Map.entry("image_url", 3), java.util.Map.entry("commerce_platform", 4), java.util.Map.entry("create_time", 5), java.util.Map.entry("update_time", 6), java.util.Map.entry("version", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("image_url", java.util.List.of("imageUrl", "image_url")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_line_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Product.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; public static final String SKU_PROPERTY = "sku"; - public static final String IMAGE_URL_PROPERTY = "imageUrl"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commercePlatform"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; - public static final String ORDER_LINE_LIST_PROPERTY = "orderLineList"; + public static final String IMAGE_URL_PROPERTY = "image_url"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; private String name; + private String sku; + private String imageUrl; + private CommercePlatform commercePlatform; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private SmartList orderLineList; public String getName(){ return this.name; } + public String getSku(){ return this.sku; } + public String getImageUrl(){ return this.imageUrl; } + public CommercePlatform getCommercePlatform(){ return this.commercePlatform; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public SmartList getOrderLineList(){ - return this.orderLineList; + return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; } public Product updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public Product updateSku(String sku){ sku = (sku == null ? null : sku.trim()); - if(Objects.equals(this.sku, sku)){ + if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ return this; } handleUpdate(SKU_PROPERTY, getSku(), sku); this.sku = sku; return this; } + public Product updateImageUrl(String imageUrl){ imageUrl = (imageUrl == null ? null : imageUrl.trim()); - if(Objects.equals(this.imageUrl, imageUrl)){ + if(isPropertyLoaded(IMAGE_URL_PROPERTY) && Objects.equals(this.imageUrl, imageUrl)){ return this; } handleUpdate(IMAGE_URL_PROPERTY, getImageUrl(), imageUrl); this.imageUrl = imageUrl; return this; } + public Product updateCommercePlatform(CommercePlatform commercePlatform){ - if(Objects.equals(this.commercePlatform, commercePlatform)){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ return this; } handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); this.commercePlatform = commercePlatform; return this; } + public Product updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public Product updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); this.updateTime = updateTime; return this; } + public Product addOrderLine(OrderLine orderLine){ if (orderLine == null){ return this; } if(null == this.orderLineList){ - this.orderLineList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderLineList = teaqlUnloadedItems.map(value -> value); } this.orderLineList.add(orderLine); - orderLine.cacheRelation(OrderLine.PRODUCT_PROPERTY, this); + orderLine.updateProduct(this); return this; } @@ -143,27 +179,28 @@ public Product comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @Override @FrameworkInternal public void __internalSet(String property, Object value) { + markPropertyLoaded(property); switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; - case "imageUrl": this.imageUrl = (value == null ? null : ((String)value).trim()); break; + case "image_url": this.imageUrl = (value == null ? null : ((String)value).trim()); break; - case "commercePlatform": this.commercePlatform = (CommercePlatform) value; break; + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; - case "orderLineList": this.orderLineList = (SmartList) value; break; + case "order_line_list": this.orderLineList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -174,12 +211,23 @@ public Object __internalGet(String property) { switch (property) { case "name": return this.name; case "sku": return this.sku; - case "imageUrl": return this.imageUrl; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - case "orderLineList": return this.orderLineList; - default: return super.__internalGet(property); + case "image_url": return this.imageUrl; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "order_line_list": return this.orderLineList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "sku": return this.sku; + case "imageUrl": return this.imageUrl; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java index b3d8dadbb..2bbb9c1c5 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java @@ -16,77 +16,115 @@ public String type(){ return Product.INTERNAL_TYPE; } - public void checkAndFix(UserContext _ctx, Product product, ObjectLocation _parentLocation){ - if(needCheck(_ctx, product)){ - markAsChecked(_ctx, product); - doCheck(_ctx, product, _parentLocation); + public void checkAndFix(UserContext _context, Product product, ObjectLocation _parentLocation){ + if(needCheck(_context, product)){ + markAsChecked(_context, product); + doCheck(_context, product, _parentLocation); } } - public void doCheck(UserContext _ctx, Product product, ObjectLocation _parentLocation){ + public void doCheck(UserContext _context, Product product, ObjectLocation _parentLocation){ if((product == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, product); + if(product.needPersist()){ + } if(product.newItem()){ - if(product.getCreateTime() == null){ - product.updateCreateTime(java.time.LocalDateTime.now()); - }if(product.getUpdateTime() == null){ - product.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + product.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + product.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(product.updateItem()){ - product.updateUpdateTime(java.time.LocalDateTime.now()); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + product.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!product.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("sku")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("image_url")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "image_url"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + } - checkName(_ctx, product.getProperty(Product.NAME_PROPERTY), newLocation(_parentLocation, Product.NAME_PROPERTY)); - checkSku(_ctx, product.getProperty(Product.SKU_PROPERTY), newLocation(_parentLocation, Product.SKU_PROPERTY)); - checkImageUrl(_ctx, product.getProperty(Product.IMAGE_URL_PROPERTY), newLocation(_parentLocation, Product.IMAGE_URL_PROPERTY)); - checkCommercePlatform(_ctx, product.getProperty(Product.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, Product.COMMERCE_PLATFORM_PROPERTY)); - checkCreateTime(_ctx, product.getProperty(Product.CREATE_TIME_PROPERTY), newLocation(_parentLocation, Product.CREATE_TIME_PROPERTY)); - checkUpdateTime(_ctx, product.getProperty(Product.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, Product.UPDATE_TIME_PROPERTY)); + checkName(_context, product.getProperty(Product.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkSku(_context, product.getProperty(Product.SKU_PROPERTY), newLocation(_parentLocation, "sku")); + checkImageUrl(_context, product.getProperty(Product.IMAGE_URL_PROPERTY), newLocation(_parentLocation, "image_url")); + checkCommercePlatform(_context, product.getProperty(Product.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, product.getProperty(Product.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, product.getProperty(Product.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); for(int i = 0; product.getOrderLineList() != null && i < product.getOrderLineList().size(); i++){ OrderLine orderLine = product.getOrderLineList().get(i); - new OrderLineChecker().checkAndFix(_ctx, orderLine, newLocation(_parentLocation, Product.ORDER_LINE_LIST_PROPERTY, i)); + new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); } } - public void checkName(UserContext _ctx, String name, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, name); + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); if((name == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, name); + maxStringCheck(_context, _parentLocation, 100, name); } - public void checkSku(UserContext _ctx, String sku, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, sku); + public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sku); if((sku == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, sku); + maxStringCheck(_context, _parentLocation, 100, sku); } - public void checkImageUrl(UserContext _ctx, String imageUrl, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, imageUrl); + public void checkImageUrl(UserContext _context, String imageUrl, ObjectLocation _parentLocation){ if((imageUrl == null)){ return; } - maxStringCheck(_ctx, _parentLocation, 100, imageUrl); + maxStringCheck(_context, _parentLocation, 100, imageUrl); } - public void checkCommercePlatform(UserContext _ctx, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, commercePlatform); + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); if((commercePlatform == null)){ return; } - new CommercePlatformChecker().checkAndFix(_ctx, commercePlatform, _parentLocation); + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); } - public void checkCreateTime(UserContext _ctx, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, createTime); + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); if((createTime == null)){ return; } } - public void checkUpdateTime(UserContext _ctx, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_ctx, _parentLocation, updateTime); + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); if((updateTime == null)){ return; } diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java index b69f63d0f..f548bbf54 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java @@ -39,28 +39,28 @@ public boolean isNull() { public Expression getName(){ - return apply(Product::getName); + return loaded("name", "getName", Product::getName); } public ProductExpression updateName(String name){ return new ProductExpression(this, $it -> ((Product)$it).updateName(name)); } public Expression getSku(){ - return apply(Product::getSku); + return loaded("sku", "getSku", Product::getSku); } public ProductExpression updateSku(String sku){ return new ProductExpression(this, $it -> ((Product)$it).updateSku(sku)); } public Expression getImageUrl(){ - return apply(Product::getImageUrl); + return loaded("image_url", "getImageUrl", Product::getImageUrl); } public ProductExpression updateImageUrl(String imageUrl){ return new ProductExpression(this, $it -> ((Product)$it).updateImageUrl(imageUrl)); } public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(this, $it -> ((Product)$it).getCommercePlatform()); + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", Product::getCommercePlatform)); } public ProductExpression updateCommercePlatform(CommercePlatform commercePlatform){ @@ -68,21 +68,21 @@ public ProductExpression updateCommercePlatform(CommercePlatform commer } public Expression getCreateTime(){ - return apply(Product::getCreateTime); + return loaded("create_time", "getCreateTime", Product::getCreateTime); } public ProductExpression updateCreateTime(LocalDateTime createTime){ return new ProductExpression(this, $it -> ((Product)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return apply(Product::getUpdateTime); + return loaded("update_time", "getUpdateTime", Product::getUpdateTime); } public ProductExpression updateUpdateTime(LocalDateTime updateTime){ return new ProductExpression(this, $it -> ((Product)$it).updateUpdateTime(updateTime)); } public OrderLineListExpression getOrderLineList(){ - return new OrderLineListExpression(this, $it -> ((Product)$it).getOrderLineList()); + return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", Product::getOrderLineList)); } public ProductExpression addOrderLine(OrderLine orderLine){ return new ProductExpression(this, $it -> ((Product)$it).addOrderLine(orderLine)); diff --git a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java index 2707bbf85..87244ae9c 100644 --- a/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java +++ b/examples/order-management/java-lib-core/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java @@ -15,6 +15,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class ProductRequest extends BaseRequest { @@ -23,8 +24,13 @@ public class ProductRequest extends BaseRequest { * instead of constructing request builders directly. */ @Deprecated + @SuppressWarnings("unchecked") public ProductRequest(Class returnType){ - super(returnType); + this(returnType, () -> (T) new Product()); + } + + protected ProductRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -34,6 +40,19 @@ public ProductRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ProductRequest copy(){ + return (ProductRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ProductRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public ProductRequest returnType(Class returnType){ @@ -57,6 +76,36 @@ public ProductRequest propagateAggregationCache(long cacheExpiredMillis){ return this; } + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public ProductRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ProductRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ProductRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ProductRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ProductRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + public ProductRequest appendSearchCriteria(SearchCriteria searchCriteria){ return (ProductRequest)super.appendSearchCriteria(searchCriteria); } @@ -71,6 +120,12 @@ public ProductRequest matchingAnyOf(ProductRequest product){ return this; } + public ProductRequest matchingIdsOf(ProductRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Product.ID_PROPERTY, request, Product.ID_PROPERTY)); + } + public ProductRequest enhanceChildrenIfNeeded(){ return this; } @@ -94,6 +149,20 @@ public ProductRequest selectSelfFields(){ return selectSelf(); } + public ProductRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Product.ID_PROPERTY); + selectProperty(Product.NAME_PROPERTY); + selectProperty(Product.SKU_PROPERTY); + selectProperty(Product.IMAGE_URL_PROPERTY); + selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); + selectProperty(Product.CREATE_TIME_PROPERTY); + selectProperty(Product.UPDATE_TIME_PROPERTY); + selectProperty(Product.VERSION_PROPERTY); + return this; + } + public ProductRequest selectAll(){ super.selectAll(); return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); @@ -185,7 +254,8 @@ public ProductRequest selectCommercePlatform(){ public ProductRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform); + enhanceRelation(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, Product.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -249,7 +319,8 @@ public ProductRequest selectOrderLineList(){ } public ProductRequest selectOrderLineListWith(OrderLineRequest orderLineList){ - enhanceRelation(Product.ORDER_LINE_LIST_PROPERTY, orderLineList); + enhanceRelation(Product.ORDER_LINE_LIST_PROPERTY, orderLineList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, Product.ORDER_LINE_LIST_PROPERTY)); return this; } @@ -261,11 +332,19 @@ public SearchCriteria createIdCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(Product.ID_PROPERTY, operator, values); } - public ProductRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); + public ProductRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); } + public ProductRequest withIdIn(Long... id){ - return withId(Operator.EQUAL, (Object[])id); + return withId(Operator.IN, (Object[])id); + } + + public ProductRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ProductRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); } @@ -293,6 +372,17 @@ public SearchCriteria createNameCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(Product.NAME_PROPERTY, operator, values); } + public ProductRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public ProductRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public ProductRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } public ProductRequest withNameGreaterThan(String name){ return withName(Operator.GREATER_THAN, name); } @@ -319,10 +409,22 @@ public ProductRequest withNameContaining(String name){ return withName(Operator.CONTAIN, name); } + public ProductRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public ProductRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + public ProductRequest withNameEndingWith(String name){ return withName(Operator.END_WITH, name); } + public ProductRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + public ProductRequest withNameIs(String name){ return withName(Operator.EQUAL, name); } @@ -356,6 +458,17 @@ public SearchCriteria createSkuCriteria(Operator operator, Object... values) { return createBasicSearchCriteria(Product.SKU_PROPERTY, operator, values); } + public ProductRequest withSkuIsNot(String sku){ + return withSku(Operator.NOT_EQUAL, sku); + } + + public ProductRequest withSkuIn(String... sku){ + return withSku(Operator.IN, (Object[])sku); + } + + public ProductRequest withSkuNotIn(String... sku){ + return withSku(Operator.NOT_IN, (Object[])sku); + } public ProductRequest withSkuGreaterThan(String sku){ return withSku(Operator.GREATER_THAN, sku); } @@ -382,10 +495,22 @@ public ProductRequest withSkuContaining(String sku){ return withSku(Operator.CONTAIN, sku); } + public ProductRequest withSkuNotContaining(String sku){ + return withSku(Operator.NOT_CONTAIN, sku); + } + + public ProductRequest withSkuNotStartingWith(String sku){ + return withSku(Operator.NOT_BEGIN_WITH, sku); + } + public ProductRequest withSkuEndingWith(String sku){ return withSku(Operator.END_WITH, sku); } + public ProductRequest withSkuNotEndingWith(String sku){ + return withSku(Operator.NOT_END_WITH, sku); + } + public ProductRequest withSkuIs(String sku){ return withSku(Operator.EQUAL, sku); } @@ -419,6 +544,17 @@ public SearchCriteria createImageUrlCriteria(Operator operator, Object... values return createBasicSearchCriteria(Product.IMAGE_URL_PROPERTY, operator, values); } + public ProductRequest withImageUrlIsNot(String imageUrl){ + return withImageUrl(Operator.NOT_EQUAL, imageUrl); + } + + public ProductRequest withImageUrlIn(String... imageUrl){ + return withImageUrl(Operator.IN, (Object[])imageUrl); + } + + public ProductRequest withImageUrlNotIn(String... imageUrl){ + return withImageUrl(Operator.NOT_IN, (Object[])imageUrl); + } public ProductRequest withImageUrlGreaterThan(String imageUrl){ return withImageUrl(Operator.GREATER_THAN, imageUrl); } @@ -445,10 +581,22 @@ public ProductRequest withImageUrlContaining(String imageUrl){ return withImageUrl(Operator.CONTAIN, imageUrl); } + public ProductRequest withImageUrlNotContaining(String imageUrl){ + return withImageUrl(Operator.NOT_CONTAIN, imageUrl); + } + + public ProductRequest withImageUrlNotStartingWith(String imageUrl){ + return withImageUrl(Operator.NOT_BEGIN_WITH, imageUrl); + } + public ProductRequest withImageUrlEndingWith(String imageUrl){ return withImageUrl(Operator.END_WITH, imageUrl); } + public ProductRequest withImageUrlNotEndingWith(String imageUrl){ + return withImageUrl(Operator.NOT_END_WITH, imageUrl); + } + public ProductRequest withImageUrlIs(String imageUrl){ return withImageUrl(Operator.EQUAL, imageUrl); } @@ -492,6 +640,11 @@ public ProductRequest withCommercePlatformMatching(CommercePlatformRequest co return appendSearchCriteria(new SubQuerySearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); } + public ProductRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + public ProductRequest filterByCreateTime(LocalDateTime... createTime){ if (createTime == null || createTime.length == 0) { throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); @@ -515,6 +668,21 @@ public SearchCriteria createCreateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(Product.CREATE_TIME_PROPERTY, operator, values); } + public ProductRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public ProductRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public ProductRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public ProductRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } public ProductRequest withCreateTimeGreaterThan(LocalDateTime createTime){ return withCreateTime(Operator.GREATER_THAN, createTime); } @@ -580,6 +748,21 @@ public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... valu return createBasicSearchCriteria(Product.UPDATE_TIME_PROPERTY, operator, values); } + public ProductRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public ProductRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public ProductRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public ProductRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } public ProductRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ return withUpdateTime(Operator.GREATER_THAN, updateTime); } @@ -645,6 +828,21 @@ public SearchCriteria createVersionCriteria(Operator operator, Object... values) return createBasicSearchCriteria(Product.VERSION_PROPERTY, operator, values); } + public ProductRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ProductRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ProductRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ProductRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } public ProductRequest withVersionGreaterThan(Long version){ return withVersion(Operator.GREATER_THAN, version); } @@ -665,6 +863,7 @@ public ProductRequest withVersionBetween(Long startOfVersion, Long endOfVersi return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public ProductRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(Product.ID_PROPERTY, orderLineRequest, OrderLine.PRODUCT_PROPERTY)); } @@ -683,10 +882,12 @@ public ProductRequest haveNoOrderLines(){ public ProductRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public ProductRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public ProductRequest groupByCommercePlatformWithDetails(){ @@ -701,6 +902,70 @@ public ProductRequest groupByCommercePlatformWithDetails(CommercePlatformRequ + public ProductRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ProductRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Product.ID_PROPERTY); + return this; + } + public ProductRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public ProductRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Product.NAME_PROPERTY); + return this; + } + public ProductRequest countDistinctSku(){ + return countDistinctSkuAs("sku_distinct_count"); + } + + public ProductRequest countDistinctSkuAs(String alias){ + super.countDistinctProperty(alias, Product.SKU_PROPERTY); + return this; + } + public ProductRequest countDistinctImageUrl(){ + return countDistinctImageUrlAs("image_url_distinct_count"); + } + + public ProductRequest countDistinctImageUrlAs(String alias){ + super.countDistinctProperty(alias, Product.IMAGE_URL_PROPERTY); + return this; + } + public ProductRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public ProductRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public ProductRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public ProductRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Product.CREATE_TIME_PROPERTY); + return this; + } + public ProductRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public ProductRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Product.UPDATE_TIME_PROPERTY); + return this; + } + public ProductRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ProductRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Product.VERSION_PROPERTY); + return this; + } public ProductRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ aggregate(Product.ORDER_LINE_LIST_PROPERTY, subRequest); return this; @@ -766,7 +1031,8 @@ public ProductRequest groupByImageUrlWithFunction(String retName, AggrFunctio return this; } public ProductRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(Product.COMMERCE_PLATFORM_PROPERTY, subRequest); + groupBy(Product.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); return this; } public ProductRequest groupByCommercePlatform(){ @@ -941,8 +1207,8 @@ public ProductRequest statsFromOrderLinesAs(String name, OrderLineRequest sub } public ProductRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(OrderLine.PRODUCT_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); return this; } @@ -951,8 +1217,8 @@ public ProductRequest statsFromOrderLines(OrderLineRequest subRequest){ } public CommercePlatformRequest rollUpToCommercePlatform(){ CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.withCommercePlatformMatching(commercePlatform) - .groupByCommercePlatformWith(commercePlatform); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); return commercePlatform; } @@ -960,18 +1226,28 @@ public CommercePlatformRequest rollUpToCommercePlatform(){ public ProductRequest countOrderLines(){ - return countOrderLinesAs("Count"); + addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.PRODUCT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest countOrderLinesAs(String name){ - return countOrderLinesWith(name, Q.orderLines().unlimited()); + addRelationCount(name, Q.orderLines().unlimited(), OrderLine.PRODUCT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, OrderLine.PRODUCT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest minQuantityOfOrderLines(){ - return minQuantityOfOrderLinesAs("minQuantityOfOrderLines"); + addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest minQuantityOfOrderLinesAs(String name){ @@ -979,10 +1255,18 @@ public ProductRequest minQuantityOfOrderLinesAs(String name){ } public ProductRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.minQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest maxQuantityOfOrderLines(){ - return maxQuantityOfOrderLinesAs("maxQuantityOfOrderLines"); + addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest maxQuantityOfOrderLinesAs(String name){ @@ -990,10 +1274,18 @@ public ProductRequest maxQuantityOfOrderLinesAs(String name){ } public ProductRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.maxQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest sumQuantityOfOrderLines(){ - return sumQuantityOfOrderLinesAs("sumQuantityOfOrderLines"); + addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest sumQuantityOfOrderLinesAs(String name){ @@ -1001,10 +1293,18 @@ public ProductRequest sumQuantityOfOrderLinesAs(String name){ } public ProductRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.sumQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest avgQuantityOfOrderLines(){ - return avgQuantityOfOrderLinesAs("avgQuantityOfOrderLines"); + addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest avgQuantityOfOrderLinesAs(String name){ @@ -1012,10 +1312,18 @@ public ProductRequest avgQuantityOfOrderLinesAs(String name){ } public ProductRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.avgQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest standardDeviationQuantityOfOrderLines(){ - return standardDeviationQuantityOfOrderLinesAs("stdDevQuantityOfOrderLines"); + addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name){ @@ -1023,10 +1331,18 @@ public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name){ } public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.standardDeviationQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs("stdDevPopQuantityOfOrderLines"); + addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ @@ -1034,10 +1350,18 @@ public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderL } public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.squareRootOfPopulationStandardDeviationQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest sampleVarianceQuantityOfOrderLines(){ - return sampleVarianceQuantityOfOrderLinesAs("varSampQuantityOfOrderLines"); + addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name){ @@ -1045,10 +1369,18 @@ public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name){ } public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.sampleVarianceQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest samplePopulationVarianceQuantityOfOrderLines(){ - return samplePopulationVarianceQuantityOfOrderLinesAs("varPopQuantityOfOrderLines"); + addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ @@ -1056,7 +1388,11 @@ public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String n } public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest.samplePopulationVarianceQuantity(), true); + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; } public ProductRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ @@ -1064,7 +1400,8 @@ public ProductRequest facetByCommercePlatformAs(String facetName, CommercePla } public ProductRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets); + addFacet(facetName, Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, Product.COMMERCE_PLATFORM_PROPERTY)); return this; } @@ -1078,6 +1415,11 @@ public ProductRequest top(int topN) { return this; } + /** Cross-runtime bounded-query alias. */ + public ProductRequest limit(int limit) { + return top(limit); + } + /** * get records from offset(inclusive) to offset+size(exclusive) * @param offset record offset diff --git a/examples/order-management/java-lib-core/teaql/checker-model.json b/examples/order-management/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..7c0aa2307 --- /dev/null +++ b/examples/order-management/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:feb0a6c97f37d35282317bf77fbd60ffde5a4dc18d6f6a371fd40d2c37d6c975","entities":{"CommercePlatform":{"labels":{"en":"commerce platform"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer_list","targetType":"Customer","labels":{"en":"customer"},"aliases":["CustomerList","customerList"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_line_list","targetType":"OrderLine","labels":{"en":"order line"},"aliases":["OrderLineList","orderLineList"]},{"name":"order_search_preset_list","targetType":"OrderSearchPreset","labels":{"en":"order search preset"},"aliases":["OrderSearchPresetList","orderSearchPresetList"]},{"name":"order_status_list","targetType":"OrderStatus","labels":{"en":"order status"},"aliases":["OrderStatusList","orderStatusList"]},{"name":"product_list","targetType":"Product","labels":{"en":"product"},"aliases":["ProductList","productList"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Customer":{"labels":{"en":"customer"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"email","labels":{"en":"email"},"aliases":["Email"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerOrder":{"labels":{"en":"customer order"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer","targetType":"Customer","labels":{"en":"customer"},"aliases":["Customer"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_date","labels":{"en":"order date"},"aliases":["OrderDate","orderDate"]},{"name":"order_line_list","targetType":"OrderLine","labels":{"en":"order line"},"aliases":["OrderLineList","orderLineList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"status","targetType":"OrderStatus","labels":{"en":"status"},"aliases":["Status"]},{"name":"total_amount","labels":{"en":"total amount"},"aliases":["TotalAmount","totalAmount"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderLine":{"labels":{"en":"order line"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"product","targetType":"Product","labels":{"en":"product"},"aliases":["Product"]},{"name":"product_name","labels":{"en":"product name"},"aliases":["ProductName","productName"]},{"name":"quantity","labels":{"en":"quantity"},"aliases":["Quantity"]},{"name":"sku","labels":{"en":"sku"},"aliases":["Sku"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderSearchPreset":{"labels":{"en":"order search preset"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"filter_json","labels":{"en":"filter json"},"aliases":["FilterJson","filterJson"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"owner_user_id","labels":{"en":"owner user id"},"aliases":["OwnerUserId","ownerUserId"]},{"name":"request_id","labels":{"en":"request id"},"aliases":["RequestId","requestId"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderStatus":{"labels":{"en":"order status"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"color","labels":{"en":"color"},"aliases":["Color"]},{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Product":{"labels":{"en":"product"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"image_url","labels":{"en":"image url"},"aliases":["ImageUrl","imageUrl"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_line_list","targetType":"OrderLine","labels":{"en":"order line"},"aliases":["OrderLineList","orderLineList"]},{"name":"sku","labels":{"en":"sku"},"aliases":["Sku"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/order-management/java-lib-core/teaql/model-provenance.json b/examples/order-management/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..e35d521ba --- /dev/null +++ b/examples/order-management/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/order-management/model.xml b/examples/order-management/model.xml new file mode 100644 index 000000000..3003592b1 --- /dev/null +++ b/examples/order-management/model.xml @@ -0,0 +1,13 @@ + + + + + + <_value id="1001" name="Pending" code="PENDING" color="#F59E0B" display_order="1" commerce_platform="1"/> + <_value id="1002" name="Confirmed" code="CONFIRMED" color="#10B981" display_order="2" commerce_platform="1"/> + + + + + + diff --git a/examples/scalar-type-probe/fixture-manifest.json b/examples/scalar-type-probe/fixture-manifest.json index eb8329a97..64848da18 100644 --- a/examples/scalar-type-probe/fixture-manifest.json +++ b/examples/scalar-type-probe/fixture-manifest.json @@ -1,37 +1,49 @@ { - "language": "java", - "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "evaluatedScope": "java-lib-core", "evaluationErrors": 0, - "producerReceiptSha256": "fbff9d53812a89f88ef3edb6a299e197f41912f95fdb025b481a3b0250c8810d", - "producerSource": { - "commit": "096d0e1345661ba2fdfadc311af38b578bab4016", - "diff": "0596dfec78d9d19bb9fea5206fcf54e689757362e9d2a8684de112fc180b78ab", - "status": "442cb38583d0f2e4edecb11ca28c27e8d2093d106dfb440a92a99703e393083b", - "sourceContentsSha256": "53a2d5280ca7f4774ef9ed8bdf427b5b87fb3aa7ce6a906894bc93c66f31fc96", - "assistExporterSha256": "2583414a9d656e89b43b85f1d4e993dcc774b74e2bed0f9b7120d7cb7ea47efd" - }, + "evaluationWarnings": 0, "files": { + "lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", - "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "6d77bea0bef4cebd11bfa2446d8da3e25bd1e94d2276ff20c92b2466d939be1c", - "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "8ddd890d1ce47f268820aeae3e3f92617ecedb6833ab2932c0d84ad11f0f5e09", - "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", - "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", + "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", - "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "5c3acc14ce9185a24460c9b85afba2dd57f39c240b04fbd8ccea443e436a001e", "lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99", - "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", - "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c", + "lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "2ca2464dbc834c0a6be263a8313552ffacc7ed3a59b6f8c2b7a54329024ed796", "lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", - "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", - "lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "31da8b9467fb4b1153f80347916bbd09a5d1b03c5afa060fd8cdc1b7d0a79221", - "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "a30881e5f49a63e363c5be84a76fd464b531fdc90754b0b4c013e040e730713a", - "lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e", - "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "04158167dbfc7a0a6afa4655597f7070b06ba7f1db828c99df59350489812daa", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90", + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", - "lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b" + "lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "b177989e4a5fec42f98de8374eccc93d398288f16605751fd0cc789388690b54", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", + "teaql/model-provenance.json": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e" + }, + "generatedManifestSha256": "f38220297d6c482d8eb916cfccfbe2cc6fdcc3e177c151c7fddb54c43ac26147", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "language": "java", + "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "previousFixtureManifestSha256": "0386584cede3e5e375fc347f5df959297d6d00930bcd311ee0e1000171bdc75c", + "previousOrigin": { + "commit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "path": "examples/scalar-type-probe/fixture-manifest.json" + }, + "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" } } diff --git a/examples/scalar-type-probe/generated/lib/pom.xml b/examples/scalar-type-probe/generated/lib/pom.xml index 6f3d904d8..a8c977f4c 100644 --- a/examples/scalar-type-probe/generated/lib/pom.xml +++ b/examples/scalar-type-probe/generated/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + ${teaql.version} io.teaql diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java index 59b3f02e9..fba513063 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -27,8 +27,11 @@ private void registerTypePlatform() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -42,54 +45,99 @@ private void registerTypePlatform() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -100,8 +148,11 @@ private void registerScalarTypeProbe() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -184,433 +235,822 @@ private void registerScalarTypeProbe() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") - .with("isTime", "false"); + + .with("isTime", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java index 27b2be578..b6a32a53d 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732\",\"entities\":{\"ScalarTypeProbe\":{\"labels\":{\"en\":\"Scalar Type Probe\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"large_text\",\"labels\":{\"en\":\"large text\"},\"aliases\":[\"LargeText\",\"largeText\"]},{\"name\":\"optional_boolean\",\"labels\":{\"en\":\"optional boolean\"},\"aliases\":[\"OptionalBoolean\",\"optionalBoolean\"]},{\"name\":\"optional_date\",\"labels\":{\"en\":\"optional date\"},\"aliases\":[\"OptionalDate\",\"optionalDate\"]},{\"name\":\"optional_datetime\",\"labels\":{\"en\":\"optional datetime\"},\"aliases\":[\"OptionalDatetime\",\"optionalDatetime\"]},{\"name\":\"optional_decimal\",\"labels\":{\"en\":\"optional decimal\"},\"aliases\":[\"OptionalDecimal\",\"optionalDecimal\"]},{\"name\":\"optional_double\",\"labels\":{\"en\":\"optional double\"},\"aliases\":[\"OptionalDouble\",\"optionalDouble\"]},{\"name\":\"optional_float\",\"labels\":{\"en\":\"optional float\"},\"aliases\":[\"OptionalFloat\",\"optionalFloat\"]},{\"name\":\"optional_integer\",\"labels\":{\"en\":\"optional integer\"},\"aliases\":[\"OptionalInteger\",\"optionalInteger\"]},{\"name\":\"optional_long\",\"labels\":{\"en\":\"optional long\"},\"aliases\":[\"OptionalLong\",\"optionalLong\"]},{\"name\":\"optional_string\",\"labels\":{\"en\":\"optional string\"},\"aliases\":[\"OptionalString\",\"optionalString\"]},{\"name\":\"optional_time\",\"labels\":{\"en\":\"optional time\"},\"aliases\":[\"OptionalTime\",\"optionalTime\"]},{\"name\":\"required_boolean\",\"labels\":{\"en\":\"required boolean\"},\"aliases\":[\"RequiredBoolean\",\"requiredBoolean\"]},{\"name\":\"required_date\",\"labels\":{\"en\":\"required date\"},\"aliases\":[\"RequiredDate\",\"requiredDate\"]},{\"name\":\"required_datetime\",\"labels\":{\"en\":\"required datetime\"},\"aliases\":[\"RequiredDatetime\",\"requiredDatetime\"]},{\"name\":\"required_decimal\",\"labels\":{\"en\":\"required decimal\"},\"aliases\":[\"RequiredDecimal\",\"requiredDecimal\"]},{\"name\":\"required_double\",\"labels\":{\"en\":\"required double\"},\"aliases\":[\"RequiredDouble\",\"requiredDouble\"]},{\"name\":\"required_float\",\"labels\":{\"en\":\"required float\"},\"aliases\":[\"RequiredFloat\",\"requiredFloat\"]},{\"name\":\"required_integer\",\"labels\":{\"en\":\"required integer\"},\"aliases\":[\"RequiredInteger\",\"requiredInteger\"]},{\"name\":\"required_long\",\"labels\":{\"en\":\"required long\"},\"aliases\":[\"RequiredLong\",\"requiredLong\"]},{\"name\":\"required_string\",\"labels\":{\"en\":\"required string\"},\"aliases\":[\"RequiredString\",\"requiredString\"]},{\"name\":\"required_time\",\"labels\":{\"en\":\"required time\"},\"aliases\":[\"RequiredTime\",\"requiredTime\"]},{\"name\":\"type_platform\",\"targetType\":\"TypePlatform\",\"labels\":{\"en\":\"Type Platform\"},\"aliases\":[\"TypePlatform\",\"typePlatform\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"TypePlatform\":{\"labels\":{\"en\":\"Type Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"scalar_type_probe_list\",\"targetType\":\"ScalarTypeProbe\",\"labels\":{\"en\":\"Scalar Type Probe\"},\"aliases\":[\"ScalarTypeProbeList\",\"scalarTypeProbeList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java index cdf764e46..6ee78e0c2 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -8,6 +8,7 @@ import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; @@ -36,7 +37,8 @@ public class ScalarTypeProbe extends BaseEntity implements RemoteInput { public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( ScalarTypeProbe.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); public static final String TYPE_PLATFORM_PROPERTY = "type_platform"; @@ -209,7 +211,7 @@ public LocalDateTime getUpdateTime(){ } public ScalarTypeProbe updateTypePlatform(TypePlatform typePlatform){ - if(Objects.equals(this.typePlatform, typePlatform)){ + if(isPropertyLoaded(TYPE_PLATFORM_PROPERTY) && Objects.equals(this.typePlatform, typePlatform)){ return this; } handleUpdate(TYPE_PLATFORM_PROPERTY, getTypePlatform(), typePlatform); @@ -219,7 +221,7 @@ public ScalarTypeProbe updateTypePlatform(TypePlatform typePlatform){ public ScalarTypeProbe updateRequiredString(String requiredString){ requiredString = (requiredString == null ? null : requiredString.trim()); - if(Objects.equals(this.requiredString, requiredString)){ + if(isPropertyLoaded(REQUIRED_STRING_PROPERTY) && Objects.equals(this.requiredString, requiredString)){ return this; } handleUpdate(REQUIRED_STRING_PROPERTY, getRequiredString(), requiredString); @@ -229,7 +231,7 @@ public ScalarTypeProbe updateRequiredString(String requiredString){ public ScalarTypeProbe updateOptionalString(String optionalString){ optionalString = (optionalString == null ? null : optionalString.trim()); - if(Objects.equals(this.optionalString, optionalString)){ + if(isPropertyLoaded(OPTIONAL_STRING_PROPERTY) && Objects.equals(this.optionalString, optionalString)){ return this; } handleUpdate(OPTIONAL_STRING_PROPERTY, getOptionalString(), optionalString); @@ -238,7 +240,7 @@ public ScalarTypeProbe updateOptionalString(String optionalString){ } public ScalarTypeProbe updateLargeText(String largeText){ - if(Objects.equals(this.largeText, largeText)){ + if(isPropertyLoaded(LARGE_TEXT_PROPERTY) && Objects.equals(this.largeText, largeText)){ return this; } handleUpdate(LARGE_TEXT_PROPERTY, getLargeText(), largeText); @@ -247,7 +249,7 @@ public ScalarTypeProbe updateLargeText(String largeText){ } public ScalarTypeProbe updateRequiredBoolean(Boolean requiredBoolean){ - if(Objects.equals(this.requiredBoolean, requiredBoolean)){ + if(isPropertyLoaded(REQUIRED_BOOLEAN_PROPERTY) && Objects.equals(this.requiredBoolean, requiredBoolean)){ return this; } handleUpdate(REQUIRED_BOOLEAN_PROPERTY, isRequiredBoolean(), requiredBoolean); @@ -256,7 +258,7 @@ public ScalarTypeProbe updateRequiredBoolean(Boolean requiredBoolean){ } public ScalarTypeProbe updateOptionalBoolean(Boolean optionalBoolean){ - if(Objects.equals(this.optionalBoolean, optionalBoolean)){ + if(isPropertyLoaded(OPTIONAL_BOOLEAN_PROPERTY) && Objects.equals(this.optionalBoolean, optionalBoolean)){ return this; } handleUpdate(OPTIONAL_BOOLEAN_PROPERTY, isOptionalBoolean(), optionalBoolean); @@ -265,7 +267,7 @@ public ScalarTypeProbe updateOptionalBoolean(Boolean optionalBoolean){ } public ScalarTypeProbe updateRequiredInteger(Integer requiredInteger){ - if(Objects.equals(this.requiredInteger, requiredInteger)){ + if(isPropertyLoaded(REQUIRED_INTEGER_PROPERTY) && Objects.equals(this.requiredInteger, requiredInteger)){ return this; } handleUpdate(REQUIRED_INTEGER_PROPERTY, getRequiredInteger(), requiredInteger); @@ -274,7 +276,7 @@ public ScalarTypeProbe updateRequiredInteger(Integer requiredInteger){ } public ScalarTypeProbe updateOptionalInteger(Integer optionalInteger){ - if(Objects.equals(this.optionalInteger, optionalInteger)){ + if(isPropertyLoaded(OPTIONAL_INTEGER_PROPERTY) && Objects.equals(this.optionalInteger, optionalInteger)){ return this; } handleUpdate(OPTIONAL_INTEGER_PROPERTY, getOptionalInteger(), optionalInteger); @@ -283,7 +285,7 @@ public ScalarTypeProbe updateOptionalInteger(Integer optionalInteger){ } public ScalarTypeProbe updateRequiredLong(Long requiredLong){ - if(Objects.equals(this.requiredLong, requiredLong)){ + if(isPropertyLoaded(REQUIRED_LONG_PROPERTY) && Objects.equals(this.requiredLong, requiredLong)){ return this; } handleUpdate(REQUIRED_LONG_PROPERTY, getRequiredLong(), requiredLong); @@ -292,7 +294,7 @@ public ScalarTypeProbe updateRequiredLong(Long requiredLong){ } public ScalarTypeProbe updateOptionalLong(Long optionalLong){ - if(Objects.equals(this.optionalLong, optionalLong)){ + if(isPropertyLoaded(OPTIONAL_LONG_PROPERTY) && Objects.equals(this.optionalLong, optionalLong)){ return this; } handleUpdate(OPTIONAL_LONG_PROPERTY, getOptionalLong(), optionalLong); @@ -301,7 +303,7 @@ public ScalarTypeProbe updateOptionalLong(Long optionalLong){ } public ScalarTypeProbe updateRequiredDecimal(BigDecimal requiredDecimal){ - if(Objects.equals(this.requiredDecimal, requiredDecimal)){ + if(isPropertyLoaded(REQUIRED_DECIMAL_PROPERTY) && Objects.equals(this.requiredDecimal, requiredDecimal)){ return this; } handleUpdate(REQUIRED_DECIMAL_PROPERTY, getRequiredDecimal(), requiredDecimal); @@ -310,7 +312,7 @@ public ScalarTypeProbe updateRequiredDecimal(BigDecimal requiredDecimal){ } public ScalarTypeProbe updateOptionalDecimal(BigDecimal optionalDecimal){ - if(Objects.equals(this.optionalDecimal, optionalDecimal)){ + if(isPropertyLoaded(OPTIONAL_DECIMAL_PROPERTY) && Objects.equals(this.optionalDecimal, optionalDecimal)){ return this; } handleUpdate(OPTIONAL_DECIMAL_PROPERTY, getOptionalDecimal(), optionalDecimal); @@ -319,7 +321,7 @@ public ScalarTypeProbe updateOptionalDecimal(BigDecimal optionalDecimal){ } public ScalarTypeProbe updateRequiredFloat(Float requiredFloat){ - if(Objects.equals(this.requiredFloat, requiredFloat)){ + if(isPropertyLoaded(REQUIRED_FLOAT_PROPERTY) && Objects.equals(this.requiredFloat, requiredFloat)){ return this; } handleUpdate(REQUIRED_FLOAT_PROPERTY, getRequiredFloat(), requiredFloat); @@ -328,7 +330,7 @@ public ScalarTypeProbe updateRequiredFloat(Float requiredFloat){ } public ScalarTypeProbe updateOptionalFloat(Float optionalFloat){ - if(Objects.equals(this.optionalFloat, optionalFloat)){ + if(isPropertyLoaded(OPTIONAL_FLOAT_PROPERTY) && Objects.equals(this.optionalFloat, optionalFloat)){ return this; } handleUpdate(OPTIONAL_FLOAT_PROPERTY, getOptionalFloat(), optionalFloat); @@ -337,7 +339,7 @@ public ScalarTypeProbe updateOptionalFloat(Float optionalFloat){ } public ScalarTypeProbe updateRequiredDouble(Double requiredDouble){ - if(Objects.equals(this.requiredDouble, requiredDouble)){ + if(isPropertyLoaded(REQUIRED_DOUBLE_PROPERTY) && Objects.equals(this.requiredDouble, requiredDouble)){ return this; } handleUpdate(REQUIRED_DOUBLE_PROPERTY, getRequiredDouble(), requiredDouble); @@ -346,7 +348,7 @@ public ScalarTypeProbe updateRequiredDouble(Double requiredDouble){ } public ScalarTypeProbe updateOptionalDouble(Double optionalDouble){ - if(Objects.equals(this.optionalDouble, optionalDouble)){ + if(isPropertyLoaded(OPTIONAL_DOUBLE_PROPERTY) && Objects.equals(this.optionalDouble, optionalDouble)){ return this; } handleUpdate(OPTIONAL_DOUBLE_PROPERTY, getOptionalDouble(), optionalDouble); @@ -355,7 +357,7 @@ public ScalarTypeProbe updateOptionalDouble(Double optionalDouble){ } public ScalarTypeProbe updateRequiredDate(LocalDate requiredDate){ - if(Objects.equals(this.requiredDate, requiredDate)){ + if(isPropertyLoaded(REQUIRED_DATE_PROPERTY) && Objects.equals(this.requiredDate, requiredDate)){ return this; } handleUpdate(REQUIRED_DATE_PROPERTY, getRequiredDate(), requiredDate); @@ -364,7 +366,7 @@ public ScalarTypeProbe updateRequiredDate(LocalDate requiredDate){ } public ScalarTypeProbe updateOptionalDate(LocalDate optionalDate){ - if(Objects.equals(this.optionalDate, optionalDate)){ + if(isPropertyLoaded(OPTIONAL_DATE_PROPERTY) && Objects.equals(this.optionalDate, optionalDate)){ return this; } handleUpdate(OPTIONAL_DATE_PROPERTY, getOptionalDate(), optionalDate); @@ -373,7 +375,7 @@ public ScalarTypeProbe updateOptionalDate(LocalDate optionalDate){ } public ScalarTypeProbe updateRequiredTime(LocalTime requiredTime){ - if(Objects.equals(this.requiredTime, requiredTime)){ + if(isPropertyLoaded(REQUIRED_TIME_PROPERTY) && Objects.equals(this.requiredTime, requiredTime)){ return this; } handleUpdate(REQUIRED_TIME_PROPERTY, getRequiredTime(), requiredTime); @@ -382,7 +384,7 @@ public ScalarTypeProbe updateRequiredTime(LocalTime requiredTime){ } public ScalarTypeProbe updateOptionalTime(LocalTime optionalTime){ - if(Objects.equals(this.optionalTime, optionalTime)){ + if(isPropertyLoaded(OPTIONAL_TIME_PROPERTY) && Objects.equals(this.optionalTime, optionalTime)){ return this; } handleUpdate(OPTIONAL_TIME_PROPERTY, getOptionalTime(), optionalTime); @@ -391,7 +393,7 @@ public ScalarTypeProbe updateOptionalTime(LocalTime optionalTime){ } public ScalarTypeProbe updateRequiredDatetime(LocalDateTime requiredDatetime){ - if(Objects.equals(this.requiredDatetime, requiredDatetime)){ + if(isPropertyLoaded(REQUIRED_DATETIME_PROPERTY) && Objects.equals(this.requiredDatetime, requiredDatetime)){ return this; } handleUpdate(REQUIRED_DATETIME_PROPERTY, getRequiredDatetime(), requiredDatetime); @@ -400,7 +402,7 @@ public ScalarTypeProbe updateRequiredDatetime(LocalDateTime requiredDatetime){ } public ScalarTypeProbe updateOptionalDatetime(LocalDateTime optionalDatetime){ - if(Objects.equals(this.optionalDatetime, optionalDatetime)){ + if(isPropertyLoaded(OPTIONAL_DATETIME_PROPERTY) && Objects.equals(this.optionalDatetime, optionalDatetime)){ return this; } handleUpdate(OPTIONAL_DATETIME_PROPERTY, getOptionalDatetime(), optionalDatetime); @@ -409,7 +411,7 @@ public ScalarTypeProbe updateOptionalDatetime(LocalDateTime optionalDatetime){ } public ScalarTypeProbe updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); @@ -418,7 +420,7 @@ public ScalarTypeProbe updateCreateTime(LocalDateTime createTime){ } public ScalarTypeProbe updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); @@ -535,7 +537,36 @@ public Object __internalGet(String property) { case "optional_datetime": return this.optionalDatetime; case "create_time": return this.createTime; case "update_time": return this.updateTime; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "typePlatform": return this.typePlatform; + case "requiredString": return this.requiredString; + case "optionalString": return this.optionalString; + case "largeText": return this.largeText; + case "requiredBoolean": return this.requiredBoolean; + case "optionalBoolean": return this.optionalBoolean; + case "requiredInteger": return this.requiredInteger; + case "optionalInteger": return this.optionalInteger; + case "requiredLong": return this.requiredLong; + case "optionalLong": return this.optionalLong; + case "requiredDecimal": return this.requiredDecimal; + case "optionalDecimal": return this.optionalDecimal; + case "requiredFloat": return this.requiredFloat; + case "optionalFloat": return this.optionalFloat; + case "requiredDouble": return this.requiredDouble; + case "optionalDouble": return this.optionalDouble; + case "requiredDate": return this.requiredDate; + case "optionalDate": return this.optionalDate; + case "requiredTime": return this.requiredTime; + case "optionalTime": return this.optionalTime; + case "requiredDatetime": return this.requiredDatetime; + case "optionalDatetime": return this.optionalDatetime; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java index d55fe2420..b9d9a2f04 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -28,17 +28,34 @@ public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, Objec if((scalarTypeProbe == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, scalarTypeProbe); + if(scalarTypeProbe.needPersist()){ + } if(scalarTypeProbe.newItem()){ - if(scalarTypeProbe.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { scalarTypeProbe.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(scalarTypeProbe.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(scalarTypeProbe.updateItem()){ - scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); } diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java index 6a60aaedd..ffee511c0 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -16,6 +16,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Date; +import java.util.Objects; public class ScalarTypeProbeRequest extends BaseRequest { @@ -40,6 +41,19 @@ public ScalarTypeProbeRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest copy(){ + return (ScalarTypeProbeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ScalarTypeProbeRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public ScalarTypeProbeRequest returnType(Class returnType){ @@ -107,6 +121,12 @@ public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarType return this; } + public ScalarTypeProbeRequest matchingIdsOf(ScalarTypeProbeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + ScalarTypeProbe.ID_PROPERTY, request, ScalarTypeProbe.ID_PROPERTY)); + } + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ return this; } @@ -2998,6 +3018,214 @@ public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequ + public ScalarTypeProbeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctTypePlatform(){ + return countDistinctTypePlatformAs("type_platform_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctTypePlatformAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredString(){ + return countDistinctRequiredStringAs("required_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalString(){ + return countDistinctOptionalStringAs("optional_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctLargeText(){ + return countDistinctLargeTextAs("large_text_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctLargeTextAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredBoolean(){ + return countDistinctRequiredBooleanAs("required_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalBoolean(){ + return countDistinctOptionalBooleanAs("optional_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredInteger(){ + return countDistinctRequiredIntegerAs("required_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalInteger(){ + return countDistinctOptionalIntegerAs("optional_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredLong(){ + return countDistinctRequiredLongAs("required_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalLong(){ + return countDistinctOptionalLongAs("optional_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDecimal(){ + return countDistinctRequiredDecimalAs("required_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDecimal(){ + return countDistinctOptionalDecimalAs("optional_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredFloat(){ + return countDistinctRequiredFloatAs("required_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalFloat(){ + return countDistinctOptionalFloatAs("optional_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDouble(){ + return countDistinctRequiredDoubleAs("required_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDouble(){ + return countDistinctOptionalDoubleAs("optional_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDate(){ + return countDistinctRequiredDateAs("required_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDate(){ + return countDistinctOptionalDateAs("optional_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredTime(){ + return countDistinctRequiredTimeAs("required_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalTime(){ + return countDistinctOptionalTimeAs("optional_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDatetime(){ + return countDistinctRequiredDatetimeAs("required_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDatetime(){ + return countDistinctOptionalDatetimeAs("optional_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } public ScalarTypeProbeRequest groupById(){ groupBy(ScalarTypeProbe.ID_PROPERTY); @@ -3014,7 +3242,8 @@ public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunct return this; } public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ - groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTypePlatformWith", null, "type_platform")); return this; } public ScalarTypeProbeRequest groupByTypePlatform(){ @@ -3673,8 +3902,8 @@ public ScalarTypeProbeRequest orderByVersionDescending(){ public TypePlatformRequest rollUpToTypePlatform(){ TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); - this.withTypePlatformMatching(typePlatform) - .groupByTypePlatformWith(typePlatform); + this.internalRollUpTo("type_platform", typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTypePlatform", null, "type_platform")); return typePlatform; } diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java index 196c3bb4c..4f6485749 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -9,6 +9,7 @@ import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -33,7 +34,8 @@ public class TypePlatform extends BaseEntity implements RemoteInput { public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( TypePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); public static final String NAME_PROPERTY = "name"; @@ -47,11 +49,11 @@ public String getName(){ } public SmartList getScalarTypeProbeList(){ - return this.scalarTypeProbeList; + return this.scalarTypeProbeList == null ? SmartList.unloaded() : this.scalarTypeProbeList; } public TypePlatform updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); @@ -65,7 +67,8 @@ public TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ } if(null == this.scalarTypeProbeList){ - this.scalarTypeProbeList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.scalarTypeProbeList = teaqlUnloadedItems.map(value -> value); } this.scalarTypeProbeList.add(scalarTypeProbe); @@ -114,7 +117,13 @@ public Object __internalGet(String property) { switch (property) { case "name": return this.name; case "scalar_type_probe_list": return this.scalarTypeProbeList; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java index 723b2d082..294c56f57 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -24,6 +24,9 @@ public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocat if((typePlatform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, typePlatform); + if(typePlatform.needPersist()){ + } if(typePlatform.newItem()){ }else if(typePlatform.updateItem()){ if(!typePlatform.isPropertyLoaded("name")){ diff --git a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java index 0ac2f1d18..ce149200c 100644 --- a/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java +++ b/examples/scalar-type-probe/generated/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class TypePlatformRequest extends BaseRequest { @@ -35,6 +36,19 @@ public TypePlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TypePlatformRequest copy(){ + return (TypePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TypePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public TypePlatformRequest returnType(Class returnType){ @@ -102,6 +116,12 @@ public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ return this; } + public TypePlatformRequest matchingIdsOf(TypePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + TypePlatform.ID_PROPERTY, request, TypePlatform.ID_PROPERTY)); + } + public TypePlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -403,6 +423,30 @@ public TypePlatformRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public TypePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TypePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TypePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TypePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.VERSION_PROPERTY); + return this; + } public TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); return this; diff --git a/examples/scalar-type-probe/generated/teaql/checker-model.json b/examples/scalar-type-probe/generated/teaql/checker-model.json new file mode 100644 index 000000000..b36f1a22b --- /dev/null +++ b/examples/scalar-type-probe/generated/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732","entities":{"ScalarTypeProbe":{"labels":{"en":"Scalar Type Probe"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"large_text","labels":{"en":"large text"},"aliases":["LargeText","largeText"]},{"name":"optional_boolean","labels":{"en":"optional boolean"},"aliases":["OptionalBoolean","optionalBoolean"]},{"name":"optional_date","labels":{"en":"optional date"},"aliases":["OptionalDate","optionalDate"]},{"name":"optional_datetime","labels":{"en":"optional datetime"},"aliases":["OptionalDatetime","optionalDatetime"]},{"name":"optional_decimal","labels":{"en":"optional decimal"},"aliases":["OptionalDecimal","optionalDecimal"]},{"name":"optional_double","labels":{"en":"optional double"},"aliases":["OptionalDouble","optionalDouble"]},{"name":"optional_float","labels":{"en":"optional float"},"aliases":["OptionalFloat","optionalFloat"]},{"name":"optional_integer","labels":{"en":"optional integer"},"aliases":["OptionalInteger","optionalInteger"]},{"name":"optional_long","labels":{"en":"optional long"},"aliases":["OptionalLong","optionalLong"]},{"name":"optional_string","labels":{"en":"optional string"},"aliases":["OptionalString","optionalString"]},{"name":"optional_time","labels":{"en":"optional time"},"aliases":["OptionalTime","optionalTime"]},{"name":"required_boolean","labels":{"en":"required boolean"},"aliases":["RequiredBoolean","requiredBoolean"]},{"name":"required_date","labels":{"en":"required date"},"aliases":["RequiredDate","requiredDate"]},{"name":"required_datetime","labels":{"en":"required datetime"},"aliases":["RequiredDatetime","requiredDatetime"]},{"name":"required_decimal","labels":{"en":"required decimal"},"aliases":["RequiredDecimal","requiredDecimal"]},{"name":"required_double","labels":{"en":"required double"},"aliases":["RequiredDouble","requiredDouble"]},{"name":"required_float","labels":{"en":"required float"},"aliases":["RequiredFloat","requiredFloat"]},{"name":"required_integer","labels":{"en":"required integer"},"aliases":["RequiredInteger","requiredInteger"]},{"name":"required_long","labels":{"en":"required long"},"aliases":["RequiredLong","requiredLong"]},{"name":"required_string","labels":{"en":"required string"},"aliases":["RequiredString","requiredString"]},{"name":"required_time","labels":{"en":"required time"},"aliases":["RequiredTime","requiredTime"]},{"name":"type_platform","targetType":"TypePlatform","labels":{"en":"Type Platform"},"aliases":["TypePlatform","typePlatform"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"TypePlatform":{"labels":{"en":"Type Platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"scalar_type_probe_list","targetType":"ScalarTypeProbe","labels":{"en":"Scalar Type Probe"},"aliases":["ScalarTypeProbeList","scalarTypeProbeList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/scalar-type-probe/generated/teaql/model-provenance.json b/examples/scalar-type-probe/generated/teaql/model-provenance.json new file mode 100644 index 000000000..19a79eb6c --- /dev/null +++ b/examples/scalar-type-probe/generated/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml b/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml index 6f3d904d8..a8c977f4c 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + ${teaql.version} io.teaql diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java index 59b3f02e9..fba513063 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -27,8 +27,11 @@ private void registerTypePlatform() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -42,54 +45,99 @@ private void registerTypePlatform() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -100,8 +148,11 @@ private void registerScalarTypeProbe() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -184,433 +235,822 @@ private void registerScalarTypeProbe() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") - .with("isTime", "false"); + + .with("isTime", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java index ff8c5ba2a..a35bfa7d7 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732\",\"entities\":{\"ScalarTypeProbe\":{\"labels\":{\"en\":\"Scalar Type Probe\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"large_text\",\"labels\":{\"en\":\"large text\"},\"aliases\":[\"LargeText\",\"largeText\"]},{\"name\":\"optional_boolean\",\"labels\":{\"en\":\"optional boolean\"},\"aliases\":[\"OptionalBoolean\",\"optionalBoolean\"]},{\"name\":\"optional_date\",\"labels\":{\"en\":\"optional date\"},\"aliases\":[\"OptionalDate\",\"optionalDate\"]},{\"name\":\"optional_datetime\",\"labels\":{\"en\":\"optional datetime\"},\"aliases\":[\"OptionalDatetime\",\"optionalDatetime\"]},{\"name\":\"optional_decimal\",\"labels\":{\"en\":\"optional decimal\"},\"aliases\":[\"OptionalDecimal\",\"optionalDecimal\"]},{\"name\":\"optional_double\",\"labels\":{\"en\":\"optional double\"},\"aliases\":[\"OptionalDouble\",\"optionalDouble\"]},{\"name\":\"optional_float\",\"labels\":{\"en\":\"optional float\"},\"aliases\":[\"OptionalFloat\",\"optionalFloat\"]},{\"name\":\"optional_integer\",\"labels\":{\"en\":\"optional integer\"},\"aliases\":[\"OptionalInteger\",\"optionalInteger\"]},{\"name\":\"optional_long\",\"labels\":{\"en\":\"optional long\"},\"aliases\":[\"OptionalLong\",\"optionalLong\"]},{\"name\":\"optional_string\",\"labels\":{\"en\":\"optional string\"},\"aliases\":[\"OptionalString\",\"optionalString\"]},{\"name\":\"optional_time\",\"labels\":{\"en\":\"optional time\"},\"aliases\":[\"OptionalTime\",\"optionalTime\"]},{\"name\":\"required_boolean\",\"labels\":{\"en\":\"required boolean\"},\"aliases\":[\"RequiredBoolean\",\"requiredBoolean\"]},{\"name\":\"required_date\",\"labels\":{\"en\":\"required date\"},\"aliases\":[\"RequiredDate\",\"requiredDate\"]},{\"name\":\"required_datetime\",\"labels\":{\"en\":\"required datetime\"},\"aliases\":[\"RequiredDatetime\",\"requiredDatetime\"]},{\"name\":\"required_decimal\",\"labels\":{\"en\":\"required decimal\"},\"aliases\":[\"RequiredDecimal\",\"requiredDecimal\"]},{\"name\":\"required_double\",\"labels\":{\"en\":\"required double\"},\"aliases\":[\"RequiredDouble\",\"requiredDouble\"]},{\"name\":\"required_float\",\"labels\":{\"en\":\"required float\"},\"aliases\":[\"RequiredFloat\",\"requiredFloat\"]},{\"name\":\"required_integer\",\"labels\":{\"en\":\"required integer\"},\"aliases\":[\"RequiredInteger\",\"requiredInteger\"]},{\"name\":\"required_long\",\"labels\":{\"en\":\"required long\"},\"aliases\":[\"RequiredLong\",\"requiredLong\"]},{\"name\":\"required_string\",\"labels\":{\"en\":\"required string\"},\"aliases\":[\"RequiredString\",\"requiredString\"]},{\"name\":\"required_time\",\"labels\":{\"en\":\"required time\"},\"aliases\":[\"RequiredTime\",\"requiredTime\"]},{\"name\":\"type_platform\",\"targetType\":\"TypePlatform\",\"labels\":{\"en\":\"Type Platform\"},\"aliases\":[\"TypePlatform\",\"typePlatform\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"TypePlatform\":{\"labels\":{\"en\":\"Type Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"scalar_type_probe_list\",\"targetType\":\"ScalarTypeProbe\",\"labels\":{\"en\":\"Scalar Type Probe\"},\"aliases\":[\"ScalarTypeProbeList\",\"scalarTypeProbeList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java index 5e2c4c336..6a46b42e3 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -537,7 +537,36 @@ public Object __internalGet(String property) { case "optional_datetime": return this.optionalDatetime; case "create_time": return this.createTime; case "update_time": return this.updateTime; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "typePlatform": return this.typePlatform; + case "requiredString": return this.requiredString; + case "optionalString": return this.optionalString; + case "largeText": return this.largeText; + case "requiredBoolean": return this.requiredBoolean; + case "optionalBoolean": return this.optionalBoolean; + case "requiredInteger": return this.requiredInteger; + case "optionalInteger": return this.optionalInteger; + case "requiredLong": return this.requiredLong; + case "optionalLong": return this.optionalLong; + case "requiredDecimal": return this.requiredDecimal; + case "optionalDecimal": return this.optionalDecimal; + case "requiredFloat": return this.requiredFloat; + case "optionalFloat": return this.optionalFloat; + case "requiredDouble": return this.requiredDouble; + case "optionalDouble": return this.optionalDouble; + case "requiredDate": return this.requiredDate; + case "optionalDate": return this.optionalDate; + case "requiredTime": return this.requiredTime; + case "optionalTime": return this.optionalTime; + case "requiredDatetime": return this.requiredDatetime; + case "optionalDatetime": return this.optionalDatetime; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java index 3ad70ad88..b9d9a2f04 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -28,19 +28,34 @@ public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, Objec if((scalarTypeProbe == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, scalarTypeProbe); if(scalarTypeProbe.needPersist()){ } if(scalarTypeProbe.newItem()){ - if(scalarTypeProbe.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { scalarTypeProbe.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(scalarTypeProbe.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(scalarTypeProbe.updateItem()){ - scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); } diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java index 6a60aaedd..ffee511c0 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -16,6 +16,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Date; +import java.util.Objects; public class ScalarTypeProbeRequest extends BaseRequest { @@ -40,6 +41,19 @@ public ScalarTypeProbeRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest copy(){ + return (ScalarTypeProbeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ScalarTypeProbeRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public ScalarTypeProbeRequest returnType(Class returnType){ @@ -107,6 +121,12 @@ public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarType return this; } + public ScalarTypeProbeRequest matchingIdsOf(ScalarTypeProbeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + ScalarTypeProbe.ID_PROPERTY, request, ScalarTypeProbe.ID_PROPERTY)); + } + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ return this; } @@ -2998,6 +3018,214 @@ public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequ + public ScalarTypeProbeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctTypePlatform(){ + return countDistinctTypePlatformAs("type_platform_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctTypePlatformAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredString(){ + return countDistinctRequiredStringAs("required_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalString(){ + return countDistinctOptionalStringAs("optional_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctLargeText(){ + return countDistinctLargeTextAs("large_text_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctLargeTextAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredBoolean(){ + return countDistinctRequiredBooleanAs("required_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalBoolean(){ + return countDistinctOptionalBooleanAs("optional_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredInteger(){ + return countDistinctRequiredIntegerAs("required_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalInteger(){ + return countDistinctOptionalIntegerAs("optional_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredLong(){ + return countDistinctRequiredLongAs("required_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalLong(){ + return countDistinctOptionalLongAs("optional_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDecimal(){ + return countDistinctRequiredDecimalAs("required_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDecimal(){ + return countDistinctOptionalDecimalAs("optional_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredFloat(){ + return countDistinctRequiredFloatAs("required_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalFloat(){ + return countDistinctOptionalFloatAs("optional_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDouble(){ + return countDistinctRequiredDoubleAs("required_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDouble(){ + return countDistinctOptionalDoubleAs("optional_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDate(){ + return countDistinctRequiredDateAs("required_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDate(){ + return countDistinctOptionalDateAs("optional_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredTime(){ + return countDistinctRequiredTimeAs("required_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalTime(){ + return countDistinctOptionalTimeAs("optional_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDatetime(){ + return countDistinctRequiredDatetimeAs("required_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDatetime(){ + return countDistinctOptionalDatetimeAs("optional_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } public ScalarTypeProbeRequest groupById(){ groupBy(ScalarTypeProbe.ID_PROPERTY); @@ -3014,7 +3242,8 @@ public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunct return this; } public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ - groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTypePlatformWith", null, "type_platform")); return this; } public ScalarTypeProbeRequest groupByTypePlatform(){ @@ -3673,8 +3902,8 @@ public ScalarTypeProbeRequest orderByVersionDescending(){ public TypePlatformRequest rollUpToTypePlatform(){ TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); - this.withTypePlatformMatching(typePlatform) - .groupByTypePlatformWith(typePlatform); + this.internalRollUpTo("type_platform", typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTypePlatform", null, "type_platform")); return typePlatform; } diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java index b7bc639f5..8d7cb580f 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -49,7 +49,7 @@ public String getName(){ } public SmartList getScalarTypeProbeList(){ - return this.scalarTypeProbeList; + return this.scalarTypeProbeList == null ? SmartList.unloaded() : this.scalarTypeProbeList; } public TypePlatform updateName(String name){ name = (name == null ? null : name.trim()); @@ -67,7 +67,8 @@ public TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ } if(null == this.scalarTypeProbeList){ - this.scalarTypeProbeList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.scalarTypeProbeList = teaqlUnloadedItems.map(value -> value); } this.scalarTypeProbeList.add(scalarTypeProbe); @@ -116,7 +117,13 @@ public Object __internalGet(String property) { switch (property) { case "name": return this.name; case "scalar_type_probe_list": return this.scalarTypeProbeList; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java index 62df23ea0..294c56f57 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -24,6 +24,7 @@ public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocat if((typePlatform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, typePlatform); if(typePlatform.needPersist()){ } if(typePlatform.newItem()){ diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java index 0ac2f1d18..ce149200c 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java +++ b/examples/scalar-type-probe/json-profiles/PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class TypePlatformRequest extends BaseRequest { @@ -35,6 +36,19 @@ public TypePlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TypePlatformRequest copy(){ + return (TypePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TypePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public TypePlatformRequest returnType(Class returnType){ @@ -102,6 +116,12 @@ public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ return this; } + public TypePlatformRequest matchingIdsOf(TypePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + TypePlatform.ID_PROPERTY, request, TypePlatform.ID_PROPERTY)); + } + public TypePlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -403,6 +423,30 @@ public TypePlatformRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public TypePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TypePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TypePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TypePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.VERSION_PROPERTY); + return this; + } public TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); return this; diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/checker-model.json b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/checker-model.json new file mode 100644 index 000000000..b36f1a22b --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732","entities":{"ScalarTypeProbe":{"labels":{"en":"Scalar Type Probe"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"large_text","labels":{"en":"large text"},"aliases":["LargeText","largeText"]},{"name":"optional_boolean","labels":{"en":"optional boolean"},"aliases":["OptionalBoolean","optionalBoolean"]},{"name":"optional_date","labels":{"en":"optional date"},"aliases":["OptionalDate","optionalDate"]},{"name":"optional_datetime","labels":{"en":"optional datetime"},"aliases":["OptionalDatetime","optionalDatetime"]},{"name":"optional_decimal","labels":{"en":"optional decimal"},"aliases":["OptionalDecimal","optionalDecimal"]},{"name":"optional_double","labels":{"en":"optional double"},"aliases":["OptionalDouble","optionalDouble"]},{"name":"optional_float","labels":{"en":"optional float"},"aliases":["OptionalFloat","optionalFloat"]},{"name":"optional_integer","labels":{"en":"optional integer"},"aliases":["OptionalInteger","optionalInteger"]},{"name":"optional_long","labels":{"en":"optional long"},"aliases":["OptionalLong","optionalLong"]},{"name":"optional_string","labels":{"en":"optional string"},"aliases":["OptionalString","optionalString"]},{"name":"optional_time","labels":{"en":"optional time"},"aliases":["OptionalTime","optionalTime"]},{"name":"required_boolean","labels":{"en":"required boolean"},"aliases":["RequiredBoolean","requiredBoolean"]},{"name":"required_date","labels":{"en":"required date"},"aliases":["RequiredDate","requiredDate"]},{"name":"required_datetime","labels":{"en":"required datetime"},"aliases":["RequiredDatetime","requiredDatetime"]},{"name":"required_decimal","labels":{"en":"required decimal"},"aliases":["RequiredDecimal","requiredDecimal"]},{"name":"required_double","labels":{"en":"required double"},"aliases":["RequiredDouble","requiredDouble"]},{"name":"required_float","labels":{"en":"required float"},"aliases":["RequiredFloat","requiredFloat"]},{"name":"required_integer","labels":{"en":"required integer"},"aliases":["RequiredInteger","requiredInteger"]},{"name":"required_long","labels":{"en":"required long"},"aliases":["RequiredLong","requiredLong"]},{"name":"required_string","labels":{"en":"required string"},"aliases":["RequiredString","requiredString"]},{"name":"required_time","labels":{"en":"required time"},"aliases":["RequiredTime","requiredTime"]},{"name":"type_platform","targetType":"TypePlatform","labels":{"en":"Type Platform"},"aliases":["TypePlatform","typePlatform"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"TypePlatform":{"labels":{"en":"Type Platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"scalar_type_probe_list","targetType":"ScalarTypeProbe","labels":{"en":"Scalar Type Probe"},"aliases":["ScalarTypeProbeList","scalarTypeProbeList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json new file mode 100644 index 000000000..1d8618d0a --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml b/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml index 6f3d904d8..a8c977f4c 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + ${teaql.version} io.teaql diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java index 59b3f02e9..fba513063 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -27,8 +27,11 @@ private void registerTypePlatform() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -42,54 +45,99 @@ private void registerTypePlatform() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -100,8 +148,11 @@ private void registerScalarTypeProbe() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -184,433 +235,822 @@ private void registerScalarTypeProbe() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") - .with("isTime", "false"); + + .with("isTime", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java index 27b2be578..b6a32a53d 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732\",\"entities\":{\"ScalarTypeProbe\":{\"labels\":{\"en\":\"Scalar Type Probe\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"large_text\",\"labels\":{\"en\":\"large text\"},\"aliases\":[\"LargeText\",\"largeText\"]},{\"name\":\"optional_boolean\",\"labels\":{\"en\":\"optional boolean\"},\"aliases\":[\"OptionalBoolean\",\"optionalBoolean\"]},{\"name\":\"optional_date\",\"labels\":{\"en\":\"optional date\"},\"aliases\":[\"OptionalDate\",\"optionalDate\"]},{\"name\":\"optional_datetime\",\"labels\":{\"en\":\"optional datetime\"},\"aliases\":[\"OptionalDatetime\",\"optionalDatetime\"]},{\"name\":\"optional_decimal\",\"labels\":{\"en\":\"optional decimal\"},\"aliases\":[\"OptionalDecimal\",\"optionalDecimal\"]},{\"name\":\"optional_double\",\"labels\":{\"en\":\"optional double\"},\"aliases\":[\"OptionalDouble\",\"optionalDouble\"]},{\"name\":\"optional_float\",\"labels\":{\"en\":\"optional float\"},\"aliases\":[\"OptionalFloat\",\"optionalFloat\"]},{\"name\":\"optional_integer\",\"labels\":{\"en\":\"optional integer\"},\"aliases\":[\"OptionalInteger\",\"optionalInteger\"]},{\"name\":\"optional_long\",\"labels\":{\"en\":\"optional long\"},\"aliases\":[\"OptionalLong\",\"optionalLong\"]},{\"name\":\"optional_string\",\"labels\":{\"en\":\"optional string\"},\"aliases\":[\"OptionalString\",\"optionalString\"]},{\"name\":\"optional_time\",\"labels\":{\"en\":\"optional time\"},\"aliases\":[\"OptionalTime\",\"optionalTime\"]},{\"name\":\"required_boolean\",\"labels\":{\"en\":\"required boolean\"},\"aliases\":[\"RequiredBoolean\",\"requiredBoolean\"]},{\"name\":\"required_date\",\"labels\":{\"en\":\"required date\"},\"aliases\":[\"RequiredDate\",\"requiredDate\"]},{\"name\":\"required_datetime\",\"labels\":{\"en\":\"required datetime\"},\"aliases\":[\"RequiredDatetime\",\"requiredDatetime\"]},{\"name\":\"required_decimal\",\"labels\":{\"en\":\"required decimal\"},\"aliases\":[\"RequiredDecimal\",\"requiredDecimal\"]},{\"name\":\"required_double\",\"labels\":{\"en\":\"required double\"},\"aliases\":[\"RequiredDouble\",\"requiredDouble\"]},{\"name\":\"required_float\",\"labels\":{\"en\":\"required float\"},\"aliases\":[\"RequiredFloat\",\"requiredFloat\"]},{\"name\":\"required_integer\",\"labels\":{\"en\":\"required integer\"},\"aliases\":[\"RequiredInteger\",\"requiredInteger\"]},{\"name\":\"required_long\",\"labels\":{\"en\":\"required long\"},\"aliases\":[\"RequiredLong\",\"requiredLong\"]},{\"name\":\"required_string\",\"labels\":{\"en\":\"required string\"},\"aliases\":[\"RequiredString\",\"requiredString\"]},{\"name\":\"required_time\",\"labels\":{\"en\":\"required time\"},\"aliases\":[\"RequiredTime\",\"requiredTime\"]},{\"name\":\"type_platform\",\"targetType\":\"TypePlatform\",\"labels\":{\"en\":\"Type Platform\"},\"aliases\":[\"TypePlatform\",\"typePlatform\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"TypePlatform\":{\"labels\":{\"en\":\"Type Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"scalar_type_probe_list\",\"targetType\":\"ScalarTypeProbe\",\"labels\":{\"en\":\"Scalar Type Probe\"},\"aliases\":[\"ScalarTypeProbeList\",\"scalarTypeProbeList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java index 1e0717527..6ee78e0c2 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -537,7 +537,36 @@ public Object __internalGet(String property) { case "optional_datetime": return this.optionalDatetime; case "create_time": return this.createTime; case "update_time": return this.updateTime; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "typePlatform": return this.typePlatform; + case "requiredString": return this.requiredString; + case "optionalString": return this.optionalString; + case "largeText": return this.largeText; + case "requiredBoolean": return this.requiredBoolean; + case "optionalBoolean": return this.optionalBoolean; + case "requiredInteger": return this.requiredInteger; + case "optionalInteger": return this.optionalInteger; + case "requiredLong": return this.requiredLong; + case "optionalLong": return this.optionalLong; + case "requiredDecimal": return this.requiredDecimal; + case "optionalDecimal": return this.optionalDecimal; + case "requiredFloat": return this.requiredFloat; + case "optionalFloat": return this.optionalFloat; + case "requiredDouble": return this.requiredDouble; + case "optionalDouble": return this.optionalDouble; + case "requiredDate": return this.requiredDate; + case "optionalDate": return this.optionalDate; + case "requiredTime": return this.requiredTime; + case "optionalTime": return this.optionalTime; + case "requiredDatetime": return this.requiredDatetime; + case "optionalDatetime": return this.optionalDatetime; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java index 3ad70ad88..b9d9a2f04 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -28,19 +28,34 @@ public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, Objec if((scalarTypeProbe == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, scalarTypeProbe); if(scalarTypeProbe.needPersist()){ } if(scalarTypeProbe.newItem()){ - if(scalarTypeProbe.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { scalarTypeProbe.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(scalarTypeProbe.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(scalarTypeProbe.updateItem()){ - scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); } diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java index 6a60aaedd..ffee511c0 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -16,6 +16,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Date; +import java.util.Objects; public class ScalarTypeProbeRequest extends BaseRequest { @@ -40,6 +41,19 @@ public ScalarTypeProbeRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest copy(){ + return (ScalarTypeProbeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ScalarTypeProbeRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public ScalarTypeProbeRequest returnType(Class returnType){ @@ -107,6 +121,12 @@ public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarType return this; } + public ScalarTypeProbeRequest matchingIdsOf(ScalarTypeProbeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + ScalarTypeProbe.ID_PROPERTY, request, ScalarTypeProbe.ID_PROPERTY)); + } + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ return this; } @@ -2998,6 +3018,214 @@ public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequ + public ScalarTypeProbeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctTypePlatform(){ + return countDistinctTypePlatformAs("type_platform_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctTypePlatformAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredString(){ + return countDistinctRequiredStringAs("required_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalString(){ + return countDistinctOptionalStringAs("optional_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctLargeText(){ + return countDistinctLargeTextAs("large_text_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctLargeTextAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredBoolean(){ + return countDistinctRequiredBooleanAs("required_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalBoolean(){ + return countDistinctOptionalBooleanAs("optional_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredInteger(){ + return countDistinctRequiredIntegerAs("required_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalInteger(){ + return countDistinctOptionalIntegerAs("optional_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredLong(){ + return countDistinctRequiredLongAs("required_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalLong(){ + return countDistinctOptionalLongAs("optional_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDecimal(){ + return countDistinctRequiredDecimalAs("required_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDecimal(){ + return countDistinctOptionalDecimalAs("optional_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredFloat(){ + return countDistinctRequiredFloatAs("required_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalFloat(){ + return countDistinctOptionalFloatAs("optional_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDouble(){ + return countDistinctRequiredDoubleAs("required_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDouble(){ + return countDistinctOptionalDoubleAs("optional_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDate(){ + return countDistinctRequiredDateAs("required_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDate(){ + return countDistinctOptionalDateAs("optional_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredTime(){ + return countDistinctRequiredTimeAs("required_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalTime(){ + return countDistinctOptionalTimeAs("optional_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDatetime(){ + return countDistinctRequiredDatetimeAs("required_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDatetime(){ + return countDistinctOptionalDatetimeAs("optional_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } public ScalarTypeProbeRequest groupById(){ groupBy(ScalarTypeProbe.ID_PROPERTY); @@ -3014,7 +3242,8 @@ public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunct return this; } public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ - groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTypePlatformWith", null, "type_platform")); return this; } public ScalarTypeProbeRequest groupByTypePlatform(){ @@ -3673,8 +3902,8 @@ public ScalarTypeProbeRequest orderByVersionDescending(){ public TypePlatformRequest rollUpToTypePlatform(){ TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); - this.withTypePlatformMatching(typePlatform) - .groupByTypePlatformWith(typePlatform); + this.internalRollUpTo("type_platform", typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTypePlatform", null, "type_platform")); return typePlatform; } diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java index d7fdce2e1..4f6485749 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -49,7 +49,7 @@ public String getName(){ } public SmartList getScalarTypeProbeList(){ - return this.scalarTypeProbeList; + return this.scalarTypeProbeList == null ? SmartList.unloaded() : this.scalarTypeProbeList; } public TypePlatform updateName(String name){ name = (name == null ? null : name.trim()); @@ -67,7 +67,8 @@ public TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ } if(null == this.scalarTypeProbeList){ - this.scalarTypeProbeList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.scalarTypeProbeList = teaqlUnloadedItems.map(value -> value); } this.scalarTypeProbeList.add(scalarTypeProbe); @@ -116,7 +117,13 @@ public Object __internalGet(String property) { switch (property) { case "name": return this.name; case "scalar_type_probe_list": return this.scalarTypeProbeList; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java index 62df23ea0..294c56f57 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -24,6 +24,7 @@ public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocat if((typePlatform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, typePlatform); if(typePlatform.needPersist()){ } if(typePlatform.newItem()){ diff --git a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java index 0ac2f1d18..ce149200c 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java +++ b/examples/scalar-type-probe/json-profiles/camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class TypePlatformRequest extends BaseRequest { @@ -35,6 +36,19 @@ public TypePlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TypePlatformRequest copy(){ + return (TypePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TypePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public TypePlatformRequest returnType(Class returnType){ @@ -102,6 +116,12 @@ public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ return this; } + public TypePlatformRequest matchingIdsOf(TypePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + TypePlatform.ID_PROPERTY, request, TypePlatform.ID_PROPERTY)); + } + public TypePlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -403,6 +423,30 @@ public TypePlatformRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public TypePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TypePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TypePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TypePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.VERSION_PROPERTY); + return this; + } public TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); return this; diff --git a/examples/scalar-type-probe/json-profiles/camelCase/teaql/checker-model.json b/examples/scalar-type-probe/json-profiles/camelCase/teaql/checker-model.json new file mode 100644 index 000000000..b36f1a22b --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732","entities":{"ScalarTypeProbe":{"labels":{"en":"Scalar Type Probe"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"large_text","labels":{"en":"large text"},"aliases":["LargeText","largeText"]},{"name":"optional_boolean","labels":{"en":"optional boolean"},"aliases":["OptionalBoolean","optionalBoolean"]},{"name":"optional_date","labels":{"en":"optional date"},"aliases":["OptionalDate","optionalDate"]},{"name":"optional_datetime","labels":{"en":"optional datetime"},"aliases":["OptionalDatetime","optionalDatetime"]},{"name":"optional_decimal","labels":{"en":"optional decimal"},"aliases":["OptionalDecimal","optionalDecimal"]},{"name":"optional_double","labels":{"en":"optional double"},"aliases":["OptionalDouble","optionalDouble"]},{"name":"optional_float","labels":{"en":"optional float"},"aliases":["OptionalFloat","optionalFloat"]},{"name":"optional_integer","labels":{"en":"optional integer"},"aliases":["OptionalInteger","optionalInteger"]},{"name":"optional_long","labels":{"en":"optional long"},"aliases":["OptionalLong","optionalLong"]},{"name":"optional_string","labels":{"en":"optional string"},"aliases":["OptionalString","optionalString"]},{"name":"optional_time","labels":{"en":"optional time"},"aliases":["OptionalTime","optionalTime"]},{"name":"required_boolean","labels":{"en":"required boolean"},"aliases":["RequiredBoolean","requiredBoolean"]},{"name":"required_date","labels":{"en":"required date"},"aliases":["RequiredDate","requiredDate"]},{"name":"required_datetime","labels":{"en":"required datetime"},"aliases":["RequiredDatetime","requiredDatetime"]},{"name":"required_decimal","labels":{"en":"required decimal"},"aliases":["RequiredDecimal","requiredDecimal"]},{"name":"required_double","labels":{"en":"required double"},"aliases":["RequiredDouble","requiredDouble"]},{"name":"required_float","labels":{"en":"required float"},"aliases":["RequiredFloat","requiredFloat"]},{"name":"required_integer","labels":{"en":"required integer"},"aliases":["RequiredInteger","requiredInteger"]},{"name":"required_long","labels":{"en":"required long"},"aliases":["RequiredLong","requiredLong"]},{"name":"required_string","labels":{"en":"required string"},"aliases":["RequiredString","requiredString"]},{"name":"required_time","labels":{"en":"required time"},"aliases":["RequiredTime","requiredTime"]},{"name":"type_platform","targetType":"TypePlatform","labels":{"en":"Type Platform"},"aliases":["TypePlatform","typePlatform"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"TypePlatform":{"labels":{"en":"Type Platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"scalar_type_probe_list","targetType":"ScalarTypeProbe","labels":{"en":"Scalar Type Probe"},"aliases":["ScalarTypeProbeList","scalarTypeProbeList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json new file mode 100644 index 000000000..19a79eb6c --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/provenance.json b/examples/scalar-type-probe/json-profiles/provenance.json index 77acf2c2a..5ff71f792 100644 --- a/examples/scalar-type-probe/json-profiles/provenance.json +++ b/examples/scalar-type-probe/json-profiles/provenance.json @@ -1,83 +1,101 @@ { - "producerReceiptSha256": "a190d5ed205b40c0db1ad907fb68379fb0f31a2e8b54f002128fe77eda6b1cca", - "producerSource": { - "commit": "39da6d21fe34e09c05224de15a7a02a07971c552", - "diff": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "status": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "sourceContentsSha256": "f57f23380158495beb3748d65e549ee97866901de2184520fd25d65bd224533f", - "assistExporterSha256": "2583414a9d656e89b43b85f1d4e993dcc774b74e2bed0f9b7120d7cb7ea47efd" - }, + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 0, "files": { + "PascalCase/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "897af4eeaa2235e2fd4cf3665977ba6326aae246d659f8f12a87cf98083c0e68", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "f219e3a5eb0ac5d6fa44717f9db083d91befc1d4c7c623cb7e3f18ac93d0741c", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "6c1a64b50196d7701518a1820f61e38de837372e7d0fa04ee7e87e0f655eddc5", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "0a2c88bf2e955240e090e8921f3c711ab38beb2352426fdd212a25a53989e9e1", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", + "PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "PascalCase/model.xml": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", + "PascalCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", + "PascalCase/teaql/model-provenance.json": "ae427ef988d132abf6690f6dd0988e045249b7897a9ab1e3adee5c6ff789157b", "base-model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "manifest.json": "519dfe321218a4248a9da550b22d35e3507a0408eb8e60fad1bc009a058afa6d", - "camelCase/model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "camelCase/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "5c3acc14ce9185a24460c9b85afba2dd57f39c240b04fbd8ccea443e436a001e", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "8c0dc1f8945933a86e9a5fac31c07fb977e858916441b50d3b84bbed83bf0341", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "78dfd21f0e6918121c43028dc5cce7ecbdb7e1467b447db0d3dac07b17433a69", - "camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", - "camelCase/lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "5b30ec087b361856c32a7cfaa7adaf494a1351692256004bfdefe834d7011d99", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "2ca2464dbc834c0a6be263a8313552ffacc7ed3a59b6f8c2b7a54329024ed796", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "04158167dbfc7a0a6afa4655597f7070b06ba7f1db828c99df59350489812daa", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", - "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e", - "snake_case/model.xml": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "b177989e4a5fec42f98de8374eccc93d398288f16605751fd0cc789388690b54", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", + "camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "camelCase/model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", + "camelCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", + "camelCase/teaql/model-provenance.json": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e", + "manifest.json": "519dfe321218a4248a9da550b22d35e3507a0408eb8e60fad1bc009a058afa6d", + "snake_case/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "a912abea3e686e5dcf4de14fc4fb594c53e5fb3bd36e0d565baa4035a398f793", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "d5eb32050c3d76724f5728a9a98cf1af5b97e280dc57018c12531a5af470b7b3", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "bc983ba89daad16e2e522e7c6b68b1c9c202db923e4d86f9d0858e37f63032b1", - "snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", - "snake_case/lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "07bda7cfc1c24acea406381d33150f44bf6c32c7a5e9485abbdda5fdc3cec4d1", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "22fe6ce8742b4c596fae00207b04a47275d7a167395f54e7a968afb512b4a22c", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "50928e3ee1fb00938f4759b69a2c09ca2f9334465081d2d6bc0205ae7a1fffa0", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "da3fe55f44510b3b54d4eb6fd081f19964ed825025be8c0c245824a13d9ab3c8", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "d380c790184d4f25950b987de14df8632ca8a1c144655a3bf97d499ffe875e90", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", - "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e", - "PascalCase/model.xml": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "c1f35284a4bfc6183d5fbf9cd6cba59927051af89b67e94ac4a4e78efe683806", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java": "bef4e12652e1f6d34b99067b7ca5b5bf03d74a54bf982d5a83d157801a4608bf", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java": "67278565b479fbd509b7087d03c1fbebe206707529fb3aa0b2b32f175afe48fb", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Constants.java": "532173f7d3bf649e53a770c582a0b7992783c7d7c0c091690f930a3006be7051", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/ScalarTypeConformanceServiceUserContext.java": "da51c7752e2e3ad48a51a74fc4e30d8b5d624528967c93cb8289c496aa68c153", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "942fbe9038116a9330f01da69cb807a03b5630447e4ad9b9fddf1670547bfaec", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java": "5f6fd4941b22a8a77ba523ff082ac4290aa00c076dc44726d28d5a786e83f097", - "PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/Q.java": "1323cb489c5002e29f1df2d059815954391f6a520d82c0dc6c13deda1d381264", - "PascalCase/lib/pom.xml": "beb527ffbd3b312ae3ce63c03ecc904ee979481d275873d514891b5a0a605e2b", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "bc9ff294276679c85901678f972a393317be901a96987c0cd05eff2fbf20f766", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "af9f46c490740eea0cfaca791741e3984275224d9135570f8e043470ed792d7a", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/E.java": "897af4eeaa2235e2fd4cf3665977ba6326aae246d659f8f12a87cf98083c0e68", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeExpression.java": "f8d1e40d33d446ef9bc8b07755216ee85664591fcddeddbf8841feff2a7877fe", - "PascalCase/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java": "4853306dd5be58ed2d2871e3ba52c7efa43f56a1852968d4a2874f1f9ec4ff3e" + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeListExpression.java": "5bde5287effdfbe050f53f9735cdf56c84cc337dd5c38d1bc180f55312423fdc", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java": "4da1c8d4d3d73abcb9719e327f1a436993609e0f303cc075ba8004d6ae0236f9", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java": "9152e4dd26331cc7950b21fc1bc3c343968ae0cb702ba3f3aeb970201a99d205", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java": "4162eb2929b8f15b5c2cb2c55f65809304d31cb1110ad922082c7c70c3483a53", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformExpression.java": "892aa2db6927d1076e41ac6e9c0e6a382cb31d8e2530cdcbe87c37d540b53a11", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformListExpression.java": "30aee627dec3b9ce89f23d90cc615ba22bb94b44a6af420b0f9683781cddb72a", + "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", + "snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", + "snake_case/model.xml": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", + "snake_case/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", + "snake_case/teaql/model-provenance.json": "aae97b2ed5d87ede29d03b620225b0cd242b8e088d6ec9fc8cdf7629ff200a98" + }, + "generatedManifestSha256": "642d8577b4379a11e9e55e5585c126bdb7f7c03634c3f68636c0ec90ecbb83c7", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", + "previousFixtureManifestSha256": "64d9d59523014b0091016c83e70d9cb9820aacfcd53693962644682807368bdf", + "previousOrigin": { + "commit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "path": "examples/scalar-type-probe/json-profiles/provenance.json" + }, + "producerReceiptSha256": "cae8fc7833271365c96c843108f60e0ee11ae4648c06c655715145cba81cfb2c", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" } } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml b/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml index 6f3d904d8..a8c977f4c 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.555-RELEASE + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.555-RELEASE + ${teaql.version} io.teaql diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java index 59b3f02e9..fba513063 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/EntityMetaRegistry.java @@ -27,8 +27,11 @@ private void registerTypePlatform() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.typeplatform.TypePlatform::new); entityDescriptor.with("name", "Type Platform") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -42,54 +45,99 @@ private void registerTypePlatform() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Scalar Type Conformance") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.typeplatform.TypePlatform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -100,8 +148,11 @@ private void registerScalarTypeProbe() { entityDescriptor.setTargetType(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.class); entityDescriptor.setEntitySupplier(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe::new); entityDescriptor.with("name", "Scalar Type Probe") + .with("module", "Type Conformance") - .with("module_key", "type-conformance"); + + .with("module_key", "type-conformance") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -184,433 +235,822 @@ private void registerScalarTypeProbe() { ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.TYPE_PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_STRING_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.LARGE_TEXT_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.lang.String") + .with("sqlType", "LARGE_TEXT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isText", "true") - .with("isTime", "false"); + + .with("isTime", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_LONG_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("isFloat", "true") + .with("oracle_sqlType", "binary_float") + .with("javaType", "java.lang.Float") + .with("sqlType", "REAL") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Float") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("optional", "true") + .with("oracle_sqlType", "binary_double") + .with("javaType", "java.lang.Double") + .with("sqlType", "DOUBLE PRECISION") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("mssql_sqlType", "FLOAT") + .with("isString", "false") + .with("isDate", "false") + .with("mysql_sqlType", "DOUBLE") + .with("graphqlType", "Float") + .with("isTime", "false") + .with("isText", "false") - .with("isDouble", "true"); + + .with("isDouble", "true") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalTime") + .with("sqlType", "TIME") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Time") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("optional", "true") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbe.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java index 01b4fcb51..a70c782b3 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.example.scalartypeconformanceservice.typeplatform.TypePlatformChecker(), new com.example.scalartypeconformanceservice.scalartypeprobe.ScalarTypeProbeChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732\",\"entities\":{\"ScalarTypeProbe\":{\"labels\":{\"en\":\"Scalar Type Probe\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"large_text\",\"labels\":{\"en\":\"large text\"},\"aliases\":[\"LargeText\",\"largeText\"]},{\"name\":\"optional_boolean\",\"labels\":{\"en\":\"optional boolean\"},\"aliases\":[\"OptionalBoolean\",\"optionalBoolean\"]},{\"name\":\"optional_date\",\"labels\":{\"en\":\"optional date\"},\"aliases\":[\"OptionalDate\",\"optionalDate\"]},{\"name\":\"optional_datetime\",\"labels\":{\"en\":\"optional datetime\"},\"aliases\":[\"OptionalDatetime\",\"optionalDatetime\"]},{\"name\":\"optional_decimal\",\"labels\":{\"en\":\"optional decimal\"},\"aliases\":[\"OptionalDecimal\",\"optionalDecimal\"]},{\"name\":\"optional_double\",\"labels\":{\"en\":\"optional double\"},\"aliases\":[\"OptionalDouble\",\"optionalDouble\"]},{\"name\":\"optional_float\",\"labels\":{\"en\":\"optional float\"},\"aliases\":[\"OptionalFloat\",\"optionalFloat\"]},{\"name\":\"optional_integer\",\"labels\":{\"en\":\"optional integer\"},\"aliases\":[\"OptionalInteger\",\"optionalInteger\"]},{\"name\":\"optional_long\",\"labels\":{\"en\":\"optional long\"},\"aliases\":[\"OptionalLong\",\"optionalLong\"]},{\"name\":\"optional_string\",\"labels\":{\"en\":\"optional string\"},\"aliases\":[\"OptionalString\",\"optionalString\"]},{\"name\":\"optional_time\",\"labels\":{\"en\":\"optional time\"},\"aliases\":[\"OptionalTime\",\"optionalTime\"]},{\"name\":\"required_boolean\",\"labels\":{\"en\":\"required boolean\"},\"aliases\":[\"RequiredBoolean\",\"requiredBoolean\"]},{\"name\":\"required_date\",\"labels\":{\"en\":\"required date\"},\"aliases\":[\"RequiredDate\",\"requiredDate\"]},{\"name\":\"required_datetime\",\"labels\":{\"en\":\"required datetime\"},\"aliases\":[\"RequiredDatetime\",\"requiredDatetime\"]},{\"name\":\"required_decimal\",\"labels\":{\"en\":\"required decimal\"},\"aliases\":[\"RequiredDecimal\",\"requiredDecimal\"]},{\"name\":\"required_double\",\"labels\":{\"en\":\"required double\"},\"aliases\":[\"RequiredDouble\",\"requiredDouble\"]},{\"name\":\"required_float\",\"labels\":{\"en\":\"required float\"},\"aliases\":[\"RequiredFloat\",\"requiredFloat\"]},{\"name\":\"required_integer\",\"labels\":{\"en\":\"required integer\"},\"aliases\":[\"RequiredInteger\",\"requiredInteger\"]},{\"name\":\"required_long\",\"labels\":{\"en\":\"required long\"},\"aliases\":[\"RequiredLong\",\"requiredLong\"]},{\"name\":\"required_string\",\"labels\":{\"en\":\"required string\"},\"aliases\":[\"RequiredString\",\"requiredString\"]},{\"name\":\"required_time\",\"labels\":{\"en\":\"required time\"},\"aliases\":[\"RequiredTime\",\"requiredTime\"]},{\"name\":\"type_platform\",\"targetType\":\"TypePlatform\",\"labels\":{\"en\":\"Type Platform\"},\"aliases\":[\"TypePlatform\",\"typePlatform\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"TypePlatform\":{\"labels\":{\"en\":\"Type Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"scalar_type_probe_list\",\"targetType\":\"ScalarTypeProbe\",\"labels\":{\"en\":\"Scalar Type Probe\"},\"aliases\":[\"ScalarTypeProbeList\",\"scalarTypeProbeList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java index fe99b5c64..1e9f630bf 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbe.java @@ -537,7 +537,36 @@ public Object __internalGet(String property) { case "optional_datetime": return this.optionalDatetime; case "create_time": return this.createTime; case "update_time": return this.updateTime; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "typePlatform": return this.typePlatform; + case "requiredString": return this.requiredString; + case "optionalString": return this.optionalString; + case "largeText": return this.largeText; + case "requiredBoolean": return this.requiredBoolean; + case "optionalBoolean": return this.optionalBoolean; + case "requiredInteger": return this.requiredInteger; + case "optionalInteger": return this.optionalInteger; + case "requiredLong": return this.requiredLong; + case "optionalLong": return this.optionalLong; + case "requiredDecimal": return this.requiredDecimal; + case "optionalDecimal": return this.optionalDecimal; + case "requiredFloat": return this.requiredFloat; + case "optionalFloat": return this.optionalFloat; + case "requiredDouble": return this.requiredDouble; + case "optionalDouble": return this.optionalDouble; + case "requiredDate": return this.requiredDate; + case "optionalDate": return this.optionalDate; + case "requiredTime": return this.requiredTime; + case "optionalTime": return this.optionalTime; + case "requiredDatetime": return this.requiredDatetime; + case "optionalDatetime": return this.optionalDatetime; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java index 3ad70ad88..b9d9a2f04 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeChecker.java @@ -28,19 +28,34 @@ public void doCheck(UserContext _context, ScalarTypeProbe scalarTypeProbe, Objec if((scalarTypeProbe == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, scalarTypeProbe); if(scalarTypeProbe.needPersist()){ } if(scalarTypeProbe.newItem()){ - if(scalarTypeProbe.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { scalarTypeProbe.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(scalarTypeProbe.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(scalarTypeProbe.updateItem()){ - scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + scalarTypeProbe.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!scalarTypeProbe.isPropertyLoaded("type_platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "type_platform"), "Mutation requires a fully loaded entity"); } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java index 6a60aaedd..ffee511c0 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/scalartypeprobe/ScalarTypeProbeRequest.java @@ -16,6 +16,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.Date; +import java.util.Objects; public class ScalarTypeProbeRequest extends BaseRequest { @@ -40,6 +41,19 @@ public ScalarTypeProbeRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ScalarTypeProbeRequest copy(){ + return (ScalarTypeProbeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ScalarTypeProbeRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public ScalarTypeProbeRequest returnType(Class returnType){ @@ -107,6 +121,12 @@ public ScalarTypeProbeRequest matchingAnyOf(ScalarTypeProbeRequest scalarType return this; } + public ScalarTypeProbeRequest matchingIdsOf(ScalarTypeProbeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + ScalarTypeProbe.ID_PROPERTY, request, ScalarTypeProbe.ID_PROPERTY)); + } + public ScalarTypeProbeRequest enhanceChildrenIfNeeded(){ return this; } @@ -2998,6 +3018,214 @@ public ScalarTypeProbeRequest groupByTypePlatformWithDetails(TypePlatformRequ + public ScalarTypeProbeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.ID_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctTypePlatform(){ + return countDistinctTypePlatformAs("type_platform_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctTypePlatformAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.TYPE_PLATFORM_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredString(){ + return countDistinctRequiredStringAs("required_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalString(){ + return countDistinctOptionalStringAs("optional_string_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalStringAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_STRING_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctLargeText(){ + return countDistinctLargeTextAs("large_text_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctLargeTextAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.LARGE_TEXT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredBoolean(){ + return countDistinctRequiredBooleanAs("required_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalBoolean(){ + return countDistinctOptionalBooleanAs("optional_boolean_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalBooleanAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_BOOLEAN_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredInteger(){ + return countDistinctRequiredIntegerAs("required_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalInteger(){ + return countDistinctOptionalIntegerAs("optional_integer_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalIntegerAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_INTEGER_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredLong(){ + return countDistinctRequiredLongAs("required_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalLong(){ + return countDistinctOptionalLongAs("optional_long_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalLongAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_LONG_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDecimal(){ + return countDistinctRequiredDecimalAs("required_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDecimal(){ + return countDistinctOptionalDecimalAs("optional_decimal_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDecimalAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DECIMAL_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredFloat(){ + return countDistinctRequiredFloatAs("required_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalFloat(){ + return countDistinctOptionalFloatAs("optional_float_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalFloatAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_FLOAT_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDouble(){ + return countDistinctRequiredDoubleAs("required_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDouble(){ + return countDistinctOptionalDoubleAs("optional_double_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDoubleAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DOUBLE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDate(){ + return countDistinctRequiredDateAs("required_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDate(){ + return countDistinctOptionalDateAs("optional_date_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDateAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATE_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredTime(){ + return countDistinctRequiredTimeAs("required_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalTime(){ + return countDistinctOptionalTimeAs("optional_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctRequiredDatetime(){ + return countDistinctRequiredDatetimeAs("required_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctRequiredDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.REQUIRED_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctOptionalDatetime(){ + return countDistinctOptionalDatetimeAs("optional_datetime_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctOptionalDatetimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.OPTIONAL_DATETIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.CREATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.UPDATE_TIME_PROPERTY); + return this; + } + public ScalarTypeProbeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ScalarTypeProbeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, ScalarTypeProbe.VERSION_PROPERTY); + return this; + } public ScalarTypeProbeRequest groupById(){ groupBy(ScalarTypeProbe.ID_PROPERTY); @@ -3014,7 +3242,8 @@ public ScalarTypeProbeRequest groupByIdWithFunction(String retName, AggrFunct return this; } public ScalarTypeProbeRequest groupByTypePlatformWith(TypePlatformRequest subRequest){ - groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest); + groupBy(ScalarTypeProbe.TYPE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTypePlatformWith", null, "type_platform")); return this; } public ScalarTypeProbeRequest groupByTypePlatform(){ @@ -3673,8 +3902,8 @@ public ScalarTypeProbeRequest orderByVersionDescending(){ public TypePlatformRequest rollUpToTypePlatform(){ TypePlatformRequest typePlatform = Q.typePlatforms().unlimited(); - this.withTypePlatformMatching(typePlatform) - .groupByTypePlatformWith(typePlatform); + this.internalRollUpTo("type_platform", typePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTypePlatform", null, "type_platform")); return typePlatform; } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java index c879182af..10a7b17d1 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatform.java @@ -49,7 +49,7 @@ public String getName(){ } public SmartList getScalarTypeProbeList(){ - return this.scalarTypeProbeList; + return this.scalarTypeProbeList == null ? SmartList.unloaded() : this.scalarTypeProbeList; } public TypePlatform updateName(String name){ name = (name == null ? null : name.trim()); @@ -67,7 +67,8 @@ public TypePlatform addScalarTypeProbe(ScalarTypeProbe scalarTypeProbe){ } if(null == this.scalarTypeProbeList){ - this.scalarTypeProbeList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.scalarTypeProbeList = teaqlUnloadedItems.map(value -> value); } this.scalarTypeProbeList.add(scalarTypeProbe); @@ -116,7 +117,13 @@ public Object __internalGet(String property) { switch (property) { case "name": return this.name; case "scalar_type_probe_list": return this.scalarTypeProbeList; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java index 62df23ea0..294c56f57 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformChecker.java @@ -24,6 +24,7 @@ public void doCheck(UserContext _context, TypePlatform typePlatform, ObjectLocat if((typePlatform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, typePlatform); if(typePlatform.needPersist()){ } if(typePlatform.newItem()){ diff --git a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java index 0ac2f1d18..ce149200c 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java +++ b/examples/scalar-type-probe/json-profiles/snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class TypePlatformRequest extends BaseRequest { @@ -35,6 +36,19 @@ public TypePlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TypePlatformRequest copy(){ + return (TypePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TypePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public TypePlatformRequest returnType(Class returnType){ @@ -102,6 +116,12 @@ public TypePlatformRequest matchingAnyOf(TypePlatformRequest typePlatform){ return this; } + public TypePlatformRequest matchingIdsOf(TypePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + TypePlatform.ID_PROPERTY, request, TypePlatform.ID_PROPERTY)); + } + public TypePlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -403,6 +423,30 @@ public TypePlatformRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public TypePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TypePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.ID_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TypePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.NAME_PROPERTY); + return this; + } + public TypePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TypePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, TypePlatform.VERSION_PROPERTY); + return this; + } public TypePlatformRequest groupByScalarTypeProbesWithDetails(ScalarTypeProbeRequest subRequest){ aggregate(TypePlatform.SCALAR_TYPE_PROBE_LIST_PROPERTY, subRequest); return this; diff --git a/examples/scalar-type-probe/json-profiles/snake_case/teaql/checker-model.json b/examples/scalar-type-probe/json-profiles/snake_case/teaql/checker-model.json new file mode 100644 index 000000000..b36f1a22b --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:841a468d4530e236b3e8b3c9400e7e9ae833a21319368d8320686732f2516732","entities":{"ScalarTypeProbe":{"labels":{"en":"Scalar Type Probe"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"large_text","labels":{"en":"large text"},"aliases":["LargeText","largeText"]},{"name":"optional_boolean","labels":{"en":"optional boolean"},"aliases":["OptionalBoolean","optionalBoolean"]},{"name":"optional_date","labels":{"en":"optional date"},"aliases":["OptionalDate","optionalDate"]},{"name":"optional_datetime","labels":{"en":"optional datetime"},"aliases":["OptionalDatetime","optionalDatetime"]},{"name":"optional_decimal","labels":{"en":"optional decimal"},"aliases":["OptionalDecimal","optionalDecimal"]},{"name":"optional_double","labels":{"en":"optional double"},"aliases":["OptionalDouble","optionalDouble"]},{"name":"optional_float","labels":{"en":"optional float"},"aliases":["OptionalFloat","optionalFloat"]},{"name":"optional_integer","labels":{"en":"optional integer"},"aliases":["OptionalInteger","optionalInteger"]},{"name":"optional_long","labels":{"en":"optional long"},"aliases":["OptionalLong","optionalLong"]},{"name":"optional_string","labels":{"en":"optional string"},"aliases":["OptionalString","optionalString"]},{"name":"optional_time","labels":{"en":"optional time"},"aliases":["OptionalTime","optionalTime"]},{"name":"required_boolean","labels":{"en":"required boolean"},"aliases":["RequiredBoolean","requiredBoolean"]},{"name":"required_date","labels":{"en":"required date"},"aliases":["RequiredDate","requiredDate"]},{"name":"required_datetime","labels":{"en":"required datetime"},"aliases":["RequiredDatetime","requiredDatetime"]},{"name":"required_decimal","labels":{"en":"required decimal"},"aliases":["RequiredDecimal","requiredDecimal"]},{"name":"required_double","labels":{"en":"required double"},"aliases":["RequiredDouble","requiredDouble"]},{"name":"required_float","labels":{"en":"required float"},"aliases":["RequiredFloat","requiredFloat"]},{"name":"required_integer","labels":{"en":"required integer"},"aliases":["RequiredInteger","requiredInteger"]},{"name":"required_long","labels":{"en":"required long"},"aliases":["RequiredLong","requiredLong"]},{"name":"required_string","labels":{"en":"required string"},"aliases":["RequiredString","requiredString"]},{"name":"required_time","labels":{"en":"required time"},"aliases":["RequiredTime","requiredTime"]},{"name":"type_platform","targetType":"TypePlatform","labels":{"en":"Type Platform"},"aliases":["TypePlatform","typePlatform"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"TypePlatform":{"labels":{"en":"Type Platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"scalar_type_probe_list","targetType":"ScalarTypeProbe","labels":{"en":"Scalar Type Probe"},"aliases":["ScalarTypeProbeList","scalarTypeProbeList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json new file mode 100644 index 000000000..8e39a5200 --- /dev/null +++ b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/school-management/AGENTS.md b/examples/school-management/AGENTS.md index 98bef0657..bbf188ba2 100644 --- a/examples/school-management/AGENTS.md +++ b/examples/school-management/AGENTS.md @@ -2,6 +2,31 @@ # TeaQL Java Agent Instructions +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + > [!WARNING] > **IGNORE GENERIC ORM EXPERIENCE** > @@ -13,29 +38,7 @@ > > Do **not** guess TeaQL method names. -## How to Write Domain Code - -To get the exact API usage and query examples for the entity you are working on, execute the following command: - -```bash -cargo teaql --input models/school-management-service.xml java-assist-[action]/[entity-name] -``` - -> `models/school-management-service.xml` is the default model path. If the model file is located elsewhere, adjust the `--input` path to match the actual file location in this project. - -Replace `[action]` with one of the following: - -| action | when-to-use | -|--------|-------------| -| query | Read/find records from the database using Q. | -| create | Insert a new record into the database | -| update | Modify and save an existing record | -| delete | Remove or soft-delete a record | -| expression | Safely extract nested relation values using E. | -| list-page | Implement a paginated query returning SmartList | -| debug | View instructions for enabling SQL logging and debugging | - -Replace `[entity-name]` with the exact entity-name from the table below: +## Model entities | entity-name | display-name | |-------------|--------------| @@ -44,9 +47,10 @@ Replace `[entity-name]` with the exact entity-name from the table below: | school | School | -Once the command succeeds, read its output. Use the printed code as a template to write your logic. +## Application entry and context -If the command cannot be executed, stop and report the missing context. Do not invent APIs. +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. ## Additional References @@ -56,4 +60,8 @@ Read these only when the task requires them: Framework runtime references and context handling. * **`RUNTIME_CUSTOM_GUIDE.md`** - Runtime setup, debugging, and project-specific restrictions. \ No newline at end of file + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/school-management/RUNTIME_CUSTOM_GUIDE.md b/examples/school-management/RUNTIME_CUSTOM_GUIDE.md index bedbff19d..93dad43c5 100644 --- a/examples/school-management/RUNTIME_CUSTOM_GUIDE.md +++ b/examples/school-management/RUNTIME_CUSTOM_GUIDE.md @@ -1,6 +1,17 @@ # TeaQL Runtime Customization Guide +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + > [!WARNING] > **DO NOT GUESS RUNTIME CONFIGURATION** > Do not guess how to configure the runtime, connection pools, or schema generation. diff --git a/examples/school-management/STANDARD_TELEMETRY.md b/examples/school-management/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/school-management/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/school-management/lib/pom.xml b/examples/school-management/lib/pom.xml index 982a09839..ca269438a 100644 --- a/examples/school-management/lib/pom.xml +++ b/examples/school-management/lib/pom.xml @@ -82,7 +82,7 @@ cn.hutool hutool-all - 5.8.47 + 5.8.20 @@ -139,4 +139,4 @@ https://maven.teaql.io/repository/maven-releases/ - + \ No newline at end of file diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java index c67077564..0629960ea 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java @@ -7,16 +7,17 @@ import com.example.schoolmanagementservice.school.SchoolExpression; import com.example.schoolmanagementservice.schooltype.SchoolType; import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; import io.teaql.core.value.ValueExpression; public class E { public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform)); + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); } public static SchoolTypeExpression schoolType(SchoolType schoolType){ - return new SchoolTypeExpression(new ValueExpression(schoolType)); + return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); } public static SchoolExpression school(School school){ - return new SchoolExpression(new ValueExpression(school)); + return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); } } \ No newline at end of file diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java index 92e8c0cef..257189a02 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java @@ -1,6 +1,7 @@ package com.example.schoolmanagementservice; +import io.teaql.core.FieldLayout; import io.teaql.core.meta.EntityDescriptor; import io.teaql.core.meta.EntityMetaAssembler; import io.teaql.core.meta.EntityMetaFactory; @@ -20,14 +21,19 @@ public void assemble(EntityMetaFactory factory) { registerSchool(); } private void registerPlatform() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.platform.Platform.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE); entityDescriptor.setTargetType(com.example.schoolmanagementservice.platform.Platform.class); entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.platform.Platform::new); entityDescriptor.with("name", "Platform") + .with("module", "Organization") - .with("module_key", "organization"); + .with("module_key", "organization") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY, Long.class) ; @@ -48,124 +54,226 @@ private void registerPlatform() { ; entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Campus Learning Platform") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "https://campus.example.com") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("candidates", "createTime()") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("candidates", "updateTime()") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerSchoolType() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE); entityDescriptor.setTargetType(com.example.schoolmanagementservice.schooltype.SchoolType.class); entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schooltype.SchoolType::new); entityDescriptor.with("name", "School Type") + .with("module", "Academics") + .with("module_key", "academics") + .with("constant", "true") - .with("identifier", "code"); + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor platform = entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) ; @@ -185,107 +293,191 @@ private void registerSchoolType() { entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) ; entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("candidates", "1001,1002") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Primary,Secondary") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") + .with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "PRIMARY,SECONDARY") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("candidates", "1,2") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerSchool() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.school.School.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.example.schoolmanagementservice.school.School.INTERNAL_TYPE); entityDescriptor.setTargetType(com.example.schoolmanagementservice.school.School.class); entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.school.School::new); entityDescriptor.with("name", "School") + .with("module", "Academics") - .with("module_key", "academics"); + .with("module_key", "academics") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY, Long.class) ; @@ -321,20 +513,35 @@ private void registerSchool() { ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY).with("required", "true"); @@ -342,139 +549,259 @@ private void registerSchool() { entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(1)") + .with("javaType", "java.lang.Boolean") + .with("sqlType", "BOOLEAN") + .with("isId", "false") + .with("isBool", "true") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "bit") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Boolean") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("updateFunction", "now") + .with("javaType", "java.time.LocalDateTime") + .with("sqlType", "TIMESTAMP") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("mssql_sqlType", "dateTime") + .with("isDateTime", "true") + .with("createFunction", "now") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "LocalTime") + .with("isTime", "true") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java index 555a9dddf..9f8f340c9 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java @@ -4,11 +4,26 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.example.schoolmanagementservice.platform.PlatformChecker(), new com.example.schoolmanagementservice.schooltype.SchoolTypeChecker(), new com.example.schoolmanagementservice.school.SchoolChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:71ba9da7267282a87034f786438f6f60442609b86ca42c3ef288e51c43107ce1\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"School\"},\"fields\":[{\"name\":\"active\",\"labels\":{\"en\":\"active\"},\"aliases\":[\"Active\"]},{\"name\":\"address\",\"labels\":{\"en\":\"address\"},\"aliases\":[\"Address\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"established_date\",\"labels\":{\"en\":\"established date\"},\"aliases\":[\"EstablishedDate\",\"establishedDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"School Type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} public static io.teaql.core.RuntimeModule module() { return MODULE; } + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("address", "address"), java.util.Map.entry("established_date", "establishedDate"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("active", "active"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); com.example.schoolmanagementservice.platform.Platform domainRoot; diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java index 73c1a5774..c8368197d 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java @@ -12,6 +12,7 @@ public static com.example.schoolmanagementservice.platform.PlatformRequest schoolTypes(){ return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -20,6 +21,7 @@ public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schools(){ return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); } @@ -28,4 +30,5 @@ public static com.example.schoolmanagementservice.school.SchoolRequest __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_type_list", "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String NAME_PROPERTY = "name"; - public static final String BASE_URL_PROPERTY = "baseUrl"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; - public static final String SCHOOL_TYPE_LIST_PROPERTY = "schoolTypeList"; - public static final String SCHOOL_LIST_PROPERTY = "schoolList"; + public static final String BASE_URL_PROPERTY = "base_url"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; private String name; + private String baseUrl; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private SmartList schoolTypeList; private SmartList schoolList; public String getName(){ return this.name; } + public String getBaseUrl(){ return this.baseUrl; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public SmartList getSchoolTypeList(){ - return this.schoolTypeList; + return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; } public SmartList getSchoolList(){ - return this.schoolList; + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; } public Platform updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public Platform updateBaseUrl(String baseUrl){ baseUrl = (baseUrl == null ? null : baseUrl.trim()); - if(Objects.equals(this.baseUrl, baseUrl)){ + if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ return this; } handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); this.baseUrl = baseUrl; return this; } + public Platform updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public Platform updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); this.updateTime = updateTime; return this; } + public Platform addSchoolType(SchoolType schoolType){ if (schoolType == null){ return this; } if(null == this.schoolTypeList){ - this.schoolTypeList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolTypeList = teaqlUnloadedItems.map(value -> value); } this.schoolTypeList.add(schoolType); @@ -107,7 +137,8 @@ public Platform addSchool(School school){ } if(null == this.schoolList){ - this.schoolList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); } this.schoolList.add(school); @@ -134,7 +165,7 @@ public Platform comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -145,14 +176,14 @@ public void __internalSet(String property, Object value) { switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "baseUrl": this.baseUrl = (value == null ? null : ((String)value).trim()); break; + case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; - case "schoolTypeList": this.schoolTypeList = (SmartList) value; break; - case "schoolList": this.schoolList = (SmartList) value; break; + case "school_type_list": this.schoolTypeList = (SmartList) value; break; + case "school_list": this.schoolList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -162,12 +193,21 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "name": return this.name; - case "baseUrl": return this.baseUrl; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - case "schoolTypeList": return this.schoolTypeList; - case "schoolList": return this.schoolList; - default: return super.__internalGet(property); + case "base_url": return this.baseUrl; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "school_type_list": return this.schoolTypeList; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "baseUrl": return this.baseUrl; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java index 9f7991f82..d20345fd5 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java @@ -27,26 +27,47 @@ public void doCheck(UserContext _context, Platform platform, ObjectLocation _par if((platform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } if(platform.newItem()){ - if(platform.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { platform.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(platform.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { platform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(platform.updateItem()){ - platform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!platform.isPropertyLoaded("name")){ invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - }if(!platform.isPropertyLoaded("baseUrl")){ + } + if(!platform.isPropertyLoaded("base_url")){ invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); - }if(!platform.isPropertyLoaded("createTime")){ + } + if(!platform.isPropertyLoaded("create_time")){ invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - }if(!platform.isPropertyLoaded("updateTime")){ + } + if(!platform.isPropertyLoaded("update_time")){ invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); } + } checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java index 392f3fe47..0547820e6 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java @@ -39,38 +39,38 @@ public boolean isNull() { public Expression getName(){ - return loaded("name", Platform::getName); + return loaded("name", "getName", Platform::getName); } public PlatformExpression updateName(String name){ return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); } public Expression getBaseUrl(){ - return loaded("baseUrl", Platform::getBaseUrl); + return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); } public PlatformExpression updateBaseUrl(String baseUrl){ return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); } public Expression getCreateTime(){ - return loaded("createTime", Platform::getCreateTime); + return loaded("create_time", "getCreateTime", Platform::getCreateTime); } public PlatformExpression updateCreateTime(LocalDateTime createTime){ return new PlatformExpression(this, $it -> ((Platform)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return loaded("updateTime", Platform::getUpdateTime); + return loaded("update_time", "getUpdateTime", Platform::getUpdateTime); } public PlatformExpression updateUpdateTime(LocalDateTime updateTime){ return new PlatformExpression(this, $it -> ((Platform)$it).updateUpdateTime(updateTime)); } public SchoolTypeListExpression getSchoolTypeList(){ - return new SchoolTypeListExpression(loaded("schoolTypeList", Platform::getSchoolTypeList)); + return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); } public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("schoolList", Platform::getSchoolList)); + return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); } public PlatformExpression addSchoolType(SchoolType schoolType){ return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java index a08e04728..c0abb6538 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java @@ -15,6 +15,7 @@ import io.teaql.core.criteria.TwoOperatorCriteria; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class PlatformRequest extends BaseRequest { @@ -25,7 +26,11 @@ public class PlatformRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public PlatformRequest(Class returnType){ - super(returnType, () -> (T) new Platform()); + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -35,6 +40,19 @@ public PlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PlatformRequest returnType(Class returnType){ @@ -102,6 +120,12 @@ public PlatformRequest matchingAnyOf(PlatformRequest platform){ return this; } + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + public PlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -125,6 +149,18 @@ public PlatformRequest selectSelfFields(){ return selectSelf(); } + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.BASE_URL_PROPERTY); + selectProperty(Platform.CREATE_TIME_PROPERTY); + selectProperty(Platform.UPDATE_TIME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectAll(){ super.selectAll(); return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); @@ -244,7 +280,8 @@ public PlatformRequest selectSchoolTypeList(){ } public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ - enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList); + enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); return this; } public PlatformRequest selectSchoolList(){ @@ -252,7 +289,8 @@ public PlatformRequest selectSchoolList(){ } public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList); + enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); return this; } @@ -671,6 +709,7 @@ public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVers return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); } @@ -704,10 +743,60 @@ public PlatformRequest haveNoSchools(){ public PlatformRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public PlatformRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctBaseUrl(){ + return countDistinctBaseUrlAs("base_url_distinct_count"); + } + + public PlatformRequest countDistinctBaseUrlAs(String alias){ + super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public PlatformRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public PlatformRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); return this; } public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ @@ -893,8 +982,8 @@ public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest } public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(SchoolType.PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); return this; } @@ -906,8 +995,8 @@ public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subReque } public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(School.PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); return this; } @@ -915,29 +1004,45 @@ public PlatformRequest statsFromSchools(SchoolRequest subRequest){ return statsFromSchoolsAs(REFINEMENTS, subRequest); } public PlatformRequest countSchoolTypes(){ - return countSchoolTypesAs("Count"); + addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest countSchoolTypesAs(String name){ - return countSchoolTypesWith(name, Q.schoolTypes().unlimited()); + addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest countSchools(){ - return countSchoolsAs("Count"); + addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest countSchoolsAs(String name){ - return countSchoolsWith(name, Q.schools().unlimited()); + addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest minDisplayOrderOfSchoolTypes(){ - return minDisplayOrderOfSchoolTypesAs("minDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("minDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ @@ -945,10 +1050,18 @@ public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ } public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.minDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest maxDisplayOrderOfSchoolTypes(){ - return maxDisplayOrderOfSchoolTypesAs("maxDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("maxDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ @@ -956,10 +1069,18 @@ public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ } public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.maxDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest sumDisplayOrderOfSchoolTypes(){ - return sumDisplayOrderOfSchoolTypesAs("sumDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("sumDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ @@ -967,10 +1088,18 @@ public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ } public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.sumDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest avgDisplayOrderOfSchoolTypes(){ - return avgDisplayOrderOfSchoolTypesAs("avgDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("avgDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ @@ -978,10 +1107,18 @@ public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ } public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.avgDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest standardDeviationDisplayOrderOfSchoolTypes(){ - return standardDeviationDisplayOrderOfSchoolTypesAs("stdDevDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("stdDevDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name){ @@ -989,10 +1126,18 @@ public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String na } public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.standardDeviationDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes(){ - return squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs("stdDevPopDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("stdDevPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name){ @@ -1000,10 +1145,18 @@ public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfS } public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.squareRootOfPopulationStandardDeviationDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypes(){ - return sampleVarianceDisplayOrderOfSchoolTypesAs("varSampDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("varSampDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name){ @@ -1011,10 +1164,18 @@ public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name) } public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.sampleVarianceDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypes(){ - return samplePopulationVarianceDisplayOrderOfSchoolTypesAs("varPopDisplayOrderOfSchoolTypes"); + addRelationScalarAggregate("varPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name){ @@ -1022,10 +1183,18 @@ public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(St } public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest.samplePopulationVarianceDisplayOrder(), true); + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; } public PlatformRequest minStudentCapacityOfSchools(){ - return minStudentCapacityOfSchoolsAs("minStudentCapacityOfSchools"); + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ @@ -1033,10 +1202,18 @@ public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ } public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.minStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest maxStudentCapacityOfSchools(){ - return maxStudentCapacityOfSchoolsAs("maxStudentCapacityOfSchools"); + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ @@ -1044,10 +1221,18 @@ public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ } public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.maxStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest sumStudentCapacityOfSchools(){ - return sumStudentCapacityOfSchoolsAs("sumStudentCapacityOfSchools"); + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ @@ -1055,10 +1240,18 @@ public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ } public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.sumStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest avgStudentCapacityOfSchools(){ - return avgStudentCapacityOfSchoolsAs("avgStudentCapacityOfSchools"); + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ @@ -1066,10 +1259,18 @@ public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ } public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.avgStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest standardDeviationStudentCapacityOfSchools(){ - return standardDeviationStudentCapacityOfSchoolsAs("stdDevStudentCapacityOfSchools"); + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ @@ -1077,10 +1278,18 @@ public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String nam } public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.standardDeviationStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs("stdDevPopStudentCapacityOfSchools"); + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ @@ -1088,10 +1297,18 @@ public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacity } public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.squareRootOfPopulationStandardDeviationStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ - return sampleVarianceStudentCapacityOfSchoolsAs("varSampStudentCapacityOfSchools"); + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ @@ -1099,10 +1316,18 @@ public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ } public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.sampleVarianceStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs("varPopStudentCapacityOfSchools"); + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; } public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ @@ -1110,7 +1335,11 @@ public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(Str } public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.samplePopulationVarianceStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; } diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java index 437b5be64..3923b042c 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java @@ -7,8 +7,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Objects; @@ -24,126 +26,168 @@ public class School extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "School"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "14b4bfbb4cda258779665e3bc38ab991040fe75793a416d29eddd06f8fa8f586"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("address", 4), java.util.Map.entry("established_date", 5), java.util.Map.entry("student_capacity", 6), java.util.Map.entry("active", 7), java.util.Map.entry("create_time", 8), java.util.Map.entry("update_time", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("address", java.util.List.of("address", "address")), java.util.Map.entry("established_date", java.util.List.of("establishedDate", "established_date")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("active", java.util.List.of("active", "active")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + School.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String PLATFORM_PROPERTY = "platform"; - public static final String SCHOOL_TYPE_PROPERTY = "schoolType"; + public static final String SCHOOL_TYPE_PROPERTY = "school_type"; public static final String NAME_PROPERTY = "name"; public static final String ADDRESS_PROPERTY = "address"; - public static final String ESTABLISHED_DATE_PROPERTY = "establishedDate"; - public static final String STUDENT_CAPACITY_PROPERTY = "studentCapacity"; + public static final String ESTABLISHED_DATE_PROPERTY = "established_date"; + public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; public static final String ACTIVE_PROPERTY = "active"; - public static final String CREATE_TIME_PROPERTY = "createTime"; - public static final String UPDATE_TIME_PROPERTY = "updateTime"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; private Platform platform; + private SchoolType schoolType; + private String name; + private String address; + private LocalDate establishedDate; + private Integer studentCapacity; + private Boolean active; + private LocalDateTime createTime; + private LocalDateTime updateTime; + public Platform getPlatform(){ return this.platform; } + public SchoolType getSchoolType(){ return this.schoolType; } + public String getName(){ return this.name; } + public String getAddress(){ return this.address; } + public LocalDate getEstablishedDate(){ return this.establishedDate; } + public Integer getStudentCapacity(){ return this.studentCapacity; } + public Boolean isActive(){ return this.active; } + public LocalDateTime getCreateTime(){ return this.createTime; } + public LocalDateTime getUpdateTime(){ return this.updateTime; } + public School updatePlatform(Platform platform){ - if(Objects.equals(this.platform, platform)){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ return this; } handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); this.platform = platform; return this; } + protected School updateSchoolType(SchoolType schoolType){ - if(Objects.equals(this.schoolType, schoolType)){ + if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ return this; } handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); this.schoolType = schoolType; return this; } + public School updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public School updateAddress(String address){ address = (address == null ? null : address.trim()); - if(Objects.equals(this.address, address)){ + if(isPropertyLoaded(ADDRESS_PROPERTY) && Objects.equals(this.address, address)){ return this; } handleUpdate(ADDRESS_PROPERTY, getAddress(), address); this.address = address; return this; } + public School updateEstablishedDate(LocalDate establishedDate){ - if(Objects.equals(this.establishedDate, establishedDate)){ + if(isPropertyLoaded(ESTABLISHED_DATE_PROPERTY) && Objects.equals(this.establishedDate, establishedDate)){ return this; } handleUpdate(ESTABLISHED_DATE_PROPERTY, getEstablishedDate(), establishedDate); this.establishedDate = establishedDate; return this; } + public School updateStudentCapacity(Integer studentCapacity){ - if(Objects.equals(this.studentCapacity, studentCapacity)){ + if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ return this; } handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); this.studentCapacity = studentCapacity; return this; } + public School updateActive(Boolean active){ - if(Objects.equals(this.active, active)){ + if(isPropertyLoaded(ACTIVE_PROPERTY) && Objects.equals(this.active, active)){ return this; } handleUpdate(ACTIVE_PROPERTY, isActive(), active); this.active = active; return this; } + public School updateCreateTime(LocalDateTime createTime){ - if(Objects.equals(this.createTime, createTime)){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ return this; } handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); this.createTime = createTime; return this; } + public School updateUpdateTime(LocalDateTime updateTime){ - if(Objects.equals(this.updateTime, updateTime)){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ return this; } handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); this.updateTime = updateTime; return this; } + public boolean isSchoolTypePrimary(){ return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); } @@ -178,7 +222,7 @@ public School comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -189,21 +233,21 @@ public void __internalSet(String property, Object value) { switch (property) { case "platform": this.platform = (Platform) value; break; - case "schoolType": this.schoolType = (SchoolType) value; break; + case "school_type": this.schoolType = (SchoolType) value; break; case "name": this.name = (value == null ? null : ((String)value).trim()); break; case "address": this.address = (value == null ? null : ((String)value).trim()); break; - case "establishedDate": this.establishedDate = (LocalDate) value; break; + case "established_date": this.establishedDate = (LocalDate) value; break; - case "studentCapacity": this.studentCapacity = (Integer) value; break; + case "student_capacity": this.studentCapacity = (Integer) value; break; case "active": this.active = (Boolean) value; break; - case "createTime": this.createTime = (LocalDateTime) value; break; + case "create_time": this.createTime = (LocalDateTime) value; break; - case "updateTime": this.updateTime = (LocalDateTime) value; break; + case "update_time": this.updateTime = (LocalDateTime) value; break; default: super.__internalSet(property, value); } @@ -214,15 +258,29 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "platform": return this.platform; - case "schoolType": return this.schoolType; + case "school_type": return this.schoolType; case "name": return this.name; case "address": return this.address; - case "establishedDate": return this.establishedDate; - case "studentCapacity": return this.studentCapacity; + case "established_date": return this.establishedDate; + case "student_capacity": return this.studentCapacity; case "active": return this.active; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "schoolType": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "establishedDate": return this.establishedDate; + case "studentCapacity": return this.studentCapacity; + case "active": return this.active; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } } } diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java index 4b10e72ae..df8d0faa3 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java @@ -28,36 +28,62 @@ public void doCheck(UserContext _context, School school, ObjectLocation _parentL if((school == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, school); + if(school.needPersist()){ + } if(school.newItem()){ - if(school.getCreateTime() == null){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { school.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); - }if(school.getUpdateTime() == null){ + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { school.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); } }else if(school.updateItem()){ - school.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", io.teaql.core.checker.FixEvidence.Source.CLOCK, "graphClock")); + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } if(!school.isPropertyLoaded("platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("schoolType")){ + } + if(!school.isPropertyLoaded("school_type")){ invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("name")){ + } + if(!school.isPropertyLoaded("name")){ invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("address")){ + } + if(!school.isPropertyLoaded("address")){ invalidTypeCheck(_context, newLocation(_parentLocation, "address"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("establishedDate")){ + } + if(!school.isPropertyLoaded("established_date")){ invalidTypeCheck(_context, newLocation(_parentLocation, "established_date"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("studentCapacity")){ + } + if(!school.isPropertyLoaded("student_capacity")){ invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("active")){ + } + if(!school.isPropertyLoaded("active")){ invalidTypeCheck(_context, newLocation(_parentLocation, "active"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("createTime")){ + } + if(!school.isPropertyLoaded("create_time")){ invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - }if(!school.isPropertyLoaded("updateTime")){ + } + if(!school.isPropertyLoaded("update_time")){ invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); } + } checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java index ad3136e21..381a4e119 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java @@ -40,7 +40,7 @@ public boolean isNull() { public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", School::getPlatform)); + return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); } public SchoolExpression updatePlatform(Platform platform){ @@ -48,7 +48,7 @@ public SchoolExpression updatePlatform(Platform platform){ } public SchoolTypeExpression getSchoolType(){ - return new SchoolTypeExpression(loaded("schoolType", School::getSchoolType)); + return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); } public SchoolExpression updateSchoolTypeToPrimary(){ @@ -59,49 +59,49 @@ public SchoolExpression updateSchoolTypeToSecondary(){ } public Expression getName(){ - return loaded("name", School::getName); + return loaded("name", "getName", School::getName); } public SchoolExpression updateName(String name){ return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); } public Expression getAddress(){ - return loaded("address", School::getAddress); + return loaded("address", "getAddress", School::getAddress); } public SchoolExpression updateAddress(String address){ return new SchoolExpression(this, $it -> ((School)$it).updateAddress(address)); } public Expression getEstablishedDate(){ - return loaded("establishedDate", School::getEstablishedDate); + return loaded("established_date", "getEstablishedDate", School::getEstablishedDate); } public SchoolExpression updateEstablishedDate(LocalDate establishedDate){ return new SchoolExpression(this, $it -> ((School)$it).updateEstablishedDate(establishedDate)); } public Expression getStudentCapacity(){ - return loaded("studentCapacity", School::getStudentCapacity); + return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); } public SchoolExpression updateStudentCapacity(Integer studentCapacity){ return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); } public Expression isActive(){ - return loaded("active", School::isActive); + return loaded("active", "isActive", School::isActive); } public SchoolExpression updateActive(Boolean active){ return new SchoolExpression(this, $it -> ((School)$it).updateActive(active)); } public Expression getCreateTime(){ - return loaded("createTime", School::getCreateTime); + return loaded("create_time", "getCreateTime", School::getCreateTime); } public SchoolExpression updateCreateTime(LocalDateTime createTime){ return new SchoolExpression(this, $it -> ((School)$it).updateCreateTime(createTime)); } public Expression getUpdateTime(){ - return loaded("updateTime", School::getUpdateTime); + return loaded("update_time", "getUpdateTime", School::getUpdateTime); } public SchoolExpression updateUpdateTime(LocalDateTime updateTime){ return new SchoolExpression(this, $it -> ((School)$it).updateUpdateTime(updateTime)); diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java index d59448893..c5ad3c9c4 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java @@ -16,6 +16,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; +import java.util.Objects; public class SchoolRequest extends BaseRequest { @@ -26,7 +27,11 @@ public class SchoolRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public SchoolRequest(Class returnType){ - super(returnType, () -> (T) new School()); + this(returnType, () -> (T) new School()); + } + + protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -36,6 +41,19 @@ public SchoolRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolRequest copy(){ + return (SchoolRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public SchoolRequest returnType(Class returnType){ @@ -103,6 +121,12 @@ public SchoolRequest matchingAnyOf(SchoolRequest school){ return this; } + public SchoolRequest matchingIdsOf(SchoolRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + School.ID_PROPERTY, request, School.ID_PROPERTY)); + } + public SchoolRequest enhanceChildrenIfNeeded(){ return this; } @@ -126,6 +150,23 @@ public SchoolRequest selectSelfFields(){ return selectSelf(); } + public SchoolRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(School.ID_PROPERTY); + selectProperty(School.PLATFORM_PROPERTY); + selectProperty(School.SCHOOL_TYPE_PROPERTY); + selectProperty(School.NAME_PROPERTY); + selectProperty(School.ADDRESS_PROPERTY); + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + selectProperty(School.ACTIVE_PROPERTY); + selectProperty(School.CREATE_TIME_PROPERTY); + selectProperty(School.UPDATE_TIME_PROPERTY); + selectProperty(School.VERSION_PROPERTY); + return this; + } + public SchoolRequest selectAll(){ super.selectAll(); return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); @@ -165,7 +206,8 @@ public SchoolRequest selectPlatform(){ public SchoolRequest selectPlatformWith(PlatformRequest platform){ selectProperty(School.PLATFORM_PROPERTY); - enhanceRelation(School.PLATFORM_PROPERTY, platform); + enhanceRelation(School.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); return this; } @@ -184,7 +226,8 @@ public SchoolRequest selectSchoolType(){ public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ selectProperty(School.SCHOOL_TYPE_PROPERTY); - enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType); + enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); return this; } @@ -1001,12 +1044,15 @@ public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersio } + public SchoolRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public SchoolRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public SchoolRequest minStudentCapacity(){ @@ -1099,6 +1145,94 @@ public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subReques + public SchoolRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, School.ID_PROPERTY); + return this; + } + public SchoolRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public SchoolRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, School.NAME_PROPERTY); + return this; + } + public SchoolRequest countDistinctAddress(){ + return countDistinctAddressAs("address_distinct_count"); + } + + public SchoolRequest countDistinctAddressAs(String alias){ + super.countDistinctProperty(alias, School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest countDistinctEstablishedDate(){ + return countDistinctEstablishedDateAs("established_date_distinct_count"); + } + + public SchoolRequest countDistinctEstablishedDateAs(String alias){ + super.countDistinctProperty(alias, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public SchoolRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest countDistinctActive(){ + return countDistinctActiveAs("active_distinct_count"); + } + + public SchoolRequest countDistinctActiveAs(String alias){ + super.countDistinctProperty(alias, School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public SchoolRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public SchoolRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, School.VERSION_PROPERTY); + return this; + } public SchoolRequest groupById(){ groupBy(School.ID_PROPERTY); @@ -1115,7 +1249,8 @@ public SchoolRequest groupByIdWithFunction(String retName, AggrFunction funct return this; } public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(School.PLATFORM_PROPERTY, subRequest); + groupBy(School.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); return this; } public SchoolRequest groupByPlatform(){ @@ -1133,7 +1268,8 @@ public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction return this; } public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest); + groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); return this; } public SchoolRequest groupBySchoolType(){ @@ -1414,15 +1550,15 @@ public SchoolRequest orderByVersionDescending(){ public PlatformRequest rollUpToPlatform(){ PlatformRequest platform = Q.platforms().unlimited(); - this.withPlatformMatching(platform) - .groupByPlatformWith(platform); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); return platform; } public SchoolTypeRequest rollUpToSchoolType(){ SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); - this.withSchoolTypeMatching(schoolType) - .groupBySchoolTypeWith(schoolType); + this.internalRollUpTo("school_type", schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); return schoolType; } @@ -1440,7 +1576,8 @@ public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest plat } public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets); + addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); return this; } public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ @@ -1448,7 +1585,8 @@ public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest } public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ - addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets); + addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); return this; } diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java index 55f4b11b7..082e03793 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java @@ -6,9 +6,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.util.Objects; @@ -23,73 +25,101 @@ public class SchoolType extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "SchoolType"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "36f5b35e840d2f9ef89c6ee13c7d936fa10abc12a139d7f0373f9acabc9eac12"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public static final String PLATFORM_PROPERTY = "platform"; public static final String NAME_PROPERTY = "name"; public static final String CODE_PROPERTY = "code"; - public static final String DISPLAY_ORDER_PROPERTY = "displayOrder"; - public static final String SCHOOL_LIST_PROPERTY = "schoolList"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; private Platform platform; + private String name; + private String code; + private BigDecimal displayOrder; + private SmartList schoolList; public Platform getPlatform(){ return this.platform; } + public String getName(){ return this.name; } + public String getCode(){ return this.code; } + public BigDecimal getDisplayOrder(){ return this.displayOrder; } + public SmartList getSchoolList(){ - return this.schoolList; + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; } public SchoolType updatePlatform(Platform platform){ - if(Objects.equals(this.platform, platform)){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ return this; } handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); this.platform = platform; return this; } + public SchoolType updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); this.name = name; return this; } + public SchoolType updateCode(String code){ code = (code == null ? null : code.trim()); - if(Objects.equals(this.code, code)){ + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ return this; } handleUpdate(CODE_PROPERTY, getCode(), code); this.code = code; return this; } + public SchoolType updateDisplayOrder(BigDecimal displayOrder){ - if(Objects.equals(this.displayOrder, displayOrder)){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ return this; } handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); this.displayOrder = displayOrder; return this; } + public SchoolType addSchool(School school){ if (school == null){ return this; } if(null == this.schoolList){ - this.schoolList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); } this.schoolList.add(school); @@ -116,7 +146,7 @@ public SchoolType comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -131,9 +161,9 @@ public void __internalSet(String property, Object value) { case "code": this.code = (value == null ? null : ((String)value).trim()); break; - case "displayOrder": this.displayOrder = (BigDecimal) value; break; + case "display_order": this.displayOrder = (BigDecimal) value; break; - case "schoolList": this.schoolList = (SmartList) value; break; + case "school_list": this.schoolList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -145,9 +175,18 @@ public Object __internalGet(String property) { case "platform": return this.platform; case "name": return this.name; case "code": return this.code; - case "displayOrder": return this.displayOrder; - case "schoolList": return this.schoolList; - default: return super.__internalGet(property); + case "display_order": return this.displayOrder; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "displayOrder": return this.displayOrder; + default: return super.__internalGet(property); + } } } diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java index 1c8e5c255..6e59fad6a 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java @@ -27,17 +27,24 @@ public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation if((schoolType == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, schoolType); + if(schoolType.needPersist()){ + } if(schoolType.newItem()){ }else if(schoolType.updateItem()){ if(!schoolType.isPropertyLoaded("platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - }if(!schoolType.isPropertyLoaded("name")){ + } + if(!schoolType.isPropertyLoaded("name")){ invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - }if(!schoolType.isPropertyLoaded("code")){ + } + if(!schoolType.isPropertyLoaded("code")){ invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); - }if(!schoolType.isPropertyLoaded("displayOrder")){ + } + if(!schoolType.isPropertyLoaded("display_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); } + } checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java index 9bb31524d..f77c8c705 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java @@ -39,7 +39,7 @@ public boolean isNull() { public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", SchoolType::getPlatform)); + return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); } public SchoolTypeExpression updatePlatform(Platform platform){ @@ -47,28 +47,28 @@ public SchoolTypeExpression updatePlatform(Platform platform){ } public Expression getName(){ - return loaded("name", SchoolType::getName); + return loaded("name", "getName", SchoolType::getName); } public SchoolTypeExpression updateName(String name){ return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); } public Expression getCode(){ - return loaded("code", SchoolType::getCode); + return loaded("code", "getCode", SchoolType::getCode); } public SchoolTypeExpression updateCode(String code){ return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); } public Expression getDisplayOrder(){ - return loaded("displayOrder", SchoolType::getDisplayOrder); + return loaded("display_order", "getDisplayOrder", SchoolType::getDisplayOrder); } public SchoolTypeExpression updateDisplayOrder(BigDecimal displayOrder){ return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateDisplayOrder(displayOrder)); } public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("schoolList", SchoolType::getSchoolList)); + return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); } public SchoolTypeExpression addSchool(School school){ return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java index b2467dd1a..1b91f030f 100644 --- a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java +++ b/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java @@ -14,6 +14,7 @@ import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; import java.math.BigDecimal; +import java.util.Objects; public class SchoolTypeRequest extends BaseRequest { @@ -24,7 +25,11 @@ public class SchoolTypeRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public SchoolTypeRequest(Class returnType){ - super(returnType, () -> (T) new SchoolType()); + this(returnType, () -> (T) new SchoolType()); + } + + protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -34,6 +39,19 @@ public SchoolTypeRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolTypeRequest copy(){ + return (SchoolTypeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public SchoolTypeRequest returnType(Class returnType){ @@ -101,6 +119,12 @@ public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ return this; } + public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); + } + public SchoolTypeRequest enhanceChildrenIfNeeded(){ return this; } @@ -124,6 +148,18 @@ public SchoolTypeRequest selectSelfFields(){ return selectSelf(); } + public SchoolTypeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolType.PLATFORM_PROPERTY); + selectProperty(SchoolType.ID_PROPERTY); + selectProperty(SchoolType.NAME_PROPERTY); + selectProperty(SchoolType.CODE_PROPERTY); + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest selectAll(){ super.selectAll(); return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); @@ -147,7 +183,8 @@ public SchoolTypeRequest selectPlatform(){ public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ selectProperty(SchoolType.PLATFORM_PROPERTY); - enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform); + enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); return this; } @@ -253,7 +290,8 @@ public SchoolTypeRequest selectSchoolList(){ } public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList); + enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); return this; } @@ -610,6 +648,7 @@ public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVe return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); } + public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); } @@ -628,10 +667,12 @@ public SchoolTypeRequest haveNoSchools(){ public SchoolTypeRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public SchoolTypeRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public SchoolTypeRequest minDisplayOrder(){ @@ -712,13 +753,62 @@ public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subReques + public SchoolTypeRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolTypeRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolTypeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolTypeRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public SchoolTypeRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public SchoolTypeRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolTypeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); + return this; + } public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); return this; } public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(SchoolType.PLATFORM_PROPERTY, subRequest); + groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); return this; } public SchoolTypeRequest groupByPlatform(){ @@ -895,8 +985,8 @@ public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subReq } public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(School.SCHOOL_TYPE_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); return this; } @@ -905,8 +995,8 @@ public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ } public PlatformRequest rollUpToPlatform(){ PlatformRequest platform = Q.platforms().unlimited(); - this.withPlatformMatching(platform) - .groupByPlatformWith(platform); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); return platform; } @@ -916,18 +1006,28 @@ public PlatformRequest rollUpToPlatform(){ public SchoolTypeRequest countSchools(){ - return countSchoolsAs("Count"); + addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest countSchoolsAs(String name){ - return countSchoolsWith(name, Q.schools().unlimited()); + addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest minStudentCapacityOfSchools(){ - return minStudentCapacityOfSchoolsAs("minStudentCapacityOfSchools"); + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ @@ -935,10 +1035,18 @@ public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ } public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.minStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest maxStudentCapacityOfSchools(){ - return maxStudentCapacityOfSchoolsAs("maxStudentCapacityOfSchools"); + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ @@ -946,10 +1054,18 @@ public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ } public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.maxStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest sumStudentCapacityOfSchools(){ - return sumStudentCapacityOfSchoolsAs("sumStudentCapacityOfSchools"); + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ @@ -957,10 +1073,18 @@ public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ } public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.sumStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest avgStudentCapacityOfSchools(){ - return avgStudentCapacityOfSchoolsAs("avgStudentCapacityOfSchools"); + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ @@ -968,10 +1092,18 @@ public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ } public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.avgStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ - return standardDeviationStudentCapacityOfSchoolsAs("stdDevStudentCapacityOfSchools"); + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ @@ -979,10 +1111,18 @@ public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String n } public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.standardDeviationStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs("stdDevPopStudentCapacityOfSchools"); + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ @@ -990,10 +1130,18 @@ public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapaci } public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.squareRootOfPopulationStandardDeviationStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ - return sampleVarianceStudentCapacityOfSchoolsAs("varSampStudentCapacityOfSchools"); + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ @@ -1001,10 +1149,18 @@ public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name } public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.sampleVarianceStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs("varPopStudentCapacityOfSchools"); + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ @@ -1012,7 +1168,11 @@ public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(S } public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest.samplePopulationVarianceStudentCapacity(), true); + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; } public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ @@ -1020,7 +1180,8 @@ public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest } public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets); + addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); return this; } diff --git a/examples/school-management/teaql/checker-model.json b/examples/school-management/teaql/checker-model.json new file mode 100644 index 000000000..f81ff864c --- /dev/null +++ b/examples/school-management/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:71ba9da7267282a87034f786438f6f60442609b86ca42c3ef288e51c43107ce1","entities":{"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"base_url","labels":{"en":"base url"},"aliases":["BaseUrl","baseUrl"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"school_list","targetType":"School","labels":{"en":"School"},"aliases":["SchoolList","schoolList"]},{"name":"school_type_list","targetType":"SchoolType","labels":{"en":"School Type"},"aliases":["SchoolTypeList","schoolTypeList"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"School":{"labels":{"en":"School"},"fields":[{"name":"active","labels":{"en":"active"},"aliases":["Active"]},{"name":"address","labels":{"en":"address"},"aliases":["Address"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"established_date","labels":{"en":"established date"},"aliases":["EstablishedDate","establishedDate"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"school_type","targetType":"SchoolType","labels":{"en":"School Type"},"aliases":["SchoolType","schoolType"]},{"name":"student_capacity","labels":{"en":"student capacity"},"aliases":["StudentCapacity","studentCapacity"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolType":{"labels":{"en":"School Type"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"school_list","targetType":"School","labels":{"en":"School"},"aliases":["SchoolList","schoolList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/school-management/teaql/model-provenance.json b/examples/school-management/teaql/model-provenance.json new file mode 100644 index 000000000..ba10b19b8 --- /dev/null +++ b/examples/school-management/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/standard-order/generated/lib/pom.xml b/examples/standard-order/generated/lib/pom.xml index 57703388f..d6ba11e43 100644 --- a/examples/standard-order/generated/lib/pom.xml +++ b/examples/standard-order/generated/lib/pom.xml @@ -12,7 +12,7 @@ 21 4.1.1 - 1.557-RELEASE + 6.3.0 UTF-8 true @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 1.557-RELEASE + ${teaql.version} io.teaql @@ -139,4 +139,4 @@ https://maven.teaql.io/repository/maven-releases/ - + \ No newline at end of file diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java index 84a3bdae1..b7f4b2984 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java @@ -11,22 +11,23 @@ import com.example.requesttreeorderservice.orderstatus.OrderStatusExpression; import com.example.requesttreeorderservice.platform.Platform; import com.example.requesttreeorderservice.platform.PlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; import io.teaql.core.value.ValueExpression; public class E { public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform)); + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); } public static OrderStatusExpression orderStatus(OrderStatus orderStatus){ - return new OrderStatusExpression(new ValueExpression(orderStatus)); + return new OrderStatusExpression(new ValueExpression(orderStatus, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderStatus()")); } public static CustomerExpression customer(Customer customer){ - return new CustomerExpression(new ValueExpression(customer)); + return new CustomerExpression(new ValueExpression(customer, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customer()")); } public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder)); + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); } public static OrderItemExpression orderItem(OrderItem orderItem){ - return new OrderItemExpression(new ValueExpression(orderItem)); + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); } } \ No newline at end of file diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java index 2d33ef169..f263ba221 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java @@ -28,8 +28,11 @@ private void registerPlatform() { entityDescriptor.setTargetType(com.example.requesttreeorderservice.platform.Platform.class); entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.platform.Platform::new); entityDescriptor.with("name", "Commerce Platform") + .with("module", "Commerce") - .with("module_key", "commerce"); + + .with("module_key", "commerce") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -43,54 +46,99 @@ private void registerPlatform() { ; entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Commerce Test Platform") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -101,10 +149,15 @@ private void registerOrderStatus() { entityDescriptor.setTargetType(com.example.requesttreeorderservice.orderstatus.OrderStatus.class); entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.orderstatus.OrderStatus::new); entityDescriptor.with("name", "Order Status") + .with("module", "Commerce") + .with("module_key", "commerce") + .with("constant", "true") - .with("identifier", "code"); + + .with("identifier", "code") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor platform = @@ -129,112 +182,206 @@ private void registerOrderStatus() { entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY, Long.class) ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("candidates", "platform()"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("candidates", "platform()") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("candidates", "1001,1002,1003") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "New,Paid,Cancelled") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY).with("identifier", "true") + .with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "NEW,PAID,CANCELLED") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "#94A3B8,#22C55E,#EF4444") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("candidates", "1,2,3") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -245,9 +392,13 @@ private void registerCustomer() { entityDescriptor.setTargetType(com.example.requesttreeorderservice.customer.Customer.class); entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.customer.Customer::new); entityDescriptor.with("name", "Customer") + .with("module", "Commerce") + .with("module_key", "commerce") - .with("audit_mask_fields", "name"); + + .with("audit_mask_fields", "name") + ; entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY)); PropertyDescriptor id = @@ -264,55 +415,99 @@ private void registerCustomer() { ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -323,9 +518,13 @@ private void registerCustomerOrder() { entityDescriptor.setTargetType(com.example.requesttreeorderservice.customerorder.CustomerOrder.class); entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.customerorder.CustomerOrder::new); entityDescriptor.with("name", "Customer Order") + .with("module", "Commerce") + .with("module_key", "commerce") - .with("audit_mask_fields", "order_number"); + + .with("audit_mask_fields", "order_number") + ; entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY)); PropertyDescriptor id = @@ -351,20 +550,35 @@ private void registerCustomerOrder() { ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY).with("required", "true"); @@ -372,68 +586,125 @@ private void registerCustomerOrder() { entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("javaType", "java.time.LocalDate") + .with("sqlType", "DATE") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isDate", "true") + .with("isString", "false") + .with("graphqlType", "Date") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } @@ -444,8 +715,11 @@ private void registerOrderItem() { entityDescriptor.setTargetType(com.example.requesttreeorderservice.orderitem.OrderItem.class); entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.orderitem.OrderItem::new); entityDescriptor.with("name", "Order Item") + .with("module", "Commerce") - .with("module_key", "commerce"); + + .with("module_key", "commerce") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -468,90 +742,165 @@ private void registerOrderItem() { ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.lang.Integer") + .with("sqlType", "INTEGER") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isInt", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "Int") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") + .with("db2_sqlType", "decimal(19,7)") + .with("isVersion", "false") + .with("oracle_sqlType", "number(19,7)") + .with("javaType", "java.math.BigDecimal") + .with("sqlType", "NUMERIC(19,7)") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "true") + .with("isString", "false") + .with("isDate", "false") + .with("graphqlType", "BigDecimal") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java index b1c117f0f..50e4a262d 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.example.requesttreeorderservice.platform.PlatformChecker(), new com.example.requesttreeorderservice.orderstatus.OrderStatusChecker(), new com.example.requesttreeorderservice.customer.CustomerChecker(), new com.example.requesttreeorderservice.customerorder.CustomerOrderChecker(), new com.example.requesttreeorderservice.orderitem.OrderItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:dd69b1927859f89b828bf1e7fb802e68157655ac0eca216e5aee11f0e8667aa8\",\"entities\":{\"Customer\":{\"labels\":{\"en\":\"Customer\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Commerce Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"customer\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"Customer\"},\"aliases\":[\"Customer\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_date\",\"labels\":{\"en\":\"order date\"},\"aliases\":[\"OrderDate\",\"orderDate\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"Order Item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"status\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"Order Status\"},\"aliases\":[\"Status\"]},{\"name\":\"total_amount\",\"labels\":{\"en\":\"total amount\"},\"aliases\":[\"TotalAmount\",\"totalAmount\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"Order Item\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"unit_price\",\"labels\":{\"en\":\"unit price\"},\"aliases\":[\"UnitPrice\",\"unitPrice\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderStatus\":{\"labels\":{\"en\":\"Order Status\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"color\",\"labels\":{\"en\":\"color\"},\"aliases\":[\"Color\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Commerce Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Commerce Platform\"},\"fields\":[{\"name\":\"customer_list\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"Customer\"},\"aliases\":[\"CustomerList\",\"customerList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_status_list\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"Order Status\"},\"aliases\":[\"OrderStatusList\",\"orderStatusList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java index 5019c2413..4499d623c 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java @@ -10,6 +10,7 @@ import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -30,16 +31,17 @@ public class Customer extends BaseEntity implements RemoteInput { public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customerOrderList"); + "customer_order_list"); public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( Customer.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); public static final String PLATFORM_PROPERTY = "platform"; public static final String NAME_PROPERTY = "name"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customerOrderList"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; private Platform platform; private String name; @@ -55,10 +57,10 @@ public String getName(){ } public SmartList getCustomerOrderList(){ - return this.customerOrderList; + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; } public Customer updatePlatform(Platform platform){ - if(Objects.equals(this.platform, platform)){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ return this; } handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); @@ -68,7 +70,7 @@ public Customer updatePlatform(Platform platform){ public Customer updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); @@ -82,7 +84,8 @@ public Customer addCustomerOrder(CustomerOrder customerOrder){ } if(null == this.customerOrderList){ - this.customerOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); } this.customerOrderList.add(customerOrder); @@ -122,7 +125,7 @@ public void __internalSet(String property, Object value) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "customerOrderList": this.customerOrderList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -133,8 +136,15 @@ public Object __internalGet(String property) { switch (property) { case "platform": return this.platform; case "name": return this.name; - case "customerOrderList": return this.customerOrderList; - default: return super.__internalGet(property); + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java index ffb923c62..81246067f 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java @@ -26,6 +26,9 @@ public void doCheck(UserContext _context, Customer customer, ObjectLocation _par if((customer == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, customer); + if(customer.needPersist()){ + } if(customer.newItem()){ }else if(customer.updateItem()){ if(!customer.isPropertyLoaded("platform")){ diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java index 5cbee5099..c0e0888d4 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java @@ -38,7 +38,7 @@ public boolean isNull() { public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", Customer::getPlatform)); + return new PlatformExpression(loaded("platform", "getPlatform", Customer::getPlatform)); } public CustomerExpression updatePlatform(Platform platform){ @@ -46,14 +46,14 @@ public CustomerExpression updatePlatform(Platform platform){ } public Expression getName(){ - return loaded("name", Customer::getName); + return loaded("name", "getName", Customer::getName); } public CustomerExpression updateName(String name){ return new CustomerExpression(this, $it -> ((Customer)$it).updateName(name)); } public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customerOrderList", Customer::getCustomerOrderList)); + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Customer::getCustomerOrderList)); } public CustomerExpression addCustomerOrder(CustomerOrder customerOrder){ return new CustomerExpression(this, $it -> ((Customer)$it).addCustomerOrder(customerOrder)); diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java index 95238396a..b6752cacc 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java @@ -13,6 +13,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class CustomerRequest extends BaseRequest { @@ -37,6 +38,19 @@ public CustomerRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerRequest copy(){ + return (CustomerRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CustomerRequest returnType(Class returnType){ @@ -104,6 +118,12 @@ public CustomerRequest matchingAnyOf(CustomerRequest customer){ return this; } + public CustomerRequest matchingIdsOf(CustomerRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Customer.ID_PROPERTY, request, Customer.ID_PROPERTY)); + } + public CustomerRequest enhanceChildrenIfNeeded(){ return this; } @@ -475,6 +495,38 @@ public CustomerRequest groupByPlatformWithDetails(PlatformRequest subRequest) + public CustomerRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Customer.ID_PROPERTY); + return this; + } + public CustomerRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public CustomerRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, Customer.PLATFORM_PROPERTY); + return this; + } + public CustomerRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CustomerRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Customer.VERSION_PROPERTY); + return this; + } public CustomerRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ aggregate(Customer.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); return this; @@ -495,7 +547,8 @@ public CustomerRequest groupByIdWithFunction(String retName, AggrFunction fun return this; } public CustomerRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(Customer.PLATFORM_PROPERTY, subRequest); + groupBy(Customer.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); return this; } public CustomerRequest groupByPlatform(){ @@ -609,8 +662,8 @@ public CustomerRequest statsFromCustomerOrders(CustomerOrderRequest subReques } public PlatformRequest rollUpToPlatform(){ PlatformRequest platform = Q.platforms().unlimited(); - this.withPlatformMatching(platform) - .groupByPlatformWith(platform); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); return platform; } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java index 98201887e..686cdce0a 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java @@ -12,6 +12,7 @@ import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.time.LocalDate; import java.util.Objects; @@ -34,19 +35,20 @@ public class CustomerOrder extends BaseEntity implements RemoteInput { public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer", java.util.List.of("customer", "customer")), java.util.Map.entry("status", java.util.List.of("status", "status")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("order_date", java.util.List.of("orderDate", "order_date")), java.util.Map.entry("total_amount", java.util.List.of("totalAmount", "total_amount")), java.util.Map.entry("version", java.util.List.of("version", "version"))); public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "orderItemList"); + "order_item_list"); public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); public static final String CUSTOMER_PROPERTY = "customer"; public static final String STATUS_PROPERTY = "status"; - public static final String ORDER_NUMBER_PROPERTY = "orderNumber"; - public static final String ORDER_DATE_PROPERTY = "orderDate"; - public static final String TOTAL_AMOUNT_PROPERTY = "totalAmount"; - public static final String ORDER_ITEM_LIST_PROPERTY = "orderItemList"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String ORDER_DATE_PROPERTY = "order_date"; + public static final String TOTAL_AMOUNT_PROPERTY = "total_amount"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; private Customer customer; private OrderStatus status; @@ -80,10 +82,10 @@ public BigDecimal getTotalAmount(){ } public SmartList getOrderItemList(){ - return this.orderItemList; + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; } public CustomerOrder updateCustomer(Customer customer){ - if(Objects.equals(this.customer, customer)){ + if(isPropertyLoaded(CUSTOMER_PROPERTY) && Objects.equals(this.customer, customer)){ return this; } handleUpdate(CUSTOMER_PROPERTY, getCustomer(), customer); @@ -92,7 +94,7 @@ public CustomerOrder updateCustomer(Customer customer){ } protected CustomerOrder updateStatus(OrderStatus status){ - if(Objects.equals(this.status, status)){ + if(isPropertyLoaded(STATUS_PROPERTY) && Objects.equals(this.status, status)){ return this; } handleUpdate(STATUS_PROPERTY, getStatus(), status); @@ -102,7 +104,7 @@ protected CustomerOrder updateStatus(OrderStatus status){ public CustomerOrder updateOrderNumber(String orderNumber){ orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(Objects.equals(this.orderNumber, orderNumber)){ + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ return this; } handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); @@ -111,7 +113,7 @@ public CustomerOrder updateOrderNumber(String orderNumber){ } public CustomerOrder updateOrderDate(LocalDate orderDate){ - if(Objects.equals(this.orderDate, orderDate)){ + if(isPropertyLoaded(ORDER_DATE_PROPERTY) && Objects.equals(this.orderDate, orderDate)){ return this; } handleUpdate(ORDER_DATE_PROPERTY, getOrderDate(), orderDate); @@ -120,7 +122,7 @@ public CustomerOrder updateOrderDate(LocalDate orderDate){ } public CustomerOrder updateTotalAmount(BigDecimal totalAmount){ - if(Objects.equals(this.totalAmount, totalAmount)){ + if(isPropertyLoaded(TOTAL_AMOUNT_PROPERTY) && Objects.equals(this.totalAmount, totalAmount)){ return this; } handleUpdate(TOTAL_AMOUNT_PROPERTY, getTotalAmount(), totalAmount); @@ -134,7 +136,8 @@ public CustomerOrder addOrderItem(OrderItem orderItem){ } if(null == this.orderItemList){ - this.orderItemList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); } this.orderItemList.add(orderItem); @@ -195,13 +198,13 @@ public void __internalSet(String property, Object value) { case "status": this.status = (OrderStatus) value; break; - case "orderNumber": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - case "orderDate": this.orderDate = (LocalDate) value; break; + case "order_date": this.orderDate = (LocalDate) value; break; - case "totalAmount": this.totalAmount = (BigDecimal) value; break; + case "total_amount": this.totalAmount = (BigDecimal) value; break; - case "orderItemList": this.orderItemList = (SmartList) value; break; + case "order_item_list": this.orderItemList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -212,11 +215,21 @@ public Object __internalGet(String property) { switch (property) { case "customer": return this.customer; case "status": return this.status; - case "orderNumber": return this.orderNumber; - case "orderDate": return this.orderDate; - case "totalAmount": return this.totalAmount; - case "orderItemList": return this.orderItemList; - default: return super.__internalGet(property); + case "order_number": return this.orderNumber; + case "order_date": return this.orderDate; + case "total_amount": return this.totalAmount; + case "order_item_list": return this.orderItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customer": return this.customer; + case "status": return this.status; + case "orderNumber": return this.orderNumber; + case "orderDate": return this.orderDate; + case "totalAmount": return this.totalAmount; + default: return super.__internalGet(property); + } } } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java index 21a40f68a..e18674ef8 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java @@ -30,6 +30,9 @@ public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLoc if((customerOrder == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } if(customerOrder.newItem()){ }else if(customerOrder.updateItem()){ if(!customerOrder.isPropertyLoaded("customer")){ @@ -38,13 +41,13 @@ public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLoc if(!customerOrder.isPropertyLoaded("status")){ invalidTypeCheck(_context, newLocation(_parentLocation, "status"), "Mutation requires a fully loaded entity"); } - if(!customerOrder.isPropertyLoaded("orderNumber")){ + if(!customerOrder.isPropertyLoaded("order_number")){ invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); } - if(!customerOrder.isPropertyLoaded("orderDate")){ + if(!customerOrder.isPropertyLoaded("order_date")){ invalidTypeCheck(_context, newLocation(_parentLocation, "order_date"), "Mutation requires a fully loaded entity"); } - if(!customerOrder.isPropertyLoaded("totalAmount")){ + if(!customerOrder.isPropertyLoaded("total_amount")){ invalidTypeCheck(_context, newLocation(_parentLocation, "total_amount"), "Mutation requires a fully loaded entity"); } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java index b75e95a46..470e8b5bf 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java @@ -42,7 +42,7 @@ public boolean isNull() { public CustomerExpression getCustomer(){ - return new CustomerExpression(loaded("customer", CustomerOrder::getCustomer)); + return new CustomerExpression(loaded("customer", "getCustomer", CustomerOrder::getCustomer)); } public CustomerOrderExpression updateCustomer(Customer customer){ @@ -50,7 +50,7 @@ public CustomerOrderExpression updateCustomer(Customer customer){ } public OrderStatusExpression getStatus(){ - return new OrderStatusExpression(loaded("status", CustomerOrder::getStatus)); + return new OrderStatusExpression(loaded("status", "getStatus", CustomerOrder::getStatus)); } public CustomerOrderExpression updateStatusToNew(){ @@ -64,28 +64,28 @@ public CustomerOrderExpression updateStatusToCancelled(){ } public Expression getOrderNumber(){ - return loaded("orderNumber", CustomerOrder::getOrderNumber); + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); } public CustomerOrderExpression updateOrderNumber(String orderNumber){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); } public Expression getOrderDate(){ - return loaded("orderDate", CustomerOrder::getOrderDate); + return loaded("order_date", "getOrderDate", CustomerOrder::getOrderDate); } public CustomerOrderExpression updateOrderDate(LocalDate orderDate){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderDate(orderDate)); } public Expression getTotalAmount(){ - return loaded("totalAmount", CustomerOrder::getTotalAmount); + return loaded("total_amount", "getTotalAmount", CustomerOrder::getTotalAmount); } public CustomerOrderExpression updateTotalAmount(BigDecimal totalAmount){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateTotalAmount(totalAmount)); } public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("orderItemList", CustomerOrder::getOrderItemList)); + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", CustomerOrder::getOrderItemList)); } public CustomerOrderExpression addOrderItem(OrderItem orderItem){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderItem(orderItem)); diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java index 1f0b6485d..baeab4690 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java @@ -18,6 +18,7 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.util.Date; +import java.util.Objects; public class CustomerOrderRequest extends BaseRequest { @@ -42,6 +43,19 @@ public CustomerOrderRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CustomerOrderRequest returnType(Class returnType){ @@ -109,6 +123,12 @@ public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder) return this; } + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + public CustomerOrderRequest enhanceChildrenIfNeeded(){ return this; } @@ -798,6 +818,62 @@ public CustomerOrderRequest groupByStatusWithDetails(OrderStatusRequest subRe + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCustomer(){ + return countDistinctCustomerAs("customer_distinct_count"); + } + + public CustomerOrderRequest countDistinctCustomerAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctStatus(){ + return countDistinctStatusAs("status_distinct_count"); + } + + public CustomerOrderRequest countDistinctStatusAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderDate(){ + return countDistinctOrderDateAs("order_date_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderDateAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctTotalAmount(){ + return countDistinctTotalAmountAs("total_amount_distinct_count"); + } + + public CustomerOrderRequest countDistinctTotalAmountAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } public CustomerOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ aggregate(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); return this; @@ -818,7 +894,8 @@ public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunctio return this; } public CustomerOrderRequest groupByCustomerWith(CustomerRequest subRequest){ - groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest); + groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerWith", null, "customer")); return this; } public CustomerOrderRequest groupByCustomer(){ @@ -836,7 +913,8 @@ public CustomerOrderRequest groupByCustomerWithFunction(String retName, AggrF return this; } public CustomerOrderRequest groupByStatusWith(OrderStatusRequest subRequest){ - groupBy(CustomerOrder.STATUS_PROPERTY, subRequest); + groupBy(CustomerOrder.STATUS_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByStatusWith", null, "status")); return this; } public CustomerOrderRequest groupByStatus(){ @@ -1028,15 +1106,15 @@ public CustomerOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ } public CustomerRequest rollUpToCustomer(){ CustomerRequest customer = Q.customers().unlimited(); - this.withCustomerMatching(customer) - .groupByCustomerWith(customer); + this.internalRollUpTo("customer", customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomer", null, "customer")); return customer; } public OrderStatusRequest rollUpToStatus(){ OrderStatusRequest status = Q.orderStatuses().unlimited(); - this.withStatusMatching(status) - .groupByStatusWith(status); + this.internalRollUpTo("status", status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToStatus", null, "status")); return status; } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java index 763de1a76..c601b176d 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java @@ -8,6 +8,7 @@ import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.util.Objects; @@ -33,13 +34,14 @@ public class OrderItem extends BaseEntity implements RemoteInput { public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); - public static final String CUSTOMER_ORDER_PROPERTY = "customerOrder"; - public static final String PRODUCT_NAME_PROPERTY = "productName"; + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String PRODUCT_NAME_PROPERTY = "product_name"; public static final String QUANTITY_PROPERTY = "quantity"; - public static final String UNIT_PRICE_PROPERTY = "unitPrice"; + public static final String UNIT_PRICE_PROPERTY = "unit_price"; private CustomerOrder customerOrder; private String productName; @@ -66,7 +68,7 @@ public BigDecimal getUnitPrice(){ } public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ - if(Objects.equals(this.customerOrder, customerOrder)){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ return this; } handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); @@ -76,7 +78,7 @@ public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ public OrderItem updateProductName(String productName){ productName = (productName == null ? null : productName.trim()); - if(Objects.equals(this.productName, productName)){ + if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ return this; } handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); @@ -85,7 +87,7 @@ public OrderItem updateProductName(String productName){ } public OrderItem updateQuantity(Integer quantity){ - if(Objects.equals(this.quantity, quantity)){ + if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ return this; } handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); @@ -94,7 +96,7 @@ public OrderItem updateQuantity(Integer quantity){ } public OrderItem updateUnitPrice(BigDecimal unitPrice){ - if(Objects.equals(this.unitPrice, unitPrice)){ + if(isPropertyLoaded(UNIT_PRICE_PROPERTY) && Objects.equals(this.unitPrice, unitPrice)){ return this; } handleUpdate(UNIT_PRICE_PROPERTY, getUnitPrice(), unitPrice); @@ -131,13 +133,13 @@ public Audited auditAs(String action) { public void __internalSet(String property, Object value) { markPropertyLoaded(property); switch (property) { - case "customerOrder": this.customerOrder = (CustomerOrder) value; break; + case "customer_order": this.customerOrder = (CustomerOrder) value; break; - case "productName": this.productName = (value == null ? null : ((String)value).trim()); break; + case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; case "quantity": this.quantity = (Integer) value; break; - case "unitPrice": this.unitPrice = (BigDecimal) value; break; + case "unit_price": this.unitPrice = (BigDecimal) value; break; default: super.__internalSet(property, value); } @@ -147,11 +149,20 @@ public void __internalSet(String property, Object value) { @FrameworkInternal public Object __internalGet(String property) { switch (property) { - case "customerOrder": return this.customerOrder; - case "productName": return this.productName; + case "customer_order": return this.customerOrder; + case "product_name": return this.productName; case "quantity": return this.quantity; - case "unitPrice": return this.unitPrice; - default: return super.__internalGet(property); + case "unit_price": return this.unitPrice; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "productName": return this.productName; + case "quantity": return this.quantity; + case "unitPrice": return this.unitPrice; + default: return super.__internalGet(property); + } } } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java index 7310b8901..31528fa21 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java @@ -25,18 +25,21 @@ public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _p if((orderItem == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + } if(orderItem.newItem()){ }else if(orderItem.updateItem()){ - if(!orderItem.isPropertyLoaded("customerOrder")){ + if(!orderItem.isPropertyLoaded("customer_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); } - if(!orderItem.isPropertyLoaded("productName")){ + if(!orderItem.isPropertyLoaded("product_name")){ invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); } if(!orderItem.isPropertyLoaded("quantity")){ invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); } - if(!orderItem.isPropertyLoaded("unitPrice")){ + if(!orderItem.isPropertyLoaded("unit_price")){ invalidTypeCheck(_context, newLocation(_parentLocation, "unit_price"), "Mutation requires a fully loaded entity"); } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java index f2372bf52..f8b30f5e6 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java @@ -37,7 +37,7 @@ public boolean isNull() { public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customerOrder", OrderItem::getCustomerOrder)); + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderItem::getCustomerOrder)); } public OrderItemExpression updateCustomerOrder(CustomerOrder customerOrder){ @@ -45,21 +45,21 @@ public OrderItemExpression updateCustomerOrder(CustomerOrder customerOr } public Expression getProductName(){ - return loaded("productName", OrderItem::getProductName); + return loaded("product_name", "getProductName", OrderItem::getProductName); } public OrderItemExpression updateProductName(String productName){ return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateProductName(productName)); } public Expression getQuantity(){ - return loaded("quantity", OrderItem::getQuantity); + return loaded("quantity", "getQuantity", OrderItem::getQuantity); } public OrderItemExpression updateQuantity(Integer quantity){ return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateQuantity(quantity)); } public Expression getUnitPrice(){ - return loaded("unitPrice", OrderItem::getUnitPrice); + return loaded("unit_price", "getUnitPrice", OrderItem::getUnitPrice); } public OrderItemExpression updateUnitPrice(BigDecimal unitPrice){ return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUnitPrice(unitPrice)); diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java index 73f962daa..158c0afe9 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java @@ -12,6 +12,7 @@ import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; import java.math.BigDecimal; +import java.util.Objects; public class OrderItemRequest extends BaseRequest { @@ -36,6 +37,19 @@ public OrderItemRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderItemRequest returnType(Class returnType){ @@ -103,6 +117,12 @@ public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ return this; } + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + public OrderItemRequest enhanceChildrenIfNeeded(){ return this; } @@ -751,6 +771,54 @@ public OrderItemRequest groupByCustomerOrderWithDetails(CustomerOrderRequest + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderItemRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctProductName(){ + return countDistinctProductNameAs("product_name_distinct_count"); + } + + public OrderItemRequest countDistinctProductNameAs(String alias){ + super.countDistinctProperty(alias, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctQuantity(){ + return countDistinctQuantityAs("quantity_distinct_count"); + } + + public OrderItemRequest countDistinctQuantityAs(String alias){ + super.countDistinctProperty(alias, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest countDistinctUnitPrice(){ + return countDistinctUnitPriceAs("unit_price_distinct_count"); + } + + public OrderItemRequest countDistinctUnitPriceAs(String alias){ + super.countDistinctProperty(alias, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } public OrderItemRequest groupById(){ groupBy(OrderItem.ID_PROPERTY); @@ -767,7 +835,8 @@ public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction fu return this; } public OrderItemRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest); + groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); return this; } public OrderItemRequest groupByCustomerOrder(){ @@ -918,8 +987,8 @@ public OrderItemRequest orderByVersionDescending(){ public CustomerOrderRequest rollUpToCustomerOrder(){ CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.withCustomerOrderMatching(customerOrder) - .groupByCustomerOrderWith(customerOrder); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); return customerOrder; } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java index bda0d7d40..83fbdfb38 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java @@ -10,6 +10,7 @@ import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.math.BigDecimal; import java.util.Objects; @@ -31,19 +32,20 @@ public class OrderStatus extends BaseEntity implements RemoteInput { public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("color", java.util.List.of("color", "color")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customerOrderList"); + "customer_order_list"); public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( OrderStatus.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); public static final String PLATFORM_PROPERTY = "platform"; public static final String NAME_PROPERTY = "name"; public static final String CODE_PROPERTY = "code"; public static final String COLOR_PROPERTY = "color"; - public static final String DISPLAY_ORDER_PROPERTY = "displayOrder"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customerOrderList"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; private Platform platform; private String name; @@ -77,10 +79,10 @@ public BigDecimal getDisplayOrder(){ } public SmartList getCustomerOrderList(){ - return this.customerOrderList; + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; } public OrderStatus updatePlatform(Platform platform){ - if(Objects.equals(this.platform, platform)){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ return this; } handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); @@ -90,7 +92,7 @@ public OrderStatus updatePlatform(Platform platform){ public OrderStatus updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); @@ -100,7 +102,7 @@ public OrderStatus updateName(String name){ public OrderStatus updateCode(String code){ code = (code == null ? null : code.trim()); - if(Objects.equals(this.code, code)){ + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ return this; } handleUpdate(CODE_PROPERTY, getCode(), code); @@ -110,7 +112,7 @@ public OrderStatus updateCode(String code){ public OrderStatus updateColor(String color){ color = (color == null ? null : color.trim()); - if(Objects.equals(this.color, color)){ + if(isPropertyLoaded(COLOR_PROPERTY) && Objects.equals(this.color, color)){ return this; } handleUpdate(COLOR_PROPERTY, getColor(), color); @@ -119,7 +121,7 @@ public OrderStatus updateColor(String color){ } public OrderStatus updateDisplayOrder(BigDecimal displayOrder){ - if(Objects.equals(this.displayOrder, displayOrder)){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ return this; } handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); @@ -133,7 +135,8 @@ public OrderStatus addCustomerOrder(CustomerOrder customerOrder){ } if(null == this.customerOrderList){ - this.customerOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); } this.customerOrderList.add(customerOrder); @@ -177,9 +180,9 @@ public void __internalSet(String property, Object value) { case "color": this.color = (value == null ? null : ((String)value).trim()); break; - case "displayOrder": this.displayOrder = (BigDecimal) value; break; + case "display_order": this.displayOrder = (BigDecimal) value; break; - case "customerOrderList": this.customerOrderList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -192,9 +195,19 @@ public Object __internalGet(String property) { case "name": return this.name; case "code": return this.code; case "color": return this.color; - case "displayOrder": return this.displayOrder; - case "customerOrderList": return this.customerOrderList; - default: return super.__internalGet(property); + case "display_order": return this.displayOrder; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "color": return this.color; + case "displayOrder": return this.displayOrder; + default: return super.__internalGet(property); + } } } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java index f7ad7ece3..0f2645a76 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java @@ -27,6 +27,9 @@ public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocatio if((orderStatus == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderStatus); + if(orderStatus.needPersist()){ + } if(orderStatus.newItem()){ }else if(orderStatus.updateItem()){ if(!orderStatus.isPropertyLoaded("platform")){ @@ -41,7 +44,7 @@ public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocatio if(!orderStatus.isPropertyLoaded("color")){ invalidTypeCheck(_context, newLocation(_parentLocation, "color"), "Mutation requires a fully loaded entity"); } - if(!orderStatus.isPropertyLoaded("displayOrder")){ + if(!orderStatus.isPropertyLoaded("display_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java index a5e5fe331..b251f692b 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java @@ -39,7 +39,7 @@ public boolean isNull() { public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", OrderStatus::getPlatform)); + return new PlatformExpression(loaded("platform", "getPlatform", OrderStatus::getPlatform)); } public OrderStatusExpression updatePlatform(Platform platform){ @@ -47,35 +47,35 @@ public OrderStatusExpression updatePlatform(Platform platform){ } public Expression getName(){ - return loaded("name", OrderStatus::getName); + return loaded("name", "getName", OrderStatus::getName); } public OrderStatusExpression updateName(String name){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateName(name)); } public Expression getCode(){ - return loaded("code", OrderStatus::getCode); + return loaded("code", "getCode", OrderStatus::getCode); } public OrderStatusExpression updateCode(String code){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCode(code)); } public Expression getColor(){ - return loaded("color", OrderStatus::getColor); + return loaded("color", "getColor", OrderStatus::getColor); } public OrderStatusExpression updateColor(String color){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateColor(color)); } public Expression getDisplayOrder(){ - return loaded("displayOrder", OrderStatus::getDisplayOrder); + return loaded("display_order", "getDisplayOrder", OrderStatus::getDisplayOrder); } public OrderStatusExpression updateDisplayOrder(BigDecimal displayOrder){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateDisplayOrder(displayOrder)); } public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customerOrderList", OrderStatus::getCustomerOrderList)); + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", OrderStatus::getCustomerOrderList)); } public OrderStatusExpression addCustomerOrder(CustomerOrder customerOrder){ return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).addCustomerOrder(customerOrder)); diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java index d4713aac1..05a90f705 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java @@ -14,6 +14,7 @@ import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; import java.math.BigDecimal; +import java.util.Objects; public class OrderStatusRequest extends BaseRequest { @@ -38,6 +39,19 @@ public OrderStatusRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderStatusRequest copy(){ + return (OrderStatusRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderStatusRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderStatusRequest returnType(Class returnType){ @@ -105,6 +119,12 @@ public OrderStatusRequest matchingAnyOf(OrderStatusRequest orderStatus){ return this; } + public OrderStatusRequest matchingIdsOf(OrderStatusRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderStatus.ID_PROPERTY, request, OrderStatus.ID_PROPERTY)); + } + public OrderStatusRequest enhanceChildrenIfNeeded(){ return this; } @@ -838,13 +858,70 @@ public OrderStatusRequest groupByPlatformWithDetails(PlatformRequest subReque + public OrderStatusRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public OrderStatusRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.PLATFORM_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderStatusRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.ID_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderStatusRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public OrderStatusRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctColor(){ + return countDistinctColorAs("color_distinct_count"); + } + + public OrderStatusRequest countDistinctColorAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public OrderStatusRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderStatusRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.VERSION_PROPERTY); + return this; + } public OrderStatusRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ aggregate(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); return this; } public OrderStatusRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(OrderStatus.PLATFORM_PROPERTY, subRequest); + groupBy(OrderStatus.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); return this; } public OrderStatusRequest groupByPlatform(){ @@ -1064,8 +1141,8 @@ public OrderStatusRequest statsFromCustomerOrders(CustomerOrderRequest subReq } public PlatformRequest rollUpToPlatform(){ PlatformRequest platform = Q.platforms().unlimited(); - this.withPlatformMatching(platform) - .groupByPlatformWith(platform); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); return platform; } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java index 5352b41f1..41af7d99f 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java @@ -10,6 +10,7 @@ import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -30,16 +31,17 @@ public class Platform extends BaseEntity implements RemoteInput { public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "orderStatusList", "customerList"); + "order_status_list", "customer_list"); public static final FieldLayout __TEAQL_FIELD_LAYOUT = FieldLayout.installGenerated(FieldLayout.generated( Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES)); + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); public static final String NAME_PROPERTY = "name"; - public static final String ORDER_STATUS_LIST_PROPERTY = "orderStatusList"; - public static final String CUSTOMER_LIST_PROPERTY = "customerList"; + public static final String ORDER_STATUS_LIST_PROPERTY = "order_status_list"; + public static final String CUSTOMER_LIST_PROPERTY = "customer_list"; private String name; private SmartList orderStatusList; @@ -50,14 +52,14 @@ public String getName(){ } public SmartList getOrderStatusList(){ - return this.orderStatusList; + return this.orderStatusList == null ? SmartList.unloaded() : this.orderStatusList; } public SmartList getCustomerList(){ - return this.customerList; + return this.customerList == null ? SmartList.unloaded() : this.customerList; } public Platform updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); @@ -71,7 +73,8 @@ public Platform addOrderStatus(OrderStatus orderStatus){ } if(null == this.orderStatusList){ - this.orderStatusList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderStatusList = teaqlUnloadedItems.map(value -> value); } this.orderStatusList.add(orderStatus); @@ -84,7 +87,8 @@ public Platform addCustomer(Customer customer){ } if(null == this.customerList){ - this.customerList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerList = teaqlUnloadedItems.map(value -> value); } this.customerList.add(customer); @@ -122,8 +126,8 @@ public void __internalSet(String property, Object value) { switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "orderStatusList": this.orderStatusList = (SmartList) value; break; - case "customerList": this.customerList = (SmartList) value; break; + case "order_status_list": this.orderStatusList = (SmartList) value; break; + case "customer_list": this.customerList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -133,9 +137,15 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "name": return this.name; - case "orderStatusList": return this.orderStatusList; - case "customerList": return this.customerList; - default: return super.__internalGet(property); + case "order_status_list": return this.orderStatusList; + case "customer_list": return this.customerList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java index 095fe8f85..21ff31db5 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java @@ -26,6 +26,9 @@ public void doCheck(UserContext _context, Platform platform, ObjectLocation _par if((platform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } if(platform.newItem()){ }else if(platform.updateItem()){ if(!platform.isPropertyLoaded("name")){ diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java index 9db873a18..7f1880f43 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java @@ -38,17 +38,17 @@ public boolean isNull() { public Expression getName(){ - return loaded("name", Platform::getName); + return loaded("name", "getName", Platform::getName); } public PlatformExpression updateName(String name){ return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); } public OrderStatusListExpression getOrderStatusList(){ - return new OrderStatusListExpression(loaded("orderStatusList", Platform::getOrderStatusList)); + return new OrderStatusListExpression(loaded("order_status_list", "getOrderStatusList", Platform::getOrderStatusList)); } public CustomerListExpression getCustomerList(){ - return new CustomerListExpression(loaded("customerList", Platform::getCustomerList)); + return new CustomerListExpression(loaded("customer_list", "getCustomerList", Platform::getCustomerList)); } public PlatformExpression addOrderStatus(OrderStatus orderStatus){ return new PlatformExpression(this, $it -> ((Platform)$it).addOrderStatus(orderStatus)); diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java index 18651ac46..e2b4cae1f 100644 --- a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java +++ b/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java @@ -13,6 +13,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class PlatformRequest extends BaseRequest { @@ -37,6 +38,19 @@ public PlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PlatformRequest returnType(Class returnType){ @@ -104,6 +118,12 @@ public PlatformRequest matchingAnyOf(PlatformRequest platform){ return this; } + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + public PlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -429,6 +449,30 @@ public PlatformRequest countAs(String retName){ setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } public PlatformRequest groupByOrderStatusesWithDetails(OrderStatusRequest subRequest){ aggregate(Platform.ORDER_STATUS_LIST_PROPERTY, subRequest); return this; diff --git a/examples/standard-order/generated/teaql/checker-model.json b/examples/standard-order/generated/teaql/checker-model.json new file mode 100644 index 000000000..471ca90fe --- /dev/null +++ b/examples/standard-order/generated/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:dd69b1927859f89b828bf1e7fb802e68157655ac0eca216e5aee11f0e8667aa8","entities":{"Customer":{"labels":{"en":"Customer"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Commerce Platform"},"aliases":["Platform"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerOrder":{"labels":{"en":"Customer Order"},"fields":[{"name":"customer","targetType":"Customer","labels":{"en":"Customer"},"aliases":["Customer"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_date","labels":{"en":"order date"},"aliases":["OrderDate","orderDate"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"Order Item"},"aliases":["OrderItemList","orderItemList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"status","targetType":"OrderStatus","labels":{"en":"Order Status"},"aliases":["Status"]},{"name":"total_amount","labels":{"en":"total amount"},"aliases":["TotalAmount","totalAmount"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderItem":{"labels":{"en":"Order Item"},"fields":[{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"product_name","labels":{"en":"product name"},"aliases":["ProductName","productName"]},{"name":"quantity","labels":{"en":"quantity"},"aliases":["Quantity"]},{"name":"unit_price","labels":{"en":"unit price"},"aliases":["UnitPrice","unitPrice"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderStatus":{"labels":{"en":"Order Status"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"color","labels":{"en":"color"},"aliases":["Color"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Commerce Platform"},"aliases":["Platform"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Commerce Platform"},"fields":[{"name":"customer_list","targetType":"Customer","labels":{"en":"Customer"},"aliases":["CustomerList","customerList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_status_list","targetType":"OrderStatus","labels":{"en":"Order Status"},"aliases":["OrderStatusList","orderStatusList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/standard-order/generated/teaql/model-provenance.json b/examples/standard-order/generated/teaql/model-provenance.json new file mode 100644 index 000000000..7e470acc1 --- /dev/null +++ b/examples/standard-order/generated/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"97830096"} \ No newline at end of file diff --git a/examples/standard-order/models/model.xml b/examples/standard-order/models/model.xml index 1afb68475..e2033e605 100644 --- a/examples/standard-order/models/model.xml +++ b/examples/standard-order/models/model.xml @@ -1,6 +1,5 @@ - + [!WARNING] > **IGNORE GENERIC ORM EXPERIENCE** > @@ -13,29 +38,7 @@ > > Do **not** guess TeaQL method names. -## How to Write Domain Code - -To get the exact API usage and query examples for the entity you are working on, execute the following command: - -```bash -cargo teaql --input models/trace-chain-service.xml java-assist-[action]/[entity-name] -``` - -> `models/trace-chain-service.xml` is the default model path. If the model file is located elsewhere, adjust the `--input` path to match the actual file location in this project. - -Replace `[action]` with one of the following: - -| action | when-to-use | -|--------|-------------| -| query | Read/find records from the database using Q. | -| create | Insert a new record into the database | -| update | Modify and save an existing record | -| delete | Remove or soft-delete a record | -| expression | Safely extract nested relation values using E. | -| list-page | Implement a paginated query returning SmartList | -| debug | View instructions for enabling SQL logging and debugging | - -Replace `[entity-name]` with the exact entity-name from the table below: +## Model entities | entity-name | display-name | |-------------|--------------| @@ -47,9 +50,10 @@ Replace `[entity-name]` with the exact entity-name from the table below: | shipment | Shipment | -Once the command succeeds, read its output. Use the printed code as a template to write your logic. +## Application entry and context -If the command cannot be executed, stop and report the missing context. Do not invent APIs. +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. ## Additional References @@ -59,4 +63,8 @@ Read these only when the task requires them: Framework runtime references and context handling. * **`RUNTIME_CUSTOM_GUIDE.md`** - Runtime setup, debugging, and project-specific restrictions. \ No newline at end of file + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/trace-chain/DOMAIN_API_GUIDE.md b/examples/trace-chain/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..768589273 --- /dev/null +++ b/examples/trace-chain/DOMAIN_API_GUIDE.md @@ -0,0 +1,33 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/trace-chain-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| customer_order | Customer Order | +| order_item | Order Item | +| payment | Payment | +| payment_attempt | Payment Attempt | +| shipment | Shipment | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/trace-chain/RUNTIME_CUSTOM_GUIDE.md b/examples/trace-chain/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..d4bfa105f --- /dev/null +++ b/examples/trace-chain/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/trace-chain-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/trace-chain/STANDARD_TELEMETRY.md b/examples/trace-chain/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/trace-chain/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/trace-chain/TOOL_API_GUIDE.md b/examples/trace-chain/TOOL_API_GUIDE.md new file mode 100644 index 000000000..f9d18891c --- /dev/null +++ b/examples/trace-chain/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/trace-chain-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/trace-chain-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/trace-chain/lib/pom.xml b/examples/trace-chain/lib/pom.xml index d92318d76..a1d24f4b6 100644 --- a/examples/trace-chain/lib/pom.xml +++ b/examples/trace-chain/lib/pom.xml @@ -67,7 +67,7 @@ io.teaql teaql-sqlite - 6.3.0 + ${teaql.version} io.teaql @@ -139,4 +139,4 @@ https://maven.teaql.io/repository/maven-releases/ - + \ No newline at end of file diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java index fffc55374..0ae2c18a9 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java @@ -13,25 +13,26 @@ import com.teaql.tracechainservice.platform.PlatformExpression; import com.teaql.tracechainservice.shipment.Shipment; import com.teaql.tracechainservice.shipment.ShipmentExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; import io.teaql.core.value.ValueExpression; public class E { public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform)); + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); } public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder)); + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); } public static OrderItemExpression orderItem(OrderItem orderItem){ - return new OrderItemExpression(new ValueExpression(orderItem)); + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); } public static PaymentExpression payment(Payment payment){ - return new PaymentExpression(new ValueExpression(payment)); + return new PaymentExpression(new ValueExpression(payment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.payment()")); } public static PaymentAttemptExpression paymentAttempt(PaymentAttempt paymentAttempt){ - return new PaymentAttemptExpression(new ValueExpression(paymentAttempt)); + return new PaymentAttemptExpression(new ValueExpression(paymentAttempt, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.paymentAttempt()")); } public static ShipmentExpression shipment(Shipment shipment){ - return new ShipmentExpression(new ValueExpression(shipment)); + return new ShipmentExpression(new ValueExpression(shipment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.shipment()")); } } \ No newline at end of file diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java index bdb577aee..75a93b749 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java @@ -1,6 +1,7 @@ package com.teaql.tracechainservice; +import io.teaql.core.FieldLayout; import io.teaql.core.meta.EntityDescriptor; import io.teaql.core.meta.EntityMetaAssembler; import io.teaql.core.meta.EntityMetaFactory; @@ -20,13 +21,17 @@ public void assemble(EntityMetaFactory factory) { registerShipment(); } private void registerPlatform() { + FieldLayout.installGenerated(com.teaql.tracechainservice.platform.Platform.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.tracechainservice.platform.Platform.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.tracechainservice.platform.Platform.class); entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.platform.Platform::new); entityDescriptor.with("name", "Platform") + .with("module", "Trace Chain") - .with("module_key", "trace-chain"); + + .with("module_key", "trace-chain") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -40,65 +45,114 @@ private void registerPlatform() { ; entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("candidates", "Trace Chain Verification") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.tracechainservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.tracechainservice.customerorder.CustomerOrder.class); entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.customerorder.CustomerOrder::new); entityDescriptor.with("name", "Customer Order") + .with("module", "Trace Chain") - .with("module_key", "trace-chain"); + + .with("module_key", "trace-chain") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -118,83 +172,146 @@ private void registerCustomerOrder() { ; entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.PLATFORM_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerOrderItem() { + FieldLayout.installGenerated(com.teaql.tracechainservice.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.tracechainservice.orderitem.OrderItem.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.tracechainservice.orderitem.OrderItem.class); entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.orderitem.OrderItem::new); entityDescriptor.with("name", "Order Item") + .with("module", "Trace Chain") + .with("module_key", "trace-chain") - .with("audit_mask_fields", "name"); + + .with("audit_mask_fields", "name") + ; entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY)); PropertyDescriptor id = @@ -211,66 +328,114 @@ private void registerOrderItem() { ; entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerPayment() { + FieldLayout.installGenerated(com.teaql.tracechainservice.payment.Payment.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.tracechainservice.payment.Payment.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.tracechainservice.payment.Payment.class); entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.payment.Payment::new); entityDescriptor.with("name", "Payment") + .with("module", "Trace Chain") - .with("module_key", "trace-chain"); + + .with("module_key", "trace-chain") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -287,66 +452,114 @@ private void registerPayment() { ; entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerPaymentAttempt() { + FieldLayout.installGenerated(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class); entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.paymentattempt.PaymentAttempt::new); entityDescriptor.with("name", "Payment Attempt") + .with("module", "Trace Chain") - .with("module_key", "trace-chain"); + + .with("module_key", "trace-chain") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -363,66 +576,114 @@ private void registerPaymentAttempt() { ; entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.PAYMENT_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } private void registerShipment() { + FieldLayout.installGenerated(com.teaql.tracechainservice.shipment.Shipment.__TEAQL_FIELD_LAYOUT); EntityDescriptor entityDescriptor = new EntityDescriptor(); entityDescriptor.setType(com.teaql.tracechainservice.shipment.Shipment.INTERNAL_TYPE); entityDescriptor.setTargetType(com.teaql.tracechainservice.shipment.Shipment.class); entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.shipment.Shipment::new); entityDescriptor.with("name", "Shipment") + .with("module", "Trace Chain") - .with("module_key", "trace-chain"); + + .with("module_key", "trace-chain") + ; entityDescriptor.setAuditMaskFields(java.util.List.of()); PropertyDescriptor id = @@ -439,55 +700,99 @@ private void registerShipment() { ; entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY).with("isPassword", "false") + .with("isVersion", "false") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "true") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY).with("isPassword", "false") + .with("max", "100") + .with("isVersion", "false") + .with("javaType", "java.lang.String") + .with("sqlType", "VARCHAR()") + .with("isId", "false") + .with("isBool", "false") + .with("isBaseEntityField", "false") + .with("isNumber", "false") + .with("isString", "true") + .with("isDate", "false") + .with("graphqlType", "String") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY).with("required", "true"); entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY).with("isPassword", "false") + .with("isVersion", "true") + .with("oracle_sqlType", "number(11)") + .with("javaType", "java.lang.Long") + .with("sqlType", "BIGINT") + .with("isId", "false") + .with("isBaseEntityField", "true") + .with("isBool", "false") + .with("isNumber", "false") + .with("isString", "false") + .with("isDate", "false") + .with("snowflake_sqlType", "number") + .with("graphqlType", "Long") + .with("isTime", "false") - .with("isText", "false"); + + .with("isText", "false") + ; $factory.register(entityDescriptor); } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java index 1e2dc5fe1..b55a80e8f 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java @@ -4,6 +4,7 @@ public final class GeneratedRuntimeModule { private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) .withCheckers(new com.teaql.tracechainservice.platform.PlatformChecker(), new com.teaql.tracechainservice.customerorder.CustomerOrderChecker(), new com.teaql.tracechainservice.orderitem.OrderItemChecker(), new com.teaql.tracechainservice.payment.PaymentChecker(), new com.teaql.tracechainservice.paymentattempt.PaymentAttemptChecker(), new com.teaql.tracechainservice.shipment.ShipmentChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:3360338e7162e546ad5c97348770bb50933b4da775b55b99a9707d39f93c8b0a\",\"entities\":{\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"description\",\"labels\":{\"en\":\"description\"},\"aliases\":[\"Description\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"Order Item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"payment_list\",\"targetType\":\"Payment\",\"labels\":{\"en\":\"Payment\"},\"aliases\":[\"PaymentList\",\"paymentList\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"shipment_list\",\"targetType\":\"Shipment\",\"labels\":{\"en\":\"Shipment\"},\"aliases\":[\"ShipmentList\",\"shipmentList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"Order Item\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Payment\":{\"labels\":{\"en\":\"Payment\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"payment_attempt_list\",\"targetType\":\"PaymentAttempt\",\"labels\":{\"en\":\"Payment Attempt\"},\"aliases\":[\"PaymentAttemptList\",\"paymentAttemptList\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PaymentAttempt\":{\"labels\":{\"en\":\"Payment Attempt\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"payment\",\"targetType\":\"Payment\",\"labels\":{\"en\":\"Payment\"},\"aliases\":[\"Payment\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Shipment\":{\"labels\":{\"en\":\"Shipment\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); private GeneratedRuntimeModule() {} diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java index 6cdb4bc81..7d8b00783 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java @@ -8,9 +8,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -24,13 +26,27 @@ public class CustomerOrder extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "CustomerOrder"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f10d535b66998395625745c0c3f6032ed01350e7f851687673b5ff1eb94a4337"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("order_number", 2), java.util.Map.entry("description", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("description", java.util.List.of("description", "description")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list", "payment_list", "shipment_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + public static final String PLATFORM_PROPERTY = "platform"; - public static final String ORDER_NUMBER_PROPERTY = "orderNumber"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; public static final String DESCRIPTION_PROPERTY = "description"; - public static final String ORDER_ITEM_LIST_PROPERTY = "orderItemList"; - public static final String PAYMENT_LIST_PROPERTY = "paymentList"; - public static final String SHIPMENT_LIST_PROPERTY = "shipmentList"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + public static final String PAYMENT_LIST_PROPERTY = "payment_list"; + public static final String SHIPMENT_LIST_PROPERTY = "shipment_list"; private Platform platform; private String orderNumber; @@ -54,16 +70,16 @@ public String getDescription(){ } public SmartList getOrderItemList(){ - return this.orderItemList; + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; } public SmartList getPaymentList(){ - return this.paymentList; + return this.paymentList == null ? SmartList.unloaded() : this.paymentList; } public SmartList getShipmentList(){ - return this.shipmentList; + return this.shipmentList == null ? SmartList.unloaded() : this.shipmentList; } public CustomerOrder updatePlatform(Platform platform){ - if(Objects.equals(this.platform, platform)){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ return this; } handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); @@ -73,7 +89,7 @@ public CustomerOrder updatePlatform(Platform platform){ public CustomerOrder updateOrderNumber(String orderNumber){ orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(Objects.equals(this.orderNumber, orderNumber)){ + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ return this; } handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); @@ -83,7 +99,7 @@ public CustomerOrder updateOrderNumber(String orderNumber){ public CustomerOrder updateDescription(String description){ description = (description == null ? null : description.trim()); - if(Objects.equals(this.description, description)){ + if(isPropertyLoaded(DESCRIPTION_PROPERTY) && Objects.equals(this.description, description)){ return this; } handleUpdate(DESCRIPTION_PROPERTY, getDescription(), description); @@ -97,7 +113,8 @@ public CustomerOrder addOrderItem(OrderItem orderItem){ } if(null == this.orderItemList){ - this.orderItemList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); } this.orderItemList.add(orderItem); @@ -110,7 +127,8 @@ public CustomerOrder addPayment(Payment payment){ } if(null == this.paymentList){ - this.paymentList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.paymentList = teaqlUnloadedItems.map(value -> value); } this.paymentList.add(payment); @@ -123,7 +141,8 @@ public CustomerOrder addShipment(Shipment shipment){ } if(null == this.shipmentList){ - this.shipmentList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.shipmentList = teaqlUnloadedItems.map(value -> value); } this.shipmentList.add(shipment); @@ -150,7 +169,7 @@ public CustomerOrder comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -161,13 +180,13 @@ public void __internalSet(String property, Object value) { switch (property) { case "platform": this.platform = (Platform) value; break; - case "orderNumber": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; case "description": this.description = (value == null ? null : ((String)value).trim()); break; - case "orderItemList": this.orderItemList = (SmartList) value; break; - case "paymentList": this.paymentList = (SmartList) value; break; - case "shipmentList": this.shipmentList = (SmartList) value; break; + case "order_item_list": this.orderItemList = (SmartList) value; break; + case "payment_list": this.paymentList = (SmartList) value; break; + case "shipment_list": this.shipmentList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -177,12 +196,20 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "platform": return this.platform; - case "orderNumber": return this.orderNumber; + case "order_number": return this.orderNumber; case "description": return this.description; - case "orderItemList": return this.orderItemList; - case "paymentList": return this.paymentList; - case "shipmentList": return this.shipmentList; - default: return super.__internalGet(property); + case "order_item_list": return this.orderItemList; + case "payment_list": return this.paymentList; + case "shipment_list": return this.shipmentList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "orderNumber": return this.orderNumber; + case "description": return this.description; + default: return super.__internalGet(property); + } } } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java index 60bacb4c2..2dbe2f874 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java @@ -30,12 +30,15 @@ public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLoc if((customerOrder == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } if(customerOrder.newItem()){ }else if(customerOrder.updateItem()){ if(!customerOrder.isPropertyLoaded("platform")){ invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); } - if(!customerOrder.isPropertyLoaded("orderNumber")){ + if(!customerOrder.isPropertyLoaded("order_number")){ invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); } if(!customerOrder.isPropertyLoaded("description")){ diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java index f2cd05eb6..05cb88590 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java @@ -42,7 +42,7 @@ public boolean isNull() { public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", CustomerOrder::getPlatform)); + return new PlatformExpression(loaded("platform", "getPlatform", CustomerOrder::getPlatform)); } public CustomerOrderExpression updatePlatform(Platform platform){ @@ -50,27 +50,27 @@ public CustomerOrderExpression updatePlatform(Platform platform){ } public Expression getOrderNumber(){ - return loaded("orderNumber", CustomerOrder::getOrderNumber); + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); } public CustomerOrderExpression updateOrderNumber(String orderNumber){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); } public Expression getDescription(){ - return loaded("description", CustomerOrder::getDescription); + return loaded("description", "getDescription", CustomerOrder::getDescription); } public CustomerOrderExpression updateDescription(String description){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateDescription(description)); } public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("orderItemList", CustomerOrder::getOrderItemList)); + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", CustomerOrder::getOrderItemList)); } public PaymentListExpression getPaymentList(){ - return new PaymentListExpression(loaded("paymentList", CustomerOrder::getPaymentList)); + return new PaymentListExpression(loaded("payment_list", "getPaymentList", CustomerOrder::getPaymentList)); } public ShipmentListExpression getShipmentList(){ - return new ShipmentListExpression(loaded("shipmentList", CustomerOrder::getShipmentList)); + return new ShipmentListExpression(loaded("shipment_list", "getShipmentList", CustomerOrder::getShipmentList)); } public CustomerOrderExpression addOrderItem(OrderItem orderItem){ return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderItem(orderItem)); diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java index 29aa5466c..59adf8813 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java @@ -17,6 +17,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class CustomerOrderRequest extends BaseRequest { @@ -27,7 +28,11 @@ public class CustomerOrderRequest extends BaseRequest returnType){ - super(returnType, () -> (T) new CustomerOrder()); + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -37,6 +42,19 @@ public CustomerOrderRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public CustomerOrderRequest returnType(Class returnType){ @@ -104,6 +122,12 @@ public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder) return this; } + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + public CustomerOrderRequest enhanceChildrenIfNeeded(){ return this; } @@ -127,6 +151,17 @@ public CustomerOrderRequest selectSelfFields(){ return selectSelf(); } + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.PLATFORM_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.DESCRIPTION_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectAll(){ super.selectAll(); return selectId().selectPlatform().selectOrderNumber().selectDescription().selectVersion(); @@ -167,7 +202,8 @@ public CustomerOrderRequest selectPlatform(){ public CustomerOrderRequest selectPlatformWith(PlatformRequest platform){ selectProperty(CustomerOrder.PLATFORM_PROPERTY); - enhanceRelation(CustomerOrder.PLATFORM_PROPERTY, platform); + enhanceRelation(CustomerOrder.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, CustomerOrder.PLATFORM_PROPERTY)); return this; } @@ -231,7 +267,8 @@ public CustomerOrderRequest selectOrderItemList(){ } public CustomerOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ - enhanceRelation(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList); + enhanceRelation(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); return this; } public CustomerOrderRequest selectPaymentList(){ @@ -239,7 +276,8 @@ public CustomerOrderRequest selectPaymentList(){ } public CustomerOrderRequest selectPaymentListWith(PaymentRequest paymentList){ - enhanceRelation(CustomerOrder.PAYMENT_LIST_PROPERTY, paymentList); + enhanceRelation(CustomerOrder.PAYMENT_LIST_PROPERTY, paymentList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentListWith", null, CustomerOrder.PAYMENT_LIST_PROPERTY)); return this; } public CustomerOrderRequest selectShipmentList(){ @@ -247,7 +285,8 @@ public CustomerOrderRequest selectShipmentList(){ } public CustomerOrderRequest selectShipmentListWith(ShipmentRequest shipmentList){ - enhanceRelation(CustomerOrder.SHIPMENT_LIST_PROPERTY, shipmentList); + enhanceRelation(CustomerOrder.SHIPMENT_LIST_PROPERTY, shipmentList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectShipmentListWith", null, CustomerOrder.SHIPMENT_LIST_PROPERTY)); return this; } @@ -593,10 +632,12 @@ public CustomerOrderRequest haveNoShipments(){ public CustomerOrderRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public CustomerOrderRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public CustomerOrderRequest groupByPlatformWithDetails(){ @@ -611,6 +652,46 @@ public CustomerOrderRequest groupByPlatformWithDetails(PlatformRequest subReq + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public CustomerOrderRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctDescription(){ + return countDistinctDescriptionAs("description_distinct_count"); + } + + public CustomerOrderRequest countDistinctDescriptionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } public CustomerOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ aggregate(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); return this; @@ -639,7 +720,8 @@ public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunctio return this; } public CustomerOrderRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(CustomerOrder.PLATFORM_PROPERTY, subRequest); + groupBy(CustomerOrder.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); return this; } public CustomerOrderRequest groupByPlatform(){ @@ -776,8 +858,8 @@ public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemReque } public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); return this; } @@ -789,8 +871,8 @@ public CustomerOrderRequest statsFromPaymentsAs(String name, PaymentRequest s } public CustomerOrderRequest statsFromPaymentsAs(String name, PaymentRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(Payment.CUSTOMER_ORDER_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, Payment.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPaymentsAs", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); return this; } @@ -802,8 +884,8 @@ public CustomerOrderRequest statsFromShipmentsAs(String name, ShipmentRequest } public CustomerOrderRequest statsFromShipmentsAs(String name, ShipmentRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(Shipment.CUSTOMER_ORDER_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, Shipment.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromShipmentsAs", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); return this; } @@ -812,8 +894,8 @@ public CustomerOrderRequest statsFromShipments(ShipmentRequest subRequest){ } public PlatformRequest rollUpToPlatform(){ PlatformRequest platform = Q.platforms().unlimited(); - this.withPlatformMatching(platform) - .groupByPlatformWith(platform); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); return platform; } @@ -821,37 +903,55 @@ public PlatformRequest rollUpToPlatform(){ public CustomerOrderRequest countOrderItems(){ - return countOrderItemsAs("Count"); + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countOrderItemsAs(String name){ - return countOrderItemsWith(name, Q.orderItems().unlimited()); + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ - return statsFromOrderItemsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countPayments(){ - return countPaymentsAs("Count"); + addRelationCount("Count", Q.payments().unlimited(), Payment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPayments", null, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countPaymentsAs(String name){ - return countPaymentsWith(name, Q.payments().unlimited()); + addRelationCount(name, Q.payments().unlimited(), Payment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentsAs", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countPaymentsWith(String name, PaymentRequest subRequest){ - return statsFromPaymentsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, Payment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentsWith", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countShipments(){ - return countShipmentsAs("Count"); + addRelationCount("Count", Q.shipments().unlimited(), Shipment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipments", null, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countShipmentsAs(String name){ - return countShipmentsWith(name, Q.shipments().unlimited()); + addRelationCount(name, Q.shipments().unlimited(), Shipment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipmentsAs", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; } public CustomerOrderRequest countShipmentsWith(String name, ShipmentRequest subRequest){ - return statsFromShipmentsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, Shipment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipmentsWith", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; } public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform){ @@ -859,7 +959,8 @@ public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformReque } public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.PLATFORM_PROPERTY, platform, includeAllFacets); + addFacet(facetName, CustomerOrder.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, CustomerOrder.PLATFORM_PROPERTY)); return this; } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java index 28a2ede6c..2284e067e 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java @@ -5,8 +5,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -20,8 +22,22 @@ public class OrderItem extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "OrderItem"; - - public static final String CUSTOMER_ORDER_PROPERTY = "customerOrder"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f1e0aaf75e3389eec4a68edadfb443fdc23c5cce2449a98cf55d935ed897b6fb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("name", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; public static final String NAME_PROPERTY = "name"; private CustomerOrder customerOrder; @@ -37,7 +53,7 @@ public String getName(){ } public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ - if(Objects.equals(this.customerOrder, customerOrder)){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ return this; } handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); @@ -47,7 +63,7 @@ public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ public OrderItem updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); @@ -75,7 +91,7 @@ public OrderItem comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -84,7 +100,7 @@ public Audited auditAs(String action) { public void __internalSet(String property, Object value) { markPropertyLoaded(property); switch (property) { - case "customerOrder": this.customerOrder = (CustomerOrder) value; break; + case "customer_order": this.customerOrder = (CustomerOrder) value; break; case "name": this.name = (value == null ? null : ((String)value).trim()); break; @@ -96,9 +112,16 @@ public void __internalSet(String property, Object value) { @FrameworkInternal public Object __internalGet(String property) { switch (property) { - case "customerOrder": return this.customerOrder; + case "customer_order": return this.customerOrder; case "name": return this.name; - default: return super.__internalGet(property); + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java index fd43c3d55..be1b79b87 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java @@ -24,9 +24,12 @@ public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _p if((orderItem == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + } if(orderItem.newItem()){ }else if(orderItem.updateItem()){ - if(!orderItem.isPropertyLoaded("customerOrder")){ + if(!orderItem.isPropertyLoaded("customer_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); } if(!orderItem.isPropertyLoaded("name")){ diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java index a1acacdad..f89f73eae 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java @@ -36,7 +36,7 @@ public boolean isNull() { public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customerOrder", OrderItem::getCustomerOrder)); + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderItem::getCustomerOrder)); } public OrderItemExpression updateCustomerOrder(CustomerOrder customerOrder){ @@ -44,7 +44,7 @@ public OrderItemExpression updateCustomerOrder(CustomerOrder customerOr } public Expression getName(){ - return loaded("name", OrderItem::getName); + return loaded("name", "getName", OrderItem::getName); } public OrderItemExpression updateName(String name){ return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateName(name)); diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java index 149c3b20b..7c957950e 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class OrderItemRequest extends BaseRequest { @@ -21,7 +22,11 @@ public class OrderItemRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public OrderItemRequest(Class returnType){ - super(returnType, () -> (T) new OrderItem()); + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -31,6 +36,19 @@ public OrderItemRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public OrderItemRequest returnType(Class returnType){ @@ -98,6 +116,12 @@ public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ return this; } + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + public OrderItemRequest enhanceChildrenIfNeeded(){ return this; } @@ -121,6 +145,16 @@ public OrderItemRequest selectSelfFields(){ return selectSelf(); } + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderItem.NAME_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + public OrderItemRequest selectAll(){ super.selectAll(); return selectId().selectCustomerOrder().selectName().selectVersion(); @@ -160,7 +194,8 @@ public OrderItemRequest selectCustomerOrder(){ public OrderItemRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder); + enhanceRelation(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderItem.CUSTOMER_ORDER_PROPERTY)); return this; } @@ -414,10 +449,12 @@ public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVer public OrderItemRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public OrderItemRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public OrderItemRequest groupByCustomerOrderWithDetails(){ @@ -431,6 +468,38 @@ public OrderItemRequest groupByCustomerOrderWithDetails(CustomerOrderRequest + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderItemRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderItemRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderItem.NAME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } public OrderItemRequest groupById(){ groupBy(OrderItem.ID_PROPERTY); @@ -447,7 +516,8 @@ public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction fu return this; } public OrderItemRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest); + groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); return this; } public OrderItemRequest groupByCustomerOrder(){ @@ -548,8 +618,8 @@ public OrderItemRequest orderByVersionDescending(){ public CustomerOrderRequest rollUpToCustomerOrder(){ CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.withCustomerOrderMatching(customerOrder) - .groupByCustomerOrderWith(customerOrder); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); return customerOrder; } @@ -561,7 +631,8 @@ public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrde } public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets); + addFacet(facetName, OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderItem.CUSTOMER_ORDER_PROPERTY)); return this; } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java index 1fb2eaaa7..193bc7080 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java @@ -6,9 +6,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -22,10 +24,24 @@ public class Payment extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "Payment"; - - public static final String CUSTOMER_ORDER_PROPERTY = "customerOrder"; - public static final String REFERENCE_CODE_PROPERTY = "referenceCode"; - public static final String PAYMENT_ATTEMPT_LIST_PROPERTY = "paymentAttemptList"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7a1e8a9603ba1bf577f0e3318f5c68e0b1e8d16c08f14ba596bf5292689211cb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "payment_attempt_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Payment.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String REFERENCE_CODE_PROPERTY = "reference_code"; + public static final String PAYMENT_ATTEMPT_LIST_PROPERTY = "payment_attempt_list"; private CustomerOrder customerOrder; private String referenceCode; @@ -41,10 +57,10 @@ public String getReferenceCode(){ } public SmartList getPaymentAttemptList(){ - return this.paymentAttemptList; + return this.paymentAttemptList == null ? SmartList.unloaded() : this.paymentAttemptList; } public Payment updateCustomerOrder(CustomerOrder customerOrder){ - if(Objects.equals(this.customerOrder, customerOrder)){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ return this; } handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); @@ -54,7 +70,7 @@ public Payment updateCustomerOrder(CustomerOrder customerOrder){ public Payment updateReferenceCode(String referenceCode){ referenceCode = (referenceCode == null ? null : referenceCode.trim()); - if(Objects.equals(this.referenceCode, referenceCode)){ + if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ return this; } handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); @@ -68,7 +84,8 @@ public Payment addPaymentAttempt(PaymentAttempt paymentAttempt){ } if(null == this.paymentAttemptList){ - this.paymentAttemptList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.paymentAttemptList = teaqlUnloadedItems.map(value -> value); } this.paymentAttemptList.add(paymentAttempt); @@ -95,7 +112,7 @@ public Payment comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -104,11 +121,11 @@ public Audited auditAs(String action) { public void __internalSet(String property, Object value) { markPropertyLoaded(property); switch (property) { - case "customerOrder": this.customerOrder = (CustomerOrder) value; break; + case "customer_order": this.customerOrder = (CustomerOrder) value; break; - case "referenceCode": this.referenceCode = (value == null ? null : ((String)value).trim()); break; + case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; - case "paymentAttemptList": this.paymentAttemptList = (SmartList) value; break; + case "payment_attempt_list": this.paymentAttemptList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -117,10 +134,17 @@ public void __internalSet(String property, Object value) { @FrameworkInternal public Object __internalGet(String property) { switch (property) { - case "customerOrder": return this.customerOrder; - case "referenceCode": return this.referenceCode; - case "paymentAttemptList": return this.paymentAttemptList; - default: return super.__internalGet(property); + case "customer_order": return this.customerOrder; + case "reference_code": return this.referenceCode; + case "payment_attempt_list": return this.paymentAttemptList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "referenceCode": return this.referenceCode; + default: return super.__internalGet(property); + } } } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java index b6440c651..2afb8566f 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java @@ -26,12 +26,15 @@ public void doCheck(UserContext _context, Payment payment, ObjectLocation _paren if((payment == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, payment); + if(payment.needPersist()){ + } if(payment.newItem()){ }else if(payment.updateItem()){ - if(!payment.isPropertyLoaded("customerOrder")){ + if(!payment.isPropertyLoaded("customer_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); } - if(!payment.isPropertyLoaded("referenceCode")){ + if(!payment.isPropertyLoaded("reference_code")){ invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java index 1f0069099..3d2cb6c48 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java @@ -38,7 +38,7 @@ public boolean isNull() { public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customerOrder", Payment::getCustomerOrder)); + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", Payment::getCustomerOrder)); } public PaymentExpression updateCustomerOrder(CustomerOrder customerOrder){ @@ -46,14 +46,14 @@ public PaymentExpression updateCustomerOrder(CustomerOrder customerOrde } public Expression getReferenceCode(){ - return loaded("referenceCode", Payment::getReferenceCode); + return loaded("reference_code", "getReferenceCode", Payment::getReferenceCode); } public PaymentExpression updateReferenceCode(String referenceCode){ return new PaymentExpression(this, $it -> ((Payment)$it).updateReferenceCode(referenceCode)); } public PaymentAttemptListExpression getPaymentAttemptList(){ - return new PaymentAttemptListExpression(loaded("paymentAttemptList", Payment::getPaymentAttemptList)); + return new PaymentAttemptListExpression(loaded("payment_attempt_list", "getPaymentAttemptList", Payment::getPaymentAttemptList)); } public PaymentExpression addPaymentAttempt(PaymentAttempt paymentAttempt){ return new PaymentExpression(this, $it -> ((Payment)$it).addPaymentAttempt(paymentAttempt)); diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java index a001c8238..2c2aff0a8 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java @@ -13,6 +13,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class PaymentRequest extends BaseRequest { @@ -23,7 +24,11 @@ public class PaymentRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public PaymentRequest(Class returnType){ - super(returnType, () -> (T) new Payment()); + this(returnType, () -> (T) new Payment()); + } + + protected PaymentRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -33,6 +38,19 @@ public PaymentRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PaymentRequest copy(){ + return (PaymentRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PaymentRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PaymentRequest returnType(Class returnType){ @@ -100,6 +118,12 @@ public PaymentRequest matchingAnyOf(PaymentRequest payment){ return this; } + public PaymentRequest matchingIdsOf(PaymentRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Payment.ID_PROPERTY, request, Payment.ID_PROPERTY)); + } + public PaymentRequest enhanceChildrenIfNeeded(){ return this; } @@ -123,6 +147,16 @@ public PaymentRequest selectSelfFields(){ return selectSelf(); } + public PaymentRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Payment.ID_PROPERTY); + selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); + selectProperty(Payment.REFERENCE_CODE_PROPERTY); + selectProperty(Payment.VERSION_PROPERTY); + return this; + } + public PaymentRequest selectAll(){ super.selectAll(); return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); @@ -163,7 +197,8 @@ public PaymentRequest selectCustomerOrder(){ public PaymentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder); + enhanceRelation(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, Payment.CUSTOMER_ORDER_PROPERTY)); return this; } @@ -210,7 +245,8 @@ public PaymentRequest selectPaymentAttemptList(){ } public PaymentRequest selectPaymentAttemptListWith(PaymentAttemptRequest paymentAttemptList){ - enhanceRelation(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, paymentAttemptList); + enhanceRelation(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, paymentAttemptList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentAttemptListWith", null, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); return this; } @@ -440,10 +476,12 @@ public PaymentRequest haveNoPaymentAttempts(){ public PaymentRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public PaymentRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public PaymentRequest groupByCustomerOrderWithDetails(){ @@ -457,6 +495,38 @@ public PaymentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest su + public PaymentRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PaymentRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Payment.ID_PROPERTY); + return this; + } + public PaymentRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public PaymentRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public PaymentRequest countDistinctReferenceCode(){ + return countDistinctReferenceCodeAs("reference_code_distinct_count"); + } + + public PaymentRequest countDistinctReferenceCodeAs(String alias){ + super.countDistinctProperty(alias, Payment.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PaymentRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Payment.VERSION_PROPERTY); + return this; + } public PaymentRequest groupByPaymentAttemptsWithDetails(PaymentAttemptRequest subRequest){ aggregate(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, subRequest); return this; @@ -477,7 +547,8 @@ public PaymentRequest groupByIdWithFunction(String retName, AggrFunction func return this; } public PaymentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(Payment.CUSTOMER_ORDER_PROPERTY, subRequest); + groupBy(Payment.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); return this; } public PaymentRequest groupByCustomerOrder(){ @@ -581,8 +652,8 @@ public PaymentRequest statsFromPaymentAttemptsAs(String name, PaymentAttemptR } public PaymentRequest statsFromPaymentAttemptsAs(String name, PaymentAttemptRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(PaymentAttempt.PAYMENT_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, PaymentAttempt.PAYMENT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPaymentAttemptsAs", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); return this; } @@ -591,23 +662,29 @@ public PaymentRequest statsFromPaymentAttempts(PaymentAttemptRequest subReque } public CustomerOrderRequest rollUpToCustomerOrder(){ CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.withCustomerOrderMatching(customerOrder) - .groupByCustomerOrderWith(customerOrder); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); return customerOrder; } public PaymentRequest countPaymentAttempts(){ - return countPaymentAttemptsAs("Count"); + addRelationCount("Count", Q.paymentAttempts().unlimited(), PaymentAttempt.PAYMENT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttempts", null, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; } public PaymentRequest countPaymentAttemptsAs(String name){ - return countPaymentAttemptsWith(name, Q.paymentAttempts().unlimited()); + addRelationCount(name, Q.paymentAttempts().unlimited(), PaymentAttempt.PAYMENT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttemptsAs", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; } public PaymentRequest countPaymentAttemptsWith(String name, PaymentAttemptRequest subRequest){ - return statsFromPaymentAttemptsAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, PaymentAttempt.PAYMENT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttemptsWith", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; } public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ @@ -615,7 +692,8 @@ public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderR } public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets); + addFacet(facetName, Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, Payment.CUSTOMER_ORDER_PROPERTY)); return this; } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java index 0f837212b..1ddd7d89d 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java @@ -5,8 +5,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -20,9 +22,23 @@ public class PaymentAttempt extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "PaymentAttempt"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e8c46db1ccaafe0f9d90335a74f7dd234482731b27d51dbebb2e9f07bebc02eb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("payment", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("payment", java.util.List.of("payment", "payment")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + PaymentAttempt.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + public static final String PAYMENT_PROPERTY = "payment"; - public static final String REFERENCE_CODE_PROPERTY = "referenceCode"; + public static final String REFERENCE_CODE_PROPERTY = "reference_code"; private Payment payment; private String referenceCode; @@ -37,7 +53,7 @@ public String getReferenceCode(){ } public PaymentAttempt updatePayment(Payment payment){ - if(Objects.equals(this.payment, payment)){ + if(isPropertyLoaded(PAYMENT_PROPERTY) && Objects.equals(this.payment, payment)){ return this; } handleUpdate(PAYMENT_PROPERTY, getPayment(), payment); @@ -47,7 +63,7 @@ public PaymentAttempt updatePayment(Payment payment){ public PaymentAttempt updateReferenceCode(String referenceCode){ referenceCode = (referenceCode == null ? null : referenceCode.trim()); - if(Objects.equals(this.referenceCode, referenceCode)){ + if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ return this; } handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); @@ -75,7 +91,7 @@ public PaymentAttempt comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -86,7 +102,7 @@ public void __internalSet(String property, Object value) { switch (property) { case "payment": this.payment = (Payment) value; break; - case "referenceCode": this.referenceCode = (value == null ? null : ((String)value).trim()); break; + case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; default: super.__internalSet(property, value); } @@ -97,8 +113,15 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "payment": return this.payment; - case "referenceCode": return this.referenceCode; - default: return super.__internalGet(property); + case "reference_code": return this.referenceCode; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "payment": return this.payment; + case "referenceCode": return this.referenceCode; + default: return super.__internalGet(property); + } } } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java index 9807decca..58896b529 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java @@ -24,12 +24,15 @@ public void doCheck(UserContext _context, PaymentAttempt paymentAttempt, ObjectL if((paymentAttempt == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, paymentAttempt); + if(paymentAttempt.needPersist()){ + } if(paymentAttempt.newItem()){ }else if(paymentAttempt.updateItem()){ if(!paymentAttempt.isPropertyLoaded("payment")){ invalidTypeCheck(_context, newLocation(_parentLocation, "payment"), "Mutation requires a fully loaded entity"); } - if(!paymentAttempt.isPropertyLoaded("referenceCode")){ + if(!paymentAttempt.isPropertyLoaded("reference_code")){ invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java index 0739623ee..cc3a5db9c 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java @@ -36,7 +36,7 @@ public boolean isNull() { public PaymentExpression getPayment(){ - return new PaymentExpression(loaded("payment", PaymentAttempt::getPayment)); + return new PaymentExpression(loaded("payment", "getPayment", PaymentAttempt::getPayment)); } public PaymentAttemptExpression updatePayment(Payment payment){ @@ -44,7 +44,7 @@ public PaymentAttemptExpression updatePayment(Payment payment){ } public Expression getReferenceCode(){ - return loaded("referenceCode", PaymentAttempt::getReferenceCode); + return loaded("reference_code", "getReferenceCode", PaymentAttempt::getReferenceCode); } public PaymentAttemptExpression updateReferenceCode(String referenceCode){ return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).updateReferenceCode(referenceCode)); diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java index b44087014..6fd063951 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class PaymentAttemptRequest extends BaseRequest { @@ -21,7 +22,11 @@ public class PaymentAttemptRequest extends BaseRequest @Deprecated @SuppressWarnings("unchecked") public PaymentAttemptRequest(Class returnType){ - super(returnType, () -> (T) new PaymentAttempt()); + this(returnType, () -> (T) new PaymentAttempt()); + } + + protected PaymentAttemptRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -31,6 +36,19 @@ public PaymentAttemptRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PaymentAttemptRequest copy(){ + return (PaymentAttemptRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PaymentAttemptRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PaymentAttemptRequest returnType(Class returnType){ @@ -98,6 +116,12 @@ public PaymentAttemptRequest matchingAnyOf(PaymentAttemptRequest paymentAttem return this; } + public PaymentAttemptRequest matchingIdsOf(PaymentAttemptRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + PaymentAttempt.ID_PROPERTY, request, PaymentAttempt.ID_PROPERTY)); + } + public PaymentAttemptRequest enhanceChildrenIfNeeded(){ return this; } @@ -121,6 +145,16 @@ public PaymentAttemptRequest selectSelfFields(){ return selectSelf(); } + public PaymentAttemptRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(PaymentAttempt.ID_PROPERTY); + selectProperty(PaymentAttempt.PAYMENT_PROPERTY); + selectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); + selectProperty(PaymentAttempt.VERSION_PROPERTY); + return this; + } + public PaymentAttemptRequest selectAll(){ super.selectAll(); return selectId().selectPayment().selectReferenceCode().selectVersion(); @@ -160,7 +194,8 @@ public PaymentAttemptRequest selectPayment(){ public PaymentAttemptRequest selectPaymentWith(PaymentRequest payment){ selectProperty(PaymentAttempt.PAYMENT_PROPERTY); - enhanceRelation(PaymentAttempt.PAYMENT_PROPERTY, payment); + enhanceRelation(PaymentAttempt.PAYMENT_PROPERTY, payment, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentWith", null, PaymentAttempt.PAYMENT_PROPERTY)); return this; } @@ -414,10 +449,12 @@ public PaymentAttemptRequest withVersionBetween(Long startOfVersion, Long end public PaymentAttemptRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public PaymentAttemptRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public PaymentAttemptRequest groupByPaymentWithDetails(){ @@ -431,6 +468,38 @@ public PaymentAttemptRequest groupByPaymentWithDetails(PaymentRequest subRequ + public PaymentAttemptRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PaymentAttemptRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.ID_PROPERTY); + return this; + } + public PaymentAttemptRequest countDistinctPayment(){ + return countDistinctPaymentAs("payment_distinct_count"); + } + + public PaymentAttemptRequest countDistinctPaymentAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + public PaymentAttemptRequest countDistinctReferenceCode(){ + return countDistinctReferenceCodeAs("reference_code_distinct_count"); + } + + public PaymentAttemptRequest countDistinctReferenceCodeAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentAttemptRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PaymentAttemptRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.VERSION_PROPERTY); + return this; + } public PaymentAttemptRequest groupById(){ groupBy(PaymentAttempt.ID_PROPERTY); @@ -447,7 +516,8 @@ public PaymentAttemptRequest groupByIdWithFunction(String retName, AggrFuncti return this; } public PaymentAttemptRequest groupByPaymentWith(PaymentRequest subRequest){ - groupBy(PaymentAttempt.PAYMENT_PROPERTY, subRequest); + groupBy(PaymentAttempt.PAYMENT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPaymentWith", null, "payment")); return this; } public PaymentAttemptRequest groupByPayment(){ @@ -548,8 +618,8 @@ public PaymentAttemptRequest orderByVersionDescending(){ public PaymentRequest rollUpToPayment(){ PaymentRequest payment = Q.payments().unlimited(); - this.withPaymentMatching(payment) - .groupByPaymentWith(payment); + this.internalRollUpTo("payment", payment, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPayment", null, "payment")); return payment; } @@ -561,7 +631,8 @@ public PaymentAttemptRequest facetByPaymentAs(String facetName, PaymentReques } public PaymentAttemptRequest facetByPaymentAs(String facetName, PaymentRequest payment, boolean includeAllFacets){ - addFacet(facetName, PaymentAttempt.PAYMENT_PROPERTY, payment, includeAllFacets); + addFacet(facetName, PaymentAttempt.PAYMENT_PROPERTY, payment, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPaymentAs", facetName, PaymentAttempt.PAYMENT_PROPERTY)); return this; } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java index 8497063a6..fbcfc1fa5 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java @@ -5,9 +5,11 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -21,9 +23,23 @@ public class Platform extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "Platform"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "81fa96c3f6326be443cf018cd91970555d84dce1efa01c2aaee273740033ba30"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + public static final String NAME_PROPERTY = "name"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customerOrderList"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; private String name; private SmartList customerOrderList; @@ -33,11 +49,11 @@ public String getName(){ } public SmartList getCustomerOrderList(){ - return this.customerOrderList; + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; } public Platform updateName(String name){ name = (name == null ? null : name.trim()); - if(Objects.equals(this.name, name)){ + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ return this; } handleUpdate(NAME_PROPERTY, getName(), name); @@ -51,7 +67,8 @@ public Platform addCustomerOrder(CustomerOrder customerOrder){ } if(null == this.customerOrderList){ - this.customerOrderList = new SmartList<>(); + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); } this.customerOrderList.add(customerOrder); @@ -78,7 +95,7 @@ public Platform comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -89,7 +106,7 @@ public void __internalSet(String property, Object value) { switch (property) { case "name": this.name = (value == null ? null : ((String)value).trim()); break; - case "customerOrderList": this.customerOrderList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; default: super.__internalSet(property, value); } } @@ -99,8 +116,14 @@ public void __internalSet(String property, Object value) { public Object __internalGet(String property) { switch (property) { case "name": return this.name; - case "customerOrderList": return this.customerOrderList; - default: return super.__internalGet(property); + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } } } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java index e3fbdd923..3ae00c5a1 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java @@ -24,6 +24,9 @@ public void doCheck(UserContext _context, Platform platform, ObjectLocation _par if((platform == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } if(platform.newItem()){ }else if(platform.updateItem()){ if(!platform.isPropertyLoaded("name")){ diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java index e6c1617d6..dfc331232 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java @@ -36,14 +36,14 @@ public boolean isNull() { public Expression getName(){ - return loaded("name", Platform::getName); + return loaded("name", "getName", Platform::getName); } public PlatformExpression updateName(String name){ return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); } public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customerOrderList", Platform::getCustomerOrderList)); + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Platform::getCustomerOrderList)); } public PlatformExpression addCustomerOrder(CustomerOrder customerOrder){ return new PlatformExpression(this, $it -> ((Platform)$it).addCustomerOrder(customerOrder)); diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java index de81ac806..56b45f02b 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class PlatformRequest extends BaseRequest { @@ -21,7 +22,11 @@ public class PlatformRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public PlatformRequest(Class returnType){ - super(returnType, () -> (T) new Platform()); + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -31,6 +36,19 @@ public PlatformRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public PlatformRequest returnType(Class returnType){ @@ -98,6 +116,12 @@ public PlatformRequest matchingAnyOf(PlatformRequest platform){ return this; } + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + public PlatformRequest enhanceChildrenIfNeeded(){ return this; } @@ -121,6 +145,15 @@ public PlatformRequest selectSelfFields(){ return selectSelf(); } + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectAll(){ super.selectAll(); return selectId().selectName().selectVersion(); @@ -189,7 +222,8 @@ public PlatformRequest selectCustomerOrderList(){ } public PlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(Platform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList); + enhanceRelation(Platform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -381,10 +415,36 @@ public PlatformRequest haveNoCustomerOrders(){ public PlatformRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public PlatformRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); return this; } public PlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ @@ -483,8 +543,8 @@ public PlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRe } public PlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - subRequest.setPartitionProperty(CustomerOrder.PLATFORM_PROPERTY); - addAggregateDynamicProperty(name, subRequest, singleResult); + addRelationAggregate(name, subRequest, CustomerOrder.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); return this; } @@ -492,15 +552,21 @@ public PlatformRequest statsFromCustomerOrders(CustomerOrderRequest subReques return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); } public PlatformRequest countCustomerOrders(){ - return countCustomerOrdersAs("Count"); + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public PlatformRequest countCustomerOrdersAs(String name){ - return countCustomerOrdersWith(name, Q.customerOrders().unlimited()); + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } public PlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest.count(), true); + addRelationCount(name, subRequest, CustomerOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java index 4640250c7..aba60f2e7 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java @@ -5,8 +5,10 @@ import io.teaql.core.Audited; import io.teaql.core.BaseEntity; import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; import io.teaql.core.FrameworkInternal; import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; import java.util.Objects; /** @@ -20,9 +22,23 @@ public class Shipment extends BaseEntity implements RemoteInput { public static String INTERNAL_TYPE = "Shipment"; - - public static final String CUSTOMER_ORDER_PROPERTY = "customerOrder"; - public static final String REFERENCE_CODE_PROPERTY = "referenceCode"; + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c70893faccb3360294f70bb0d6b23a9b27af2975a33d01706b90254feff5a0cd"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Shipment.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String REFERENCE_CODE_PROPERTY = "reference_code"; private CustomerOrder customerOrder; private String referenceCode; @@ -37,7 +53,7 @@ public String getReferenceCode(){ } public Shipment updateCustomerOrder(CustomerOrder customerOrder){ - if(Objects.equals(this.customerOrder, customerOrder)){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ return this; } handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); @@ -47,7 +63,7 @@ public Shipment updateCustomerOrder(CustomerOrder customerOrder){ public Shipment updateReferenceCode(String referenceCode){ referenceCode = (referenceCode == null ? null : referenceCode.trim()); - if(Objects.equals(this.referenceCode, referenceCode)){ + if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ return this; } handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); @@ -75,7 +91,7 @@ public Shipment comment(String comment){ @Override @SuppressWarnings("unchecked") public Audited auditAs(String action) { - return super.auditAs(action); + return new Audited<>(this, action); } // ===== Framework Internal: generated switch dispatch ===== @@ -84,9 +100,9 @@ public Audited auditAs(String action) { public void __internalSet(String property, Object value) { markPropertyLoaded(property); switch (property) { - case "customerOrder": this.customerOrder = (CustomerOrder) value; break; + case "customer_order": this.customerOrder = (CustomerOrder) value; break; - case "referenceCode": this.referenceCode = (value == null ? null : ((String)value).trim()); break; + case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; default: super.__internalSet(property, value); } @@ -96,9 +112,16 @@ public void __internalSet(String property, Object value) { @FrameworkInternal public Object __internalGet(String property) { switch (property) { - case "customerOrder": return this.customerOrder; - case "referenceCode": return this.referenceCode; - default: return super.__internalGet(property); + case "customer_order": return this.customerOrder; + case "reference_code": return this.referenceCode; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "referenceCode": return this.referenceCode; + default: return super.__internalGet(property); + } } } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java index 5ab1092cd..aed815082 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java @@ -24,12 +24,15 @@ public void doCheck(UserContext _context, Shipment shipment, ObjectLocation _par if((shipment == null)){ return; } + boolean _contextFixEligible = needContextFix(_context, shipment); + if(shipment.needPersist()){ + } if(shipment.newItem()){ }else if(shipment.updateItem()){ - if(!shipment.isPropertyLoaded("customerOrder")){ + if(!shipment.isPropertyLoaded("customer_order")){ invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); } - if(!shipment.isPropertyLoaded("referenceCode")){ + if(!shipment.isPropertyLoaded("reference_code")){ invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); } diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java index 263812a73..61cbd74f8 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java @@ -36,7 +36,7 @@ public boolean isNull() { public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customerOrder", Shipment::getCustomerOrder)); + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", Shipment::getCustomerOrder)); } public ShipmentExpression updateCustomerOrder(CustomerOrder customerOrder){ @@ -44,7 +44,7 @@ public ShipmentExpression updateCustomerOrder(CustomerOrder customerOrd } public Expression getReferenceCode(){ - return loaded("referenceCode", Shipment::getReferenceCode); + return loaded("reference_code", "getReferenceCode", Shipment::getReferenceCode); } public ShipmentExpression updateReferenceCode(String referenceCode){ return new ShipmentExpression(this, $it -> ((Shipment)$it).updateReferenceCode(referenceCode)); diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java index 2096b0328..458288c02 100644 --- a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java +++ b/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java @@ -11,6 +11,7 @@ import io.teaql.core.SubQuerySearchCriteria; import io.teaql.core.criteria.Operator; import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; public class ShipmentRequest extends BaseRequest { @@ -21,7 +22,11 @@ public class ShipmentRequest extends BaseRequest { @Deprecated @SuppressWarnings("unchecked") public ShipmentRequest(Class returnType){ - super(returnType, () -> (T) new Shipment()); + this(returnType, () -> (T) new Shipment()); + } + + protected ShipmentRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); selectId(); selectVersion(); } @@ -31,6 +36,19 @@ public ShipmentRequest comment(String comment){ return this; } + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ShipmentRequest copy(){ + return (ShipmentRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ShipmentRequest<>((Class) returnType(), this::internalNewEntity); + } + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) public ShipmentRequest returnType(Class returnType){ @@ -98,6 +116,12 @@ public ShipmentRequest matchingAnyOf(ShipmentRequest shipment){ return this; } + public ShipmentRequest matchingIdsOf(ShipmentRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Shipment.ID_PROPERTY, request, Shipment.ID_PROPERTY)); + } + public ShipmentRequest enhanceChildrenIfNeeded(){ return this; } @@ -121,6 +145,16 @@ public ShipmentRequest selectSelfFields(){ return selectSelf(); } + public ShipmentRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Shipment.ID_PROPERTY); + selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); + selectProperty(Shipment.REFERENCE_CODE_PROPERTY); + selectProperty(Shipment.VERSION_PROPERTY); + return this; + } + public ShipmentRequest selectAll(){ super.selectAll(); return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); @@ -160,7 +194,8 @@ public ShipmentRequest selectCustomerOrder(){ public ShipmentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder); + enhanceRelation(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, Shipment.CUSTOMER_ORDER_PROPERTY)); return this; } @@ -414,10 +449,12 @@ public ShipmentRequest withVersionBetween(Long startOfVersion, Long endOfVers public ShipmentRequest count(){ super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); return this; } public ShipmentRequest countAs(String retName){ super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); return this; } public ShipmentRequest groupByCustomerOrderWithDetails(){ @@ -431,6 +468,38 @@ public ShipmentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest s + public ShipmentRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ShipmentRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Shipment.ID_PROPERTY); + return this; + } + public ShipmentRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public ShipmentRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public ShipmentRequest countDistinctReferenceCode(){ + return countDistinctReferenceCodeAs("reference_code_distinct_count"); + } + + public ShipmentRequest countDistinctReferenceCodeAs(String alias){ + super.countDistinctProperty(alias, Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + public ShipmentRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ShipmentRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Shipment.VERSION_PROPERTY); + return this; + } public ShipmentRequest groupById(){ groupBy(Shipment.ID_PROPERTY); @@ -447,7 +516,8 @@ public ShipmentRequest groupByIdWithFunction(String retName, AggrFunction fun return this; } public ShipmentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(Shipment.CUSTOMER_ORDER_PROPERTY, subRequest); + groupBy(Shipment.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); return this; } public ShipmentRequest groupByCustomerOrder(){ @@ -548,8 +618,8 @@ public ShipmentRequest orderByVersionDescending(){ public CustomerOrderRequest rollUpToCustomerOrder(){ CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.withCustomerOrderMatching(customerOrder) - .groupByCustomerOrderWith(customerOrder); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); return customerOrder; } @@ -561,7 +631,8 @@ public ShipmentRequest facetByCustomerOrderAs(String facetName, CustomerOrder } public ShipmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets); + addFacet(facetName, Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, Shipment.CUSTOMER_ORDER_PROPERTY)); return this; } diff --git a/examples/trace-chain/model.xml b/examples/trace-chain/model.xml index af681a9c2..47f7ca915 100644 --- a/examples/trace-chain/model.xml +++ b/examples/trace-chain/model.xml @@ -1,6 +1,5 @@ - + Date: Thu, 19 Nov 2026 16:24:18 +0800 Subject: [PATCH 02/71] Align application creation calls and retained Assist with generator v4.2.0 --- examples/inheritance-save/assist/delete-academy-assist.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/inheritance-save/assist/delete-academy-assist.md b/examples/inheritance-save/assist/delete-academy-assist.md index b2617971b..041e58c9c 100644 --- a/examples/inheritance-save/assist/delete-academy-assist.md +++ b/examples/inheritance-save/assist/delete-academy-assist.md @@ -60,6 +60,8 @@ audited `save(context)` restores visibility and advances the negative version to a positive one. A graph can recover several children with independent local comments using one audited root save. Test committed SQL/readback/audit lineage as well as Q/E visibility; a status flag alone is not evidence that the row was recovered. +Mark recovery before optional generated field updates; those edits and recovery +commit together with exactly one root-version advance. --- From a8be22cc301ce16ce007f4e01161ab19ec322165 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 17:04:21 +0800 Subject: [PATCH 03/71] Keep inherited legacy column mapping in application metadata assembly --- examples/inheritance-save/README.md | 4 ++++ .../inheritance/InheritanceLifecycleExampleTest.java | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/inheritance-save/README.md b/examples/inheritance-save/README.md index 6b5661541..178698013 100644 --- a/examples/inheritance-save/README.md +++ b/examples/inheritance-save/README.md @@ -48,6 +48,10 @@ combinations, minimal selection, streaming and parent update/no-op readback. The verifier checks root-owned versions and mapped child storage independently with read-only SQL. It is registered in `scripts/verify-examples.sh`. +Application assembly assigns the deliberately quoted `Legacy Campus Code` +storage column before schema reconciliation. This keeps the custom mapping +covered while allowing the library to remain exact, reproducible generator output. + The tested root-version sequence is `1 → 2 → 3 → -4 → 5 → -6 → 7 → 8`. Marker-only recovery, recovery with edits, stale/live/partial recovery rejection, and recovery audit lineage are checked on both providers. Native tests also diff --git a/examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java b/examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java index 6220e3fe5..7e84980ac 100644 --- a/examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java +++ b/examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java @@ -71,11 +71,16 @@ public MutationDecision review(UserContext ignored, MutationPlan plan) { return MutationDecision.allow(); } }; - var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + var metadata = new SimpleEntityMetaFactory(); + var runtime = TeaQLRuntime.builder().metadata(metadata) .dataService("default", provider.equals("sqlite") ? new SqliteDataServiceExecutor("default", driver, source) : new PostgresDataServiceExecutor("default", driver)) .idGenerationService(ids).mutationPolicyRegistry(key -> Optional.of(observer)).build().install(GeneratedRuntimeModule.module()); + // Keep the deliberately quoted legacy storage mapping in application + // assembly so the generated library remains exact producer output. + metadata.resolveEntityDescriptor("Academy").findProperty("campus_code") + .with("column", "Legacy Campus Code").with("columnName", "Legacy Campus Code"); UserContext context = new DefaultUserContext(runtime); context.ensureSchema(); context.ensureSchema(); var auditEvents = new ArrayList(); From 952f770a7ab826d4b7ea9dca29db1517dae39743 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 17:07:25 +0800 Subject: [PATCH 04/71] Regenerate current examples with the qualified generator compatibility candidate --- .../automatic-fixture/generated-files.json | 2 +- .../automatic-fixture/generation.json | 57 ++-- .../teaql/model-provenance.json | 2 +- .../conformance/teaql/model-provenance.json | 2 +- .../fix-e-alignment/fixture-manifest.json | 24 +- .../generated/teaql/model-provenance.json | 2 +- examples/generator-v420.json | 276 +++++++++--------- .../inheritance-save/generated-files.json | 2 +- .../inheritance-save/generation-origin.json | 22 +- .../teaql/model-provenance.json | 2 +- .../java-lib-core/teaql/model-provenance.json | 2 +- .../scalar-type-probe/fixture-manifest.json | 22 +- .../generated/teaql/model-provenance.json | 2 +- .../PascalCase/teaql/model-provenance.json | 2 +- .../camelCase/teaql/model-provenance.json | 2 +- .../json-profiles/provenance.json | 28 +- .../snake_case/teaql/model-provenance.json | 2 +- .../teaql/model-provenance.json | 2 +- .../generated/teaql/model-provenance.json | 2 +- .../trace-chain/teaql/model-provenance.json | 2 +- 20 files changed, 247 insertions(+), 210 deletions(-) diff --git a/examples/conformance/natural-messages/automatic-fixture/generated-files.json b/examples/conformance/natural-messages/automatic-fixture/generated-files.json index a1d24f6d9..4eaa8ec1c 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generated-files.json +++ b/examples/conformance/natural-messages/automatic-fixture/generated-files.json @@ -22,5 +22,5 @@ "lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "e7343d1366c418947fc058200104a8748265db5763f3861de9cda088cdb9dbce", "teaql/checker-model.json": "dbac03cd54b294e3e60a62752aeb170ad1ad722a7dfb8feb639c569ff3e73b1a", - "teaql/model-provenance.json": "713092d98415609d6c111ab9d9cc57cdcf5961842078197bb8f88573e4987e39" + "teaql/model-provenance.json": "b7258ff8e69db00a0119d03e41358d272756522caa89f8701ffc5744fae2a6fe" } diff --git a/examples/conformance/natural-messages/automatic-fixture/generation.json b/examples/conformance/natural-messages/automatic-fixture/generation.json index 705b5fd18..59c73f1a7 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generation.json +++ b/examples/conformance/natural-messages/automatic-fixture/generation.json @@ -2,32 +2,55 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "implementationHandEdited": false, "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "previousGeneration": { - "fixtureOutputProperty": "teaql.java.natural.fixture.output", - "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", - "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", - "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", "implementationHandEdited": false, - "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "fixtureOutputProperty": "teaql.java.natural.fixture.output", + "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", + "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", + "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "implementationHandEdited": false, + "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core", + "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + }, + "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + }, "publicPublication": false, "runtimeDependency": "local repository source", "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core", - "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + "scope": "java-lib-core" }, - "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" }, "publicPublication": false, "runtimeDependency": "local repository source", diff --git a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json index 3bbf5d668..bae1c1ed3 100644 --- a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json +++ b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/conformance/teaql/model-provenance.json b/examples/conformance/teaql/model-provenance.json index 26c59767c..cf616952f 100644 --- a/examples/conformance/teaql/model-provenance.json +++ b/examples/conformance/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/fix-e-alignment/fixture-manifest.json b/examples/fix-e-alignment/fixture-manifest.json index 7f60bae80..7152a79f3 100644 --- a/examples/fix-e-alignment/fixture-manifest.json +++ b/examples/fix-e-alignment/fixture-manifest.json @@ -31,25 +31,25 @@ "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": "512a9f6ee04a8a27e9164c46e0ef799ce4e0cb90f7729699def1175a485449c9", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c", "teaql/checker-model.json": "92144f0d6092e143784685a82a9dd67c1672665bbe50fa6ca57b9ad441325b45", - "teaql/model-provenance.json": "79aa8ed9ea90394fb39f6a20a880522c85bbe02559877679c8637653bff3547a" + "teaql/model-provenance.json": "28f5192a1ab491de2a8c9708b9aa95555c6fae2c113b0839c985512c2f17c7ac" }, - "generatedManifestSha256": "0acae340953ca731128da9b542106bb74a13f4b9baacaf284d60151bd1b6a5dd", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/fix-e-alignment/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "29477059729167675daccc9f6827a122982334469dde30dab6c8e4f9bdb19e53", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "language": "java", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "previousFixtureManifestSha256": "825ca006bef60ad6db424d704d27d85b4e1b34361af4337eeaf3a98ba967f268", + "previousFixtureManifestSha256": "08842964a952ce9f96b94897793f3e9cc9d8f0f73e477b76eebd41a2831af0c0", "previousOrigin": { - "commit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", "path": "examples/fix-e-alignment/fixture-manifest.json" }, - "producerReceiptSha256": "af4c8dbce6f9bf2c3490fccf30d9c917b9d70a196cab9653ff899377e7805f1f", + "producerReceiptSha256": "924394d26c34ceabf248701287ade25fc0e8938b13dc300a4c2c677c859440a6", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" }, "schema": "teaql.generated-example-fixture/v1" } diff --git a/examples/fix-e-alignment/generated/teaql/model-provenance.json b/examples/fix-e-alignment/generated/teaql/model-provenance.json index 79ec96f57..b26a72701 100644 --- a/examples/fix-e-alignment/generated/teaql/model-provenance.json +++ b/examples/fix-e-alignment/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/generator-v420.json b/examples/generator-v420.json index 6d24e0308..b5269f66b 100644 --- a/examples/generator-v420.json +++ b/examples/generator-v420.json @@ -1,14 +1,16 @@ { "generator": { - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "releaseURL": "https://github.com/teaql/teaql-code-gen/releases/tag/v4.2.0", - "sourceCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "tag": "v4.2.0" + "artifactKind": "new source build; not the historical v4.2.0 release artifact", + "baseRelease": "v4.2.0", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "qualificationReceiptSHA256": "e401e5436216b87140101f7e4f29cec3e620fa852637de397f74cd7a3b9a8cf9", + "sourceCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "tag": "unreleased-source-42275522" }, - "installationReceiptSHA256": "ddf103df0daa060962986e92d230cc201fcc78293198a4c5b107cdbe09346680", + "installationReceiptSHA256": "e626eb16b0afc8ee44b8c53ec5816bfdf639f0f55f01c278493b0f65f404988c", "libraries": [ { - "archiveSHA256": "3419da661d921a4a84a1f08ea5ad6a83527405e49386d871fef75609c57f77ca", + "archiveSHA256": "2c0d02ef8740a6250bd9b8d8340ba0ff049b6a6885296e6cc1b4b06670a9605d", "destination": "examples/conformance", "generatedFiles": { "examples/conformance/lib/pom.xml": { @@ -105,7 +107,7 @@ }, "examples/conformance/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "6710ca9864c596bf2413ab1eee0ba59b94cc73b57e7fec6ad4a13f482a3cdfea" + "sha256": "6ed407a489b2240668b508c1c06c416a86f5f329df9a8c7f010859e81d9b4a89" } }, "model": "examples/conformance/model.xml", @@ -113,23 +115,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "c43025f9044a73a4c38d6d9f14ed0e84aa52f8da8a7273657f37666a9f8e1c18", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "b2a1d96d6fb84e757767aa6b50246952d655d7684456a7edd0ee348262fdbe35", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "0a59f66db2487fdd0430087dd5985ae780225c088ad800679cb57c593c6bcee7", - "producerReceiptSha256": "ec16b389c68d4b2c7cb2b308f62d29b5e2a1e68627d9a49e7304dbec46bc066e", + "producerReceiptSha256": "a85a7972a12856d38f5a4739c8c10b0b5172d1c0dcad2481ec9a463f6d28de8f", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "0096a2df360c2c35eee20c9f0e1a09e35b1a335b91fe2372e0eade81913a659c", + "archiveSHA256": "48785cfc5cddad3f5119cb33fa29ef687c75cb9b94043722e506784dc3e9fae8", "destination": "examples/conformance/natural-messages/automatic-fixture", "generatedFiles": { "examples/conformance/natural-messages/automatic-fixture/lib/pom.xml": { @@ -226,7 +228,7 @@ }, "examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "713092d98415609d6c111ab9d9cc57cdcf5961842078197bb8f88573e4987e39" + "sha256": "b7258ff8e69db00a0119d03e41358d272756522caa89f8701ffc5744fae2a6fe" } }, "model": "examples/conformance/natural-messages/model.xml", @@ -234,23 +236,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", - "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "f7203a6661b7024af44be139c55be95827c9126690baaa008085549b60e58164", + "archiveSHA256": "14c13978a96d31521425bcee1c17df420fa23bb553cfda5fa865d365df53f380", "destination": "examples/fix-e-alignment/generated", "generatedFiles": { "examples/fix-e-alignment/generated/lib/pom.xml": { @@ -367,7 +369,7 @@ }, "examples/fix-e-alignment/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "79aa8ed9ea90394fb39f6a20a880522c85bbe02559877679c8637653bff3547a" + "sha256": "28f5192a1ab491de2a8c9708b9aa95555c6fae2c113b0839c985512c2f17c7ac" } }, "model": "examples/fix-e-alignment/model.xml", @@ -375,23 +377,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 4, - "generatedManifestSha256": "0acae340953ca731128da9b542106bb74a13f4b9baacaf284d60151bd1b6a5dd", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/fix-e-alignment/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "29477059729167675daccc9f6827a122982334469dde30dab6c8e4f9bdb19e53", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "producerReceiptSha256": "af4c8dbce6f9bf2c3490fccf30d9c917b9d70a196cab9653ff899377e7805f1f", + "producerReceiptSha256": "924394d26c34ceabf248701287ade25fc0e8938b13dc300a4c2c677c859440a6", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "63ba90219166efd74d62b57f9b55a2a77f026a7ba65f3067b05454897d38852d", + "archiveSHA256": "db84849eba8d0cd0a97367210be7534dd8e8eeb187cc262845af84fcbd882f4e", "destination": "examples/inheritance-save", "generatedFiles": { "examples/inheritance-save/lib/pom.xml": { @@ -568,7 +570,7 @@ }, "examples/inheritance-save/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "f7e0e14b0905e8c83b54559464ef0a2a3763daee625b0696769ff4fc18b39c49" + "sha256": "e2f58206cb0708fbf7672c98dbbd1c849b98ec94b5ba79aa9e8f79f2c78b1be2" } }, "model": "examples/inheritance-save/model.xml", @@ -576,23 +578,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 1, - "generatedManifestSha256": "b20380c0f82114c25114ae9ccc9c34adde1bf59d134dd432f059950287141056", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/inheritance-save/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "1b4da99b919b5f2d0ad9c97f1c4204a74475d860fbfb5cc7ed106a13653ce76d", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/inheritance-save/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "9ed75f14ac524f18ccaba59be8c7261da203d2472bbe5d1f88dfc16d8b203d01", - "producerReceiptSha256": "2439bd4d0a2ea091d626d6a81f979ed35f32be85062cd0440cc1a61041d852b5", + "producerReceiptSha256": "42ecd382b5350e90b6257b9a7424e0306d42d55c408bfcb56be923ce9cf0c2de", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "9e5db531452dfda719da54ce0667bbf08fcffa6862f87faea8c3aa6f3a1bc357", + "archiveSHA256": "02a67604db66724d9c401ca1bcf4c3c2624820402c4d3fb6037bb1fb79c57e5f", "destination": "examples/scalar-type-probe/json-profiles/PascalCase", "generatedFiles": { "examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml": { @@ -689,7 +691,7 @@ }, "examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "ae427ef988d132abf6690f6dd0988e045249b7897a9ab1e3adee5c6ff789157b" + "sha256": "cbbab272d18a50f80c4368222f1645c6104e44108eb17d7be7e0fb44fcd63739" } }, "model": "examples/scalar-type-probe/json-profiles/PascalCase/model.xml", @@ -697,23 +699,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "25c379dc3025ebcafa49055475e3dd1187f3a5e7283952beebf0245cbc7e3f71", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "40c5b31b553fe5aa6f76d54153ed218d09af5a4108dad6ac3f61e74c92c36b08", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", - "producerReceiptSha256": "b71a9a18267311a0c17816d9c60181b80dd13be6acaf3413295ba946edd82fe1", + "producerReceiptSha256": "7b30cb89b6937462fc34d3ef6e1a4eac4259447757d996be1afc91cba0d6f8b1", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "81d6cfccb9573007e089f8d87fa6ca4bf55ef777039a53ecff7d98f542bc6c41", + "archiveSHA256": "e93ecf7a09625252b13757ca2cea370531f5117f986d27a35be19ecf77f51ac3", "destination": "examples/scalar-type-probe/json-profiles/camelCase", "generatedFiles": { "examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml": { @@ -810,7 +812,7 @@ }, "examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e" + "sha256": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d" } }, "model": "examples/scalar-type-probe/json-profiles/camelCase/model.xml", @@ -818,23 +820,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "f38220297d6c482d8eb916cfccfbe2cc6fdcc3e177c151c7fddb54c43ac26147", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "15544db70d8dd7a1eb94f4fa21e0904095301fd06808037eba00c03b2ea2f1d7", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "producerReceiptSha256": "32de91eee5a0ac8fd0260063b2f5419c61486cfab551711e1ad858075d358df0", + "producerReceiptSha256": "f8c4737dd76517191020e79291b7239e5257be8454818aa11851ae100bd4ea2d", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "081151eef5273550e1f8b5737b82df3206162c1367d64115ff8bef52930b0ed3", + "archiveSHA256": "6325282ab5f7230823af2422e76a2c1b812bb32a52b0d8a06762056fa91c10b7", "destination": "examples/scalar-type-probe/json-profiles/snake_case", "generatedFiles": { "examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml": { @@ -931,7 +933,7 @@ }, "examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "aae97b2ed5d87ede29d03b620225b0cd242b8e088d6ec9fc8cdf7629ff200a98" + "sha256": "a83eba55390c39bdfe6466aa15467adad758c1aa30234f802d3329598bf4f03b" } }, "model": "examples/scalar-type-probe/json-profiles/snake_case/model.xml", @@ -939,23 +941,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "642d8577b4379a11e9e55e5585c126bdb7f7c03634c3f68636c0ec90ecbb83c7", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "94ee8f28f46b9f2a7dca317147a83ed8969ad877c97108bc96e3a512f1ecba19", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "producerReceiptSha256": "cae8fc7833271365c96c843108f60e0ee11ae4648c06c655715145cba81cfb2c", + "producerReceiptSha256": "0567afbf94076fb396188604f6cd74585398007e208e9c1c5d6c8653f5c2b40d", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "81d6cfccb9573007e089f8d87fa6ca4bf55ef777039a53ecff7d98f542bc6c41", + "archiveSHA256": "e93ecf7a09625252b13757ca2cea370531f5117f986d27a35be19ecf77f51ac3", "destination": "examples/scalar-type-probe/generated", "generatedFiles": { "examples/scalar-type-probe/generated/lib/pom.xml": { @@ -1052,7 +1054,7 @@ }, "examples/scalar-type-probe/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e" + "sha256": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d" } }, "model": "examples/scalar-type-probe/model.xml", @@ -1060,23 +1062,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "f38220297d6c482d8eb916cfccfbe2cc6fdcc3e177c151c7fddb54c43ac26147", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "15544db70d8dd7a1eb94f4fa21e0904095301fd06808037eba00c03b2ea2f1d7", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "aa05156776f942dedc0b86498baf5ef098d9704b9895729cf63e293cb010f339", + "archiveSHA256": "06fa9dac09a1046e0e806c05bc579305c2af1ce79f70d36bf150e0b57e76533f", "destination": "examples/school-management", "generatedFiles": { "examples/school-management/lib/pom.xml": { @@ -1193,7 +1195,7 @@ }, "examples/school-management/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "e71643a0e395daf060883f2fb6752d0c6645884dffabd2934e2cabb6c90f0f92" + "sha256": "fabf54fdec2266a50b5d626f02c1d0ee6c7504c1b669598c15f723337a6fb7d2" } }, "model": "examples/school-management/models/school-model.xml", @@ -1201,23 +1203,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "6e9fe414c95041edd0548548583560827b305a9cf05b489b514390def6b3f824", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/school-management/models/school-model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "1d99cfd9dee2db6b33879aa76926486948debf0d4bb8731f84c4447a183e2f42", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/school-management/models/school-model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "b5cd06ae44464fc29ed24de82654b47c80f546110496756aa15923cee1c511b4", - "producerReceiptSha256": "af212bfca6565258cc4d575b5f5ce1c09ba504937857282f70bbad29e07f276f", + "producerReceiptSha256": "ae0058e2d8f481784b0c3caa0f648bb7406b03a305e81dce8bf631b22df3cfff", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "27779fca2dc258b16c11779bd69ea6ff05e17d0fb1b237523607a8a7a7bbad31", + "archiveSHA256": "b73fc4ac4c7141b54c058f4da25dc345a4e4d61c7c8540f41d2e1ddd0ea6e6bf", "destination": "examples/standard-order/generated", "generatedFiles": { "examples/standard-order/generated/lib/pom.xml": { @@ -1374,7 +1376,7 @@ }, "examples/standard-order/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "383452529a7be408d6ec9e8162bca8d2a92c2681879cf79ef4209a9edc781046" + "sha256": "562f70fc1f497618d085ebceb2f6d079436d2e5776ea48d6b57977508a93c029" } }, "model": "examples/standard-order/models/model.xml", @@ -1382,23 +1384,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "82d3dab59287c704c92638424deead1be2788526410eabe83d7f9506bfe0eafd", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/standard-order/models/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "479f5c3671f11621d357a8b0cb3d0b8f402411a1fadab03d170663bee0062e94", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/standard-order/models/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "455a5b60e571859a68586678da4bd8c9f13120132dc7ecf95f0554d98af6d674", - "producerReceiptSha256": "ee30a0f1619c7bc1b5196668848b22feef008461ef9f52f6e199c9eb7e1e9fb2", + "producerReceiptSha256": "5726d2778a6a7e11b4f4341d6cc672cf39fc95b3c8be066ac11a9af7d6d94b08", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "e2dae2be506ef2354fd57ffd360d1fd53febb330be65546f4c8480d45095bab3", + "archiveSHA256": "2c77b2bbc9875b334596738a515adcf695c2cc88fc56540ff61e8707920edfa8", "destination": "examples/trace-chain", "generatedFiles": { "examples/trace-chain/lib/pom.xml": { @@ -1575,7 +1577,7 @@ }, "examples/trace-chain/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "5267c6d37e108c1392e71d2bd7b15264e00ae97a989d98c4391d87c80c3843d4" + "sha256": "1716a8cf763ca82ed6ee28c3a780b9e4172bbe5dfdfc5d17f5f0028c655a6f55" } }, "model": "examples/trace-chain/model.xml", @@ -1583,23 +1585,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "7d5d4b7cb978bc5c649fc9cf111236cf1143abd5dde053d29ed00941240a4a65", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/trace-chain/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "30caddc81917445af76dadfd0db429997bd28135307102ef33157799298c61a2", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/trace-chain/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "c9743d776718c7b27c97792f75f492fdc99bf427e4bd0c24bf3492de6520c9a2", - "producerReceiptSha256": "3081b854805f8829dc8d468b31cd6d8294867111588bd5088b4ef06a676c048e", + "producerReceiptSha256": "e8bdf79a95f262305c9896e4307f8c9caade164bc90ef08898c8c7e1382523c6", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "aab038b915b19c068e25398081eaba84908a4ecd5db0997a2b40b3b17b046476", + "archiveSHA256": "3ce74ef96d6b8fc82755c1a29a5ada2785fbdc88175a99e5317f59781b3a3fbd", "destination": "examples/order-management/java-lib-core", "generatedFiles": { "examples/order-management/java-lib-core/lib/pom.xml": { @@ -1796,7 +1798,7 @@ }, "examples/order-management/java-lib-core/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "31405751e4401502c2c62606fbef4bf7319675863392872f90e3903a2d0f51a1" + "sha256": "d304952c86fa19e10041d50a2c9bfeb24a69ec48246d34ee9b74f2afd4a1b963" } }, "model": "examples/order-management/model.xml", @@ -1804,23 +1806,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 8, - "generatedManifestSha256": "824b44c1d120e20da7e17344bcea9b15c7720a777be4d857d4692e6a755215e1", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-followup/java/order-management/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "bbc2f521b14f8809bd3ba78447493faf045421f67a226a315d933503aedbc5b9", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/order-management/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "8b11ee844c2be184e194d8116994fb5fe95299dd593bfed83ec06d71ada0411d", - "producerReceiptSha256": "2b4b1118897e08d70507908cb5167c56422ad1f3f2416588cbf12baa6f297044", + "producerReceiptSha256": "63c340240218ac2ab7af9e147196749137f52e73771eefabe0b4e525f2a66083", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } }, "preservedApplicationFiles": {} } ], - "runtimeBaseCommit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "runtimeBaseCommit": "a8be22cc301ce16ce007f4e01161ab19ec322165", "schema": "teaql.runtime-current-generated-examples/v1", "sourceCodeHandEdited": false } diff --git a/examples/inheritance-save/generated-files.json b/examples/inheritance-save/generated-files.json index 4b31c572a..8d3859252 100644 --- a/examples/inheritance-save/generated-files.json +++ b/examples/inheritance-save/generated-files.json @@ -42,5 +42,5 @@ "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java": "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7", "teaql/checker-model.json": "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242", - "teaql/model-provenance.json": "f7e0e14b0905e8c83b54559464ef0a2a3763daee625b0696769ff4fc18b39c49" + "teaql/model-provenance.json": "e2f58206cb0708fbf7672c98dbbd1c849b98ec94b5ba79aa9e8f79f2c78b1be2" } diff --git a/examples/inheritance-save/generation-origin.json b/examples/inheritance-save/generation-origin.json index 6bbca801b..ca32c1a6a 100644 --- a/examples/inheritance-save/generation-origin.json +++ b/examples/inheritance-save/generation-origin.json @@ -1,9 +1,21 @@ { - "schema": "teaql.generated-java-inheritance-example/v1", - "generatorBaseCommit": "77081b0935ab49c90b15f345c29a7724c407b3dd", - "sourceReceipt": "teaql-conformance/evidence/2026-11-14-java-subtype-assist-generation/receipt.json", - "sourceReceiptSha256": "077581ede000c6fdec9598d679a13482e5d9f18217f8dad82a33bfa6b8f5bcaf", "generatedFiles": 44, "generatedManifest": "generated-files.json", - "note": "The candidate contains uncommitted generator changes. The receipt source hashes identify that implementation. Its generated library is byte-identical to the runtime acceptance fixture; targeted Assist is refreshed from the same generation. Runtime dependencies use local source, not a published package." + "generator": { + "artifactKind": "new source build; not the historical v4.2.0 release artifact", + "baseRelease": "v4.2.0", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "qualificationReceiptSHA256": "e401e5436216b87140101f7e4f29cec3e620fa852637de397f74cd7a3b9a8cf9", + "sourceCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "tag": "unreleased-source-42275522" + }, + "note": "Exact output from the qualified unreleased generator source candidate. Local runtime source acceptance is recorded separately; this is not a public generator release claim.", + "previousOrigin": { + "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", + "path": "examples/inheritance-save/generation-origin.json", + "sha256": "650a3b02c5d67a14bf3d2f38d1f8fafe7161985822fc8256affd84c6add3e288" + }, + "schema": "teaql.generated-java-inheritance-example/v1", + "sourceReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/inheritance-save/model/receipt.json", + "sourceReceiptSha256": "42ecd382b5350e90b6257b9a7424e0306d42d55c408bfcb56be923ce9cf0c2de" } diff --git a/examples/inheritance-save/teaql/model-provenance.json b/examples/inheritance-save/teaql/model-provenance.json index 0e5af3021..f9a936577 100644 --- a/examples/inheritance-save/teaql/model-provenance.json +++ b/examples/inheritance-save/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/order-management/java-lib-core/teaql/model-provenance.json b/examples/order-management/java-lib-core/teaql/model-provenance.json index e35d521ba..539549530 100644 --- a/examples/order-management/java-lib-core/teaql/model-provenance.json +++ b/examples/order-management/java-lib-core/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/scalar-type-probe/fixture-manifest.json b/examples/scalar-type-probe/fixture-manifest.json index 64848da18..bb2e00e39 100644 --- a/examples/scalar-type-probe/fixture-manifest.json +++ b/examples/scalar-type-probe/fixture-manifest.json @@ -26,24 +26,24 @@ "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "teaql/model-provenance.json": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e" + "teaql/model-provenance.json": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d" }, - "generatedManifestSha256": "f38220297d6c482d8eb916cfccfbe2cc6fdcc3e177c151c7fddb54c43ac26147", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "15544db70d8dd7a1eb94f4fa21e0904095301fd06808037eba00c03b2ea2f1d7", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "language": "java", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "previousFixtureManifestSha256": "0386584cede3e5e375fc347f5df959297d6d00930bcd311ee0e1000171bdc75c", + "previousFixtureManifestSha256": "9b1287687b9ff2832e4a3b8e8ec3caeffcedf8e6fd3935a7f0d8db108bfae2e0", "previousOrigin": { - "commit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", "path": "examples/scalar-type-probe/fixture-manifest.json" }, "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } } diff --git a/examples/scalar-type-probe/generated/teaql/model-provenance.json b/examples/scalar-type-probe/generated/teaql/model-provenance.json index 19a79eb6c..6a5a71beb 100644 --- a/examples/scalar-type-probe/generated/teaql/model-provenance.json +++ b/examples/scalar-type-probe/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json index 1d8618d0a..5fa91d45b 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json index 19a79eb6c..6a5a71beb 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/provenance.json b/examples/scalar-type-probe/json-profiles/provenance.json index 5ff71f792..88b00539a 100644 --- a/examples/scalar-type-probe/json-profiles/provenance.json +++ b/examples/scalar-type-probe/json-profiles/provenance.json @@ -27,7 +27,7 @@ "PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "PascalCase/model.xml": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", "PascalCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "PascalCase/teaql/model-provenance.json": "ae427ef988d132abf6690f6dd0988e045249b7897a9ab1e3adee5c6ff789157b", + "PascalCase/teaql/model-provenance.json": "cbbab272d18a50f80c4368222f1645c6104e44108eb17d7be7e0fb44fcd63739", "base-model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "camelCase/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", @@ -53,7 +53,7 @@ "camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "camelCase/model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "camelCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "camelCase/teaql/model-provenance.json": "84e6e6a9d56404f3923357514c795575e617b670ac6ea413306a4203b80ff14e", + "camelCase/teaql/model-provenance.json": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d", "manifest.json": "519dfe321218a4248a9da550b22d35e3507a0408eb8e60fad1bc009a058afa6d", "snake_case/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", @@ -79,23 +79,23 @@ "snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "snake_case/model.xml": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", "snake_case/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "snake_case/teaql/model-provenance.json": "aae97b2ed5d87ede29d03b620225b0cd242b8e088d6ec9fc8cdf7629ff200a98" + "snake_case/teaql/model-provenance.json": "a83eba55390c39bdfe6466aa15467adad758c1aa30234f802d3329598bf4f03b" }, - "generatedManifestSha256": "642d8577b4379a11e9e55e5585c126bdb7f7c03634c3f68636c0ec90ecbb83c7", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "94ee8f28f46b9f2a7dca317147a83ed8969ad877c97108bc96e3a512f1ecba19", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "previousFixtureManifestSha256": "64d9d59523014b0091016c83e70d9cb9820aacfcd53693962644682807368bdf", + "previousFixtureManifestSha256": "86a8ff2f2a9a749c8bb84805f3e1c85a9b0972bf7701408fb620fb71b6e04889", "previousOrigin": { - "commit": "6365cf040c3a06d768ec7651c4e54a530b07d023", + "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", "path": "examples/scalar-type-probe/json-profiles/provenance.json" }, - "producerReceiptSha256": "cae8fc7833271365c96c843108f60e0ee11ae4648c06c655715145cba81cfb2c", + "producerReceiptSha256": "0567afbf94076fb396188604f6cd74585398007e208e9c1c5d6c8653f5c2b40d", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" } } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json index 8e39a5200..f126af7a8 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/school-management/teaql/model-provenance.json b/examples/school-management/teaql/model-provenance.json index ba10b19b8..c60905cae 100644 --- a/examples/school-management/teaql/model-provenance.json +++ b/examples/school-management/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/standard-order/generated/teaql/model-provenance.json b/examples/standard-order/generated/teaql/model-provenance.json index 7e470acc1..2873b32ed 100644 --- a/examples/standard-order/generated/teaql/model-provenance.json +++ b/examples/standard-order/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"42275522"} \ No newline at end of file diff --git a/examples/trace-chain/teaql/model-provenance.json b/examples/trace-chain/teaql/model-provenance.json index 7ee796f91..ac84b6bd6 100644 --- a/examples/trace-chain/teaql/model-provenance.json +++ b/examples/trace-chain/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"97830096"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"42275522"} \ No newline at end of file From 11c664dfbe4d18b6653d3bc904dd02540850b769 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 17:19:51 +0800 Subject: [PATCH 05/71] Bind the order console to the generator native library coordinate --- examples/order-management/java-app-console/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/order-management/java-app-console/pom.xml b/examples/order-management/java-app-console/pom.xml index 2c4e154e8..1c090fee5 100644 --- a/examples/order-management/java-app-console/pom.xml +++ b/examples/order-management/java-app-console/pom.xml @@ -17,7 +17,7 @@ com.teaql order-management-service-core - 1.0.0 + 0.0.1-SNAPSHOT io.teaql From c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 17:38:37 +0800 Subject: [PATCH 06/71] Install generated runtime module in order console --- .../main/java/com/teaql/example/OrderManagementApp.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java b/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java index 3e5ec079b..7068907b1 100644 --- a/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java +++ b/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java @@ -1,6 +1,6 @@ package com.teaql.example; -import com.teaql.ordermanagementservice.EntityMetaRegistry; +import com.teaql.ordermanagementservice.GeneratedRuntimeModule; import com.teaql.ordermanagementservice.Q; import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; import com.teaql.ordermanagementservice.customer.Customer; @@ -12,7 +12,6 @@ import io.teaql.core.SmartList; import io.teaql.core.TeaQLRuntimeException; import io.teaql.core.UserContext; -import io.teaql.core.meta.EntityMetaFactory; import io.teaql.core.meta.SimpleEntityMetaFactory; import io.teaql.core.sqlite.SqliteDataServiceExecutor; import io.teaql.provider.jdbc.JdbcSqlExecutor; @@ -108,8 +107,6 @@ public static void main(String[] args) throws Exception { private static UserContext context(DataServiceExecutor executor) { SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); - new EntityMetaRegistry().assemble(metadata); - EntityMetaFactory.registerGlobal(metadata); AtomicLong ids = new AtomicLong(1000); InternalIdGenerationService idGeneration = (context, entity) -> ids.getAndIncrement(); OrderMutationPolicy orderPolicy = new OrderMutationPolicy(); @@ -125,7 +122,7 @@ private static UserContext context(DataServiceExecutor executor) { "example-security-review", Instant.parse("2026-09-29T12:00:00Z"))) : Optional.empty()) - .build(); + .build().install(GeneratedRuntimeModule.module()); DefaultUserContext context = new DefaultUserContext(runtime); context.putAttribute( MutationAuthority.class.getName(), new MutationAuthority(Set.of())); From ef889acc1fba8b2bff27705ac49b3d3badf095ca Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 17:52:01 +0800 Subject: [PATCH 07/71] Bind current examples to one qualified generator source revision --- .../automatic-fixture/generated-files.json | 2 +- .../automatic-fixture/generation.json | 73 +++-- .../teaql/model-provenance.json | 2 +- .../conformance/teaql/model-provenance.json | 2 +- .../fix-e-alignment/fixture-manifest.json | 24 +- .../generated/teaql/model-provenance.json | 2 +- examples/generator-v420.json | 272 +++++++++--------- .../inheritance-save/generated-files.json | 2 +- .../inheritance-save/generation-origin.json | 17 +- .../teaql/model-provenance.json | 2 +- .../com/teaql/example/OrderManagementApp.java | 8 +- .../java-lib-core/teaql/model-provenance.json | 2 +- .../scalar-type-probe/fixture-manifest.json | 22 +- .../generated/teaql/model-provenance.json | 2 +- .../PascalCase/teaql/model-provenance.json | 2 +- .../camelCase/teaql/model-provenance.json | 2 +- .../json-profiles/provenance.json | 28 +- .../snake_case/teaql/model-provenance.json | 2 +- .../teaql/model-provenance.json | 2 +- .../generated/teaql/model-provenance.json | 2 +- .../trace-chain/teaql/model-provenance.json | 2 +- 21 files changed, 251 insertions(+), 221 deletions(-) diff --git a/examples/conformance/natural-messages/automatic-fixture/generated-files.json b/examples/conformance/natural-messages/automatic-fixture/generated-files.json index 4eaa8ec1c..60dc9f95d 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generated-files.json +++ b/examples/conformance/natural-messages/automatic-fixture/generated-files.json @@ -22,5 +22,5 @@ "lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "e7343d1366c418947fc058200104a8748265db5763f3861de9cda088cdb9dbce", "teaql/checker-model.json": "dbac03cd54b294e3e60a62752aeb170ad1ad722a7dfb8feb639c569ff3e73b1a", - "teaql/model-provenance.json": "b7258ff8e69db00a0119d03e41358d272756522caa89f8701ffc5744fae2a6fe" + "teaql/model-provenance.json": "fb712caf023900f433faf280e9f8db87ff563d8cf1bceb30d121dce9a6cf8343" } diff --git a/examples/conformance/natural-messages/automatic-fixture/generation.json b/examples/conformance/natural-messages/automatic-fixture/generation.json index 59c73f1a7..4c3a1b671 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generation.json +++ b/examples/conformance/natural-messages/automatic-fixture/generation.json @@ -2,44 +2,67 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "implementationHandEdited": false, "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "previousGeneration": { "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "implementationHandEdited": false, "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "previousGeneration": { - "fixtureOutputProperty": "teaql.java.natural.fixture.output", - "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", - "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", - "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", "implementationHandEdited": false, - "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "fixtureOutputProperty": "teaql.java.natural.fixture.output", + "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", + "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", + "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "implementationHandEdited": false, + "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core", + "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + }, + "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + }, "publicPublication": false, "runtimeDependency": "local repository source", "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core", - "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + "scope": "java-lib-core" }, - "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" }, "publicPublication": false, "runtimeDependency": "local repository source", @@ -48,9 +71,9 @@ }, "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" }, "publicPublication": false, "runtimeDependency": "local repository source", diff --git a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json index bae1c1ed3..8cf3b9811 100644 --- a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json +++ b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/conformance/teaql/model-provenance.json b/examples/conformance/teaql/model-provenance.json index cf616952f..994241e8b 100644 --- a/examples/conformance/teaql/model-provenance.json +++ b/examples/conformance/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/fix-e-alignment/fixture-manifest.json b/examples/fix-e-alignment/fixture-manifest.json index 7152a79f3..fdbd964fc 100644 --- a/examples/fix-e-alignment/fixture-manifest.json +++ b/examples/fix-e-alignment/fixture-manifest.json @@ -31,25 +31,25 @@ "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": "512a9f6ee04a8a27e9164c46e0ef799ce4e0cb90f7729699def1175a485449c9", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c", "teaql/checker-model.json": "92144f0d6092e143784685a82a9dd67c1672665bbe50fa6ca57b9ad441325b45", - "teaql/model-provenance.json": "28f5192a1ab491de2a8c9708b9aa95555c6fae2c113b0839c985512c2f17c7ac" + "teaql/model-provenance.json": "0bff6edd658290902abc7b5222bd00c580955ac31540c3633f9e97dc15bf348d" }, - "generatedManifestSha256": "29477059729167675daccc9f6827a122982334469dde30dab6c8e4f9bdb19e53", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/fix-e-alignment/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "c0d5f34487792b9563b36fa07ea8486e112d50bea575c501ec065a57fcaa513a", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "language": "java", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "previousFixtureManifestSha256": "08842964a952ce9f96b94897793f3e9cc9d8f0f73e477b76eebd41a2831af0c0", + "previousFixtureManifestSha256": "b81749f3534113d4b2183ba2ce5d263fe2c78b6458d6034b04c724e9a8a3f3bb", "previousOrigin": { - "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", + "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", "path": "examples/fix-e-alignment/fixture-manifest.json" }, - "producerReceiptSha256": "924394d26c34ceabf248701287ade25fc0e8938b13dc300a4c2c677c859440a6", + "producerReceiptSha256": "ed771e8f7531ef68768238c3d3eafcadd361f680929fe23d89edd7107f81ab06", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" }, "schema": "teaql.generated-example-fixture/v1" } diff --git a/examples/fix-e-alignment/generated/teaql/model-provenance.json b/examples/fix-e-alignment/generated/teaql/model-provenance.json index b26a72701..2d054463c 100644 --- a/examples/fix-e-alignment/generated/teaql/model-provenance.json +++ b/examples/fix-e-alignment/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/generator-v420.json b/examples/generator-v420.json index b5269f66b..adebda8cb 100644 --- a/examples/generator-v420.json +++ b/examples/generator-v420.json @@ -2,15 +2,15 @@ "generator": { "artifactKind": "new source build; not the historical v4.2.0 release artifact", "baseRelease": "v4.2.0", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "qualificationReceiptSHA256": "e401e5436216b87140101f7e4f29cec3e620fa852637de397f74cd7a3b9a8cf9", - "sourceCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "tag": "unreleased-source-42275522" + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "qualificationReceiptSHA256": "d2ef37d0536f6d5be84baab53eb21ad8c771bee88aefe97a7c591d146cdfee44", + "sourceCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "tag": "unreleased-source-19feda8a" }, - "installationReceiptSHA256": "e626eb16b0afc8ee44b8c53ec5816bfdf639f0f55f01c278493b0f65f404988c", + "installationReceiptSHA256": "dfc1dcf93709c84d1b1ba1abd44b62ed2978c7a3e72eba274deeba9493908ef9", "libraries": [ { - "archiveSHA256": "2c0d02ef8740a6250bd9b8d8340ba0ff049b6a6885296e6cc1b4b06670a9605d", + "archiveSHA256": "7323718a5d03aa1d06786d9fd095f4a77f598d761679d552383dfbe2882195d2", "destination": "examples/conformance", "generatedFiles": { "examples/conformance/lib/pom.xml": { @@ -107,7 +107,7 @@ }, "examples/conformance/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "6ed407a489b2240668b508c1c06c416a86f5f329df9a8c7f010859e81d9b4a89" + "sha256": "d8e26b3805fe217d2770df366084f18f64e51b358d918488116c5d84a499e299" } }, "model": "examples/conformance/model.xml", @@ -115,23 +115,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "b2a1d96d6fb84e757767aa6b50246952d655d7684456a7edd0ee348262fdbe35", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "b8f0f4f99cf7a000e50939623c1f6c03b44af284d9eb46db11ac6cb082420d1e", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "0a59f66db2487fdd0430087dd5985ae780225c088ad800679cb57c593c6bcee7", - "producerReceiptSha256": "a85a7972a12856d38f5a4739c8c10b0b5172d1c0dcad2481ec9a463f6d28de8f", + "producerReceiptSha256": "e42e9513cc7db0b3b1d7ffda4e2843787a2a70d806ffb9be544add142b34a28f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "48785cfc5cddad3f5119cb33fa29ef687c75cb9b94043722e506784dc3e9fae8", + "archiveSHA256": "91329074012d2ffa2a9542d717048b4d615b41562218ed700615680688d37f81", "destination": "examples/conformance/natural-messages/automatic-fixture", "generatedFiles": { "examples/conformance/natural-messages/automatic-fixture/lib/pom.xml": { @@ -228,7 +228,7 @@ }, "examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "b7258ff8e69db00a0119d03e41358d272756522caa89f8701ffc5744fae2a6fe" + "sha256": "fb712caf023900f433faf280e9f8db87ff563d8cf1bceb30d121dce9a6cf8343" } }, "model": "examples/conformance/natural-messages/model.xml", @@ -236,23 +236,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "14c13978a96d31521425bcee1c17df420fa23bb553cfda5fa865d365df53f380", + "archiveSHA256": "6aa2219a498db1b6b0760904591e81fc3fbfcb3a8079dc55d68de55964cb0ec4", "destination": "examples/fix-e-alignment/generated", "generatedFiles": { "examples/fix-e-alignment/generated/lib/pom.xml": { @@ -369,7 +369,7 @@ }, "examples/fix-e-alignment/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "28f5192a1ab491de2a8c9708b9aa95555c6fae2c113b0839c985512c2f17c7ac" + "sha256": "0bff6edd658290902abc7b5222bd00c580955ac31540c3633f9e97dc15bf348d" } }, "model": "examples/fix-e-alignment/model.xml", @@ -377,23 +377,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 4, - "generatedManifestSha256": "29477059729167675daccc9f6827a122982334469dde30dab6c8e4f9bdb19e53", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/fix-e-alignment/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "c0d5f34487792b9563b36fa07ea8486e112d50bea575c501ec065a57fcaa513a", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "producerReceiptSha256": "924394d26c34ceabf248701287ade25fc0e8938b13dc300a4c2c677c859440a6", + "producerReceiptSha256": "ed771e8f7531ef68768238c3d3eafcadd361f680929fe23d89edd7107f81ab06", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "db84849eba8d0cd0a97367210be7534dd8e8eeb187cc262845af84fcbd882f4e", + "archiveSHA256": "80c06f7f68ad51a5b2a61ad83cfb8bbe293010fde8f56a794cbab9d509bc9be2", "destination": "examples/inheritance-save", "generatedFiles": { "examples/inheritance-save/lib/pom.xml": { @@ -570,7 +570,7 @@ }, "examples/inheritance-save/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "e2f58206cb0708fbf7672c98dbbd1c849b98ec94b5ba79aa9e8f79f2c78b1be2" + "sha256": "26ae33a4425645f3125932fa4bd727768cba382c7184846f1b1c14db20e7f771" } }, "model": "examples/inheritance-save/model.xml", @@ -578,23 +578,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 1, - "generatedManifestSha256": "1b4da99b919b5f2d0ad9c97f1c4204a74475d860fbfb5cc7ed106a13653ce76d", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/inheritance-save/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "fbcbf547348c11d2eb830cef043d4f93e6577b2ce93ef92c602824a248b1c75a", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/inheritance-save/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "9ed75f14ac524f18ccaba59be8c7261da203d2472bbe5d1f88dfc16d8b203d01", - "producerReceiptSha256": "42ecd382b5350e90b6257b9a7424e0306d42d55c408bfcb56be923ce9cf0c2de", + "producerReceiptSha256": "7fb45ac05a05048cc42157f773a84fd2381531b57241f0a9ca98add6846cca78", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "02a67604db66724d9c401ca1bcf4c3c2624820402c4d3fb6037bb1fb79c57e5f", + "archiveSHA256": "454a6c5e001f6a9f9e7f1bf472ce0944a05a910c38001affb3d1696440eeccfa", "destination": "examples/scalar-type-probe/json-profiles/PascalCase", "generatedFiles": { "examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml": { @@ -691,7 +691,7 @@ }, "examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "cbbab272d18a50f80c4368222f1645c6104e44108eb17d7be7e0fb44fcd63739" + "sha256": "7372010327b04cdfb387dcaf812446c65ab4754df2fcd3af901468fde63f10c0" } }, "model": "examples/scalar-type-probe/json-profiles/PascalCase/model.xml", @@ -699,23 +699,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "40c5b31b553fe5aa6f76d54153ed218d09af5a4108dad6ac3f61e74c92c36b08", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "f0afa88b5914aee732e42d846ae1b57838ed501b9fd1b08270087d2a58eb85c0", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", - "producerReceiptSha256": "7b30cb89b6937462fc34d3ef6e1a4eac4259447757d996be1afc91cba0d6f8b1", + "producerReceiptSha256": "b0da8e9fc5b83d7b3f8cc2e522de4827acb569ee88800773d55ba5402f38c80f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "e93ecf7a09625252b13757ca2cea370531f5117f986d27a35be19ecf77f51ac3", + "archiveSHA256": "5a1a4a8312eff631bac9394e81eaf97371cc7775f5fa32441fc2564b71dbef01", "destination": "examples/scalar-type-probe/json-profiles/camelCase", "generatedFiles": { "examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml": { @@ -812,7 +812,7 @@ }, "examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d" + "sha256": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc" } }, "model": "examples/scalar-type-probe/json-profiles/camelCase/model.xml", @@ -820,23 +820,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "15544db70d8dd7a1eb94f4fa21e0904095301fd06808037eba00c03b2ea2f1d7", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "1bfd037aeb9adfac3757b8358e1d68eedc43fc2da0a6ffa593f596b08ecb572b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "producerReceiptSha256": "f8c4737dd76517191020e79291b7239e5257be8454818aa11851ae100bd4ea2d", + "producerReceiptSha256": "0f3eb852da3a1a7c904b42b4fa77e453961b7da00fe2a9fa4169882194e7cd57", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "6325282ab5f7230823af2422e76a2c1b812bb32a52b0d8a06762056fa91c10b7", + "archiveSHA256": "fced0aba7fdb2655f0f3cdc49574bca43e7dccafe40f4315b23ed603d63a4518", "destination": "examples/scalar-type-probe/json-profiles/snake_case", "generatedFiles": { "examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml": { @@ -933,7 +933,7 @@ }, "examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "a83eba55390c39bdfe6466aa15467adad758c1aa30234f802d3329598bf4f03b" + "sha256": "1d31ade4f5f7f53e0af9398127b568be3615f52977bbf924f0acda23f9299747" } }, "model": "examples/scalar-type-probe/json-profiles/snake_case/model.xml", @@ -941,23 +941,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "94ee8f28f46b9f2a7dca317147a83ed8969ad877c97108bc96e3a512f1ecba19", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "ac95fff2e3ba03cfda30a732966ac0d50c0e4f869a2ebb1efd10c1ed0b094e5b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "producerReceiptSha256": "0567afbf94076fb396188604f6cd74585398007e208e9c1c5d6c8653f5c2b40d", + "producerReceiptSha256": "d1f5044db3215923a43a2719ac367d0cbf03d688cdd145d68545a8a8af93561f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "e93ecf7a09625252b13757ca2cea370531f5117f986d27a35be19ecf77f51ac3", + "archiveSHA256": "5a1a4a8312eff631bac9394e81eaf97371cc7775f5fa32441fc2564b71dbef01", "destination": "examples/scalar-type-probe/generated", "generatedFiles": { "examples/scalar-type-probe/generated/lib/pom.xml": { @@ -1054,7 +1054,7 @@ }, "examples/scalar-type-probe/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d" + "sha256": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc" } }, "model": "examples/scalar-type-probe/model.xml", @@ -1062,23 +1062,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "15544db70d8dd7a1eb94f4fa21e0904095301fd06808037eba00c03b2ea2f1d7", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "1bfd037aeb9adfac3757b8358e1d68eedc43fc2da0a6ffa593f596b08ecb572b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "06fa9dac09a1046e0e806c05bc579305c2af1ce79f70d36bf150e0b57e76533f", + "archiveSHA256": "09df20e2de0a5c045346dc346aae41560bc0f937e61ff4432206a17bc26a1de2", "destination": "examples/school-management", "generatedFiles": { "examples/school-management/lib/pom.xml": { @@ -1195,7 +1195,7 @@ }, "examples/school-management/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "fabf54fdec2266a50b5d626f02c1d0ee6c7504c1b669598c15f723337a6fb7d2" + "sha256": "d74ee1c7e93db13222a84a3be79a99b1276b36ea7f5b030917fa8c0eaa27314a" } }, "model": "examples/school-management/models/school-model.xml", @@ -1203,23 +1203,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "1d99cfd9dee2db6b33879aa76926486948debf0d4bb8731f84c4447a183e2f42", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/school-management/models/school-model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "f0b0450e713aedce7f32c5911c4ec2b0ec1ebebf73d4fe8e082dc2e9112e5349", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/school-management/models/school-model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "b5cd06ae44464fc29ed24de82654b47c80f546110496756aa15923cee1c511b4", - "producerReceiptSha256": "ae0058e2d8f481784b0c3caa0f648bb7406b03a305e81dce8bf631b22df3cfff", + "producerReceiptSha256": "014bf9e64d28d33afa3d2df5e2cf76a043aaccb3059de5237bb0e332863d1a7f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "b73fc4ac4c7141b54c058f4da25dc345a4e4d61c7c8540f41d2e1ddd0ea6e6bf", + "archiveSHA256": "c51fce823ff82af04338874daebf4b5b14b3d3075389c27cd760751e19817580", "destination": "examples/standard-order/generated", "generatedFiles": { "examples/standard-order/generated/lib/pom.xml": { @@ -1376,7 +1376,7 @@ }, "examples/standard-order/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "562f70fc1f497618d085ebceb2f6d079436d2e5776ea48d6b57977508a93c029" + "sha256": "c9b75c084d960430da627d60698516b8a5af0dee85f33319df7a76403657a4dd" } }, "model": "examples/standard-order/models/model.xml", @@ -1384,23 +1384,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "479f5c3671f11621d357a8b0cb3d0b8f402411a1fadab03d170663bee0062e94", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/standard-order/models/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "ad94261aa2c7a8bfd054a992b6974714dae606ccacbf23dcc0e986870193085c", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/standard-order/models/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "455a5b60e571859a68586678da4bd8c9f13120132dc7ecf95f0554d98af6d674", - "producerReceiptSha256": "5726d2778a6a7e11b4f4341d6cc672cf39fc95b3c8be066ac11a9af7d6d94b08", + "producerReceiptSha256": "38f71df2428edc3a4748a6648f4b4b881d7684d5987b57b09153cd60c53a3687", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "2c77b2bbc9875b334596738a515adcf695c2cc88fc56540ff61e8707920edfa8", + "archiveSHA256": "4b62b8b18bec01f3a95aaec3c987c21ab8211288d1989d92dd706857c8c6d5f1", "destination": "examples/trace-chain", "generatedFiles": { "examples/trace-chain/lib/pom.xml": { @@ -1577,7 +1577,7 @@ }, "examples/trace-chain/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "1716a8cf763ca82ed6ee28c3a780b9e4172bbe5dfdfc5d17f5f0028c655a6f55" + "sha256": "90311071c90e39a1d7849b5828fa3e05e138bf41f8ba73a082af73f5af3bf2a0" } }, "model": "examples/trace-chain/model.xml", @@ -1585,23 +1585,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "30caddc81917445af76dadfd0db429997bd28135307102ef33157799298c61a2", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/trace-chain/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "dda3d4bf14f4d88c30cdbe36f1b1e058ceffeffa8e5bc946273ef06fbdac8ee5", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/trace-chain/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "c9743d776718c7b27c97792f75f492fdc99bf427e4bd0c24bf3492de6520c9a2", - "producerReceiptSha256": "e8bdf79a95f262305c9896e4307f8c9caade164bc90ef08898c8c7e1382523c6", + "producerReceiptSha256": "59aae0603ae5fcea46c1f7ed9fd9551266dcf3a83d49083add1e60c271ef05c4", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "3ce74ef96d6b8fc82755c1a29a5ada2785fbdc88175a99e5317f59781b3a3fbd", + "archiveSHA256": "624d6e82fb6d5b1a75d668205cfca0a853259ecd485b42ded656a040fb844dbe", "destination": "examples/order-management/java-lib-core", "generatedFiles": { "examples/order-management/java-lib-core/lib/pom.xml": { @@ -1798,7 +1798,7 @@ }, "examples/order-management/java-lib-core/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "d304952c86fa19e10041d50a2c9bfeb24a69ec48246d34ee9b74f2afd4a1b963" + "sha256": "1900da5e65204484cd23b83b335c2c82f055fa300b2e2c2d8b5c69386353e6dc" } }, "model": "examples/order-management/model.xml", @@ -1806,23 +1806,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 8, - "generatedManifestSha256": "bbc2f521b14f8809bd3ba78447493faf045421f67a226a315d933503aedbc5b9", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/order-management/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "6c8248a831abbccb5698f5f1465b996c7166db1b365b3bf036b9a1ef482db394", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/order-management/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "8b11ee844c2be184e194d8116994fb5fe95299dd593bfed83ec06d71ada0411d", - "producerReceiptSha256": "63c340240218ac2ab7af9e147196749137f52e73771eefabe0b4e525f2a66083", + "producerReceiptSha256": "3ffa13654bcc15bec9be942ccf059afc927d5a0d07fa830d2d78c33ee698e826", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } }, "preservedApplicationFiles": {} } ], - "runtimeBaseCommit": "a8be22cc301ce16ce007f4e01161ab19ec322165", + "runtimeBaseCommit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", "schema": "teaql.runtime-current-generated-examples/v1", "sourceCodeHandEdited": false } diff --git a/examples/inheritance-save/generated-files.json b/examples/inheritance-save/generated-files.json index 8d3859252..1c85dde2f 100644 --- a/examples/inheritance-save/generated-files.json +++ b/examples/inheritance-save/generated-files.json @@ -42,5 +42,5 @@ "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java": "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7", "teaql/checker-model.json": "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242", - "teaql/model-provenance.json": "e2f58206cb0708fbf7672c98dbbd1c849b98ec94b5ba79aa9e8f79f2c78b1be2" + "teaql/model-provenance.json": "26ae33a4425645f3125932fa4bd727768cba382c7184846f1b1c14db20e7f771" } diff --git a/examples/inheritance-save/generation-origin.json b/examples/inheritance-save/generation-origin.json index ca32c1a6a..55feb3fbb 100644 --- a/examples/inheritance-save/generation-origin.json +++ b/examples/inheritance-save/generation-origin.json @@ -4,18 +4,19 @@ "generator": { "artifactKind": "new source build; not the historical v4.2.0 release artifact", "baseRelease": "v4.2.0", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "qualificationReceiptSHA256": "e401e5436216b87140101f7e4f29cec3e620fa852637de397f74cd7a3b9a8cf9", - "sourceCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "tag": "unreleased-source-42275522" + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "qualificationReceiptSHA256": "d2ef37d0536f6d5be84baab53eb21ad8c771bee88aefe97a7c591d146cdfee44", + "sourceCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "tag": "unreleased-source-19feda8a" }, + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", "note": "Exact output from the qualified unreleased generator source candidate. Local runtime source acceptance is recorded separately; this is not a public generator release claim.", "previousOrigin": { - "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", + "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", "path": "examples/inheritance-save/generation-origin.json", - "sha256": "650a3b02c5d67a14bf3d2f38d1f8fafe7161985822fc8256affd84c6add3e288" + "sha256": "a6c46aad29d3c992ab40327adc1b604efde8eabdbf30904858ae3febf6b99bf3" }, "schema": "teaql.generated-java-inheritance-example/v1", - "sourceReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/inheritance-save/model/receipt.json", - "sourceReceiptSha256": "42ecd382b5350e90b6257b9a7424e0306d42d55c408bfcb56be923ce9cf0c2de" + "sourceReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/inheritance-save/model/receipt.json", + "sourceReceiptSha256": "7fb45ac05a05048cc42157f773a84fd2381531b57241f0a9ca98add6846cca78" } diff --git a/examples/inheritance-save/teaql/model-provenance.json b/examples/inheritance-save/teaql/model-provenance.json index f9a936577..c2337c307 100644 --- a/examples/inheritance-save/teaql/model-provenance.json +++ b/examples/inheritance-save/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java b/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java index 7068907b1..589301f3d 100644 --- a/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java +++ b/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderManagementApp.java @@ -7,6 +7,7 @@ import com.teaql.ordermanagementservice.customerorder.CustomerOrder; import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; import io.teaql.core.DataServiceExecutor; +import io.teaql.core.Entity; import io.teaql.core.InternalIdGenerationService; import io.teaql.core.MutationPolicyApproval; import io.teaql.core.SmartList; @@ -108,7 +109,12 @@ public static void main(String[] args) throws Exception { private static UserContext context(DataServiceExecutor executor) { SimpleEntityMetaFactory metadata = new SimpleEntityMetaFactory(); AtomicLong ids = new AtomicLong(1000); - InternalIdGenerationService idGeneration = (context, entity) -> ids.getAndIncrement(); + InternalIdGenerationService idGeneration = new InternalIdGenerationService() { + public Long generateId(UserContext context, Entity entity) { return ids.getAndIncrement(); } + public void ensureFloor(String typeName, long floor) { + ids.accumulateAndGet(Math.addExact(floor, 1), Math::max); + } + }; OrderMutationPolicy orderPolicy = new OrderMutationPolicy(); TeaQLRuntime runtime = TeaQLRuntime.builder().metadata(metadata) .dataService("default", executor).dataService("sqlite", executor) diff --git a/examples/order-management/java-lib-core/teaql/model-provenance.json b/examples/order-management/java-lib-core/teaql/model-provenance.json index 539549530..4b4bd510d 100644 --- a/examples/order-management/java-lib-core/teaql/model-provenance.json +++ b/examples/order-management/java-lib-core/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/scalar-type-probe/fixture-manifest.json b/examples/scalar-type-probe/fixture-manifest.json index bb2e00e39..6a05c4874 100644 --- a/examples/scalar-type-probe/fixture-manifest.json +++ b/examples/scalar-type-probe/fixture-manifest.json @@ -26,24 +26,24 @@ "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "teaql/model-provenance.json": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d" + "teaql/model-provenance.json": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc" }, - "generatedManifestSha256": "15544db70d8dd7a1eb94f4fa21e0904095301fd06808037eba00c03b2ea2f1d7", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "1bfd037aeb9adfac3757b8358e1d68eedc43fc2da0a6ffa593f596b08ecb572b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "language": "java", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "previousFixtureManifestSha256": "9b1287687b9ff2832e4a3b8e8ec3caeffcedf8e6fd3935a7f0d8db108bfae2e0", + "previousFixtureManifestSha256": "7ed0ed858b49c47263ed6e3a0b7f62099b850fd8318acc75db4dcc553ed72ab6", "previousOrigin": { - "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", + "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", "path": "examples/scalar-type-probe/fixture-manifest.json" }, "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } } diff --git a/examples/scalar-type-probe/generated/teaql/model-provenance.json b/examples/scalar-type-probe/generated/teaql/model-provenance.json index 6a5a71beb..ad1dc5edd 100644 --- a/examples/scalar-type-probe/generated/teaql/model-provenance.json +++ b/examples/scalar-type-probe/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json index 5fa91d45b..e3eb6677e 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json index 6a5a71beb..ad1dc5edd 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/provenance.json b/examples/scalar-type-probe/json-profiles/provenance.json index 88b00539a..6d275c7e5 100644 --- a/examples/scalar-type-probe/json-profiles/provenance.json +++ b/examples/scalar-type-probe/json-profiles/provenance.json @@ -27,7 +27,7 @@ "PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "PascalCase/model.xml": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", "PascalCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "PascalCase/teaql/model-provenance.json": "cbbab272d18a50f80c4368222f1645c6104e44108eb17d7be7e0fb44fcd63739", + "PascalCase/teaql/model-provenance.json": "7372010327b04cdfb387dcaf812446c65ab4754df2fcd3af901468fde63f10c0", "base-model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "camelCase/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", @@ -53,7 +53,7 @@ "camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "camelCase/model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "camelCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "camelCase/teaql/model-provenance.json": "f826de0d805ff6c67ef4baea267b586655ba49dbb154079490ab4844e029243d", + "camelCase/teaql/model-provenance.json": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc", "manifest.json": "519dfe321218a4248a9da550b22d35e3507a0408eb8e60fad1bc009a058afa6d", "snake_case/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", @@ -79,23 +79,23 @@ "snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "snake_case/model.xml": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", "snake_case/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "snake_case/teaql/model-provenance.json": "a83eba55390c39bdfe6466aa15467adad758c1aa30234f802d3329598bf4f03b" + "snake_case/teaql/model-provenance.json": "1d31ade4f5f7f53e0af9398127b568be3615f52977bbf924f0acda23f9299747" }, - "generatedManifestSha256": "94ee8f28f46b9f2a7dca317147a83ed8969ad877c97108bc96e3a512f1ecba19", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatedManifestSha256": "ac95fff2e3ba03cfda30a732966ac0d50c0e4f869a2ebb1efd10c1ed0b094e5b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "previousFixtureManifestSha256": "86a8ff2f2a9a749c8bb84805f3e1c85a9b0972bf7701408fb620fb71b6e04889", + "previousFixtureManifestSha256": "6a91153640cee2d469db02db3582d33589081c16999befe9bd0c6274c2a5a1d5", "previousOrigin": { - "commit": "a8be22cc301ce16ce007f4e01161ab19ec322165", + "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", "path": "examples/scalar-type-probe/json-profiles/provenance.json" }, - "producerReceiptSha256": "0567afbf94076fb396188604f6cd74585398007e208e9c1c5d6c8653f5c2b40d", + "producerReceiptSha256": "d1f5044db3215923a43a2719ac367d0cbf03d688cdd145d68545a8a8af93561f", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" } } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json index f126af7a8..bedd59b38 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/school-management/teaql/model-provenance.json b/examples/school-management/teaql/model-provenance.json index c60905cae..62a49b5f9 100644 --- a/examples/school-management/teaql/model-provenance.json +++ b/examples/school-management/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/standard-order/generated/teaql/model-provenance.json b/examples/standard-order/generated/teaql/model-provenance.json index 2873b32ed..52c58844d 100644 --- a/examples/standard-order/generated/teaql/model-provenance.json +++ b/examples/standard-order/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"19feda8a"} \ No newline at end of file diff --git a/examples/trace-chain/teaql/model-provenance.json b/examples/trace-chain/teaql/model-provenance.json index ac84b6bd6..ea351296c 100644 --- a/examples/trace-chain/teaql/model-provenance.json +++ b/examples/trace-chain/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"42275522"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"19feda8a"} \ No newline at end of file From d905464d447e7fdd8b68faaf5f0f96ca91b873fd Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 17:54:38 +0800 Subject: [PATCH 08/71] Review the canonical total_amount mutation field in the order policy --- .../src/main/java/com/teaql/example/OrderMutationPolicy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderMutationPolicy.java b/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderMutationPolicy.java index d2d3ff1e9..0f972501d 100644 --- a/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderMutationPolicy.java +++ b/examples/order-management/java-app-console/src/main/java/com/teaql/example/OrderMutationPolicy.java @@ -26,7 +26,7 @@ public MutationDecision review(UserContext context, MutationPlan plan) { boolean containsHighValueOrder = plan.operations().stream() .filter(operation -> operation.kind() == MutationOperationKind.CREATE || operation.kind() == MutationOperationKind.UPDATE) - .map(operation -> operation.changedValues().get("totalAmount")) + .map(operation -> operation.changedValues().get("total_amount")) .filter(BigDecimal.class::isInstance) .map(BigDecimal.class::cast) .anyMatch(amount -> amount.compareTo(HIGH_VALUE_THRESHOLD) > 0); @@ -43,6 +43,6 @@ public MutationDecision review(UserContext context, MutationPlan plan) { return MutationDecision.deny( "ORDER-HIGH-VALUE-AUTHORITY-REQUIRED", "Orders above 10000.00 require the high-value order authority", - List.of("totalAmount")); + List.of("total_amount")); } } From da34cfe478db9ae8334ffa385b396ee786464ca0 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 18:13:37 +0800 Subject: [PATCH 09/71] Verify canonical KSML relation names in trace and aggregation metadata --- .../GeneratedAggregateTraceExampleTest.java | 24 +++++++++---------- .../GeneratedFacetTraceExampleTest.java | 8 +++---- ...GeneratedReverseFacetTraceExampleTest.java | 4 ++-- .../GeneratedTraceChainExampleTest.java | 12 +++++----- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java index 428d4163a..b366ad0b2 100644 --- a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java +++ b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java @@ -32,7 +32,7 @@ public class GeneratedAggregateTraceExampleTest { var count = Q.orderItems().withNameIs(PRIVATE).limit(10); // Public BaseRequest contract, exercised by DerivedQueryTraceSqliteTest. // Partition by the real forward model edge; runtime resolves the reverse edge. - count.setPartitionProperty("customerOrder"); count.count("count"); + count.setPartitionProperty("customer_order"); count.count("count"); var owner = Q.customerOrders().withIdIs(graph.order().getId()).limit(1); owner.addSingleAggregateDynamicProperty("selectedItemCount", count); CustomerOrder result = nested @@ -43,9 +43,9 @@ public class GeneratedAggregateTraceExampleTest { assertEquals(graph.order().getId(), E.customerOrder(result).getId().eval()); assertEquals("related aggregate must retain its actual scoped count", 1, ((Number) result.getDynamicProperty("selectedItemCount")).intValue()); - var routes = nested ? List.of(List.of(), List.of("customerOrder"), - List.of("customerOrder", "orderItemList")) - : List.of(List.of(), List.of("orderItemList")); + var routes = nested ? List.of(List.of(), List.of("customer_order"), + List.of("customer_order", "order_item_list")) + : List.of(List.of(), List.of("order_item_list")); var raw = assertFacts(fixture, nested ? "Payment" : "CustomerOrder", routes, COMMENT, PURPOSE, "inspect [REDACTED]", logging); assertEquals(1, raw.stream().filter(f -> f.getParameterizedQuery().toUpperCase(java.util.Locale.ROOT).contains("COUNT(")).count()); @@ -65,7 +65,7 @@ public class GeneratedAggregateTraceExampleTest { .executeForOne(fixture.context)).getCustomerOrder().eval() : numericOwner.comment(COMMENT).purpose("numeric partition has no edge").executeForOne(fixture.context); assertEquals(1, ((Number) numeric.getDynamicProperty("selfCount")).intValue()); - var numericRoutes = nested ? List.of(List.of(), List.of("customerOrder"), List.of("customerOrder")) + var numericRoutes = nested ? List.of(List.of(), List.of("customer_order"), List.of("customer_order")) : List.of(List.of(), List.of()); var numericRaw = assertFacts(fixture, nested ? "Payment" : "CustomerOrder", numericRoutes, COMMENT, "numeric partition has no edge", COMMENT, logging); @@ -87,7 +87,7 @@ public class GeneratedAggregateTraceExampleTest { graph.order().auditAs("seed independently scoped aggregate members").save(fixture.context); fixture.clear(); fixture.queryResults.clear(); var count = Q.orderItems().withNameIs(PRIVATE).limit(10); - count.setPartitionProperty("customerOrder"); count.count("count"); + count.setPartitionProperty("customer_order"); count.count("count"); var detail = Q.customerOrders().withIdIs(filtered ? -1L : graph.order().getId()).limit(1); var owner = Q.customerOrders().withIdIs(graph.order().getId()).limit(1) .selectOrderItemListWith(Q.orderItems().orderByIdAscending().limit(10) @@ -109,10 +109,10 @@ public class GeneratedAggregateTraceExampleTest { () -> E.customerOrder(identity).getDescription().eval()); else assertEquals(graph.order().getDescription(), E.customerOrder(identity).getDescription().eval()); } - var routes = nested ? List.of(List.of(), List.of("customerOrder"), - List.of("customerOrder", "orderItemList"), List.of("customerOrder", "orderItemList", "customerOrder"), - List.of("customerOrder", "orderItemList")) - : List.of(List.of(), List.of("orderItemList"), List.of("orderItemList", "customerOrder"), List.of("orderItemList")); + var routes = nested ? List.of(List.of(), List.of("customer_order"), + List.of("customer_order", "order_item_list"), List.of("customer_order", "order_item_list", "customer_order"), + List.of("customer_order", "order_item_list")) + : List.of(List.of(), List.of("order_item_list"), List.of("order_item_list", "customer_order"), List.of("order_item_list")); var raw = assertFacts(fixture, nested ? "Payment" : "CustomerOrder", routes, COMMENT, PURPOSE, "inspect [REDACTED]", logging); emit("JAVA_AGGREGATE_MEMBERSHIP", Map.of("nested", nested, "logging", logging, @@ -127,7 +127,7 @@ public class GeneratedAggregateTraceExampleTest { assertEquals(graph.order().getDescription(), E.customerOrder(E.orderItem(full).getCustomerOrder().eval()).getDescription().eval()); for (var item : items) assertThrows(io.teaql.core.value.TeaQLNotLoadedException.class, () -> E.customerOrder(E.orderItem(item).getCustomerOrder().eval()).getDescription().eval()); - var visibleRaw = assertFacts(fixture, "OrderItem", List.of(List.of(), List.of("customerOrder")), + var visibleRaw = assertFacts(fixture, "OrderItem", List.of(List.of(), List.of("customer_order")), "independent full detail", "verify edge-owned view", "independent full detail", logging); emit("JAVA_AGGREGATE_FORWARD", Map.of("nested", nested, "logging", logging, "originalDetailsStillNotLoaded", true, "fullDetailIndependent", true, "raw", observations(visibleRaw))); @@ -145,7 +145,7 @@ private static List assertFacts(GeneratedTraceChainExampleTes String parent = root; for (String relation : routes.get(i)) { expected.add(new TraceNode(TraceKind.RELATION, relation, null, parent + "." + relation)); - parent = relation.equals("orderItemList") ? "OrderItem" : "CustomerOrder"; + parent = relation.equals("order_item_list") ? "OrderItem" : "CustomerOrder"; } expected.add(new TraceNode(TraceKind.PROVIDER, "sqlite", null, "")); expected.add(new TraceNode(TraceKind.SQL, "select", null, "")); diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java index 141670c95..0fb51adff 100644 --- a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java +++ b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java @@ -54,8 +54,8 @@ public class GeneratedFacetTraceExampleTest { } var raw = fixture.queryResults.get(fixture.queryResults.size() - 1).statements(); var routes = List.of(List.of(), List.of("payment"), List.of("payment"), - List.of("payment", "customerOrder"), List.of("payment"), List.of("payment"), - List.of("payment", "customerOrder")); + List.of("payment", "customer_order"), List.of("payment"), List.of("payment"), + List.of("payment", "customer_order")); assertEquals(routes.size(), raw.size()); for (int i = 0; i < raw.size(); i++) assertPath(raw.get(i), routes.get(i), comment, purpose); assertEquals(logging ? raw.size() : 0, fixture.sql.size()); @@ -106,7 +106,7 @@ public class GeneratedFacetTraceExampleTest { E.customerOrder(E.payment(payment).getCustomerOrder().eval()).getId().eval()); var raw = fixture.queryResults.get(fixture.queryResults.size() - 1).statements(); var routes = List.of(List.of(), List.of("payment"), List.of("payment"), - List.of("payment", "customerOrder")); + List.of("payment", "customer_order")); assertEquals(routes.size(), raw.size()); for (int i = 0; i < raw.size(); i++) assertPath(raw.get(i), routes.get(i), comment, purpose); assertEquals(logging ? raw.size() : 0, fixture.sql.size()); @@ -170,7 +170,7 @@ public class GeneratedFacetTraceExampleTest { // two physical SELECTs for the inlined predicate. var routes = List.of(List.of(), List.of(), List.of("payment"), List.of("payment"), - List.of("payment", "customerOrder")); + List.of("payment", "customer_order")); for (int i : List.of(0, 1)) { assertTrue("membership stays in the real statement", raw.get(i).getParameterizedQuery().contains("payment IN (SELECT id FROM payment_data")); diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java index 1bf495d79..ecdb2049b 100644 --- a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java +++ b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java @@ -64,8 +64,8 @@ public class GeneratedReverseFacetTraceExampleTest { var expected = new ArrayList<>(List.of( new TraceNode(TraceKind.OPERATION, "CustomerOrder", null, "query"), new TraceNode(TraceKind.REQUEST, "CustomerOrder", null, ""))); - if (i > 0) expected.add(new TraceNode(TraceKind.RELATION, "paymentList", null, "CustomerOrder.paymentList")); - if (i > 0 && i % 3 == 0) expected.add(new TraceNode(TraceKind.RELATION, "customerOrder", null, "Payment.customerOrder")); + if (i > 0) expected.add(new TraceNode(TraceKind.RELATION, "payment_list", null, "CustomerOrder.payment_list")); + if (i > 0 && i % 3 == 0) expected.add(new TraceNode(TraceKind.RELATION, "customer_order", null, "Payment.customer_order")); expected.add(new TraceNode(TraceKind.PROVIDER, "sqlite", null, "")); expected.add(new TraceNode(TraceKind.SQL, "select", null, "")); assertFact(raw.get(i), expected, comment, purpose); diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java index 8aa8879f9..d70f3b673 100644 --- a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java +++ b/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java @@ -836,7 +836,7 @@ private static void assertCycleBoundaries(Fixture fixture, Graph graph, String o assertEquals("Trace Chain Verification", E.platform(platform).getName().eval()); var statements = fixture.sql.stream().filter(value -> value.getOperation() == DataServiceOperation.QUERY).toList(); assertEquals("one root query and three explicit relation queries", 4, statements.size()); - List names = List.of("payment", "customerOrder", "platform"); + List names = List.of("payment", "customer_order", "platform"); for (int depth = 0; depth < statements.size(); depth++) { var entry = statements.get(depth); assertEquals("what: load three levels of payment context", entry.getComment()); @@ -848,7 +848,7 @@ private static void assertCycleBoundaries(Fixture fixture, Graph graph, String o assertEquals("actual relation depth " + depth, names.subList(0, depth), relations); var details = entry.getTraceChain().stream().filter(node -> node.getKind() == TraceKind.RELATION) .map(TraceNode::getComment).toList(); - assertEquals(List.of("PaymentAttempt.payment", "Payment.customerOrder", "CustomerOrder.platform") + assertEquals(List.of("PaymentAttempt.payment", "Payment.customer_order", "CustomerOrder.platform") .subList(0, depth), details); var kinds = new ArrayList<>(List.of(TraceKind.OPERATION, TraceKind.REQUEST)); for (int relation = 0; relation < depth; relation++) kinds.add(TraceKind.RELATION); @@ -896,7 +896,7 @@ private static void assertFilteredForwardReference(Fixture fixture, Graph graph) assertEquals(graph.attempt.getId(), E.paymentAttempt(row).getId().eval()); var result = fixture.queryResults.get(fixture.queryResults.size() - 1); assertEquals(4, result.statements().size()); - var names = List.of("payment", "customerOrder", "platform"); + var names = List.of("payment", "customer_order", "platform"); for (int depth = 0; depth < 4; depth++) { var entry = result.statements().get(depth); assertEquals(comment, entry.getComment()); @@ -962,7 +962,7 @@ private static PaymentAttempt loadPaymentContext(Fixture fixture, Graph graph, S var entry = statements.get(depth); assertEquals(purpose, entry.getPurpose()); assertEquals("PaymentAttempt", entry.getTraceChain().get(0).getName()); - assertEquals(List.of("payment", "customerOrder", "platform").subList(0, depth), + assertEquals(List.of("payment", "customer_order", "platform").subList(0, depth), entry.getTraceChain().stream().filter(node -> node.getKind() == TraceKind.RELATION) .map(TraceNode::getName).toList()); } @@ -1064,7 +1064,7 @@ private static void assertQueryPaths(Fixture fixture, String comment, String pur assertEquals(graph.payment.getId(), E.payment(payment).getId().eval()); assertEquals(1, ((Number) payment.getDynamicProperty("count")).intValue()); assertQueryPaths(fixture, comment, purpose, List.of(List.of(), List.of(), - List.of("payment"), List.of("payment"), List.of("payment", "customerOrder"))); + List.of("payment"), List.of("payment"), List.of("payment", "customer_order"))); System.out.println("PASS Java generated nested facets: filtered counts and original root/relation SQL paths"); } @@ -1079,7 +1079,7 @@ private static void assertQueryPaths(Fixture fixture, String comment, String pur assertEquals(graph.attempt.getId(), E.paymentAttempt(row).getId().eval()); assertEquals(graph.payment.getId(), E.payment(E.paymentAttempt(row).getPayment().eval()).getId().eval()); assertQueryPaths(fixture, comment, purpose, List.of(List.of(), List.of("payment"), - List.of("payment"), List.of("payment", "customerOrder"))); + List.of("payment"), List.of("payment", "customer_order"))); System.out.println("PASS Java generated relation facet: original root and complete inherited SQL route"); } From ce0a5ec968f630c1209ab557dad80b1439288a5f Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 18:28:54 +0800 Subject: [PATCH 10/71] Generate current examples with the qualified stable-intent producer --- .../automatic-fixture/generated-files.json | 2 +- .../automatic-fixture/generation.json | 89 +++--- .../teaql/model-provenance.json | 2 +- .../conformance/teaql/model-provenance.json | 2 +- .../fix-e-alignment/fixture-manifest.json | 24 +- .../generated/teaql/model-provenance.json | 2 +- examples/generator-v420.json | 272 +++++++++--------- .../inheritance-save/generated-files.json | 2 +- .../inheritance-save/generation-origin.json | 18 +- .../teaql/model-provenance.json | 2 +- .../java-lib-core/teaql/model-provenance.json | 2 +- .../scalar-type-probe/fixture-manifest.json | 22 +- .../generated/teaql/model-provenance.json | 2 +- .../PascalCase/teaql/model-provenance.json | 2 +- .../camelCase/teaql/model-provenance.json | 2 +- .../json-profiles/provenance.json | 28 +- .../snake_case/teaql/model-provenance.json | 2 +- .../teaql/model-provenance.json | 2 +- .../generated/teaql/model-provenance.json | 2 +- .../trace-chain/teaql/model-provenance.json | 2 +- 20 files changed, 252 insertions(+), 229 deletions(-) diff --git a/examples/conformance/natural-messages/automatic-fixture/generated-files.json b/examples/conformance/natural-messages/automatic-fixture/generated-files.json index 60dc9f95d..3a277a622 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generated-files.json +++ b/examples/conformance/natural-messages/automatic-fixture/generated-files.json @@ -22,5 +22,5 @@ "lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "e7343d1366c418947fc058200104a8748265db5763f3861de9cda088cdb9dbce", "teaql/checker-model.json": "dbac03cd54b294e3e60a62752aeb170ad1ad722a7dfb8feb639c569ff3e73b1a", - "teaql/model-provenance.json": "fb712caf023900f433faf280e9f8db87ff563d8cf1bceb30d121dce9a6cf8343" + "teaql/model-provenance.json": "7a1c08d3bcc033947aa11600d1a18ea30f8fa7d31951680e81ed39eed4f9cece" } diff --git a/examples/conformance/natural-messages/automatic-fixture/generation.json b/examples/conformance/natural-messages/automatic-fixture/generation.json index 4c3a1b671..ea8c55b1d 100644 --- a/examples/conformance/natural-messages/automatic-fixture/generation.json +++ b/examples/conformance/natural-messages/automatic-fixture/generation.json @@ -2,56 +2,79 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", + "generatedManifestSha256": "c4c234c7fe34ac2eff76027240f192dab3362af6b6657a29ed1a233e7d74fe70", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/conformance/natural-messages/model/receipt.json", "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "implementationHandEdited": false, "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "previousGeneration": { "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", "implementationHandEdited": false, "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "previousGeneration": { "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", + "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", "implementationHandEdited": false, "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "previousGeneration": { - "fixtureOutputProperty": "teaql.java.natural.fixture.output", - "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", - "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", - "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", "implementationHandEdited": false, - "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "fixtureOutputProperty": "teaql.java.natural.fixture.output", + "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", + "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", + "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "implementationHandEdited": false, + "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core", + "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + }, + "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + }, "publicPublication": false, "runtimeDependency": "local repository source", "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core", - "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + "scope": "java-lib-core" }, - "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" }, "publicPublication": false, "runtimeDependency": "local repository source", @@ -60,9 +83,9 @@ }, "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" }, "publicPublication": false, "runtimeDependency": "local repository source", @@ -71,9 +94,9 @@ }, "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" }, "publicPublication": false, "runtimeDependency": "local repository source", diff --git a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json index 8cf3b9811..864e40a6e 100644 --- a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json +++ b/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/conformance/teaql/model-provenance.json b/examples/conformance/teaql/model-provenance.json index 994241e8b..8acaa38ad 100644 --- a/examples/conformance/teaql/model-provenance.json +++ b/examples/conformance/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/fix-e-alignment/fixture-manifest.json b/examples/fix-e-alignment/fixture-manifest.json index fdbd964fc..13c668d24 100644 --- a/examples/fix-e-alignment/fixture-manifest.json +++ b/examples/fix-e-alignment/fixture-manifest.json @@ -31,25 +31,25 @@ "lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java": "512a9f6ee04a8a27e9164c46e0ef799ce4e0cb90f7729699def1175a485449c9", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "82b9c9efe540331e915852a59470576d1b1ae7a11efcd6ee998bb3eee8e8838c", "teaql/checker-model.json": "92144f0d6092e143784685a82a9dd67c1672665bbe50fa6ca57b9ad441325b45", - "teaql/model-provenance.json": "0bff6edd658290902abc7b5222bd00c580955ac31540c3633f9e97dc15bf348d" + "teaql/model-provenance.json": "80eb2676b8ca3b65b6eb913b1eaf159e848cd1234f5158af95ef388d89ec0d40" }, - "generatedManifestSha256": "c0d5f34487792b9563b36fa07ea8486e112d50bea575c501ec065a57fcaa513a", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/fix-e-alignment/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "ea5da31929c18998e8eeec4b2abb3268a628f67935c38ac3dd141e05bf5f2f05", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "language": "java", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "previousFixtureManifestSha256": "b81749f3534113d4b2183ba2ce5d263fe2c78b6458d6034b04c724e9a8a3f3bb", + "previousFixtureManifestSha256": "5809307211b49138b8795b692bc251d73912662cb8cee5f38a9785f9d7ec1992", "previousOrigin": { - "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", + "commit": "da34cfe478db9ae8334ffa385b396ee786464ca0", "path": "examples/fix-e-alignment/fixture-manifest.json" }, - "producerReceiptSha256": "ed771e8f7531ef68768238c3d3eafcadd361f680929fe23d89edd7107f81ab06", + "producerReceiptSha256": "b674ff24ef4e83fc6ebdf7de11a7e3bbc79657e2e3e76be4f3b4a2675fa901ec", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" }, "schema": "teaql.generated-example-fixture/v1" } diff --git a/examples/fix-e-alignment/generated/teaql/model-provenance.json b/examples/fix-e-alignment/generated/teaql/model-provenance.json index 2d054463c..606dee431 100644 --- a/examples/fix-e-alignment/generated/teaql/model-provenance.json +++ b/examples/fix-e-alignment/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/generator-v420.json b/examples/generator-v420.json index adebda8cb..b5c75f808 100644 --- a/examples/generator-v420.json +++ b/examples/generator-v420.json @@ -2,15 +2,15 @@ "generator": { "artifactKind": "new source build; not the historical v4.2.0 release artifact", "baseRelease": "v4.2.0", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "qualificationReceiptSHA256": "d2ef37d0536f6d5be84baab53eb21ad8c771bee88aefe97a7c591d146cdfee44", - "sourceCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "tag": "unreleased-source-19feda8a" + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" }, - "installationReceiptSHA256": "dfc1dcf93709c84d1b1ba1abd44b62ed2978c7a3e72eba274deeba9493908ef9", + "installationReceiptSHA256": "f21153cb45c3168cdfd90e593790ffcae537458bc871b78cd3fdc6bc6fbc6d00", "libraries": [ { - "archiveSHA256": "7323718a5d03aa1d06786d9fd095f4a77f598d761679d552383dfbe2882195d2", + "archiveSHA256": "5652139e60f59c12374dad79ce15005206254c3bd07a650db2f49e3a24857cd4", "destination": "examples/conformance", "generatedFiles": { "examples/conformance/lib/pom.xml": { @@ -107,7 +107,7 @@ }, "examples/conformance/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "d8e26b3805fe217d2770df366084f18f64e51b358d918488116c5d84a499e299" + "sha256": "25c3c0f1f8b30ca2e94d36c7abdb4aa911bd735e0012ccfe1bb987a0882b9107" } }, "model": "examples/conformance/model.xml", @@ -115,23 +115,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "b8f0f4f99cf7a000e50939623c1f6c03b44af284d9eb46db11ac6cb082420d1e", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "77e4e26185f8bd2e7f9254222d1295df8cf5a59d5d7e847cba4abbc520e8c7e9", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/conformance/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "0a59f66db2487fdd0430087dd5985ae780225c088ad800679cb57c593c6bcee7", - "producerReceiptSha256": "e42e9513cc7db0b3b1d7ffda4e2843787a2a70d806ffb9be544add142b34a28f", + "producerReceiptSha256": "950b9b8c63f5491779402d655c4788f6edfe33a5f2e21ca7f9e8931c73d99687", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "91329074012d2ffa2a9542d717048b4d615b41562218ed700615680688d37f81", + "archiveSHA256": "70c856a2b5a4785b14f291db9360c6786171ff778468ffd9bf37664700683fa3", "destination": "examples/conformance/natural-messages/automatic-fixture", "generatedFiles": { "examples/conformance/natural-messages/automatic-fixture/lib/pom.xml": { @@ -228,7 +228,7 @@ }, "examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "fb712caf023900f433faf280e9f8db87ff563d8cf1bceb30d121dce9a6cf8343" + "sha256": "7a1c08d3bcc033947aa11600d1a18ea30f8fa7d31951680e81ed39eed4f9cece" } }, "model": "examples/conformance/natural-messages/model.xml", @@ -236,23 +236,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 2, - "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "c4c234c7fe34ac2eff76027240f192dab3362af6b6657a29ed1a233e7d74fe70", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/conformance/natural-messages/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "6aa2219a498db1b6b0760904591e81fc3fbfcb3a8079dc55d68de55964cb0ec4", + "archiveSHA256": "730e4313058c1e6ec9aa67ce28cec3db37bd1b807f380f3a445ba5de1b26d420", "destination": "examples/fix-e-alignment/generated", "generatedFiles": { "examples/fix-e-alignment/generated/lib/pom.xml": { @@ -369,7 +369,7 @@ }, "examples/fix-e-alignment/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "0bff6edd658290902abc7b5222bd00c580955ac31540c3633f9e97dc15bf348d" + "sha256": "80eb2676b8ca3b65b6eb913b1eaf159e848cd1234f5158af95ef388d89ec0d40" } }, "model": "examples/fix-e-alignment/model.xml", @@ -377,23 +377,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 4, - "generatedManifestSha256": "c0d5f34487792b9563b36fa07ea8486e112d50bea575c501ec065a57fcaa513a", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/fix-e-alignment/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "ea5da31929c18998e8eeec4b2abb3268a628f67935c38ac3dd141e05bf5f2f05", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/fix-e-alignment/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "producerReceiptSha256": "ed771e8f7531ef68768238c3d3eafcadd361f680929fe23d89edd7107f81ab06", + "producerReceiptSha256": "b674ff24ef4e83fc6ebdf7de11a7e3bbc79657e2e3e76be4f3b4a2675fa901ec", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "80c06f7f68ad51a5b2a61ad83cfb8bbe293010fde8f56a794cbab9d509bc9be2", + "archiveSHA256": "21a0f7f2468daa22fdda9772d9f2818dcfe579764e8e0d7df6743054bf30990e", "destination": "examples/inheritance-save", "generatedFiles": { "examples/inheritance-save/lib/pom.xml": { @@ -570,7 +570,7 @@ }, "examples/inheritance-save/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "26ae33a4425645f3125932fa4bd727768cba382c7184846f1b1c14db20e7f771" + "sha256": "1390be549b4b3dfb23404f36479839defc69fdf6b1b0bfa44a31d434d0a50e9d" } }, "model": "examples/inheritance-save/model.xml", @@ -578,23 +578,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 1, - "generatedManifestSha256": "fbcbf547348c11d2eb830cef043d4f93e6577b2ce93ef92c602824a248b1c75a", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/inheritance-save/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "125866d45632822e73355bfb99799859621381c240fac58923b725de1e03bc0b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/inheritance-save/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "9ed75f14ac524f18ccaba59be8c7261da203d2472bbe5d1f88dfc16d8b203d01", - "producerReceiptSha256": "7fb45ac05a05048cc42157f773a84fd2381531b57241f0a9ca98add6846cca78", + "producerReceiptSha256": "b8911241bfdaba2665ae26e39ea0b91013fced16b5b13d2a762df1ff5f29bf6c", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "454a6c5e001f6a9f9e7f1bf472ce0944a05a910c38001affb3d1696440eeccfa", + "archiveSHA256": "321ef8a8fb3109473ce4302b324443fc7e3c519502191c2c181f8c2ea02de702", "destination": "examples/scalar-type-probe/json-profiles/PascalCase", "generatedFiles": { "examples/scalar-type-probe/json-profiles/PascalCase/lib/pom.xml": { @@ -691,7 +691,7 @@ }, "examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "7372010327b04cdfb387dcaf812446c65ab4754df2fcd3af901468fde63f10c0" + "sha256": "f7f81c86cc8303bdb2fed7c7bfd33b3ab44b7242bd49311c4525dfa1dcdaad17" } }, "model": "examples/scalar-type-probe/json-profiles/PascalCase/model.xml", @@ -699,23 +699,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "f0afa88b5914aee732e42d846ae1b57838ed501b9fd1b08270087d2a58eb85c0", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "46a28188829b0edb3458314c4f78613939c7b71a9ae9494c2f0044f5a6b75dcc", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/scalar-type-probe/json-profiles/PascalCase/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", - "producerReceiptSha256": "b0da8e9fc5b83d7b3f8cc2e522de4827acb569ee88800773d55ba5402f38c80f", + "producerReceiptSha256": "e334f952e421204c932e94d111e1e367894d92002de8b1daec379b754fe684d5", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "5a1a4a8312eff631bac9394e81eaf97371cc7775f5fa32441fc2564b71dbef01", + "archiveSHA256": "1d5934dca3bce464b5465cbee4addb1444247f304473dcbdcedada42d274911c", "destination": "examples/scalar-type-probe/json-profiles/camelCase", "generatedFiles": { "examples/scalar-type-probe/json-profiles/camelCase/lib/pom.xml": { @@ -812,7 +812,7 @@ }, "examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc" + "sha256": "53333a1d944bcd8a9478bf7428598a1f4020a497bdf1d0a264dc58076c635002" } }, "model": "examples/scalar-type-probe/json-profiles/camelCase/model.xml", @@ -820,23 +820,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "1bfd037aeb9adfac3757b8358e1d68eedc43fc2da0a6ffa593f596b08ecb572b", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "a6c081cce8d511300d8da685c2a9011c5ee0241dd828dbe223831f7cb8830d8c", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/scalar-type-probe/json-profiles/camelCase/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "producerReceiptSha256": "0f3eb852da3a1a7c904b42b4fa77e453961b7da00fe2a9fa4169882194e7cd57", + "producerReceiptSha256": "2359c20744a43507a036ba738f0eeac654236489d8490b5555040d6a213d21cf", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "fced0aba7fdb2655f0f3cdc49574bca43e7dccafe40f4315b23ed603d63a4518", + "archiveSHA256": "15cb4724f4599a25f9353bdeabc47d00665427165684a0f79d780189fc530f6d", "destination": "examples/scalar-type-probe/json-profiles/snake_case", "generatedFiles": { "examples/scalar-type-probe/json-profiles/snake_case/lib/pom.xml": { @@ -933,7 +933,7 @@ }, "examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "1d31ade4f5f7f53e0af9398127b568be3615f52977bbf924f0acda23f9299747" + "sha256": "1a37f3d936bc281cd9bb78425c3ef25e88776fe545ab420c9a3d588b0b16c0c2" } }, "model": "examples/scalar-type-probe/json-profiles/snake_case/model.xml", @@ -941,23 +941,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "ac95fff2e3ba03cfda30a732966ac0d50c0e4f869a2ebb1efd10c1ed0b094e5b", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "cf5d6ec63a773ea686b8cf6cdd6907a5b8c7591320a73d0a5d786800e8ced716", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "producerReceiptSha256": "d1f5044db3215923a43a2719ac367d0cbf03d688cdd145d68545a8a8af93561f", + "producerReceiptSha256": "9e85c9075e65ed658e719cda2316ba34a8c8110c885d1a1795f55320ef7bc358", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "5a1a4a8312eff631bac9394e81eaf97371cc7775f5fa32441fc2564b71dbef01", + "archiveSHA256": "1d5934dca3bce464b5465cbee4addb1444247f304473dcbdcedada42d274911c", "destination": "examples/scalar-type-probe/generated", "generatedFiles": { "examples/scalar-type-probe/generated/lib/pom.xml": { @@ -1054,7 +1054,7 @@ }, "examples/scalar-type-probe/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc" + "sha256": "53333a1d944bcd8a9478bf7428598a1f4020a497bdf1d0a264dc58076c635002" } }, "model": "examples/scalar-type-probe/model.xml", @@ -1062,23 +1062,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "1bfd037aeb9adfac3757b8358e1d68eedc43fc2da0a6ffa593f596b08ecb572b", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "a6c081cce8d511300d8da685c2a9011c5ee0241dd828dbe223831f7cb8830d8c", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "09df20e2de0a5c045346dc346aae41560bc0f937e61ff4432206a17bc26a1de2", + "archiveSHA256": "a8c86c7b32882a5f3eea1d53b30797ad854d117a14ccad88801be10e30d229b4", "destination": "examples/school-management", "generatedFiles": { "examples/school-management/lib/pom.xml": { @@ -1195,7 +1195,7 @@ }, "examples/school-management/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "d74ee1c7e93db13222a84a3be79a99b1276b36ea7f5b030917fa8c0eaa27314a" + "sha256": "37dfcdffaeb5cabe6ffb233212ec4afec39d19c242b3cbcee53e3634c3715a2e" } }, "model": "examples/school-management/models/school-model.xml", @@ -1203,23 +1203,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "f0b0450e713aedce7f32c5911c4ec2b0ec1ebebf73d4fe8e082dc2e9112e5349", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/school-management/models/school-model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "36aa5ebe3434fd92b95076e0d6bd9f35f59497faa7d4950c551b45cc4328ff1b", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/school-management/models/school-model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "b5cd06ae44464fc29ed24de82654b47c80f546110496756aa15923cee1c511b4", - "producerReceiptSha256": "014bf9e64d28d33afa3d2df5e2cf76a043aaccb3059de5237bb0e332863d1a7f", + "producerReceiptSha256": "288a151c506048352f583308de05248f5ba0f0bd7435db0a265d5a39ea1f65af", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "c51fce823ff82af04338874daebf4b5b14b3d3075389c27cd760751e19817580", + "archiveSHA256": "7f6df4cd62627c64e7f58b95105a1edf2c57e60f6afbcbf00b89ba0094294308", "destination": "examples/standard-order/generated", "generatedFiles": { "examples/standard-order/generated/lib/pom.xml": { @@ -1376,7 +1376,7 @@ }, "examples/standard-order/generated/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "c9b75c084d960430da627d60698516b8a5af0dee85f33319df7a76403657a4dd" + "sha256": "5caac595e97bde8c7dcc1636bbf42163abf361a44826f9a0775486eb4d21d983" } }, "model": "examples/standard-order/models/model.xml", @@ -1384,23 +1384,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "ad94261aa2c7a8bfd054a992b6974714dae606ccacbf23dcc0e986870193085c", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/standard-order/models/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "61b57912a2ca63e86958a3b54e9943257e8aaad9d4f213476a34faa9999aa478", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/standard-order/models/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "455a5b60e571859a68586678da4bd8c9f13120132dc7ecf95f0554d98af6d674", - "producerReceiptSha256": "38f71df2428edc3a4748a6648f4b4b881d7684d5987b57b09153cd60c53a3687", + "producerReceiptSha256": "dc4ccc783f815d985ec1d35a4b7a824e3bb311338c1d5c5ac29b146c183fe838", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "4b62b8b18bec01f3a95aaec3c987c21ab8211288d1989d92dd706857c8c6d5f1", + "archiveSHA256": "48dddea022bf94fcc5cd2b2e21ed6393f70d7421765bbdd156c389094d2bf0b9", "destination": "examples/trace-chain", "generatedFiles": { "examples/trace-chain/lib/pom.xml": { @@ -1577,7 +1577,7 @@ }, "examples/trace-chain/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "90311071c90e39a1d7849b5828fa3e05e138bf41f8ba73a082af73f5af3bf2a0" + "sha256": "b34f98f91832753bf90101458f7dfb8a0626d8fc4a97a1cfe939546f1fd8a4d8" } }, "model": "examples/trace-chain/model.xml", @@ -1585,23 +1585,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 0, - "generatedManifestSha256": "dda3d4bf14f4d88c30cdbe36f1b1e058ceffeffa8e5bc946273ef06fbdac8ee5", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/trace-chain/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "0657b896f40e4c4a0a60064ff3a6f15669d343e2c10b8be66babcf1678d5c321", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/trace-chain/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "c9743d776718c7b27c97792f75f492fdc99bf427e4bd0c24bf3492de6520c9a2", - "producerReceiptSha256": "59aae0603ae5fcea46c1f7ed9fd9551266dcf3a83d49083add1e60c271ef05c4", + "producerReceiptSha256": "c76ac873eaafc560f650ca5088b18d81e1307c482b3e8bda092d6a50b7000020", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} }, { - "archiveSHA256": "624d6e82fb6d5b1a75d668205cfca0a853259ecd485b42ded656a040fb844dbe", + "archiveSHA256": "306cffd6cd13abdd4c3f8dca80343be022a3d649b34ef9cecb3852e7cf95c2dd", "destination": "examples/order-management/java-lib-core", "generatedFiles": { "examples/order-management/java-lib-core/lib/pom.xml": { @@ -1798,7 +1798,7 @@ }, "examples/order-management/java-lib-core/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", - "sha256": "1900da5e65204484cd23b83b335c2c82f055fa300b2e2c2d8b5c69386353e6dc" + "sha256": "49d9c58bee8d5f8e0f85a915656d61233a99d1288ca1bd6f053a1077afec3382" } }, "model": "examples/order-management/model.xml", @@ -1806,23 +1806,23 @@ "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 8, - "generatedManifestSha256": "6c8248a831abbccb5698f5f1465b996c7166db1b365b3bf036b9a1ef482db394", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/order-management/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "3aaef0ccd2aad4a0cd6165aea29f6d113876e2fdbb0fbd4f1bb091588df12d60", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/order-management/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "8b11ee844c2be184e194d8116994fb5fe95299dd593bfed83ec06d71ada0411d", - "producerReceiptSha256": "3ffa13654bcc15bec9be942ccf059afc927d5a0d07fa830d2d78c33ee698e826", + "producerReceiptSha256": "8469485fd0dfd6601070aaa2a3036c8da8ef262c2524b20a344b48fd6c418ebf", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } }, "preservedApplicationFiles": {} } ], - "runtimeBaseCommit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", + "runtimeBaseCommit": "da34cfe478db9ae8334ffa385b396ee786464ca0", "schema": "teaql.runtime-current-generated-examples/v1", "sourceCodeHandEdited": false } diff --git a/examples/inheritance-save/generated-files.json b/examples/inheritance-save/generated-files.json index 1c85dde2f..537e775cb 100644 --- a/examples/inheritance-save/generated-files.json +++ b/examples/inheritance-save/generated-files.json @@ -42,5 +42,5 @@ "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java": "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7", "teaql/checker-model.json": "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242", - "teaql/model-provenance.json": "26ae33a4425645f3125932fa4bd727768cba382c7184846f1b1c14db20e7f771" + "teaql/model-provenance.json": "1390be549b4b3dfb23404f36479839defc69fdf6b1b0bfa44a31d434d0a50e9d" } diff --git a/examples/inheritance-save/generation-origin.json b/examples/inheritance-save/generation-origin.json index 55feb3fbb..41c8f1840 100644 --- a/examples/inheritance-save/generation-origin.json +++ b/examples/inheritance-save/generation-origin.json @@ -4,19 +4,19 @@ "generator": { "artifactKind": "new source build; not the historical v4.2.0 release artifact", "baseRelease": "v4.2.0", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "qualificationReceiptSHA256": "d2ef37d0536f6d5be84baab53eb21ad8c771bee88aefe97a7c591d146cdfee44", - "sourceCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "tag": "unreleased-source-19feda8a" + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" }, - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", "note": "Exact output from the qualified unreleased generator source candidate. Local runtime source acceptance is recorded separately; this is not a public generator release claim.", "previousOrigin": { - "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", + "commit": "da34cfe478db9ae8334ffa385b396ee786464ca0", "path": "examples/inheritance-save/generation-origin.json", - "sha256": "a6c46aad29d3c992ab40327adc1b604efde8eabdbf30904858ae3febf6b99bf3" + "sha256": "787be9398abd04562ee19395ad7ddf713a3325ea9d47da885080d635252767e6" }, "schema": "teaql.generated-java-inheritance-example/v1", - "sourceReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/inheritance-save/model/receipt.json", - "sourceReceiptSha256": "7fb45ac05a05048cc42157f773a84fd2381531b57241f0a9ca98add6846cca78" + "sourceReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/inheritance-save/model/receipt.json", + "sourceReceiptSha256": "b8911241bfdaba2665ae26e39ea0b91013fced16b5b13d2a762df1ff5f29bf6c" } diff --git a/examples/inheritance-save/teaql/model-provenance.json b/examples/inheritance-save/teaql/model-provenance.json index c2337c307..532504d89 100644 --- a/examples/inheritance-save/teaql/model-provenance.json +++ b/examples/inheritance-save/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/order-management/java-lib-core/teaql/model-provenance.json b/examples/order-management/java-lib-core/teaql/model-provenance.json index 4b4bd510d..388505b1b 100644 --- a/examples/order-management/java-lib-core/teaql/model-provenance.json +++ b/examples/order-management/java-lib-core/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/scalar-type-probe/fixture-manifest.json b/examples/scalar-type-probe/fixture-manifest.json index 6a05c4874..592f07025 100644 --- a/examples/scalar-type-probe/fixture-manifest.json +++ b/examples/scalar-type-probe/fixture-manifest.json @@ -26,24 +26,24 @@ "lib/src/main/java/com/example/scalartypeconformanceservice/typeplatform/TypePlatformRequest.java": "e403c54280f42feace6905d2c448a2ab8eb4bf56ee3531fac659695c8c8dbc4b", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "teaql/model-provenance.json": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc" + "teaql/model-provenance.json": "53333a1d944bcd8a9478bf7428598a1f4020a497bdf1d0a264dc58076c635002" }, - "generatedManifestSha256": "1bfd037aeb9adfac3757b8358e1d68eedc43fc2da0a6ffa593f596b08ecb572b", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "a6c081cce8d511300d8da685c2a9011c5ee0241dd828dbe223831f7cb8830d8c", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/scalar-type-probe/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "language": "java", "modelSha256": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", - "previousFixtureManifestSha256": "7ed0ed858b49c47263ed6e3a0b7f62099b850fd8318acc75db4dcc553ed72ab6", + "previousFixtureManifestSha256": "dfae3928ca6765e346cb06a6b8f49d6e7767fd765ee900ffa224072fdae9c74d", "previousOrigin": { - "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", + "commit": "da34cfe478db9ae8334ffa385b396ee786464ca0", "path": "examples/scalar-type-probe/fixture-manifest.json" }, "producerReceiptSha256": "1ff97c9bf5491e655c2ec8ac4a48abf6a8a5efbe2608426f16ef437077e4dc1f", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } } diff --git a/examples/scalar-type-probe/generated/teaql/model-provenance.json b/examples/scalar-type-probe/generated/teaql/model-provenance.json index ad1dc5edd..7162b2122 100644 --- a/examples/scalar-type-probe/generated/teaql/model-provenance.json +++ b/examples/scalar-type-probe/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json index e3eb6677e..88a65ea62 100644 --- a/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/PascalCase/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:745cb38a47f97f7d0b49c7c83d47efc1698054c8b612fc1a80782e3c972ce873","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json index ad1dc5edd..7162b2122 100644 --- a/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/camelCase/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:85f0cc782c7d7653dd5d83afb32a431c5cfb969a3be7bce725008c8885bfd2f0","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/scalar-type-probe/json-profiles/provenance.json b/examples/scalar-type-probe/json-profiles/provenance.json index 6d275c7e5..351faea8f 100644 --- a/examples/scalar-type-probe/json-profiles/provenance.json +++ b/examples/scalar-type-probe/json-profiles/provenance.json @@ -27,7 +27,7 @@ "PascalCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "PascalCase/model.xml": "f836540a765f8c372bd7103a25a83ca316797253079ac63f8a1ef5ee4ded027d", "PascalCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "PascalCase/teaql/model-provenance.json": "7372010327b04cdfb387dcaf812446c65ab4754df2fcd3af901468fde63f10c0", + "PascalCase/teaql/model-provenance.json": "f7f81c86cc8303bdb2fed7c7bfd33b3ab44b7242bd49311c4525dfa1dcdaad17", "base-model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "camelCase/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "camelCase/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", @@ -53,7 +53,7 @@ "camelCase/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "camelCase/model.xml": "8d3017392ffd00abbc06be2555ced27ac6360e2d05fabc4299e27a5ef8f1c762", "camelCase/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "camelCase/teaql/model-provenance.json": "8d792f1114dddbf61b64f6afbae687abc9bd2410d751ea1ac1fcdef1895696dc", + "camelCase/teaql/model-provenance.json": "53333a1d944bcd8a9478bf7428598a1f4020a497bdf1d0a264dc58076c635002", "manifest.json": "519dfe321218a4248a9da550b22d35e3507a0408eb8e60fad1bc009a058afa6d", "snake_case/lib/pom.xml": "4a5ce36eb242e7e67fe06b9f554ff98d4d287c85e57a36ef9acdb9c41073c061", "snake_case/lib/src/main/java/com/example/scalartypeconformanceservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", @@ -79,23 +79,23 @@ "snake_case/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a2834fd53f1a3c377863d4c74804dae9ecec56022c99d645a7d6aa29e1608629", "snake_case/model.xml": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", "snake_case/teaql/checker-model.json": "ce4ae61861d89991e89b2762d48bb448ad04ad18853c9c5d5ea4e0c7ac093bab", - "snake_case/teaql/model-provenance.json": "1d31ade4f5f7f53e0af9398127b568be3615f52977bbf924f0acda23f9299747" + "snake_case/teaql/model-provenance.json": "1a37f3d936bc281cd9bb78425c3ef25e88776fe545ab420c9a3d588b0b16c0c2" }, - "generatedManifestSha256": "ac95fff2e3ba03cfda30a732966ac0d50c0e4f869a2ebb1efd10c1ed0b094e5b", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", + "generatedManifestSha256": "cf5d6ec63a773ea686b8cf6cdd6907a5b8c7591320a73d0a5d786800e8ced716", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/scalar-type-probe/json-profiles/snake_case/model/receipt.json", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", "modelSha256": "2dbbcfea6057a5dc7c7c356ea4d0dacec5d5165538f6a9c5903d4d3b64ee13c6", - "previousFixtureManifestSha256": "6a91153640cee2d469db02db3582d33589081c16999befe9bd0c6274c2a5a1d5", + "previousFixtureManifestSha256": "0f82025107104d1d885e9f217a91c00b1477a3b1dedb6a9061e8e866a155f55f", "previousOrigin": { - "commit": "c80a5ebfb6ae3586c3ca492b25d06b02ce5f4a22", + "commit": "da34cfe478db9ae8334ffa385b396ee786464ca0", "path": "examples/scalar-type-probe/json-profiles/provenance.json" }, - "producerReceiptSha256": "d1f5044db3215923a43a2719ac367d0cbf03d688cdd145d68545a8a8af93561f", + "producerReceiptSha256": "9e85c9075e65ed658e719cda2316ba34a8c8110c885d1a1795f55320ef7bc358", "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" } } diff --git a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json index bedd59b38..f2a380071 100644 --- a/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json +++ b/examples/scalar-type-probe/json-profiles/snake_case/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:9e4e7e46ce271457d742fa08ff2f084db8596ef87cbcc94ec0cf19e4df530b3a","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/school-management/teaql/model-provenance.json b/examples/school-management/teaql/model-provenance.json index 62a49b5f9..a9e08fd03 100644 --- a/examples/school-management/teaql/model-provenance.json +++ b/examples/school-management/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/standard-order/generated/teaql/model-provenance.json b/examples/standard-order/generated/teaql/model-provenance.json index 52c58844d..56b0d0bb3 100644 --- a/examples/standard-order/generated/teaql/model-provenance.json +++ b/examples/standard-order/generated/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/trace-chain/teaql/model-provenance.json b/examples/trace-chain/teaql/model-provenance.json index ea351296c..bfc689539 100644 --- a/examples/trace-chain/teaql/model-provenance.json +++ b/examples/trace-chain/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"19feda8a"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"021b1ed8"} \ No newline at end of file From 4aaf42016fa98f1a0f29629292a3e6c6c070a43a Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 18:36:29 +0800 Subject: [PATCH 11/71] fix(examples): use canonical Standard Order JSON field --- .../requesttreeorderservice/StandardOrderTelemetryTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java b/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java index e3e4052f4..841df0b82 100644 --- a/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java +++ b/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java @@ -79,7 +79,7 @@ public class StandardOrderTelemetryTest { } private static SmartList fullOrderPage(UserContext context) { - return JsonRequests.findWithJson(context, Q.customerOrdersWithMinimalFields(), "{\"orderNumber\":\"" + PRIVATE + "\"}") + return JsonRequests.findWithJson(context, Q.customerOrdersWithMinimalFields(), "{\"order_number\":\"" + PRIVATE + "\"}") .countAs("totalOrders").facetByStatusAs("statusCounts", statusFacets()) .selectOrderNumber().selectOrderDate().selectStatusWith(statusDetails()) .selectOrderItemListWith(itemPreviews()).countOrderItemsAs("itemCount") From 9a23c754998f28c9bddf95b5ab24d0aad313bfcc Mon Sep 17 00:00:00 2001 From: Philip Z Date: Thu, 19 Nov 2026 18:53:33 +0800 Subject: [PATCH 12/71] fix(examples): verify current Java scalar model metadata layout --- examples/scalar-type-probe/verify-local.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/scalar-type-probe/verify-local.cjs b/examples/scalar-type-probe/verify-local.cjs index 032d1912d..3ca05c17d 100644 --- a/examples/scalar-type-probe/verify-local.cjs +++ b/examples/scalar-type-probe/verify-local.cjs @@ -36,8 +36,9 @@ function fixture() { } walk(path.join(__dirname, 'generated')); assert.deepEqual(actual.sort(), Object.keys(manifest.files).sort(), 'unexpected generated source'); + const modelMetadata = new Set(['teaql/checker-model.json', 'teaql/model-provenance.json']); for (const [file, expected] of Object.entries(manifest.files)) { - assert(file.startsWith('lib/') && !file.split('/').includes('..')); + assert((file.startsWith('lib/') || modelMetadata.has(file)) && !file.split('/').includes('..')); assert.equal(sha(fs.readFileSync(path.join(__dirname, 'generated', file))), expected, file); } return {manifest, manifestSha256: sha(bytes)}; From 7e3843684ae46cf72366e4172feaa82e5d61199f Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 11:34:28 +0800 Subject: [PATCH 13/71] Place the School lifecycle consumer in generated Java scopes --- .github/workflows/ci.yml | 6 +- README.md | 2 +- examples/generator-v420.json | 60 +- examples/school-management/AGENTS.md | 71 +- examples/school-management/README.md | 24 +- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 67 + .../java-app-console/DOMAIN_API_GUIDE.md | 30 + .../{ => java-app-console}/Makefile | 0 .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 169 ++ .../java-app-console/lib/pom.xml | 102 + .../BaseServiceConfiguration.java | 0 .../schoolmanagementservice/Checkers.java | 0 .../schoolmanagementservice/Constants.java | 0 .../example/schoolmanagementservice/E.java | 0 .../EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 .../example/schoolmanagementservice/Q.java | 0 .../schoolmanagementservice/Repositories.java | 0 .../SchoolManagementServiceUserContext.java | 0 .../platform/Platform.java | 0 .../platform/PlatformChecker.java | 0 .../platform/PlatformExpression.java | 0 .../platform/PlatformListExpression.java | 0 .../platform/PlatformRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../school/School.java | 0 .../school/SchoolChecker.java | 0 .../school/SchoolExpression.java | 0 .../school/SchoolListExpression.java | 0 .../school/SchoolRequest.java | 0 .../schooltype/SchoolType.java | 0 .../schooltype/SchoolTypeChecker.java | 0 .../schooltype/SchoolTypeExpression.java | 0 .../schooltype/SchoolTypeListExpression.java | 0 .../schooltype/SchoolTypeRequest.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 .../{ => java-app-console}/pom.xml | 0 .../example/schoolmanagementservice/App.java | 0 .../BootstrapTraceVerifier.java | 0 .../CustomUserContext.java | 0 .../RequestIntentVerifier.java | 0 .../SchoolLifecycleVerifier.java | 0 .../WorkspaceTeaQLDatabase.java | 0 .../src/main/resources/application.properties | 0 .../java-app-console/teaql-i18n.json | 122 ++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 0 .../{ => java-lib-core}/lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 .../schoolmanagementservice/Checkers.java | 0 .../schoolmanagementservice/Constants.java | 13 + .../example/schoolmanagementservice/E.java | 23 + .../EntityMetaRegistry.java | 808 ++++++++ .../GeneratedRuntimeModule.java | 75 + .../example/schoolmanagementservice/Q.java | 34 + .../schoolmanagementservice/Repositories.java | 0 .../SchoolManagementServiceUserContext.java | 10 + .../platform/Platform.java | 214 +++ .../platform/PlatformChecker.java | 114 ++ .../platform/PlatformExpression.java | 81 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 1396 ++++++++++++++ .../sampledata/SampleDataService.java | 0 .../school/School.java | 287 +++ .../school/SchoolChecker.java | 159 ++ .../school/SchoolExpression.java | 110 ++ .../school/SchoolListExpression.java | 25 + .../school/SchoolRequest.java | 1643 +++++++++++++++++ .../schooltype/SchoolType.java | 193 ++ .../schooltype/SchoolTypeChecker.java | 88 + .../schooltype/SchoolTypeExpression.java | 76 + .../schooltype/SchoolTypeListExpression.java | 25 + .../schooltype/SchoolTypeRequest.java | 1238 +++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/school-management/showcase.json | 57 + examples/school-management/verify.sh | 76 + examples/verify-runtime-examples.sh | 7 +- pom.xml | 4 +- scripts/verify-examples.sh | 4 +- 85 files changed, 7489 insertions(+), 107 deletions(-) create mode 100644 examples/school-management/java-app-console/.gitignore create mode 100644 examples/school-management/java-app-console/AGENTS.md create mode 100644 examples/school-management/java-app-console/DOMAIN_API_GUIDE.md rename examples/school-management/{ => java-app-console}/Makefile (100%) create mode 100644 examples/school-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/school-management/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/school-management/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/school-management/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/school-management/java-app-console/lib/pom.xml rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/Constants.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/E.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/Q.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/school/School.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java (100%) rename examples/school-management/{ => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) rename examples/school-management/{ => java-app-console}/pom.xml (100%) rename examples/school-management/{ => java-app-console}/src/main/java/com/example/schoolmanagementservice/App.java (100%) rename examples/school-management/{ => java-app-console}/src/main/java/com/example/schoolmanagementservice/BootstrapTraceVerifier.java (100%) rename examples/school-management/{ => java-app-console}/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java (100%) rename examples/school-management/{ => java-app-console}/src/main/java/com/example/schoolmanagementservice/RequestIntentVerifier.java (100%) rename examples/school-management/{ => java-app-console}/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java (100%) rename examples/school-management/{ => java-app-console}/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java (100%) rename examples/school-management/{ => java-app-console}/src/main/resources/application.properties (100%) create mode 100644 examples/school-management/java-app-console/teaql-i18n.json rename examples/school-management/{ => java-app-console}/teaql/checker-model.json (100%) rename examples/school-management/{ => java-app-console}/teaql/model-provenance.json (100%) rename examples/school-management/{ => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java create mode 100644 examples/school-management/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/school-management/java-lib-core/teaql/checker-model.json create mode 100644 examples/school-management/java-lib-core/teaql/model-provenance.json create mode 100644 examples/school-management/showcase.json create mode 100644 examples/school-management/verify.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f6132878..0141de895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,10 +88,10 @@ jobs: -Dformats=HTML,JSON - name: OWASP Dependency Check standalone generated examples run: | - mvn -B -f examples/school-management/lib/pom.xml install -DskipTests + mvn -B -f examples/school-management/java-lib-core/lib/pom.xml install -DskipTests for pom in \ - examples/school-management/lib/pom.xml \ - examples/school-management/pom.xml \ + examples/school-management/java-lib-core/lib/pom.xml \ + examples/school-management/java-app-console/pom.xml \ examples/order-management/java-lib-core/lib/pom.xml; do mvn -B -f "$pom" org.owasp:dependency-check-maven:13.0.0:check \ -DdataDirectory=${{ runner.temp }}/teaql-odc-data \ diff --git a/README.md b/README.md index 9a4c20a85..e9b45242e 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ own Java APIs. These application-code excerpts assume the example's generated imports, trusted Context and an existing object identity. `Q` and `E` belong to the generated domain library, not a generic runtime object with arbitrary field strings. -See the [application source](examples/school-management/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java) for complete setup. +See the [application source](examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java) for complete setup. ```java var schoolTypeDetails = Q.schoolTypesWithMinimalFields().selectCode(); diff --git a/examples/generator-v420.json b/examples/generator-v420.json index b5c75f808..76399e3c2 100644 --- a/examples/generator-v420.json +++ b/examples/generator-v420.json @@ -1079,121 +1079,121 @@ }, { "archiveSHA256": "a8c86c7b32882a5f3eea1d53b30797ad854d117a14ccad88801be10e30d229b4", - "destination": "examples/school-management", + "destination": "examples/school-management/java-lib-core", "generatedFiles": { - "examples/school-management/lib/pom.xml": { + "examples/school-management/java-lib-core/lib/pom.xml": { "emittedPath": "lib/pom.xml", "sha256": "23fb23e3bd4956cf0708210611325be12e67065e0f4d673b3fde63576465d17b" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java", "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Checkers.java", "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Constants.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Constants.java", "sha256": "c146bba14760bcc83958d8b5b71a0e2136db3a16254c28ab9ae5a1a1643910c5" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/E.java", "sha256": "a2fe4f80b5ea3aada0267c717a6c9b0913715d2ed2bdee959042ec8d62958da8" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java", "sha256": "cf04c850db5199d6a6d30a6c5181526e09c068f9266a7dd9e982f07206dfc0c0" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java", "sha256": "fda202b9ed21f87bf65d6688ae167d2dc3e7982f2757a9f5fcbfc3513cf8d96d" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Q.java", "sha256": "db51bb72ee4e7c0752e6256b25a65d890b3750f63d24ff839d6b158f0cdfee49" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/Repositories.java", "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java", "sha256": "b924a8e1b890211486785b9d076e0ef81eb0f94558bf2b31e3a497d0a61509a0" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java", "sha256": "2bf78b74003d5dafe571f3e20f5a91d0e6a5a38785d705a45d30f9849c15dcf3" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java", "sha256": "312df235674b87518fa3e5af3f2f1475c71d86f2c6a7499c9db20b2f7fcd8de5" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java", "sha256": "b5f09cbe63ff1f63fb9c94e1b5c81ba78465bd0c78602ddf8ce97667c980c12f" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java", "sha256": "5dcf6781878f69ae68760d6767ccb8f036e5aec5cec2446a6006e20ed7684da9" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java", "sha256": "0e3e1a8bcdadee4008cdfe139d2f0a1db7ccf4920064c9544eac2afb81c9929a" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java", "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/School.java", "sha256": "4de7fb018260149c521226f002beb9084a68e9c3ff233dc361bc9c5f07998528" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java", "sha256": "eade01d79d598870b87949866e2ff15e09596bbbe6e67f3e3c288e5384e9eb9a" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java", "sha256": "29a8f0af8c19c488ea5facf3e18b35fc4500e305960e0f1dd50e239d4b84ccea" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java", "sha256": "f8ebc48aec4c099a9c32c01dac825e2f6efa1918a437c6c617013e752fd754e7" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java", "sha256": "78328172cc2d31caf70df4c7f80ce0c825fece345b39002475fb614a50db6292" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java", "sha256": "6d2d2ba18e5fd8865a5c573ca222872fa2b79fe6670f8589c28d41327b27660f" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java", "sha256": "4b3e29551b77290a7fc0b3d90bd30c04ec918e424dfec48e13740ea1d1618d6d" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java", "sha256": "5aa66ba48667373431c297b9b4e72d9d7e64df475f66808eb3c427219c0554f4" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java", "sha256": "cf40825a8ec01a22ae698d26d586ce1e1fd1dd5ac7b9762addc84f84233d3263" }, - "examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java": { + "examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java": { "emittedPath": "lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java", "sha256": "b706b4336e1c5b1591b7a7f94227225bb096645a97fbeabf877e9a6374513d2d" }, - "examples/school-management/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { + "examples/school-management/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": { "emittedPath": "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler", "sha256": "bacf17c0f620b2ddac37a9b549f0835af0d85e625b36c7c3a44f668001ee310a" }, - "examples/school-management/teaql/checker-model.json": { + "examples/school-management/java-lib-core/teaql/checker-model.json": { "emittedPath": "teaql/checker-model.json", "sha256": "8e28ee16cddc21191816ed05999142fccb870bf42795f5a1f21268ebd4469e71" }, - "examples/school-management/teaql/model-provenance.json": { + "examples/school-management/java-lib-core/teaql/model-provenance.json": { "emittedPath": "teaql/model-provenance.json", "sha256": "37dfcdffaeb5cabe6ffb233212ec4afec39d19c242b3cbcee53e3634c3715a2e" } diff --git a/examples/school-management/AGENTS.md b/examples/school-management/AGENTS.md index bbf188ba2..d58abf83d 100644 --- a/examples/school-management/AGENTS.md +++ b/examples/school-management/AGENTS.md @@ -1,67 +1,6 @@ - +# School showcase ownership -# TeaQL Java Agent Instructions - -## TeaQL workspace rules - -- Work in application-owned files. Keep the generated domain library read-only. -- Discover API names and signatures through model-aware Assist only. - Do not read or search generated library source for API discovery. Use the - original evaluated KSML file or directory and its exact entity and field names. -- Ask for the current entity and action first. Request field-level query help - only for the fields you use. If Assist lacks the operation, report - `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. - -```text -cargo teaql --input [model] java-assist-[action]/[entity] -cargo teaql --input [model] java-assist-query/[entity].[field] -``` - -Replace the bracketed values with the actual model path, action, entity, and -field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and -`expression`. Validate API usage by compiling and testing the application. - -- Use the trusted `UserContext` as the only runtime argument for generated query - execution and saves. Resolve tenant, actor, authorization, and provider - resources from trusted application setup. -- Keep queries bounded and provide a non-empty purpose and comment. Supply a - non-empty audit reason for writes through the API shown by Assist. - -> [!WARNING] -> **IGNORE GENERIC ORM EXPERIENCE** -> -> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. -> -> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. -> -> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. -> -> Do **not** guess TeaQL method names. - -## Model entities - -| entity-name | display-name | -|-------------|--------------| -| platform | Platform | -| school_type | School Type | -| school | School | - - -## Application entry and context - -Start in `App.java` under `src/main/java`. The console assembles the -`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. - -## Additional References - -Read these only when the task requires them: - -* **`TOOL_API_GUIDE.md`** - Framework runtime references and context handling. - -* **`RUNTIME_CUSTOM_GUIDE.md`** - Runtime setup, debugging, and project-specific restrictions. - -## Optional standard telemetry - -See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. +Follow [java-app-console/AGENTS.md](java-app-console/AGENTS.md). The model is +`models/school-model.xml`. Both native scopes are generated from it. Keep the +generated domain code read-only; application composition and business probes +live in `java-app-console`. Current scope identities are in `showcase.json`. diff --git a/examples/school-management/README.md b/examples/school-management/README.md index c78d7e198..ff3652d08 100644 --- a/examples/school-management/README.md +++ b/examples/school-management/README.md @@ -1,4 +1,26 @@ -# School Management bootstrap example +# School startup and lifecycle showcase + +`models/school-model.xml` owns `java-lib-core` and `java-app-console`. The +workspace retains all original application, request-intent, bootstrap and +lifecycle sources byte for byte. Current scope provenance is in `showcase.json`. +The focused gate builds disposable copies of both projects against freshly +source-built runtime artifacts in an isolated offline Maven repository. It +starts the School application twice on one retained SQLite file and verifies +active Schools, deleted lifecycle rows and constant versions independently. +These are new source outputs, not historical or public artifact identities. + +From teaql-conformance, run: + +```bash +PYTHONDONTWRITEBYTECODE=1 python3 model-aware-services/generation/verify/qualify-runtime-example-inventory.py \ + --runtime java --gate school --source /path/to/teaql-java \ + --generator-source /path/to/teaql-code-gen --output /new/evidence-directory +``` + +The qualifier uses empty settings, an isolated dependency repository, retained +third-party artifacts and offline Maven. It never reads host Maven settings or +uses private-feed credentials. Disposable source/build/cache copies are removed +after compact evidence is written. This generated example retains `models/school-model.xml`. It explicitly calls SQLite `ensureSchema` twice and verifies Platform `id=1` plus SchoolType constants diff --git a/examples/school-management/java-app-console/.gitignore b/examples/school-management/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/school-management/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/school-management/java-app-console/AGENTS.md b/examples/school-management/java-app-console/AGENTS.md new file mode 100644 index 000000000..bbf188ba2 --- /dev/null +++ b/examples/school-management/java-app-console/AGENTS.md @@ -0,0 +1,67 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| school_type | School Type | +| school | School | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/school-management/java-app-console/DOMAIN_API_GUIDE.md b/examples/school-management/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..67d58ee95 --- /dev/null +++ b/examples/school-management/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,30 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/school-management-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| school_type | School Type | +| school | School | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/school-management/Makefile b/examples/school-management/java-app-console/Makefile similarity index 100% rename from examples/school-management/Makefile rename to examples/school-management/java-app-console/Makefile diff --git a/examples/school-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/school-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..93dad43c5 --- /dev/null +++ b/examples/school-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/school-management-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/school-management/java-app-console/STANDARD_TELEMETRY.md b/examples/school-management/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/school-management/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/school-management/java-app-console/TOOL_API_GUIDE.md b/examples/school-management/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..f49eea7e2 --- /dev/null +++ b/examples/school-management/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/school-management-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/school-management-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/school-management/java-app-console/docs/teaql-java-crud-guide.md b/examples/school-management/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..7c1e72775 --- /dev/null +++ b/examples/school-management/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,169 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.schoolmanagementservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.SchoolManagementServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +Most workspace code receives a TeaQL context from Spring: + +```java +public WebResponse handle(@TQLContext UserContext userContext) { + // use Q, WebResponse, and entity.auditAs("comment").save(userContext) +} +``` + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectSchoolTypeListWith(Q.schoolTypes().selectSelf()) + .comment("load with schoolTypeList") + .purpose("fetch child schoolTypeList") + .executeForList(userContext); +``` + +```java +var list = Q.platforms() + .selectSchoolListWith(Q.schools().selectSelf()) + .comment("load with schoolList") + .purpose("fetch child schoolList") + .executeForList(userContext); +``` + +```java +var list = Q.schoolTypes() + .selectPlatformWith(Q.platforms().selectSelf()) + .comment("load with platform") + .purpose("fetch associated platform") + .executeForList(userContext); +``` + + + + + +```java +var list = Q.schoolTypes() + .selectSchoolListWith(Q.schools().selectSelf()) + .comment("load with schoolList") + .purpose("fetch child schoolList") + .executeForList(userContext); +``` + + +## Delete + +Use the generated TeaQL soft-delete API available on the entity/request class in this domain. If unsure, inspect the generated request class for the target entity and use the soft-delete operation it exposes. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `2`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.example.schoolmanagementservice.platform.PlatformRequest` +- `SchoolType`: reverse relations `1`, query `Q.schoolTypes()`, save `new SchoolType().auditAs("comment").save(userContext)`, request `com.example.schoolmanagementservice.schooltype.SchoolTypeRequest` \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/pom.xml b/examples/school-management/java-app-console/lib/pom.xml new file mode 100644 index 000000000..2031c7204 --- /dev/null +++ b/examples/school-management/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + school-management-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Constants.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Constants.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/E.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Q.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/School.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java diff --git a/examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java similarity index 100% rename from examples/school-management/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java rename to examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java diff --git a/examples/school-management/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/school-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/school-management/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/school-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/school-management/pom.xml b/examples/school-management/java-app-console/pom.xml similarity index 100% rename from examples/school-management/pom.xml rename to examples/school-management/java-app-console/pom.xml diff --git a/examples/school-management/src/main/java/com/example/schoolmanagementservice/App.java b/examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/App.java similarity index 100% rename from examples/school-management/src/main/java/com/example/schoolmanagementservice/App.java rename to examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/App.java diff --git a/examples/school-management/src/main/java/com/example/schoolmanagementservice/BootstrapTraceVerifier.java b/examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/BootstrapTraceVerifier.java similarity index 100% rename from examples/school-management/src/main/java/com/example/schoolmanagementservice/BootstrapTraceVerifier.java rename to examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/BootstrapTraceVerifier.java diff --git a/examples/school-management/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java b/examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java similarity index 100% rename from examples/school-management/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java rename to examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java diff --git a/examples/school-management/src/main/java/com/example/schoolmanagementservice/RequestIntentVerifier.java b/examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/RequestIntentVerifier.java similarity index 100% rename from examples/school-management/src/main/java/com/example/schoolmanagementservice/RequestIntentVerifier.java rename to examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/RequestIntentVerifier.java diff --git a/examples/school-management/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java b/examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java similarity index 100% rename from examples/school-management/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java rename to examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java diff --git a/examples/school-management/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java b/examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java similarity index 100% rename from examples/school-management/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java rename to examples/school-management/java-app-console/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java diff --git a/examples/school-management/src/main/resources/application.properties b/examples/school-management/java-app-console/src/main/resources/application.properties similarity index 100% rename from examples/school-management/src/main/resources/application.properties rename to examples/school-management/java-app-console/src/main/resources/application.properties diff --git a/examples/school-management/java-app-console/teaql-i18n.json b/examples/school-management/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..21b3f9b8a --- /dev/null +++ b/examples/school-management/java-app-console/teaql-i18n.json @@ -0,0 +1,122 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.platform.createTime": "Create Time", + "property.platform.updateTime": "Update Time", + "property.school.platform": "Platform", + "property.school.id": "Id", + "property.schoolType.version": "Version", + "property.school.establishedDate": "Established Date", + "property.schoolType.code": "Code", + "property.school.studentCapacity": "Student Capacity", + "property.school.active": "Active", + "property.school.schoolType": "School Type", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.schoolType.displayOrder": "Display Order", + "property.schoolType.id": "Id", + "entity.school": "School", + "property.school.name": "Name", + "property.school.createTime": "Create Time", + "property.school.updateTime": "Update Time", + "entity.schoolType": "School Type", + "property.platform.baseUrl": "Base Url", + "property.platform.version": "Version", + "property.schoolType.platform": "Platform", + "property.school.version": "Version", + "property.school.address": "Address", + "property.schoolType.name": "Name" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/school-management/teaql/checker-model.json b/examples/school-management/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/school-management/teaql/checker-model.json rename to examples/school-management/java-app-console/teaql/checker-model.json diff --git a/examples/school-management/teaql/model-provenance.json b/examples/school-management/java-app-console/teaql/model-provenance.json similarity index 100% rename from examples/school-management/teaql/model-provenance.json rename to examples/school-management/java-app-console/teaql/model-provenance.json diff --git a/examples/school-management/lib/pom.xml b/examples/school-management/java-lib-core/lib/pom.xml similarity index 100% rename from examples/school-management/lib/pom.xml rename to examples/school-management/java-lib-core/lib/pom.xml diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java new file mode 100644 index 000000000..bdacf16bf --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java @@ -0,0 +1,13 @@ + +package com.example.schoolmanagementservice; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.schooltype.SchoolType; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); + public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; + public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; + public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java new file mode 100644 index 000000000..0629960ea --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java @@ -0,0 +1,23 @@ + +package com.example.schoolmanagementservice; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static SchoolTypeExpression schoolType(SchoolType schoolType){ + return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); + } + public static SchoolExpression school(School school){ + return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java new file mode 100644 index 000000000..257189a02 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java @@ -0,0 +1,808 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerSchoolType(); + registerSchool(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.platform.Platform::new); + entityDescriptor.with("name", "Platform") + + .with("module", "Organization") + + .with("module_key", "organization") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor baseUrl = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Campus Learning Platform") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "https://campus.example.com") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "createTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "updateTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchoolType() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.schooltype.SchoolType.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schooltype.SchoolType::new); + entityDescriptor.with("name", "School Type") + + .with("module", "Academics") + + .with("module_key", "academics") + + .with("constant", "true") + + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY, String.class) + ; + PropertyDescriptor code = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY, String.class) + ; + PropertyDescriptor displayOrder = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("candidates", "1001,1002") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Primary,Secondary") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") + + .with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "PRIMARY,SECONDARY") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("candidates", "1,2") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchool() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.school.School.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.school.School.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.school.School.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.school.School::new); + entityDescriptor.with("name", "School") + + .with("module", "Academics") + + .with("module_key", "academics") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor schoolType = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.schoolmanagementservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY, String.class) + ; + PropertyDescriptor address = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY, String.class) + ; + PropertyDescriptor establishedDate = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor studentCapacity = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) + ; + PropertyDescriptor active = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY, Boolean.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(1)") + + .with("javaType", "java.lang.Boolean") + + .with("sqlType", "BOOLEAN") + + .with("isId", "false") + + .with("isBool", "true") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "bit") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Boolean") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..9f8f340c9 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java @@ -0,0 +1,75 @@ +package com.example.schoolmanagementservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.schoolmanagementservice.platform.PlatformChecker(), new com.example.schoolmanagementservice.schooltype.SchoolTypeChecker(), new com.example.schoolmanagementservice.school.SchoolChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:71ba9da7267282a87034f786438f6f60442609b86ca42c3ef288e51c43107ce1\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"School\"},\"fields\":[{\"name\":\"active\",\"labels\":{\"en\":\"active\"},\"aliases\":[\"Active\"]},{\"name\":\"address\",\"labels\":{\"en\":\"address\"},\"aliases\":[\"Address\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"established_date\",\"labels\":{\"en\":\"established date\"},\"aliases\":[\"EstablishedDate\",\"establishedDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"School Type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("address", "address"), java.util.Map.entry("established_date", "establishedDate"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("active", "active"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.schoolmanagementservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.schoolmanagementservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Campus Learning Platform"); + domainRoot.updateBaseUrl("https://campus.example.com"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1001Rows.isEmpty()) { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = new com.example.schoolmanagementservice.schooltype.SchoolType(); + constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); + constantSchoolType1001.updatePlatform(domainRoot); + constantSchoolType1001.updateName("Primary"); + constantSchoolType1001.updateCode("PRIMARY"); + constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); + constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); + } else { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } + if (!((constantSchoolType1001.getDisplayOrder() != null && constantSchoolType1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } + if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); + } + var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1002Rows.isEmpty()) { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = new com.example.schoolmanagementservice.schooltype.SchoolType(); + constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); + constantSchoolType1002.updatePlatform(domainRoot); + constantSchoolType1002.updateName("Secondary"); + constantSchoolType1002.updateCode("SECONDARY"); + constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); + constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); + } else { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } + if (!((constantSchoolType1002.getDisplayOrder() != null && constantSchoolType1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } + if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); + } + } +} diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java new file mode 100644 index 000000000..c8368197d --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java @@ -0,0 +1,34 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.schoolmanagementservice.platform.PlatformRequest platforms(){ + return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypes(){ + return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ + return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.school.SchoolRequest schools(){ + return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.school.SchoolRequest schoolsWithMinimalFields(){ + return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java new file mode 100644 index 000000000..e53bf00a7 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.UserContext; +public interface SchoolManagementServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java new file mode 100644 index 000000000..97fe06180 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java @@ -0,0 +1,214 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e1da6639feab09f3d1ed370802410798c759f6bf13f85e0a93374c42d1646603"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_type_list", "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String BASE_URL_PROPERTY = "base_url"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + private String name; + + private String baseUrl; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList schoolTypeList; + private SmartList schoolList; + + public String getName(){ + return this.name; + } + + public String getBaseUrl(){ + return this.baseUrl; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getSchoolTypeList(){ + return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; + } + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform updateBaseUrl(String baseUrl){ + baseUrl = (baseUrl == null ? null : baseUrl.trim()); + if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ + return this; + } + handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); + this.baseUrl = baseUrl; + return this; + } + + public Platform updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public Platform updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public Platform addSchoolType(SchoolType schoolType){ + if (schoolType == null){ + return this; + } + + if(null == this.schoolTypeList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolTypeList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolTypeList.add(schoolType); + schoolType.updatePlatform(this); + return this; + } + public Platform addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "school_type_list": this.schoolTypeList = (SmartList) value; break; + case "school_list": this.schoolList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "base_url": return this.baseUrl; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "school_type_list": return this.schoolTypeList; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "baseUrl": return this.baseUrl; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java new file mode 100644 index 000000000..d20345fd5 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java @@ -0,0 +1,114 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolChecker; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + platform.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(platform.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("base_url")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); + checkCreateTime(_context, platform.getProperty(Platform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, platform.getProperty(Platform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ + SchoolType schoolType = platform.getSchoolTypeList().get(i); + new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); + } + for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ + School school = platform.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, baseUrl); + if((baseUrl == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, baseUrl); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java new file mode 100644 index 000000000..0547820e6 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java @@ -0,0 +1,81 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolListExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public Expression getBaseUrl(){ + return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); + } + public PlatformExpression updateBaseUrl(String baseUrl){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", Platform::getCreateTime); + } + public PlatformExpression updateCreateTime(LocalDateTime createTime){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", Platform::getUpdateTime); + } + public PlatformExpression updateUpdateTime(LocalDateTime updateTime){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateUpdateTime(updateTime)); + } + + public SchoolTypeListExpression getSchoolTypeList(){ + return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); + } + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); + } + public PlatformExpression addSchoolType(SchoolType schoolType){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); + } + public PlatformExpression addSchool(School school){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..14e4a4c13 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java new file mode 100644 index 000000000..c0abb6538 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java @@ -0,0 +1,1396 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolRequest; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.BASE_URL_PROPERTY); + selectProperty(Platform.CREATE_TIME_PROPERTY); + selectProperty(Platform.UPDATE_TIME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectSchoolTypeList().selectSchoolList(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectBaseUrl(){ + selectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + + /** + * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectBaseUrl(){ + unselectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest selectCreateTime(){ + selectProperty(Platform.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectCreateTime(){ + unselectProperty(Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest selectUpdateTime(){ + selectProperty(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectUpdateTime(){ + unselectProperty(Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectSchoolTypeList(){ + return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); + } + + public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ + enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByBaseUrl(String... baseUrl){ + if (baseUrl == null || baseUrl.length == 0) { + throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); + } + return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); + } + + public PlatformRequest withBaseUrl(Operator operator, Object... values){ + return appendSearchCriteria(createBaseUrlCriteria(operator, values)); + } + + public PlatformRequest withBaseUrlIsUnknown(){ + return withBaseUrl(Operator.IS_NULL); + } + + public PlatformRequest withBaseUrlIsKnown(){ + return withBaseUrl(Operator.IS_NOT_NULL); + } + + public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); + } + + public PlatformRequest withBaseUrlIsNot(String baseUrl){ + return withBaseUrl(Operator.NOT_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlIn(String... baseUrl){ + return withBaseUrl(Operator.IN, (Object[])baseUrl); + } + + public PlatformRequest withBaseUrlNotIn(String... baseUrl){ + return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); + } + public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlLessThan(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ + return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); + } + public PlatformRequest withBaseUrlStartingWith(String baseUrl){ + return withBaseUrl(Operator.BEGIN_WITH, baseUrl); + } + public PlatformRequest withBaseUrlContaining(String baseUrl){ + return withBaseUrl(Operator.CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotContaining(String baseUrl){ + return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlEndingWith(String baseUrl){ + return withBaseUrl(Operator.END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlIs(String baseUrl){ + return withBaseUrl(Operator.EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ + return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); + } + + + + public PlatformRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public PlatformRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public PlatformRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public PlatformRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.CREATE_TIME_PROPERTY, operator, values); + } + + public PlatformRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public PlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public PlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public PlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public PlatformRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public PlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public PlatformRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public PlatformRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public PlatformRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.UPDATE_TIME_PROPERTY, operator, values); + } + + public PlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public PlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public PlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public PlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchoolTypes(){ + return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + + public PlatformRequest haveNoSchoolTypes(){ + return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public PlatformRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctBaseUrl(){ + return countDistinctBaseUrlAs("base_url_distinct_count"); + } + + public PlatformRequest countDistinctBaseUrlAs(String alias){ + super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public PlatformRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public PlatformRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ + aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByBaseUrl(){ + groupBy(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlAs(String retName){ + groupBy(retName, Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.BASE_URL_PROPERTY, function); + return this; + } + + public PlatformRequest groupByCreateTime(){ + groupBy(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByCreateTimeAs(String retName){ + groupBy(retName, Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.CREATE_TIME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByUpdateTime(){ + groupBy(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.UPDATE_TIME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscending(){ + addOrderByAscending(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescending(){ + addOrderByDescending(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByCreateTimeAscending(){ + addOrderByAscending(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByCreateTimeDescending(){ + addOrderByDescending(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByUpdateTimeAscending(){ + addOrderByAscending(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByUpdateTimeDescending(){ + addOrderByDescending(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest countSchoolTypes(){ + addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesAs(String name){ + addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ + addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest minDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("minDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ + return minDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("maxDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ + return maxDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("sumDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ + return sumDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("avgDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ + return avgDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("stdDevDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name){ + return standardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("stdDevPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name){ + return squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("varSampDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name){ + return sampleVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("varPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name){ + return samplePopulationVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java new file mode 100644 index 000000000..3923b042c --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java @@ -0,0 +1,287 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.Constants; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class School extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "School"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "14b4bfbb4cda258779665e3bc38ab991040fe75793a416d29eddd06f8fa8f586"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("address", 4), java.util.Map.entry("established_date", 5), java.util.Map.entry("student_capacity", 6), java.util.Map.entry("active", 7), java.util.Map.entry("create_time", 8), java.util.Map.entry("update_time", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("address", java.util.List.of("address", "address")), java.util.Map.entry("established_date", java.util.List.of("establishedDate", "established_date")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("active", java.util.List.of("active", "active")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + School.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String SCHOOL_TYPE_PROPERTY = "school_type"; + public static final String NAME_PROPERTY = "name"; + public static final String ADDRESS_PROPERTY = "address"; + public static final String ESTABLISHED_DATE_PROPERTY = "established_date"; + public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; + public static final String ACTIVE_PROPERTY = "active"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private Platform platform; + + private SchoolType schoolType; + + private String name; + + private String address; + + private LocalDate establishedDate; + + private Integer studentCapacity; + + private Boolean active; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public Platform getPlatform(){ + return this.platform; + } + + public SchoolType getSchoolType(){ + return this.schoolType; + } + + public String getName(){ + return this.name; + } + + public String getAddress(){ + return this.address; + } + + public LocalDate getEstablishedDate(){ + return this.establishedDate; + } + + public Integer getStudentCapacity(){ + return this.studentCapacity; + } + + public Boolean isActive(){ + return this.active; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public School updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + protected School updateSchoolType(SchoolType schoolType){ + if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ + return this; + } + handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); + this.schoolType = schoolType; + return this; + } + + public School updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public School updateAddress(String address){ + address = (address == null ? null : address.trim()); + if(isPropertyLoaded(ADDRESS_PROPERTY) && Objects.equals(this.address, address)){ + return this; + } + handleUpdate(ADDRESS_PROPERTY, getAddress(), address); + this.address = address; + return this; + } + + public School updateEstablishedDate(LocalDate establishedDate){ + if(isPropertyLoaded(ESTABLISHED_DATE_PROPERTY) && Objects.equals(this.establishedDate, establishedDate)){ + return this; + } + handleUpdate(ESTABLISHED_DATE_PROPERTY, getEstablishedDate(), establishedDate); + this.establishedDate = establishedDate; + return this; + } + + public School updateStudentCapacity(Integer studentCapacity){ + if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ + return this; + } + handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); + this.studentCapacity = studentCapacity; + return this; + } + + public School updateActive(Boolean active){ + if(isPropertyLoaded(ACTIVE_PROPERTY) && Objects.equals(this.active, active)){ + return this; + } + handleUpdate(ACTIVE_PROPERTY, isActive(), active); + this.active = active; + return this; + } + + public School updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public School updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public boolean isSchoolTypePrimary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); + } + + public School updateSchoolTypeToPrimary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); + } + public boolean isSchoolTypeSecondary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); + } + + public School updateSchoolTypeToSecondary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); + } + + public static School refer(Long id){ + School refer = new School(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public School comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "school_type": this.schoolType = (SchoolType) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "address": this.address = (value == null ? null : ((String)value).trim()); break; + + case "established_date": this.establishedDate = (LocalDate) value; break; + + case "student_capacity": this.studentCapacity = (Integer) value; break; + + case "active": this.active = (Boolean) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "school_type": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "established_date": return this.establishedDate; + case "student_capacity": return this.studentCapacity; + case "active": return this.active; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "schoolType": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "establishedDate": return this.establishedDate; + case "studentCapacity": return this.studentCapacity; + case "active": return this.active; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java new file mode 100644 index 000000000..df8d0faa3 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java @@ -0,0 +1,159 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class SchoolChecker implements Checker{ + + public String type(){ + return School.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ + if(needCheck(_context, school)){ + markAsChecked(_context, school); + doCheck(_context, school, _parentLocation); + } + } + + public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ + if((school == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, school); + if(school.needPersist()){ + } + if(school.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + school.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(school.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!school.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("school_type")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("address")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "address"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("established_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "established_date"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("student_capacity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("active")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "active"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); + checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkAddress(_context, school.getProperty(School.ADDRESS_PROPERTY), newLocation(_parentLocation, "address")); + checkEstablishedDate(_context, school.getProperty(School.ESTABLISHED_DATE_PROPERTY), newLocation(_parentLocation, "established_date")); + checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); + checkActive(_context, school.getProperty(School.ACTIVE_PROPERTY), newLocation(_parentLocation, "active")); + checkCreateTime(_context, school.getProperty(School.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, school.getProperty(School.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, schoolType); + if((schoolType == null)){ + return; + } + new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkAddress(UserContext _context, String address, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, address); + if((address == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, address); + + } + public void checkEstablishedDate(UserContext _context, LocalDate establishedDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, establishedDate); + if((establishedDate == null)){ + return; + } + } + public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, studentCapacity); + if((studentCapacity == null)){ + return; + } + } + public void checkActive(UserContext _context, Boolean active, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, active); + if((active == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java new file mode 100644 index 000000000..381a4e119 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java @@ -0,0 +1,110 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolExpression(Expression expression){ + super(expression); + } + + public SchoolExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolExpression updateId(Long id){ + return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); + } + + public SchoolExpression save(UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolExpression save(String intent, UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); + } + + public SchoolExpression updatePlatform(Platform platform){ + return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); + } + + public SchoolTypeExpression getSchoolType(){ + return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); + } + + public SchoolExpression updateSchoolTypeToPrimary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); + } + public SchoolExpression updateSchoolTypeToSecondary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); + } + + public Expression getName(){ + return loaded("name", "getName", School::getName); + } + public SchoolExpression updateName(String name){ + return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); + } + + public Expression getAddress(){ + return loaded("address", "getAddress", School::getAddress); + } + public SchoolExpression updateAddress(String address){ + return new SchoolExpression(this, $it -> ((School)$it).updateAddress(address)); + } + + public Expression getEstablishedDate(){ + return loaded("established_date", "getEstablishedDate", School::getEstablishedDate); + } + public SchoolExpression updateEstablishedDate(LocalDate establishedDate){ + return new SchoolExpression(this, $it -> ((School)$it).updateEstablishedDate(establishedDate)); + } + + public Expression getStudentCapacity(){ + return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); + } + public SchoolExpression updateStudentCapacity(Integer studentCapacity){ + return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); + } + + public Expression isActive(){ + return loaded("active", "isActive", School::isActive); + } + public SchoolExpression updateActive(Boolean active){ + return new SchoolExpression(this, $it -> ((School)$it).updateActive(active)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", School::getCreateTime); + } + public SchoolExpression updateCreateTime(LocalDateTime createTime){ + return new SchoolExpression(this, $it -> ((School)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", School::getUpdateTime); + } + public SchoolExpression updateUpdateTime(LocalDateTime updateTime){ + return new SchoolExpression(this, $it -> ((School)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java new file mode 100644 index 000000000..c41793f7b --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.school; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolListExpression extends SmartListExpression { + public SchoolListExpression(Expression> expression){ + super(expression); + } + + public SchoolListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolExpression first() { + return new SchoolExpression(super.first()); + } + + public SchoolExpression get(int index) { + return new SchoolExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java new file mode 100644 index 000000000..c5ad3c9c4 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java @@ -0,0 +1,1643 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class SchoolRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolRequest(Class returnType){ + this(returnType, () -> (T) new School()); + } + + protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolRequest copy(){ + return (SchoolRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolRequest matchingAnyOf(SchoolRequest school){ + super.internalMatchAny(school); + return this; + } + + public SchoolRequest matchingIdsOf(SchoolRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + School.ID_PROPERTY, request, School.ID_PROPERTY)); + } + + public SchoolRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public SchoolRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(School.ID_PROPERTY); + selectProperty(School.PLATFORM_PROPERTY); + selectProperty(School.SCHOOL_TYPE_PROPERTY); + selectProperty(School.NAME_PROPERTY); + selectProperty(School.ADDRESS_PROPERTY); + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + selectProperty(School.ACTIVE_PROPERTY); + selectProperty(School.CREATE_TIME_PROPERTY); + selectProperty(School.UPDATE_TIME_PROPERTY); + selectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public SchoolRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public SchoolRequest selectId(){ + selectProperty(School.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectId(){ + unselectProperty(School.ID_PROPERTY); + return this; + } + public SchoolRequest selectPlatformIdOnly(){ + selectProperty(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(School.PLATFORM_PROPERTY); + enhanceRelation(School.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); + return this; + } + + public SchoolRequest unselectPlatform(){ + unselectProperty(School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest selectSchoolTypeIdOnly(){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest selectSchoolType(){ + return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); + } + + public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + public SchoolRequest unselectSchoolType(){ + unselectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest selectName(){ + selectProperty(School.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectName(){ + unselectProperty(School.NAME_PROPERTY); + return this; + } + public SchoolRequest selectAddress(){ + selectProperty(School.ADDRESS_PROPERTY); + return this; + } + + /** + * fill the address with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS address) to fetch address property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectAddress(){ + unselectProperty(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest selectEstablishedDate(){ + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + /** + * fill the establishedDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS establishedDate) to fetch establishedDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectEstablishedDate(){ + unselectProperty(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest selectStudentCapacity(){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); + return this; + } + + + public SchoolRequest unselectStudentCapacity(){ + unselectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest selectActive(){ + selectProperty(School.ACTIVE_PROPERTY); + return this; + } + + /** + * fill the active with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS active) to fetch active property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectActive(){ + unselectProperty(School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest selectCreateTime(){ + selectProperty(School.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectCreateTime(){ + unselectProperty(School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest selectUpdateTime(){ + selectProperty(School.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectUpdateTime(){ + unselectProperty(School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest selectVersion(){ + selectProperty(School.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectVersion(){ + unselectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); + } + + public SchoolRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); + } + + public SchoolRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolRequest filterBySchoolType(SchoolType... schoolType){ + if (schoolType == null || schoolType.length == 0) { + throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); + } + return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); + } + + public SchoolRequest withSchoolType(Operator operator, Object... values){ + return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); + } + + public SchoolRequest withSchoolTypeIsUnknown(){ + return withSchoolType(Operator.IS_NULL); + } + + public SchoolRequest withSchoolTypeIsKnown(){ + return withSchoolType(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); + } + + public SchoolRequest filterBySchoolType(Long schoolType){ + if(schoolType == null){ + return this; + } + return withSchoolType(Operator.EQUAL, schoolType); + } + public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); + } + + public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); + } + + public SchoolRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); + } + + public SchoolRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolRequest filterByAddress(String... address){ + if (address == null || address.length == 0) { + throw new IllegalArgumentException("filterByAddress parameter address cannot be empty"); + } + return appendSearchCriteria(createAddressCriteria(Operator.EQUAL, (Object[])address)); + } + + public SchoolRequest withAddress(Operator operator, Object... values){ + return appendSearchCriteria(createAddressCriteria(operator, values)); + } + + public SchoolRequest withAddressIsUnknown(){ + return withAddress(Operator.IS_NULL); + } + + public SchoolRequest withAddressIsKnown(){ + return withAddress(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAddressCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ADDRESS_PROPERTY, operator, values); + } + + public SchoolRequest withAddressIsNot(String address){ + return withAddress(Operator.NOT_EQUAL, address); + } + + public SchoolRequest withAddressIn(String... address){ + return withAddress(Operator.IN, (Object[])address); + } + + public SchoolRequest withAddressNotIn(String... address){ + return withAddress(Operator.NOT_IN, (Object[])address); + } + public SchoolRequest withAddressGreaterThan(String address){ + return withAddress(Operator.GREATER_THAN, address); + } + + public SchoolRequest withAddressGreaterThanOrEqualTo(String address){ + return withAddress(Operator.GREATER_THAN_OR_EQUAL, address); + } + + public SchoolRequest withAddressLessThan(String address){ + return withAddress(Operator.LESS_THAN, address); + } + + public SchoolRequest withAddressLessThanOrEqualTo(String address){ + return withAddress(Operator.LESS_THAN_OR_EQUAL, address); + } + + public SchoolRequest withAddressBetween(String startOfAddress, String endOfAddress){ + return withAddress(Operator.BETWEEN, startOfAddress, endOfAddress); + } + public SchoolRequest withAddressStartingWith(String address){ + return withAddress(Operator.BEGIN_WITH, address); + } + public SchoolRequest withAddressContaining(String address){ + return withAddress(Operator.CONTAIN, address); + } + + public SchoolRequest withAddressNotContaining(String address){ + return withAddress(Operator.NOT_CONTAIN, address); + } + + public SchoolRequest withAddressNotStartingWith(String address){ + return withAddress(Operator.NOT_BEGIN_WITH, address); + } + + public SchoolRequest withAddressEndingWith(String address){ + return withAddress(Operator.END_WITH, address); + } + + public SchoolRequest withAddressNotEndingWith(String address){ + return withAddress(Operator.NOT_END_WITH, address); + } + + public SchoolRequest withAddressIs(String address){ + return withAddress(Operator.EQUAL, address); + } + + public SchoolRequest withAddressSoundingLike(String address){ + return withAddress(Operator.SOUNDS_LIKE, address); + } + + + + public SchoolRequest filterByEstablishedDate(LocalDate... establishedDate){ + if (establishedDate == null || establishedDate.length == 0) { + throw new IllegalArgumentException("filterByEstablishedDate parameter establishedDate cannot be empty"); + } + return appendSearchCriteria(createEstablishedDateCriteria(Operator.EQUAL, (Object[])establishedDate)); + } + + public SchoolRequest withEstablishedDate(Operator operator, Object... values){ + return appendSearchCriteria(createEstablishedDateCriteria(operator, values)); + } + + public SchoolRequest withEstablishedDateIsUnknown(){ + return withEstablishedDate(Operator.IS_NULL); + } + + public SchoolRequest withEstablishedDateIsKnown(){ + return withEstablishedDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createEstablishedDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ESTABLISHED_DATE_PROPERTY, operator, values); + } + + public SchoolRequest withEstablishedDateIs(LocalDate establishedDate){ + return withEstablishedDate(Operator.EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateIsNot(LocalDate establishedDate){ + return withEstablishedDate(Operator.NOT_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateIn(LocalDate... establishedDate){ + return withEstablishedDate(Operator.IN, (Object[])establishedDate); + } + + public SchoolRequest withEstablishedDateNotIn(LocalDate... establishedDate){ + return withEstablishedDate(Operator.NOT_IN, (Object[])establishedDate); + } + public SchoolRequest withEstablishedDateGreaterThan(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateGreaterThanOrEqualTo(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN_OR_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateLessThan(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateLessThanOrEqualTo(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN_OR_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateBetween(LocalDate startOfEstablishedDate, LocalDate endOfEstablishedDate){ + return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); + } + public SchoolRequest withEstablishedDateBefore(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateBefore(Date establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateAfter(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateAfter(Date establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateBetween(Date startOfEstablishedDate, Date endOfEstablishedDate){ + return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); + } + + + + + public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ + if (studentCapacity == null || studentCapacity.length == 0) { + throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); + } + return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); + } + + public SchoolRequest withStudentCapacity(Operator operator, Object... values){ + return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); + } + + public SchoolRequest withStudentCapacityIsUnknown(){ + return withStudentCapacity(Operator.IS_NULL); + } + + public SchoolRequest withStudentCapacityIsKnown(){ + return withStudentCapacity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); + } + + public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ + return withStudentCapacity(Operator.EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ + return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.IN, (Object[])studentCapacity); + } + + public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); + } + public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); + } + + + + public SchoolRequest filterByActive(Boolean... active){ + if (active == null || active.length == 0) { + throw new IllegalArgumentException("filterByActive parameter active cannot be empty"); + } + return appendSearchCriteria(createActiveCriteria(Operator.EQUAL, (Object[])active)); + } + + public SchoolRequest withActive(Operator operator, Object... values){ + return appendSearchCriteria(createActiveCriteria(operator, values)); + } + + public SchoolRequest withActiveIsUnknown(){ + return withActive(Operator.IS_NULL); + } + + public SchoolRequest withActiveIsKnown(){ + return withActive(Operator.IS_NOT_NULL); + } + + public SearchCriteria createActiveCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ACTIVE_PROPERTY, operator, values); + } + + public SchoolRequest whichAreActive(){ + return withActive(Operator.EQUAL, true); + } + + public SchoolRequest whichAreNotActive(){ + return withActive(Operator.EQUAL, false); + } + + + public SchoolRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public SchoolRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public SchoolRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public SchoolRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.CREATE_TIME_PROPERTY, operator, values); + } + + public SchoolRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public SchoolRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public SchoolRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public SchoolRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public SchoolRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public SchoolRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public SchoolRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public SchoolRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public SchoolRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.UPDATE_TIME_PROPERTY, operator, values); + } + + public SchoolRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public SchoolRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public SchoolRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public SchoolRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public SchoolRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); + } + + public SchoolRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SchoolRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolRequest minStudentCapacity(){ + return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest minStudentCapacityAs(String retName){ + super.min(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest maxStudentCapacity(){ + return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest maxStudentCapacityAs(String retName){ + super.max(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sumStudentCapacity(){ + return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sumStudentCapacityAs(String retName){ + super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest avgStudentCapacity(){ + return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest avgStudentCapacityAs(String retName){ + super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest standardDeviationStudentCapacity(){ + return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest standardDeviationStudentCapacityAs(String retName){ + super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ + return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sampleVarianceStudentCapacity(){ + return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ + super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest samplePopulationVarianceStudentCapacity(){ + return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ + super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(School.PLATFORM_PROPERTY, subRequest); + return this; + } + + public SchoolRequest groupBySchoolTypeWithDetails(){ + return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); + } + + public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); + return this; + } + + + + + + + + + + public SchoolRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, School.ID_PROPERTY); + return this; + } + public SchoolRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public SchoolRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, School.NAME_PROPERTY); + return this; + } + public SchoolRequest countDistinctAddress(){ + return countDistinctAddressAs("address_distinct_count"); + } + + public SchoolRequest countDistinctAddressAs(String alias){ + super.countDistinctProperty(alias, School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest countDistinctEstablishedDate(){ + return countDistinctEstablishedDateAs("established_date_distinct_count"); + } + + public SchoolRequest countDistinctEstablishedDateAs(String alias){ + super.countDistinctProperty(alias, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public SchoolRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest countDistinctActive(){ + return countDistinctActiveAs("active_distinct_count"); + } + + public SchoolRequest countDistinctActiveAs(String alias){ + super.countDistinctProperty(alias, School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public SchoolRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public SchoolRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupById(){ + groupBy(School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdAs(String retName){ + groupBy(retName, School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ID_PROPERTY, function); + return this; + } + public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(School.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolRequest groupByPlatform(){ + groupBy(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformAs(String retName){ + groupBy(retName, School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.PLATFORM_PROPERTY, function); + return this; + } + public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); + return this; + } + public SchoolRequest groupBySchoolType(){ + groupBy(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeAs(String retName){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByName(){ + groupBy(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameAs(String retName){ + groupBy(retName, School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.NAME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByAddress(){ + groupBy(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest groupByAddressAs(String retName){ + groupBy(retName, School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest groupByAddressWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ADDRESS_PROPERTY, function); + return this; + } + + public SchoolRequest groupByEstablishedDate(){ + groupBy(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest groupByEstablishedDateAs(String retName){ + groupBy(retName, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest groupByEstablishedDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ESTABLISHED_DATE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByStudentCapacity(){ + groupBy(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityAs(String retName){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); + return this; + } + + public SchoolRequest groupByActive(){ + groupBy(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest groupByActiveAs(String retName){ + groupBy(retName, School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest groupByActiveWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ACTIVE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByCreateTime(){ + groupBy(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByCreateTimeAs(String retName){ + groupBy(retName, School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.CREATE_TIME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByUpdateTime(){ + groupBy(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.UPDATE_TIME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByVersion(){ + groupBy(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionAs(String retName){ + groupBy(retName, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.VERSION_PROPERTY, function); + return this; + } + + public SchoolRequest withSchoolTypeIsPrimary(){ + filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_PRIMARY); + return this; + } + + + public SchoolRequest withSchoolTypeIsSecondary(){ + filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_SECONDARY); + return this; + } + + + + + public SchoolRequest orderByIdAscending(){ + addOrderByAscending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByIdDescending(){ + addOrderByDescending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformAscending(){ + addOrderByAscending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformDescending(){ + addOrderByDescending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeAscending(){ + addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeDescending(){ + addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderByNameAscending(){ + addOrderByAscending(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescending(){ + addOrderByDescending(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByAddressAscending(){ + addOrderByAscending(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest orderByAddressDescending(){ + addOrderByDescending(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest orderByAddressAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest orderByAddressDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest orderByEstablishedDateAscending(){ + addOrderByAscending(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest orderByEstablishedDateDescending(){ + addOrderByDescending(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityAscending(){ + addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityDescending(){ + addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByActiveAscending(){ + addOrderByAscending(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest orderByActiveDescending(){ + addOrderByDescending(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest orderByCreateTimeAscending(){ + addOrderByAscending(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByCreateTimeDescending(){ + addOrderByDescending(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByUpdateTimeAscending(){ + addOrderByAscending(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByUpdateTimeDescending(){ + addOrderByDescending(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionAscending(){ + addOrderByAscending(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionDescending(){ + addOrderByDescending(School.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + public SchoolTypeRequest rollUpToSchoolType(){ + SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); + this.internalRollUpTo("school_type", schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); + return schoolType; + } + + + + + + + + + + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); + return this; + } + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ + return facetBySchoolTypeAs(facetName, schoolType, true); + } + + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ + addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java new file mode 100644 index 000000000..082e03793 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java @@ -0,0 +1,193 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.school.School; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SchoolType extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SchoolType"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "36f5b35e840d2f9ef89c6ee13c7d936fa10abc12a139d7f0373f9acabc9eac12"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String CODE_PROPERTY = "code"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + private Platform platform; + + private String name; + + private String code; + + private BigDecimal displayOrder; + + private SmartList schoolList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public String getCode(){ + return this.code; + } + + public BigDecimal getDisplayOrder(){ + return this.displayOrder; + } + + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public SchoolType updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public SchoolType updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public SchoolType updateCode(String code){ + code = (code == null ? null : code.trim()); + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ + return this; + } + handleUpdate(CODE_PROPERTY, getCode(), code); + this.code = code; + return this; + } + + public SchoolType updateDisplayOrder(BigDecimal displayOrder){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ + return this; + } + handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); + this.displayOrder = displayOrder; + return this; + } + + public SchoolType addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); + return this; + } + + public static SchoolType refer(Long id){ + SchoolType refer = new SchoolType(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SchoolType comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "code": this.code = (value == null ? null : ((String)value).trim()); break; + + case "display_order": this.displayOrder = (BigDecimal) value; break; + + case "school_list": this.schoolList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "display_order": return this.displayOrder; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "displayOrder": return this.displayOrder; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java new file mode 100644 index 000000000..6e59fad6a --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java @@ -0,0 +1,88 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class SchoolTypeChecker implements Checker{ + + public String type(){ + return SchoolType.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if(needCheck(_context, schoolType)){ + markAsChecked(_context, schoolType); + doCheck(_context, schoolType, _parentLocation); + } + } + + public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if((schoolType == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, schoolType); + if(schoolType.needPersist()){ + } + if(schoolType.newItem()){ + }else if(schoolType.updateItem()){ + if(!schoolType.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("display_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); + checkDisplayOrder(_context, schoolType.getProperty(SchoolType.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); + for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ + School school = schoolType.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); + if((code == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, code); + + } + public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, displayOrder); + if((displayOrder == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java new file mode 100644 index 000000000..f77c8c705 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java @@ -0,0 +1,76 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolTypeExpression(Expression expression){ + super(expression); + } + + public SchoolTypeExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolTypeExpression updateId(Long id){ + return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); + } + + public SchoolTypeExpression save(UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolTypeExpression save(String intent, UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); + } + + public SchoolTypeExpression updatePlatform(Platform platform){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", SchoolType::getName); + } + public SchoolTypeExpression updateName(String name){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); + } + + public Expression getCode(){ + return loaded("code", "getCode", SchoolType::getCode); + } + public SchoolTypeExpression updateCode(String code){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); + } + + public Expression getDisplayOrder(){ + return loaded("display_order", "getDisplayOrder", SchoolType::getDisplayOrder); + } + public SchoolTypeExpression updateDisplayOrder(BigDecimal displayOrder){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateDisplayOrder(displayOrder)); + } + + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); + } + public SchoolTypeExpression addSchool(School school){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java new file mode 100644 index 000000000..55fdae628 --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.schooltype; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolTypeListExpression extends SmartListExpression { + public SchoolTypeListExpression(Expression> expression){ + super(expression); + } + + public SchoolTypeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolTypeExpression first() { + return new SchoolTypeExpression(super.first()); + } + + public SchoolTypeExpression get(int index) { + return new SchoolTypeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java new file mode 100644 index 000000000..1b91f030f --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java @@ -0,0 +1,1238 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class SchoolTypeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolTypeRequest(Class returnType){ + this(returnType, () -> (T) new SchoolType()); + } + + protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolTypeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolTypeRequest copy(){ + return (SchoolTypeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolTypeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolTypeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolTypeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolTypeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolTypeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ + super.internalMatchAny(schoolType); + return this; + } + + public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); + } + + public SchoolTypeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolTypeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolTypeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolTypeRequest selectSelf(){ + super.selectSelf(); + return selectPlatformIdOnly().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + public SchoolTypeRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolTypeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolType.PLATFORM_PROPERTY); + selectProperty(SchoolType.ID_PROPERTY); + selectProperty(SchoolType.NAME_PROPERTY); + selectProperty(SchoolType.CODE_PROPERTY); + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest selectAll(){ + super.selectAll(); + return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + public SchoolTypeRequest selectChildren(){ + super.selectAny(); + selectSchoolList(); + return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + + public SchoolTypeRequest selectPlatformIdOnly(){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + public SchoolTypeRequest unselectPlatform(){ + unselectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest selectId(){ + selectProperty(SchoolType.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectId(){ + unselectProperty(SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest selectName(){ + selectProperty(SchoolType.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectName(){ + unselectProperty(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest selectCode(){ + selectProperty(SchoolType.CODE_PROPERTY); + return this; + } + + /** + * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectCode(){ + unselectProperty(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest selectDisplayOrder(){ + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + /** + * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. + * @param aggrFunction aggrFunction + */ + public SchoolTypeRequest selectDisplayOrder(AggrFunction aggrFunction){ + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY, aggrFunction); + return this; + } + + + public SchoolTypeRequest unselectDisplayOrder(){ + unselectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest selectVersion(){ + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectVersion(){ + unselectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolTypeRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolTypeRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolTypeRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); + } + + public SchoolTypeRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolTypeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); + } + + public SchoolTypeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolTypeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolTypeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolTypeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolTypeRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolTypeRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolTypeRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolTypeRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); + } + + public SchoolTypeRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolTypeRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolTypeRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolTypeRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolTypeRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolTypeRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolTypeRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolTypeRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolTypeRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolTypeRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolTypeRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolTypeRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolTypeRequest filterByCode(String... code){ + if (code == null || code.length == 0) { + throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); + } + return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); + } + + public SchoolTypeRequest withCode(Operator operator, Object... values){ + return appendSearchCriteria(createCodeCriteria(operator, values)); + } + + public SchoolTypeRequest withCodeIsUnknown(){ + return withCode(Operator.IS_NULL); + } + + public SchoolTypeRequest withCodeIsKnown(){ + return withCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); + } + + public SchoolTypeRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public SchoolTypeRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public SchoolTypeRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } + public SchoolTypeRequest withCodeGreaterThan(String code){ + return withCode(Operator.GREATER_THAN, code); + } + + public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ + return withCode(Operator.GREATER_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeLessThan(String code){ + return withCode(Operator.LESS_THAN, code); + } + + public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ + return withCode(Operator.LESS_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ + return withCode(Operator.BETWEEN, startOfCode, endOfCode); + } + public SchoolTypeRequest withCodeStartingWith(String code){ + return withCode(Operator.BEGIN_WITH, code); + } + public SchoolTypeRequest withCodeContaining(String code){ + return withCode(Operator.CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + + public SchoolTypeRequest withCodeEndingWith(String code){ + return withCode(Operator.END_WITH, code); + } + + public SchoolTypeRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + + public SchoolTypeRequest withCodeIs(String code){ + return withCode(Operator.EQUAL, code); + } + + public SchoolTypeRequest withCodeSoundingLike(String code){ + return withCode(Operator.SOUNDS_LIKE, code); + } + + + + public SchoolTypeRequest filterByDisplayOrder(BigDecimal... displayOrder){ + if (displayOrder == null || displayOrder.length == 0) { + throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); + } + return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); + } + + public SchoolTypeRequest withDisplayOrder(Operator operator, Object... values){ + return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); + } + + public SchoolTypeRequest withDisplayOrderIsUnknown(){ + return withDisplayOrder(Operator.IS_NULL); + } + + public SchoolTypeRequest withDisplayOrderIsKnown(){ + return withDisplayOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.DISPLAY_ORDER_PROPERTY, operator, values); + } + + public SchoolTypeRequest withDisplayOrderIs(BigDecimal displayOrder){ + return withDisplayOrder(Operator.EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderIsNot(BigDecimal displayOrder){ + return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.IN, (Object[])displayOrder); + } + + public SchoolTypeRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); + } + public SchoolTypeRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderLessThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ + return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); + } + + + + public SchoolTypeRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolTypeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolTypeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolTypeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); + } + + public SchoolTypeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolTypeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolTypeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolTypeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolTypeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); + } + + public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); + } + + public SchoolTypeRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolTypeRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolTypeRequest minDisplayOrder(){ + return minDisplayOrderAs(prefix("minOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest minDisplayOrderAs(String retName){ + super.min(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest maxDisplayOrder(){ + return maxDisplayOrderAs(prefix("maxOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest maxDisplayOrderAs(String retName){ + super.max(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest sumDisplayOrder(){ + return sumDisplayOrderAs(prefix("sumOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest sumDisplayOrderAs(String retName){ + super.sum(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest avgDisplayOrder(){ + return avgDisplayOrderAs(prefix("avgOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest avgDisplayOrderAs(String retName){ + super.avg(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest standardDeviationDisplayOrder(){ + return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest standardDeviationDisplayOrderAs(String retName){ + super.standardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ + return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest sampleVarianceDisplayOrder(){ + return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest sampleVarianceDisplayOrderAs(String retName){ + super.sampleVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest samplePopulationVarianceDisplayOrder(){ + return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest samplePopulationVarianceDisplayOrderAs(String retName){ + super.samplePopulationVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + public SchoolTypeRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolTypeRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolTypeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolTypeRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public SchoolTypeRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public SchoolTypeRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolTypeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + + public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolTypeRequest groupByPlatform(){ + groupBy(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformAs(String retName){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupById(){ + groupBy(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdAs(String retName){ + groupBy(retName, SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.ID_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByName(){ + groupBy(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameAs(String retName){ + groupBy(retName, SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.NAME_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByCode(){ + groupBy(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeAs(String retName){ + groupBy(retName, SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.CODE_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByDisplayOrder(){ + groupBy(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByDisplayOrderAs(String retName){ + groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByVersion(){ + groupBy(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionAs(String retName){ + groupBy(retName, SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.VERSION_PROPERTY, function); + return this; + } + + + + public SchoolTypeRequest orderByPlatformAscending(){ + addOrderByAscending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByPlatformDescending(){ + addOrderByDescending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdAscending(){ + addOrderByAscending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdDescending(){ + addOrderByDescending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameAscending(){ + addOrderByAscending(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescending(){ + addOrderByDescending(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscending(){ + addOrderByAscending(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescending(){ + addOrderByDescending(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByDisplayOrderAscending(){ + addOrderByAscending(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByDisplayOrderDescending(){ + addOrderByDescending(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionAscending(){ + addOrderByAscending(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionDescending(){ + addOrderByDescending(SchoolType.VERSION_PROPERTY); + return this; + } + + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + public SchoolTypeRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolTypeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolTypeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolTypeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolTypeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolTypeRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolTypeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/school-management/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..29fd0dd7c --- /dev/null +++ b/examples/school-management/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.schoolmanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/school-management/java-lib-core/teaql/checker-model.json b/examples/school-management/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..f81ff864c --- /dev/null +++ b/examples/school-management/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:71ba9da7267282a87034f786438f6f60442609b86ca42c3ef288e51c43107ce1","entities":{"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"base_url","labels":{"en":"base url"},"aliases":["BaseUrl","baseUrl"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"school_list","targetType":"School","labels":{"en":"School"},"aliases":["SchoolList","schoolList"]},{"name":"school_type_list","targetType":"SchoolType","labels":{"en":"School Type"},"aliases":["SchoolTypeList","schoolTypeList"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"School":{"labels":{"en":"School"},"fields":[{"name":"active","labels":{"en":"active"},"aliases":["Active"]},{"name":"address","labels":{"en":"address"},"aliases":["Address"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"established_date","labels":{"en":"established date"},"aliases":["EstablishedDate","establishedDate"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"school_type","targetType":"SchoolType","labels":{"en":"School Type"},"aliases":["SchoolType","schoolType"]},{"name":"student_capacity","labels":{"en":"student capacity"},"aliases":["StudentCapacity","studentCapacity"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolType":{"labels":{"en":"School Type"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"school_list","targetType":"School","labels":{"en":"School"},"aliases":["SchoolList","schoolList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/school-management/java-lib-core/teaql/model-provenance.json b/examples/school-management/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..a9e08fd03 --- /dev/null +++ b/examples/school-management/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:5d2fc608b6317e2cbd4c0e4bd58bbe0dba4f7dc60a35e4cccabd1c83a4dfd810","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/school-management/showcase.json b/examples/school-management/showcase.json new file mode 100644 index 000000000..e806f7244 --- /dev/null +++ b/examples/school-management/showcase.json @@ -0,0 +1,57 @@ +{ + "expected": { + "constantIdentities": [ + 1001, + 1002 + ], + "originalApplicationFilesRetained": 10, + "rootIdentity": 1, + "sameDatabaseStarts": 2 + }, + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/school-management", + "library": { + "generatedFilesManifestSHA256": "36aa5ebe3434fd92b95076e0d6bd9f35f59497faa7d4950c551b45cc4328ff1b", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "models/school-model.xml", + "sha256": "b5cd06ae44464fc29ed24de82654b47c80f546110496756aa15923cee1c511b4" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/school-generation/receipt.json", + "receiptSHA256": "86cdc634a758fdf746de3323e8cd5c4fd32a050e50c0b7b04c5e64b397a1165f" + }, + "scene": "School bootstrap, constant reconciliation and complete School query/save lifecycle", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "Makefile", + "docs/teaql-java-crud-guide.md", + "pom.xml", + "src/main/java/com/example/schoolmanagementservice/App.java", + "src/main/java/com/example/schoolmanagementservice/BootstrapTraceVerifier.java", + "src/main/java/com/example/schoolmanagementservice/CustomUserContext.java", + "src/main/java/com/example/schoolmanagementservice/RequestIntentVerifier.java", + "src/main/java/com/example/schoolmanagementservice/SchoolLifecycleVerifier.java", + "src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java", + "src/main/resources/application.properties" + ], + "generatedFilesManifestSHA256": "820c6d2a699fd8ce6686d6f6398357195211c062f2fd95ff87a2dde57aff4765", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/school-management/verify.sh b/examples/school-management/verify.sh new file mode 100644 index 000000000..e1e138c31 --- /dev/null +++ b/examples/school-management/verify.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" +: "${TEAQL_MAVEN_DEPENDENCY_CACHE:?Use the documented isolated source qualifier for this gate}" +if [[ -n "${TEAQL_SCHOOL_EVIDENCE_DIR:-}" ]]; then + evidence="$TEAQL_SCHOOL_EVIDENCE_DIR" + mkdir "$evidence" +else + evidence="$(mktemp -d -t teaql-java-school-evidence.XXXXXXXX)" +fi +scratch="$(mktemp -d -t teaql-java-school-build.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +fingerprint() { + (cd "$example" && find java-lib-core java-app-console -type f \ + ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) +} +fingerprint > "$evidence/source-before.sha256" +python3 -B - "$example" "$scratch" <<'PY' +from pathlib import Path +import shutil, sys +source, destination = map(Path, sys.argv[1:]) +for scope in ['java-lib-core', 'java-app-console']: + for path in (source / scope).rglob('*'): + assert not path.is_symlink(), path + shutil.copytree(source / scope, destination / scope, ignore=shutil.ignore_patterns('target', '.git')) +PY +library="$scratch/java-lib-core/lib/pom.xml" +workspace="$scratch/java-app-console/pom.xml" +mvn -o -f "$library" install -DskipTests > "$evidence/library-build.log" 2>&1 +for round in 1 2; do + timeout --kill-after=10s 180s mvn -o -f "$workspace" spring-boot:run \ + "-Dspring-boot.run.arguments=--spring.main.web-application-type=none --server.port=0 --spring.datasource.url=jdbc:sqlite:$evidence/showcase.sqlite" \ + > "$evidence/run-$round.log" 2>&1 +done +fingerprint > "$evidence/source-after.sha256" +cmp "$evidence/source-before.sha256" "$evidence/source-after.sha256" +python3 -B - "$evidence" "$scratch" "$TEAQL_MAVEN_DEPENDENCY_CACHE" <<'PY' +import hashlib, json, pathlib, sqlite3, sys, xml.etree.ElementTree as ET +root, scratch, cache = map(pathlib.Path, sys.argv[1:]) +markers = ['PASS Java generated School dynamic search: related scope, drift warnings, typed bindings', + 'PASS Java School Q/E/Checker/audited create-update-delete lifecycle', + 'PASS Java request-owned comment/purpose gates and generated relation inheritance', + 'PASS Java School bootstrap, portable Query, and native SQLite Facet parity'] +for round in [1, 2]: + text = (root / f'run-{round}.log').read_text() + for marker in markers: + assert marker in text, marker + state = f'fresh={str(round == 1).lower()} originalVersion={1 if round == 1 else 3}' + assert 'PASS Java generated bootstrap request intent, committed trace and reconciliation ' + state in text + assert 'BUILD SUCCESS' in text +pom = ET.parse(scratch / 'java-lib-core/lib/pom.xml').getroot() +namespace = {'m': 'http://maven.apache.org/POM/4.0.0'} +group, name, version = [pom.find('m:' + key, namespace).text for key in ['groupId', 'artifactId', 'version']] +jar = scratch / 'java-lib-core/lib/target' / f'{name}-{version}.jar' +installed = cache / group.replace('.', '/') / name / version / jar.name +assert jar.is_file() and installed.is_file() and jar.read_bytes() == installed.read_bytes() +database = root / 'showcase.sqlite' +with sqlite3.connect(database.resolve().as_uri() + '?mode=ro&immutable=1', uri=True) as connection: + rows = connection.execute('SELECT name,version,student_capacity FROM school_data WHERE version>0').fetchall() + assert rows == [('Riverside Primary School', 1, 800)], rows + deleted = connection.execute('SELECT name,version FROM school_data WHERE version<0').fetchall() + assert deleted == [('Lifecycle Probe Academy', -3), ('Lifecycle Probe Academy', -3)], deleted + types = connection.execute('SELECT id,version FROM school_type_data ORDER BY id').fetchall() + assert types == [(1001, 5), (1002, 1)], types + assert connection.execute('SELECT count(*) FROM platform_data').fetchone() == (1,) + assert connection.execute('PRAGMA quick_check').fetchone() == ('ok',) +receipt = dict(schema='teaql.java-school-business/v1', passed=True, originalApplicationAssertionsPassed=True, + sameDatabaseStarts=2, generatedScopesUnchanged=True, originalApplicationSourceUnchanged=True, + artifactKind='new local source build; not a historical or published artifact', + installedDomainArtifactSHA256=hashlib.sha256(jar.read_bytes()).hexdigest(), + sqliteRows=rows, deletedLifecycleRows=deleted, schoolTypeVersions=types, + databaseSHA256=hashlib.sha256(database.read_bytes()).hexdigest()) +(root / 'business-receipt.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') +print(json.dumps(dict(passed=True, sameDatabaseStarts=2, sourceArtifactInstalled=True))) +PY diff --git a/examples/verify-runtime-examples.sh b/examples/verify-runtime-examples.sh index 821c4a6e3..8775f8cc0 100755 --- a/examples/verify-runtime-examples.sh +++ b/examples/verify-runtime-examples.sh @@ -6,17 +6,20 @@ run_dir="$(mktemp -d)" active_pid="" cleanup() { + local result=$? + trap - EXIT if [[ -n "$active_pid" ]] && kill -0 "$active_pid" 2>/dev/null; then kill "$active_pid" 2>/dev/null || true wait "$active_pid" 2>/dev/null || true fi rm -rf "$run_dir" + exit "$result" } trap cleanup EXIT mvn -q -f "$repo_dir/pom.xml" \ -Pruntime-examples \ - -pl examples/conformance,examples/school-management \ + -pl examples/conformance,examples/school-management/java-app-console \ -am package -DskipTests run_example() { @@ -80,7 +83,7 @@ for repetition in 1 2; do run_example \ "school-management" \ - "$repo_dir/examples/school-management/target/deploy/school-management-service-0.0.1-SNAPSHOT.jar" \ + "$repo_dir/examples/school-management/java-app-console/target/deploy/school-management-service-0.0.1-SNAPSHOT.jar" \ "PASS Java School bootstrap, portable Query, and native SQLite Facet parity" "$repetition" done diff --git a/pom.xml b/pom.xml index 065bfd24b..bbc22b998 100644 --- a/pom.xml +++ b/pom.xml @@ -373,8 +373,8 @@ runtime-examples - examples/school-management/lib - examples/school-management + examples/school-management/java-lib-core/lib + examples/school-management/java-app-console examples/trace-chain/lib examples/trace-chain examples/standard-order/generated/lib diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index c6025e1bb..e7fa0cabb 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -42,8 +42,8 @@ mvn -q -f examples/conformance/pom.xml spring-boot:run \ -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/conformance.db" TEAQL_JAVA_SPRING_EVIDENCE_DIR="$evidence_dir/spring-transactions" \ node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/conformance/spring-transactions/verify-local.cjs" -mvn -q -f examples/school-management/lib/pom.xml install -DskipTests -mvn -q -f examples/school-management/pom.xml spring-boot:run \ +mvn -q -f examples/school-management/java-lib-core/lib/pom.xml install -DskipTests +mvn -q -f examples/school-management/java-app-console/pom.xml spring-boot:run \ -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/school-management.db" mvn -q -f examples/order-management/pom.xml install -DskipTests # The console resolves .local/order.db from its process directory. Never mutate From 932ad87e4140f38602e495fada76361ed63e60f8 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 11:37:43 +0800 Subject: [PATCH 14/71] Record offline School source qualification and two-start business proof --- examples/school-management/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/school-management/showcase.json b/examples/school-management/showcase.json index e806f7244..70434687b 100644 --- a/examples/school-management/showcase.json +++ b/examples/school-management/showcase.json @@ -30,9 +30,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/school-generation/receipt.json", "receiptSHA256": "86cdc634a758fdf746de3323e8cd5c4fd32a050e50c0b7b04c5e64b397a1165f" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-school-scopes/runtime/school-management/business-receipt.json", + "businessReceiptSHA256": "0448c958f316e77aa588f94676e2f177e7951ebecbb3af3a5c95b4992b0eff58", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-school-scopes/receipt.json", + "nativeReceiptSHA256": "a06a7cc0a58f53f1ca9ce7898d73015191e71bc655d6ee96c2ef3761a19ae2db", + "remainingFullRuntimeInventory": true, + "sourceCommit": "7e3843684ae46cf72366e4172feaa82e5d61199f" + }, "scene": "School bootstrap, constant reconciliation and complete School query/save lifecycle", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "verify.sh" From ce0eec9f271035f15eb6f147ac88de14b88de5f9 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 12:26:35 +0800 Subject: [PATCH 15/71] Use the generated Java Order workspace with the retained business and policy application --- examples/order-management/README.md | 10 +- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 71 + .../java-app-console/DOMAIN_API_GUIDE.md | 34 + .../java-app-console/Makefile | 11 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 228 +++ .../java-app-console/lib/pom.xml | 102 + .../BaseServiceConfiguration.java | 0 .../ordermanagementservice/Checkers.java | 0 .../ordermanagementservice/Constants.java | 13 + .../com/teaql/ordermanagementservice/E.java | 43 + .../EntityMetaRegistry.java | 1741 ++++++++++++++++ .../GeneratedRuntimeModule.java | 82 + .../OrderManagementServiceUserContext.java | 10 + .../com/teaql/ordermanagementservice/Q.java | 70 + .../ordermanagementservice/Repositories.java | 0 .../commerceplatform/CommercePlatform.java | 281 +++ .../CommercePlatformChecker.java | 126 ++ .../CommercePlatformExpression.java | 106 + .../CommercePlatformListExpression.java | 25 + .../CommercePlatformRequest.java | 1643 ++++++++++++++++ .../customer/Customer.java | 213 ++ .../customer/CustomerChecker.java | 121 ++ .../customer/CustomerExpression.java | 83 + .../customer/CustomerListExpression.java | 25 + .../customer/CustomerRequest.java | 1313 +++++++++++++ .../customerorder/CustomerOrder.java | 291 +++ .../customerorder/CustomerOrderChecker.java | 157 ++ .../CustomerOrderExpression.java | 115 ++ .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 1742 +++++++++++++++++ .../orderline/OrderLine.java | 232 +++ .../orderline/OrderLineChecker.java | 126 ++ .../orderline/OrderLineExpression.java | 95 + .../orderline/OrderLineListExpression.java | 25 + .../orderline/OrderLineRequest.java | 1402 +++++++++++++ .../ordersearchpreset/OrderSearchPreset.java | 232 +++ .../OrderSearchPresetChecker.java | 139 ++ .../OrderSearchPresetExpression.java | 89 + .../OrderSearchPresetListExpression.java | 25 + .../OrderSearchPresetRequest.java | 1390 +++++++++++++ .../orderstatus/OrderStatus.java | 214 ++ .../orderstatus/OrderStatusChecker.java | 98 + .../orderstatus/OrderStatusExpression.java | 83 + .../OrderStatusListExpression.java | 25 + .../orderstatus/OrderStatusRequest.java | 1374 +++++++++++++ .../product/Product.java | 234 +++ .../product/ProductChecker.java | 132 ++ .../product/ProductExpression.java | 90 + .../product/ProductListExpression.java | 25 + .../product/ProductRequest.java | 1458 ++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../order-management/java-app-console/pom.xml | 2 +- .../com/teaql/ordermanagementservice/App.java | 9 + .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 158 ++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + examples/order-management/showcase.json | 53 + examples/order-management/verify.sh | 76 + scripts/verify-examples.sh | 5 +- 67 files changed, 16727 insertions(+), 6 deletions(-) create mode 100644 examples/order-management/java-app-console/.gitignore create mode 100644 examples/order-management/java-app-console/AGENTS.md create mode 100644 examples/order-management/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/order-management/java-app-console/Makefile create mode 100644 examples/order-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/order-management/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/order-management/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/order-management/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/order-management/java-app-console/lib/pom.xml create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java create mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java create mode 100644 examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/App.java create mode 100644 examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/CustomUserContext.java create mode 100644 examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/order-management/java-app-console/src/main/resources/application.properties create mode 100644 examples/order-management/java-app-console/teaql-i18n.json create mode 100644 examples/order-management/java-app-console/teaql/checker-model.json create mode 100644 examples/order-management/java-app-console/teaql/model-provenance.json create mode 100644 examples/order-management/showcase.json create mode 100644 examples/order-management/verify.sh diff --git a/examples/order-management/README.md b/examples/order-management/README.md index eb43a0220..24a05db55 100644 --- a/examples/order-management/README.md +++ b/examples/order-management/README.md @@ -1,5 +1,13 @@ # Order Management — Java + SQLite +`model.xml` owns the exact generated `java-lib-core` and `java-app-console` +scopes. The native App entry delegates to the unchanged business program; its +customer-owned mutation policy remains in the workspace. Current provenance is +in `showcase.json`. The focused `bash verify.sh` gate uses disposable project +copies and isolated offline source-built runtime artifacts, starts the native +entry twice on one retained SQLite file, and verifies persisted orders and +policy-denied rows independently. It removes owned build outputs. + Use Java 21. No database server, fixture DB, model input, or generator installation is needed. ```bash @@ -15,7 +23,7 @@ an unauthorized high-value order as one complete graph, and queries SQLite to prove that zero order rows were written. The second run demonstrates idempotency and repeats the policy proof. -Read `java-app-console/.../OrderManagementApp.java` first (handwritten), then `java-lib-core/lib/.../Q.java`, `CustomerOrderRequest.java`, and `CustomerOrder.java` (generated). Java is the naming and governance gold standard: `comment(...)` may appear anywhere before `purpose(...)`; only the purposed request exposes execute methods. +Read `java-app-console/.../OrderManagementApp.java` first. Discover generated APIs through current model-aware Assist. Java is the naming and governance gold standard: `comment(...)` may appear anywhere before `purpose(...)`; only the purposed request exposes execute methods. ## Verify the first result diff --git a/examples/order-management/java-app-console/.gitignore b/examples/order-management/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/order-management/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/order-management/java-app-console/AGENTS.md b/examples/order-management/java-app-console/AGENTS.md new file mode 100644 index 000000000..e83e650e4 --- /dev/null +++ b/examples/order-management/java-app-console/AGENTS.md @@ -0,0 +1,71 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| commerce_platform | commerce_platform | +| customer | customer | +| order_status | order_status | +| customer_order | customer_order | +| product | product | +| order_line | order_line | +| order_search_preset | order_search_preset | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/order-management/java-app-console/DOMAIN_API_GUIDE.md b/examples/order-management/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..3b335bb2f --- /dev/null +++ b/examples/order-management/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,34 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/order-management-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| commerce_platform | commerce_platform | +| customer | customer | +| order_status | order_status | +| customer_order | customer_order | +| product | product | +| order_line | order_line | +| order_search_preset | order_search_preset | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/order-management/java-app-console/Makefile b/examples/order-management/java-app-console/Makefile new file mode 100644 index 000000000..8b1acfb12 --- /dev/null +++ b/examples/order-management/java-app-console/Makefile @@ -0,0 +1,11 @@ +.PHONY: build run test + +build: + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests + mvn package -DskipTests + +run: build + mvn exec:java + +test: + mvn test diff --git a/examples/order-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/order-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..28ec475e9 --- /dev/null +++ b/examples/order-management/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/order-management-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/order-management/java-app-console/STANDARD_TELEMETRY.md b/examples/order-management/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/order-management/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/order-management/java-app-console/TOOL_API_GUIDE.md b/examples/order-management/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..fde1e8b79 --- /dev/null +++ b/examples/order-management/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/order-management-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/order-management-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/order-management-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/order-management-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/order-management-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/order-management-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/order-management/java-app-console/docs/teaql-java-crud-guide.md b/examples/order-management/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..c0373c155 --- /dev/null +++ b/examples/order-management/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,228 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.ordermanagementservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.OrderManagementServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.commercePlatforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.commercePlatforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new CommercePlatform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.commercePlatforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.commercePlatforms() + .selectCustomerListWith(Q.customers().selectSelf()) + .comment("load with customerList") + .purpose("fetch child customerList") + .executeForList(userContext); +``` + +```java +var list = Q.commercePlatforms() + .selectOrderStatusListWith(Q.orderStatuses().selectSelf()) + .comment("load with orderStatusList") + .purpose("fetch child orderStatusList") + .executeForList(userContext); +``` + +```java +var list = Q.commercePlatforms() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.commercePlatforms() + .selectProductListWith(Q.products().selectSelf()) + .comment("load with productList") + .purpose("fetch child productList") + .executeForList(userContext); +``` + +```java +var list = Q.commercePlatforms() + .selectOrderLineListWith(Q.orderLines().selectSelf()) + .comment("load with orderLineList") + .purpose("fetch child orderLineList") + .executeForList(userContext); +``` + +```java +var list = Q.commercePlatforms() + .selectOrderSearchPresetListWith(Q.orderSearchPresets().selectSelf()) + .comment("load with orderSearchPresetList") + .purpose("fetch child orderSearchPresetList") + .executeForList(userContext); +``` + +```java +var list = Q.customers() + .selectCommercePlatformWith(Q.commercePlatforms().selectSelf()) + .comment("load with commercePlatform") + .purpose("fetch associated commercePlatform") + .executeForList(userContext); +``` + + + +```java +var list = Q.customers() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.customerOrders() + .selectStatusWith(Q.orderStatuses().selectSelf()) + .comment("load with status") + .purpose("fetch associated status") + .executeForList(userContext); +``` +```java +var list = Q.customerOrders() + .selectCustomerWith(Q.customers().selectSelf()) + .comment("load with customer") + .purpose("fetch associated customer") + .executeForList(userContext); +``` +```java +var list = Q.customerOrders() + .selectCommercePlatformWith(Q.commercePlatforms().selectSelf()) + .comment("load with commercePlatform") + .purpose("fetch associated commercePlatform") + .executeForList(userContext); +``` + + + +```java +var list = Q.customerOrders() + .selectOrderLineListWith(Q.orderLines().selectSelf()) + .comment("load with orderLineList") + .purpose("fetch child orderLineList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `CommercePlatform`: reverse relations `6`, query `Q.commercePlatforms()`, save `new CommercePlatform().auditAs("comment").save(userContext)`, request `com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest` +- `Customer`: reverse relations `1`, query `Q.customers()`, save `new Customer().auditAs("comment").save(userContext)`, request `com.teaql.ordermanagementservice.customer.CustomerRequest` +- `CustomerOrder`: reverse relations `1`, query `Q.customerOrders()`, save `new CustomerOrder().auditAs("comment").save(userContext)`, request `com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest` \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/pom.xml b/examples/order-management/java-app-console/lib/pom.xml new file mode 100644 index 000000000..e02844cd5 --- /dev/null +++ b/examples/order-management/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + order-management-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java new file mode 100644 index 000000000..83c69ad5c --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java @@ -0,0 +1,13 @@ + +package com.teaql.ordermanagementservice; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; + +public interface Constants { + public static final long COMMERCE_PLATFORM_ID = 1l; + public static final CommercePlatform COMMERCE_PLATFORM = CommercePlatform.refer(COMMERCE_PLATFORM_ID); + public static final long ORDER_STATUS_PENDING_ID = 1001l ; + public static final OrderStatus ORDER_STATUS_PENDING = OrderStatus.refer(ORDER_STATUS_PENDING_ID);public static final long ORDER_STATUS_CONFIRMED_ID = 1002l ; + public static final OrderStatus ORDER_STATUS_CONFIRMED = OrderStatus.refer(ORDER_STATUS_CONFIRMED_ID); +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java new file mode 100644 index 000000000..8e27c74fc --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java @@ -0,0 +1,43 @@ + +package com.teaql.ordermanagementservice; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerExpression; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderExpression; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineExpression; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetExpression; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusExpression; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static CommercePlatformExpression commercePlatform(CommercePlatform commercePlatform){ + return new CommercePlatformExpression(new ValueExpression(commercePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.commercePlatform()")); + } + public static CustomerExpression customer(Customer customer){ + return new CustomerExpression(new ValueExpression(customer, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customer()")); + } + public static OrderStatusExpression orderStatus(OrderStatus orderStatus){ + return new OrderStatusExpression(new ValueExpression(orderStatus, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderStatus()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } + public static ProductExpression product(Product product){ + return new ProductExpression(new ValueExpression(product, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.product()")); + } + public static OrderLineExpression orderLine(OrderLine orderLine){ + return new OrderLineExpression(new ValueExpression(orderLine, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderLine()")); + } + public static OrderSearchPresetExpression orderSearchPreset(OrderSearchPreset orderSearchPreset){ + return new OrderSearchPresetExpression(new ValueExpression(orderSearchPreset, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderSearchPreset()")); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java new file mode 100644 index 000000000..d855d7fe5 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java @@ -0,0 +1,1741 @@ + +package com.teaql.ordermanagementservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerCommercePlatform(); + registerCustomer(); + registerOrderStatus(); + registerCustomerOrder(); + registerProduct(); + registerOrderLine(); + registerOrderSearchPreset(); + } + private void registerCommercePlatform() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Northwind Demo") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "createTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "updateTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomer() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.customer.Customer.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.customer.Customer.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.customer.Customer.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.customer.Customer::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY, String.class) + ; + PropertyDescriptor email = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY, String.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customer.Customer.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CUSTOMER_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderStatus() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.orderstatus.OrderStatus.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.orderstatus.OrderStatus.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.orderstatus.OrderStatus::new); + entityDescriptor.with("constant", "true") + + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY, String.class) + ; + PropertyDescriptor code = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY, String.class) + ; + PropertyDescriptor color = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COLOR_PROPERTY, String.class) + ; + PropertyDescriptor displayOrder = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ORDER_STATUS_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("candidates", "1001,1002") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Pending,Confirmed") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY).with("identifier", "true") + + .with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "PENDING,CONFIRMED") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("javaType", "java.lang.String") + + .with("candidates", "#F59E0B,#10B981") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("candidates", "1,2") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("candidates", "1,1") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.customerorder.CustomerOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor orderDate = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor totalAmount = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor status = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customerorder.CustomerOrder.STATUS_PROPERTY, com.teaql.ordermanagementservice.orderstatus.OrderStatus.INTERNAL_TYPE, com.teaql.ordermanagementservice.orderstatus.OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.ordermanagementservice.orderstatus.OrderStatus.class) + ; + PropertyDescriptor customer = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY, com.teaql.ordermanagementservice.customer.Customer.INTERNAL_TYPE, com.teaql.ordermanagementservice.customer.Customer.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.ordermanagementservice.customer.Customer.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.STATUS_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerProduct() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.product.Product.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.product.Product.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.product.Product.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.product.Product::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY, String.class) + ; + PropertyDescriptor sku = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY, String.class) + ; + PropertyDescriptor imageUrl = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.IMAGE_URL_PROPERTY, String.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.product.Product.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.PRODUCT_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.IMAGE_URL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderLine() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.orderline.OrderLine.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.orderline.OrderLine.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.orderline.OrderLine.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.orderline.OrderLine::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderline.OrderLine.CUSTOMER_ORDER_PROPERTY, com.teaql.ordermanagementservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_LINE_LIST_PROPERTY, com.teaql.ordermanagementservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor product = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_PROPERTY, com.teaql.ordermanagementservice.product.Product.INTERNAL_TYPE, com.teaql.ordermanagementservice.product.Product.ORDER_LINE_LIST_PROPERTY, com.teaql.ordermanagementservice.product.Product.class) + ; + PropertyDescriptor productName = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY, String.class) + ; + PropertyDescriptor sku = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY, String.class) + ; + PropertyDescriptor quantity = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY, Integer.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderline.OrderLine.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ORDER_LINE_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderSearchPreset() { + FieldLayout.installGenerated(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class); + entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY, String.class) + ; + PropertyDescriptor filterJson = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY, String.class) + ; + PropertyDescriptor requestId = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY, String.class) + ; + PropertyDescriptor ownerUserId = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY, String.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..098165a55 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java @@ -0,0 +1,82 @@ +package com.teaql.ordermanagementservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker(), new com.teaql.ordermanagementservice.customer.CustomerChecker(), new com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker(), new com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker(), new com.teaql.ordermanagementservice.product.ProductChecker(), new com.teaql.ordermanagementservice.orderline.OrderLineChecker(), new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:feb0a6c97f37d35282317bf77fbd60ffde5a4dc18d6f6a371fd40d2c37d6c975\",\"entities\":{\"CommercePlatform\":{\"labels\":{\"en\":\"commerce platform\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_list\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"customer\"},\"aliases\":[\"CustomerList\",\"customerList\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"order_search_preset_list\",\"targetType\":\"OrderSearchPreset\",\"labels\":{\"en\":\"order search preset\"},\"aliases\":[\"OrderSearchPresetList\",\"orderSearchPresetList\"]},{\"name\":\"order_status_list\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"order status\"},\"aliases\":[\"OrderStatusList\",\"orderStatusList\"]},{\"name\":\"product_list\",\"targetType\":\"Product\",\"labels\":{\"en\":\"product\"},\"aliases\":[\"ProductList\",\"productList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Customer\":{\"labels\":{\"en\":\"customer\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"email\",\"labels\":{\"en\":\"email\"},\"aliases\":[\"Email\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"customer order\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"customer\"},\"aliases\":[\"Customer\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_date\",\"labels\":{\"en\":\"order date\"},\"aliases\":[\"OrderDate\",\"orderDate\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"status\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"status\"},\"aliases\":[\"Status\"]},{\"name\":\"total_amount\",\"labels\":{\"en\":\"total amount\"},\"aliases\":[\"TotalAmount\",\"totalAmount\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderLine\":{\"labels\":{\"en\":\"order line\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product\",\"targetType\":\"Product\",\"labels\":{\"en\":\"product\"},\"aliases\":[\"Product\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderSearchPreset\":{", "\"labels\":{\"en\":\"order search preset\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"filter_json\",\"labels\":{\"en\":\"filter json\"},\"aliases\":[\"FilterJson\",\"filterJson\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"owner_user_id\",\"labels\":{\"en\":\"owner user id\"},\"aliases\":[\"OwnerUserId\",\"ownerUserId\"]},{\"name\":\"request_id\",\"labels\":{\"en\":\"request id\"},\"aliases\":[\"RequestId\",\"requestId\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderStatus\":{\"labels\":{\"en\":\"order status\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"color\",\"labels\":{\"en\":\"color\"},\"aliases\":[\"Color\"]},{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Product\":{\"labels\":{\"en\":\"product\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"image_url\",\"labels\":{\"en\":\"image url\"},\"aliases\":[\"ImageUrl\",\"imageUrl\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("CommercePlatform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Customer", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("email", "email"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderStatus", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("color", "color"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("order_date", "orderDate"), java.util.Map.entry("total_amount", "totalAmount"), java.util.Map.entry("status", "status"), java.util.Map.entry("customer", "customer"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Product", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("image_url", "imageUrl"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderLine", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("product", "product"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderSearchPreset", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("filter_json", "filterJson"), java.util.Map.entry("request_id", "requestId"), java.util.Map.entry("owner_user_id", "ownerUserId"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.commercePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.ordermanagementservice.commerceplatform.CommercePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.ordermanagementservice.commerceplatform.CommercePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Northwind Demo"); + domainRoot.auditAs("create generated Domain Root CommercePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("CommercePlatform", domainRoot.getId())); + var constantOrderStatus1001Rows = Q.orderStatuses().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1001Rows.isEmpty()) { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1001 = new com.teaql.ordermanagementservice.orderstatus.OrderStatus(); + constantOrderStatus1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1001, 1001L); + constantOrderStatus1001.updateName("Pending"); + constantOrderStatus1001.updateCode("PENDING"); + constantOrderStatus1001.updateColor("#F59E0B"); + constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); + constantOrderStatus1001.updateCommercePlatform(domainRoot); + constantOrderStatus1001.auditAs("create model constant OrderStatus(1001)").save(context); + } else { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1001 = constantOrderStatus1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1001.getName(), "Pending"))) { constantOrderStatus1001.updateName("Pending"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getCode(), "PENDING"))) { constantOrderStatus1001.updateCode("PENDING"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getColor(), "#F59E0B"))) { constantOrderStatus1001.updateColor("#F59E0B"); changed = true; } + if (!((constantOrderStatus1001.getDisplayOrder() != null && constantOrderStatus1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getCommercePlatform().getId(), domainRoot.getId()))) { constantOrderStatus1001.updateCommercePlatform(domainRoot); changed = true; } + if (changed) constantOrderStatus1001.auditAs("reconcile model constant OrderStatus(1001)").save(context); + } + var constantOrderStatus1002Rows = Q.orderStatuses().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1002Rows.isEmpty()) { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1002 = new com.teaql.ordermanagementservice.orderstatus.OrderStatus(); + constantOrderStatus1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1002, 1002L); + constantOrderStatus1002.updateName("Confirmed"); + constantOrderStatus1002.updateCode("CONFIRMED"); + constantOrderStatus1002.updateColor("#10B981"); + constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); + constantOrderStatus1002.updateCommercePlatform(domainRoot); + constantOrderStatus1002.auditAs("create model constant OrderStatus(1002)").save(context); + } else { + com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1002 = constantOrderStatus1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1002.getName(), "Confirmed"))) { constantOrderStatus1002.updateName("Confirmed"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getCode(), "CONFIRMED"))) { constantOrderStatus1002.updateCode("CONFIRMED"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getColor(), "#10B981"))) { constantOrderStatus1002.updateColor("#10B981"); changed = true; } + if (!((constantOrderStatus1002.getDisplayOrder() != null && constantOrderStatus1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getCommercePlatform().getId(), domainRoot.getId()))) { constantOrderStatus1002.updateCommercePlatform(domainRoot); changed = true; } + if (changed) constantOrderStatus1002.auditAs("reconcile model constant OrderStatus(1002)").save(context); + } + } +} diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java new file mode 100644 index 000000000..ce5d39903 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.ordermanagementservice; + +import io.teaql.core.UserContext; +public interface OrderManagementServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java new file mode 100644 index 000000000..0cdd1f62a --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java @@ -0,0 +1,70 @@ + +package com.teaql.ordermanagementservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest commercePlatforms(){ + return new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest commercePlatformsWithMinimalFields(){ + return new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordermanagementservice.customer.CustomerRequest customers(){ + return new com.teaql.ordermanagementservice.customer.CustomerRequest(com.teaql.ordermanagementservice.customer.Customer.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.customer.CustomerRequest customersWithMinimalFields(){ + return new com.teaql.ordermanagementservice.customer.CustomerRequest(com.teaql.ordermanagementservice.customer.Customer.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest orderStatuses(){ + return new com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest orderStatusesWithMinimalFields(){ + return new com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordermanagementservice.product.ProductRequest products(){ + return new com.teaql.ordermanagementservice.product.ProductRequest(com.teaql.ordermanagementservice.product.Product.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.product.ProductRequest productsWithMinimalFields(){ + return new com.teaql.ordermanagementservice.product.ProductRequest(com.teaql.ordermanagementservice.product.Product.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordermanagementservice.orderline.OrderLineRequest orderLines(){ + return new com.teaql.ordermanagementservice.orderline.OrderLineRequest(com.teaql.ordermanagementservice.orderline.OrderLine.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.orderline.OrderLineRequest orderLinesWithMinimalFields(){ + return new com.teaql.ordermanagementservice.orderline.OrderLineRequest(com.teaql.ordermanagementservice.orderline.OrderLine.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest orderSearchPresets(){ + return new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest orderSearchPresetsWithMinimalFields(){ + return new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java new file mode 100644 index 000000000..ccc71faac --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java @@ -0,0 +1,281 @@ + +package com.teaql.ordermanagementservice.commerceplatform; + +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.product.Product; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CommercePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CommercePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "67294964fa1d025f37e472895a7b4548e18b1d34e91dd854877dbc11d0367f28"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("create_time", 2), java.util.Map.entry("update_time", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_list", "order_status_list", "customer_order_list", "product_list", "order_line_list", "order_search_preset_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CommercePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String CUSTOMER_LIST_PROPERTY = "customer_list"; + public static final String ORDER_STATUS_LIST_PROPERTY = "order_status_list"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + public static final String PRODUCT_LIST_PROPERTY = "product_list"; + public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; + public static final String ORDER_SEARCH_PRESET_LIST_PROPERTY = "order_search_preset_list"; + private String name; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList customerList; + private SmartList orderStatusList; + private SmartList customerOrderList; + private SmartList productList; + private SmartList orderLineList; + private SmartList orderSearchPresetList; + + public String getName(){ + return this.name; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getCustomerList(){ + return this.customerList == null ? SmartList.unloaded() : this.customerList; + } + public SmartList getOrderStatusList(){ + return this.orderStatusList == null ? SmartList.unloaded() : this.orderStatusList; + } + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public SmartList getProductList(){ + return this.productList == null ? SmartList.unloaded() : this.productList; + } + public SmartList getOrderLineList(){ + return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; + } + public SmartList getOrderSearchPresetList(){ + return this.orderSearchPresetList == null ? SmartList.unloaded() : this.orderSearchPresetList; + } + public CommercePlatform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public CommercePlatform updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public CommercePlatform updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public CommercePlatform addCustomer(Customer customer){ + if (customer == null){ + return this; + } + + if(null == this.customerList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerList = teaqlUnloadedItems.map(value -> value); + } + + this.customerList.add(customer); + customer.updateCommercePlatform(this); + return this; + } + public CommercePlatform addOrderStatus(OrderStatus orderStatus){ + if (orderStatus == null){ + return this; + } + + if(null == this.orderStatusList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderStatusList = teaqlUnloadedItems.map(value -> value); + } + + this.orderStatusList.add(orderStatus); + orderStatus.updateCommercePlatform(this); + return this; + } + public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCommercePlatform(this); + return this; + } + public CommercePlatform addProduct(Product product){ + if (product == null){ + return this; + } + + if(null == this.productList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.productList = teaqlUnloadedItems.map(value -> value); + } + + this.productList.add(product); + product.updateCommercePlatform(this); + return this; + } + public CommercePlatform addOrderLine(OrderLine orderLine){ + if (orderLine == null){ + return this; + } + + if(null == this.orderLineList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderLineList = teaqlUnloadedItems.map(value -> value); + } + + this.orderLineList.add(orderLine); + orderLine.updateCommercePlatform(this); + return this; + } + public CommercePlatform addOrderSearchPreset(OrderSearchPreset orderSearchPreset){ + if (orderSearchPreset == null){ + return this; + } + + if(null == this.orderSearchPresetList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderSearchPresetList = teaqlUnloadedItems.map(value -> value); + } + + this.orderSearchPresetList.add(orderSearchPreset); + orderSearchPreset.updateCommercePlatform(this); + return this; + } + + public static CommercePlatform refer(Long id){ + CommercePlatform refer = new CommercePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CommercePlatform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "customer_list": this.customerList = (SmartList) value; break; + case "order_status_list": this.orderStatusList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + case "product_list": this.productList = (SmartList) value; break; + case "order_line_list": this.orderLineList = (SmartList) value; break; + case "order_search_preset_list": this.orderSearchPresetList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "customer_list": return this.customerList; + case "order_status_list": return this.orderStatusList; + case "customer_order_list": return this.customerOrderList; + case "product_list": return this.productList; + case "order_line_list": return this.orderLineList; + case "order_search_preset_list": return this.orderSearchPresetList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java new file mode 100644 index 000000000..51cc24171 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java @@ -0,0 +1,126 @@ + +package com.teaql.ordermanagementservice.commerceplatform; + +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerChecker; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineChecker; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetChecker; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class CommercePlatformChecker implements Checker{ + + public String type(){ + return CommercePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, commercePlatform)){ + markAsChecked(_context, commercePlatform); + doCheck(_context, commercePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if((commercePlatform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, commercePlatform); + if(commercePlatform.needPersist()){ + } + if(commercePlatform.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + commercePlatform.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + commercePlatform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(commercePlatform.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + commercePlatform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!commercePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!commercePlatform.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!commercePlatform.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCreateTime(_context, commercePlatform.getProperty(CommercePlatform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, commercePlatform.getProperty(CommercePlatform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; commercePlatform.getCustomerList() != null && i < commercePlatform.getCustomerList().size(); i++){ + Customer customer = commercePlatform.getCustomerList().get(i); + new CustomerChecker().checkAndFix(_context, customer, newLocation(_parentLocation, "customer_list", i)); + } + for(int i = 0; commercePlatform.getOrderStatusList() != null && i < commercePlatform.getOrderStatusList().size(); i++){ + OrderStatus orderStatus = commercePlatform.getOrderStatusList().get(i); + new OrderStatusChecker().checkAndFix(_context, orderStatus, newLocation(_parentLocation, "order_status_list", i)); + } + for(int i = 0; commercePlatform.getCustomerOrderList() != null && i < commercePlatform.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = commercePlatform.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + for(int i = 0; commercePlatform.getProductList() != null && i < commercePlatform.getProductList().size(); i++){ + Product product = commercePlatform.getProductList().get(i); + new ProductChecker().checkAndFix(_context, product, newLocation(_parentLocation, "product_list", i)); + } + for(int i = 0; commercePlatform.getOrderLineList() != null && i < commercePlatform.getOrderLineList().size(); i++){ + OrderLine orderLine = commercePlatform.getOrderLineList().get(i); + new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); + } + for(int i = 0; commercePlatform.getOrderSearchPresetList() != null && i < commercePlatform.getOrderSearchPresetList().size(); i++){ + OrderSearchPreset orderSearchPreset = commercePlatform.getOrderSearchPresetList().get(i); + new OrderSearchPresetChecker().checkAndFix(_context, orderSearchPreset, newLocation(_parentLocation, "order_search_preset_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java new file mode 100644 index 000000000..9bd17a4b3 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java @@ -0,0 +1,106 @@ + +package com.teaql.ordermanagementservice.commerceplatform; + +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerListExpression; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderListExpression; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineListExpression; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetListExpression; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusListExpression; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class CommercePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CommercePlatformExpression(Expression expression){ + super(expression); + } + + public CommercePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public CommercePlatformExpression updateId(Long id){ + return new CommercePlatformExpression(this, $it -> {((CommercePlatform)$it).__internalSet("id", id); return this;}); + } + + public CommercePlatformExpression save(UserContext userContext){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CommercePlatformExpression save(String intent, UserContext userContext){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", CommercePlatform::getName); + } + public CommercePlatformExpression updateName(String name){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateName(name)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", CommercePlatform::getCreateTime); + } + public CommercePlatformExpression updateCreateTime(LocalDateTime createTime){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", CommercePlatform::getUpdateTime); + } + public CommercePlatformExpression updateUpdateTime(LocalDateTime updateTime){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateUpdateTime(updateTime)); + } + + public CustomerListExpression getCustomerList(){ + return new CustomerListExpression(loaded("customer_list", "getCustomerList", CommercePlatform::getCustomerList)); + } + public OrderStatusListExpression getOrderStatusList(){ + return new OrderStatusListExpression(loaded("order_status_list", "getOrderStatusList", CommercePlatform::getOrderStatusList)); + } + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CommercePlatform::getCustomerOrderList)); + } + public ProductListExpression getProductList(){ + return new ProductListExpression(loaded("product_list", "getProductList", CommercePlatform::getProductList)); + } + public OrderLineListExpression getOrderLineList(){ + return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", CommercePlatform::getOrderLineList)); + } + public OrderSearchPresetListExpression getOrderSearchPresetList(){ + return new OrderSearchPresetListExpression(loaded("order_search_preset_list", "getOrderSearchPresetList", CommercePlatform::getOrderSearchPresetList)); + } + public CommercePlatformExpression addCustomer(Customer customer){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomer(customer)); + } + public CommercePlatformExpression addOrderStatus(OrderStatus orderStatus){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addOrderStatus(orderStatus)); + } + public CommercePlatformExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomerOrder(customerOrder)); + } + public CommercePlatformExpression addProduct(Product product){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addProduct(product)); + } + public CommercePlatformExpression addOrderLine(OrderLine orderLine){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addOrderLine(orderLine)); + } + public CommercePlatformExpression addOrderSearchPreset(OrderSearchPreset orderSearchPreset){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addOrderSearchPreset(orderSearchPreset)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java new file mode 100644 index 000000000..e3da0f48e --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.commerceplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CommercePlatformListExpression extends SmartListExpression { + public CommercePlatformListExpression(Expression> expression){ + super(expression); + } + + public CommercePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CommercePlatformExpression first() { + return new CommercePlatformExpression(super.first()); + } + + public CommercePlatformExpression get(int index) { + return new CommercePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java new file mode 100644 index 000000000..9d87e3de1 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java @@ -0,0 +1,1643 @@ + +package com.teaql.ordermanagementservice.commerceplatform; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerRequest; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineRequest; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; +import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class CommercePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CommercePlatformRequest(Class returnType){ + this(returnType, () -> (T) new CommercePlatform()); + } + + protected CommercePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CommercePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CommercePlatformRequest copy(){ + return (CommercePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CommercePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CommercePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CommercePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CommercePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CommercePlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CommercePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CommercePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CommercePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CommercePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CommercePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public CommercePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CommercePlatformRequest matchingAnyOf(CommercePlatformRequest commercePlatform){ + super.internalMatchAny(commercePlatform); + return this; + } + + public CommercePlatformRequest matchingIdsOf(CommercePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CommercePlatform.ID_PROPERTY, request, CommercePlatform.ID_PROPERTY)); + } + + public CommercePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CommercePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CommercePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CommercePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public CommercePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public CommercePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CommercePlatform.ID_PROPERTY); + selectProperty(CommercePlatform.NAME_PROPERTY); + selectProperty(CommercePlatform.CREATE_TIME_PROPERTY); + selectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public CommercePlatformRequest selectChildren(){ + super.selectAny(); + selectCustomerList().selectOrderStatusList().selectCustomerOrderList().selectProductList().selectOrderLineList().selectOrderSearchPresetList(); + return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public CommercePlatformRequest selectId(){ + selectProperty(CommercePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectId(){ + unselectProperty(CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest selectName(){ + selectProperty(CommercePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectName(){ + unselectProperty(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest selectCreateTime(){ + selectProperty(CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectCreateTime(){ + unselectProperty(CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + public CommercePlatformRequest selectUpdateTime(){ + selectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectUpdateTime(){ + unselectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + public CommercePlatformRequest selectVersion(){ + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectVersion(){ + unselectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest selectCustomerList(){ + return selectCustomerListWith(Q.customers().selectSelf()); + } + + public CommercePlatformRequest selectCustomerListWith(CustomerRequest customerList){ + enhanceRelation(CommercePlatform.CUSTOMER_LIST_PROPERTY, customerList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerListWith", null, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest selectOrderStatusList(){ + return selectOrderStatusListWith(Q.orderStatuses().selectSelf()); + } + + public CommercePlatformRequest selectOrderStatusListWith(OrderStatusRequest orderStatusList){ + enhanceRelation(CommercePlatform.ORDER_STATUS_LIST_PROPERTY, orderStatusList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderStatusListWith", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CommercePlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest selectProductList(){ + return selectProductListWith(Q.products().selectSelf()); + } + + public CommercePlatformRequest selectProductListWith(ProductRequest productList){ + enhanceRelation(CommercePlatform.PRODUCT_LIST_PROPERTY, productList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectProductListWith", null, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest selectOrderLineList(){ + return selectOrderLineListWith(Q.orderLines().selectSelf()); + } + + public CommercePlatformRequest selectOrderLineListWith(OrderLineRequest orderLineList){ + enhanceRelation(CommercePlatform.ORDER_LINE_LIST_PROPERTY, orderLineList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest selectOrderSearchPresetList(){ + return selectOrderSearchPresetListWith(Q.orderSearchPresets().selectSelf()); + } + + public CommercePlatformRequest selectOrderSearchPresetListWith(OrderSearchPresetRequest orderSearchPresetList){ + enhanceRelation(CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, orderSearchPresetList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderSearchPresetListWith", null, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.ID_PROPERTY, operator, values); + } + + public CommercePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CommercePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CommercePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CommercePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CommercePlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CommercePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CommercePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CommercePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.NAME_PROPERTY, operator, values); + } + + public CommercePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CommercePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CommercePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CommercePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CommercePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CommercePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CommercePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CommercePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CommercePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CommercePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CommercePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CommercePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CommercePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CommercePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CommercePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CommercePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CommercePlatformRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public CommercePlatformRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public CommercePlatformRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public CommercePlatformRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.CREATE_TIME_PROPERTY, operator, values); + } + + public CommercePlatformRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public CommercePlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public CommercePlatformRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public CommercePlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public CommercePlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CommercePlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public CommercePlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CommercePlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public CommercePlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public CommercePlatformRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CommercePlatformRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CommercePlatformRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CommercePlatformRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CommercePlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public CommercePlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public CommercePlatformRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public CommercePlatformRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public CommercePlatformRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.UPDATE_TIME_PROPERTY, operator, values); + } + + public CommercePlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public CommercePlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public CommercePlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public CommercePlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public CommercePlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CommercePlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public CommercePlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CommercePlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public CommercePlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public CommercePlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CommercePlatformRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CommercePlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CommercePlatformRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CommercePlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public CommercePlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CommercePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CommercePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CommercePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.VERSION_PROPERTY, operator, values); + } + + public CommercePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CommercePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CommercePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CommercePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CommercePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CommercePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CommercePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CommercePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CommercePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CommercePlatformRequest withCustomerListMatching(CustomerRequest customerRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerRequest, Customer.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutCustomerListMatching(CustomerRequest customerRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerRequest, Customer.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveCustomers(){ + return withCustomerListMatching(Q.customers().unlimited()); + } + + public CommercePlatformRequest haveNoCustomers(){ + return withoutCustomerListMatching(Q.customers().unlimited()); + } + public CommercePlatformRequest withOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderStatusRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderStatusRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveOrderStatuses(){ + return withOrderStatusListMatching(Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest haveNoOrderStatuses(){ + return withoutOrderStatusListMatching(Q.orderStatuses().unlimited()); + } + public CommercePlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + public CommercePlatformRequest withProductListMatching(ProductRequest productRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, productRequest, Product.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutProductListMatching(ProductRequest productRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, productRequest, Product.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveProducts(){ + return withProductListMatching(Q.products().unlimited()); + } + + public CommercePlatformRequest haveNoProducts(){ + return withoutProductListMatching(Q.products().unlimited()); + } + public CommercePlatformRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderLineRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutOrderLineListMatching(OrderLineRequest orderLineRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderLineRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveOrderLines(){ + return withOrderLineListMatching(Q.orderLines().unlimited()); + } + + public CommercePlatformRequest haveNoOrderLines(){ + return withoutOrderLineListMatching(Q.orderLines().unlimited()); + } + public CommercePlatformRequest withOrderSearchPresetListMatching(OrderSearchPresetRequest orderSearchPresetRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderSearchPresetRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutOrderSearchPresetListMatching(OrderSearchPresetRequest orderSearchPresetRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderSearchPresetRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveOrderSearchPresets(){ + return withOrderSearchPresetListMatching(Q.orderSearchPresets().unlimited()); + } + + public CommercePlatformRequest haveNoOrderSearchPresets(){ + return withoutOrderSearchPresetListMatching(Q.orderSearchPresets().unlimited()); + } + + public CommercePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CommercePlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CommercePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CommercePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CommercePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public CommercePlatformRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public CommercePlatformRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CommercePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest groupByCustomersWithDetails(CustomerRequest subRequest){ + aggregate(CommercePlatform.CUSTOMER_LIST_PROPERTY, subRequest); + return this; + } + public CommercePlatformRequest groupByOrderStatusesWithDetails(OrderStatusRequest subRequest){ + aggregate(CommercePlatform.ORDER_STATUS_LIST_PROPERTY, subRequest); + return this; + } + public CommercePlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + public CommercePlatformRequest groupByProductsWithDetails(ProductRequest subRequest){ + aggregate(CommercePlatform.PRODUCT_LIST_PROPERTY, subRequest); + return this; + } + public CommercePlatformRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ + aggregate(CommercePlatform.ORDER_LINE_LIST_PROPERTY, subRequest); + return this; + } + public CommercePlatformRequest groupByOrderSearchPresetsWithDetails(OrderSearchPresetRequest subRequest){ + aggregate(CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, subRequest); + return this; + } + + public CommercePlatformRequest groupById(){ + groupBy(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByIdAs(String retName){ + groupBy(retName, CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.ID_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByName(){ + groupBy(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByNameAs(String retName){ + groupBy(retName, CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.NAME_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByCreateTime(){ + groupBy(CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByCreateTimeAs(String retName){ + groupBy(retName, CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.CREATE_TIME_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByUpdateTime(){ + groupBy(CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.UPDATE_TIME_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByVersion(){ + groupBy(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public CommercePlatformRequest orderByIdAscending(){ + addOrderByAscending(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByIdDescending(){ + addOrderByDescending(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameAscending(){ + addOrderByAscending(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameDescending(){ + addOrderByDescending(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest orderByCreateTimeAscending(){ + addOrderByAscending(CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByCreateTimeDescending(){ + addOrderByDescending(CommercePlatform.CREATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByUpdateTimeAscending(){ + addOrderByAscending(CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByUpdateTimeDescending(){ + addOrderByDescending(CommercePlatform.UPDATE_TIME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByVersionAscending(){ + addOrderByAscending(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByVersionDescending(){ + addOrderByDescending(CommercePlatform.VERSION_PROPERTY); + return this; + } + + + public CommercePlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest){ + return statsFromCustomersAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Customer.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomersAs", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromCustomers(CustomerRequest subRequest){ + return statsFromCustomersAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest){ + return statsFromOrderStatusesAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromOrderStatuses(OrderStatusRequest subRequest){ + return statsFromOrderStatusesAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest statsFromProductsAs(String name, ProductRequest subRequest){ + return statsFromProductsAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromProductsAs(String name, ProductRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Product.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromProductsAs", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromProducts(ProductRequest subRequest){ + return statsFromProductsAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest){ + return statsFromOrderLinesAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromOrderLines(OrderLineRequest subRequest){ + return statsFromOrderLinesAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest statsFromOrderSearchPresetsAs(String name, OrderSearchPresetRequest subRequest){ + return statsFromOrderSearchPresetsAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromOrderSearchPresetsAs(String name, OrderSearchPresetRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderSearchPresetsAs", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromOrderSearchPresets(OrderSearchPresetRequest subRequest){ + return statsFromOrderSearchPresetsAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest countCustomers(){ + addRelationCount("Count", Q.customers().unlimited(), Customer.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomers", null, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomersAs(String name){ + addRelationCount(name, Q.customers().unlimited(), Customer.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersAs", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomersWith(String name, CustomerRequest subRequest){ + addRelationCount(name, subRequest, Customer.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersWith", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest countOrderStatuses(){ + addRelationCount("Count", Q.orderStatuses().unlimited(), OrderStatus.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countOrderStatusesAs(String name){ + addRelationCount(name, Q.orderStatuses().unlimited(), OrderStatus.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countOrderStatusesWith(String name, OrderStatusRequest subRequest){ + addRelationCount(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesWith", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest countProducts(){ + addRelationCount("Count", Q.products().unlimited(), Product.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProducts", null, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countProductsAs(String name){ + addRelationCount(name, Q.products().unlimited(), Product.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProductsAs", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countProductsWith(String name, ProductRequest subRequest){ + addRelationCount(name, subRequest, Product.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProductsWith", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest countOrderLines(){ + addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countOrderLinesAs(String name){ + addRelationCount(name, Q.orderLines().unlimited(), OrderLine.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ + addRelationCount(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest countOrderSearchPresets(){ + addRelationCount("Count", Q.orderSearchPresets().unlimited(), OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresets", null, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countOrderSearchPresetsAs(String name){ + addRelationCount(name, Q.orderSearchPresets().unlimited(), OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresetsAs", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countOrderSearchPresetsWith(String name, OrderSearchPresetRequest subRequest){ + addRelationCount(name, subRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresetsWith", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest minDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("minDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name){ + return minDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest maxDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("maxDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name){ + return maxDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest sumDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("sumDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name){ + return sumDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest avgDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("avgDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name){ + return avgDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("stdDevDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name){ + return standardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("stdDevPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name){ + return squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("varSampDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name){ + return sampleVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("varPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name){ + return samplePopulationVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest minTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name){ + return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest maxTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name){ + return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest sumTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name){ + return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest avgTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name){ + return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ + return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ + return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest minQuantityOfOrderLines(){ + addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest minQuantityOfOrderLinesAs(String name){ + return minQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest maxQuantityOfOrderLines(){ + addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name){ + return maxQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest sumQuantityOfOrderLines(){ + addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name){ + return sumQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest avgQuantityOfOrderLines(){ + addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name){ + return avgQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest standardDeviationQuantityOfOrderLines(){ + addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String name){ + return standardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ + addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ + return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest sampleVarianceQuantityOfOrderLines(){ + addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String name){ + return sampleVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLines(){ + addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ + return samplePopulationVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public CommercePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CommercePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CommercePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CommercePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CommercePlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CommercePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java new file mode 100644 index 000000000..eb9a12f4a --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java @@ -0,0 +1,213 @@ + +package com.teaql.ordermanagementservice.customer; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Customer extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Customer"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "829c8ab79820e41e3f9a3fb0b12d364d33e0a9a3f50ea30186dd727937701a39"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("email", 2), java.util.Map.entry("commerce_platform", 3), java.util.Map.entry("create_time", 4), java.util.Map.entry("update_time", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("email", java.util.List.of("email", "email")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Customer.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String EMAIL_PROPERTY = "email"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private String email; + + private CommercePlatform commercePlatform; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public String getEmail(){ + return this.email; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public Customer updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Customer updateEmail(String email){ + email = (email == null ? null : email.trim()); + if(isPropertyLoaded(EMAIL_PROPERTY) && Objects.equals(this.email, email)){ + return this; + } + handleUpdate(EMAIL_PROPERTY, getEmail(), email); + this.email = email; + return this; + } + + public Customer updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public Customer updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public Customer updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public Customer addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCustomer(this); + return this; + } + + public static Customer refer(Long id){ + Customer refer = new Customer(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Customer comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "email": this.email = (value == null ? null : ((String)value).trim()); break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "email": return this.email; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "email": return this.email; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java new file mode 100644 index 000000000..99635a77e --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java @@ -0,0 +1,121 @@ + +package com.teaql.ordermanagementservice.customer; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class CustomerChecker implements Checker{ + + public String type(){ + return Customer.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + if(needCheck(_context, customer)){ + markAsChecked(_context, customer); + doCheck(_context, customer, _parentLocation); + } + } + + public void doCheck(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + if((customer == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customer); + if(customer.needPersist()){ + } + if(customer.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + customer.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customer.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(customer.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customer.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!customer.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("email")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "email"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, customer.getProperty(Customer.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkEmail(_context, customer.getProperty(Customer.EMAIL_PROPERTY), newLocation(_parentLocation, "email")); + checkCommercePlatform(_context, customer.getProperty(Customer.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, customer.getProperty(Customer.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, customer.getProperty(Customer.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; customer.getCustomerOrderList() != null && i < customer.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = customer.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkEmail(UserContext _context, String email, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, email); + if((email == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, email); + + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java new file mode 100644 index 000000000..a2731bc84 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java @@ -0,0 +1,83 @@ + +package com.teaql.ordermanagementservice.customer; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class CustomerExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerExpression(Expression expression){ + super(expression); + } + + public CustomerExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerExpression updateId(Long id){ + return new CustomerExpression(this, $it -> {((Customer)$it).__internalSet("id", id); return this;}); + } + + public CustomerExpression save(UserContext userContext){ + return new CustomerExpression(this, $it -> ((Customer)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerExpression save(String intent, UserContext userContext){ + return new CustomerExpression(this, $it -> ((Customer)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Customer::getName); + } + public CustomerExpression updateName(String name){ + return new CustomerExpression(this, $it -> ((Customer)$it).updateName(name)); + } + + public Expression getEmail(){ + return loaded("email", "getEmail", Customer::getEmail); + } + public CustomerExpression updateEmail(String email){ + return new CustomerExpression(this, $it -> ((Customer)$it).updateEmail(email)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", Customer::getCommercePlatform)); + } + + public CustomerExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new CustomerExpression(this, $it -> ((Customer)$it).updateCommercePlatform(commercePlatform)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", Customer::getCreateTime); + } + public CustomerExpression updateCreateTime(LocalDateTime createTime){ + return new CustomerExpression(this, $it -> ((Customer)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", Customer::getUpdateTime); + } + public CustomerExpression updateUpdateTime(LocalDateTime updateTime){ + return new CustomerExpression(this, $it -> ((Customer)$it).updateUpdateTime(updateTime)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Customer::getCustomerOrderList)); + } + public CustomerExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CustomerExpression(this, $it -> ((Customer)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java new file mode 100644 index 000000000..8c21e9948 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.customer; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerListExpression extends SmartListExpression { + public CustomerListExpression(Expression> expression){ + super(expression); + } + + public CustomerListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerExpression first() { + return new CustomerExpression(super.first()); + } + + public CustomerExpression get(int index) { + return new CustomerExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java new file mode 100644 index 000000000..114b51337 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java @@ -0,0 +1,1313 @@ + +package com.teaql.ordermanagementservice.customer; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class CustomerRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerRequest(Class returnType){ + this(returnType, () -> (T) new Customer()); + } + + protected CustomerRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerRequest copy(){ + return (CustomerRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerRequest matchingAnyOf(CustomerRequest customer){ + super.internalMatchAny(customer); + return this; + } + + public CustomerRequest matchingIdsOf(CustomerRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Customer.ID_PROPERTY, request, Customer.ID_PROPERTY)); + } + + public CustomerRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectEmail().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public CustomerRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Customer.ID_PROPERTY); + selectProperty(Customer.NAME_PROPERTY); + selectProperty(Customer.EMAIL_PROPERTY); + selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); + selectProperty(Customer.CREATE_TIME_PROPERTY); + selectProperty(Customer.UPDATE_TIME_PROPERTY); + selectProperty(Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectEmail().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public CustomerRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectName().selectEmail().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public CustomerRequest selectId(){ + selectProperty(Customer.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectId(){ + unselectProperty(Customer.ID_PROPERTY); + return this; + } + public CustomerRequest selectName(){ + selectProperty(Customer.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectName(){ + unselectProperty(Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest selectEmail(){ + selectProperty(Customer.EMAIL_PROPERTY); + return this; + } + + /** + * fill the email with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS email) to fetch email property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectEmail(){ + unselectProperty(Customer.EMAIL_PROPERTY); + return this; + } + public CustomerRequest selectCommercePlatformIdOnly(){ + selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public CustomerRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, Customer.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public CustomerRequest unselectCommercePlatform(){ + unselectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerRequest selectCreateTime(){ + selectProperty(Customer.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectCreateTime(){ + unselectProperty(Customer.CREATE_TIME_PROPERTY); + return this; + } + public CustomerRequest selectUpdateTime(){ + selectProperty(Customer.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectUpdateTime(){ + unselectProperty(Customer.UPDATE_TIME_PROPERTY); + return this; + } + public CustomerRequest selectVersion(){ + selectProperty(Customer.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectVersion(){ + unselectProperty(Customer.VERSION_PROPERTY); + return this; + } + public CustomerRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CustomerRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(Customer.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.ID_PROPERTY, operator, values); + } + + public CustomerRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CustomerRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CustomerRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CustomerRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.NAME_PROPERTY, operator, values); + } + + public CustomerRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CustomerRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CustomerRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CustomerRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CustomerRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CustomerRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CustomerRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CustomerRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CustomerRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CustomerRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CustomerRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CustomerRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CustomerRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CustomerRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CustomerRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CustomerRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CustomerRequest filterByEmail(String... email){ + if (email == null || email.length == 0) { + throw new IllegalArgumentException("filterByEmail parameter email cannot be empty"); + } + return appendSearchCriteria(createEmailCriteria(Operator.EQUAL, (Object[])email)); + } + + public CustomerRequest withEmail(Operator operator, Object... values){ + return appendSearchCriteria(createEmailCriteria(operator, values)); + } + + public CustomerRequest withEmailIsUnknown(){ + return withEmail(Operator.IS_NULL); + } + + public CustomerRequest withEmailIsKnown(){ + return withEmail(Operator.IS_NOT_NULL); + } + + public SearchCriteria createEmailCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.EMAIL_PROPERTY, operator, values); + } + + public CustomerRequest withEmailIsNot(String email){ + return withEmail(Operator.NOT_EQUAL, email); + } + + public CustomerRequest withEmailIn(String... email){ + return withEmail(Operator.IN, (Object[])email); + } + + public CustomerRequest withEmailNotIn(String... email){ + return withEmail(Operator.NOT_IN, (Object[])email); + } + public CustomerRequest withEmailGreaterThan(String email){ + return withEmail(Operator.GREATER_THAN, email); + } + + public CustomerRequest withEmailGreaterThanOrEqualTo(String email){ + return withEmail(Operator.GREATER_THAN_OR_EQUAL, email); + } + + public CustomerRequest withEmailLessThan(String email){ + return withEmail(Operator.LESS_THAN, email); + } + + public CustomerRequest withEmailLessThanOrEqualTo(String email){ + return withEmail(Operator.LESS_THAN_OR_EQUAL, email); + } + + public CustomerRequest withEmailBetween(String startOfEmail, String endOfEmail){ + return withEmail(Operator.BETWEEN, startOfEmail, endOfEmail); + } + public CustomerRequest withEmailStartingWith(String email){ + return withEmail(Operator.BEGIN_WITH, email); + } + public CustomerRequest withEmailContaining(String email){ + return withEmail(Operator.CONTAIN, email); + } + + public CustomerRequest withEmailNotContaining(String email){ + return withEmail(Operator.NOT_CONTAIN, email); + } + + public CustomerRequest withEmailNotStartingWith(String email){ + return withEmail(Operator.NOT_BEGIN_WITH, email); + } + + public CustomerRequest withEmailEndingWith(String email){ + return withEmail(Operator.END_WITH, email); + } + + public CustomerRequest withEmailNotEndingWith(String email){ + return withEmail(Operator.NOT_END_WITH, email); + } + + public CustomerRequest withEmailIs(String email){ + return withEmail(Operator.EQUAL, email); + } + + public CustomerRequest withEmailSoundingLike(String email){ + return withEmail(Operator.SOUNDS_LIKE, email); + } + + + + public CustomerRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public CustomerRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public CustomerRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public CustomerRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public CustomerRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public CustomerRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public CustomerRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public CustomerRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public CustomerRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public CustomerRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public CustomerRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.CREATE_TIME_PROPERTY, operator, values); + } + + public CustomerRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public CustomerRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public CustomerRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public CustomerRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public CustomerRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CustomerRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public CustomerRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CustomerRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public CustomerRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public CustomerRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CustomerRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CustomerRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CustomerRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CustomerRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public CustomerRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public CustomerRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public CustomerRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public CustomerRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.UPDATE_TIME_PROPERTY, operator, values); + } + + public CustomerRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public CustomerRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public CustomerRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public CustomerRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public CustomerRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CustomerRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public CustomerRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CustomerRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public CustomerRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public CustomerRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CustomerRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CustomerRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CustomerRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CustomerRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public CustomerRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.VERSION_PROPERTY, operator, values); + } + + public CustomerRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY)); + } + + public CustomerRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY))); + } + + public CustomerRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public CustomerRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(Customer.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public CustomerRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Customer.ID_PROPERTY); + return this; + } + public CustomerRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CustomerRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest countDistinctEmail(){ + return countDistinctEmailAs("email_distinct_count"); + } + + public CustomerRequest countDistinctEmailAs(String alias){ + super.countDistinctProperty(alias, Customer.EMAIL_PROPERTY); + return this; + } + public CustomerRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public CustomerRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public CustomerRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Customer.CREATE_TIME_PROPERTY); + return this; + } + public CustomerRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public CustomerRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Customer.UPDATE_TIME_PROPERTY); + return this; + } + public CustomerRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Customer.VERSION_PROPERTY); + return this; + } + public CustomerRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(Customer.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerRequest groupById(){ + groupBy(Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest groupByIdAs(String retName){ + groupBy(retName, Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.ID_PROPERTY, function); + return this; + } + + public CustomerRequest groupByName(){ + groupBy(Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest groupByNameAs(String retName){ + groupBy(retName, Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.NAME_PROPERTY, function); + return this; + } + + public CustomerRequest groupByEmail(){ + groupBy(Customer.EMAIL_PROPERTY); + return this; + } + + public CustomerRequest groupByEmailAs(String retName){ + groupBy(retName, Customer.EMAIL_PROPERTY); + return this; + } + + public CustomerRequest groupByEmailWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.EMAIL_PROPERTY, function); + return this; + } + public CustomerRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(Customer.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public CustomerRequest groupByCommercePlatform(){ + groupBy(Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public CustomerRequest groupByCreateTime(){ + groupBy(Customer.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest groupByCreateTimeAs(String retName){ + groupBy(retName, Customer.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.CREATE_TIME_PROPERTY, function); + return this; + } + + public CustomerRequest groupByUpdateTime(){ + groupBy(Customer.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, Customer.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.UPDATE_TIME_PROPERTY, function); + return this; + } + + public CustomerRequest groupByVersion(){ + groupBy(Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest groupByVersionAs(String retName){ + groupBy(retName, Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerRequest orderByIdAscending(){ + addOrderByAscending(Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest orderByIdDescending(){ + addOrderByDescending(Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest orderByNameAscending(){ + addOrderByAscending(Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest orderByNameDescending(){ + addOrderByDescending(Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest orderByEmailAscending(){ + addOrderByAscending(Customer.EMAIL_PROPERTY); + return this; + } + + public CustomerRequest orderByEmailDescending(){ + addOrderByDescending(Customer.EMAIL_PROPERTY); + return this; + } + public CustomerRequest orderByEmailAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Customer.EMAIL_PROPERTY); + return this; + } + + public CustomerRequest orderByEmailDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Customer.EMAIL_PROPERTY); + return this; + } + public CustomerRequest orderByCommercePlatformAscending(){ + addOrderByAscending(Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest orderByCommercePlatformDescending(){ + addOrderByDescending(Customer.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest orderByCreateTimeAscending(){ + addOrderByAscending(Customer.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest orderByCreateTimeDescending(){ + addOrderByDescending(Customer.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest orderByUpdateTimeAscending(){ + addOrderByAscending(Customer.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest orderByUpdateTimeDescending(){ + addOrderByDescending(Customer.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerRequest orderByVersionAscending(){ + addOrderByAscending(Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest orderByVersionDescending(){ + addOrderByDescending(Customer.VERSION_PROPERTY); + return this; + } + + + public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + + + public CustomerRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest minTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name){ + return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest maxTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name){ + return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest sumTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name){ + return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest avgTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name){ + return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest standardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest sampleVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ + return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ + return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, Customer.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..7a35c0d41 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java @@ -0,0 +1,291 @@ + +package com.teaql.ordermanagementservice.customerorder; + +import com.teaql.ordermanagementservice.Constants; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e844b19b098f340a5ae18e4091f4a6d55afb35cd5a53ec24155bd4de2601988d"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("order_number", 1), java.util.Map.entry("order_date", 2), java.util.Map.entry("total_amount", 3), java.util.Map.entry("status", 4), java.util.Map.entry("customer", 5), java.util.Map.entry("commerce_platform", 6), java.util.Map.entry("create_time", 7), java.util.Map.entry("update_time", 8), java.util.Map.entry("version", 9)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("order_date", java.util.List.of("orderDate", "order_date")), java.util.Map.entry("total_amount", java.util.List.of("totalAmount", "total_amount")), java.util.Map.entry("status", java.util.List.of("status", "status")), java.util.Map.entry("customer", java.util.List.of("customer", "customer")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_line_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String ORDER_DATE_PROPERTY = "order_date"; + public static final String TOTAL_AMOUNT_PROPERTY = "total_amount"; + public static final String STATUS_PROPERTY = "status"; + public static final String CUSTOMER_PROPERTY = "customer"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; + private String orderNumber; + + private LocalDate orderDate; + + private BigDecimal totalAmount; + + private OrderStatus status; + + private Customer customer; + + private CommercePlatform commercePlatform; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList orderLineList; + + public String getOrderNumber(){ + return this.orderNumber; + } + + public LocalDate getOrderDate(){ + return this.orderDate; + } + + public BigDecimal getTotalAmount(){ + return this.totalAmount; + } + + public OrderStatus getStatus(){ + return this.status; + } + + public Customer getCustomer(){ + return this.customer; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getOrderLineList(){ + return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; + } + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateOrderDate(LocalDate orderDate){ + if(isPropertyLoaded(ORDER_DATE_PROPERTY) && Objects.equals(this.orderDate, orderDate)){ + return this; + } + handleUpdate(ORDER_DATE_PROPERTY, getOrderDate(), orderDate); + this.orderDate = orderDate; + return this; + } + + public CustomerOrder updateTotalAmount(BigDecimal totalAmount){ + if(isPropertyLoaded(TOTAL_AMOUNT_PROPERTY) && Objects.equals(this.totalAmount, totalAmount)){ + return this; + } + handleUpdate(TOTAL_AMOUNT_PROPERTY, getTotalAmount(), totalAmount); + this.totalAmount = totalAmount; + return this; + } + + protected CustomerOrder updateStatus(OrderStatus status){ + if(isPropertyLoaded(STATUS_PROPERTY) && Objects.equals(this.status, status)){ + return this; + } + handleUpdate(STATUS_PROPERTY, getStatus(), status); + this.status = status; + return this; + } + + public CustomerOrder updateCustomer(Customer customer){ + if(isPropertyLoaded(CUSTOMER_PROPERTY) && Objects.equals(this.customer, customer)){ + return this; + } + handleUpdate(CUSTOMER_PROPERTY, getCustomer(), customer); + this.customer = customer; + return this; + } + + public CustomerOrder updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public CustomerOrder updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public CustomerOrder updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public CustomerOrder addOrderLine(OrderLine orderLine){ + if (orderLine == null){ + return this; + } + + if(null == this.orderLineList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderLineList = teaqlUnloadedItems.map(value -> value); + } + + this.orderLineList.add(orderLine); + orderLine.updateCustomerOrder(this); + return this; + } + public boolean isStatusPending(){ + return Objects.equals(getStatus(), Constants.ORDER_STATUS_PENDING); + } + + public CustomerOrder updateStatusToPending(){ + return updateStatus(Constants.ORDER_STATUS_PENDING); + } + public boolean isStatusConfirmed(){ + return Objects.equals(getStatus(), Constants.ORDER_STATUS_CONFIRMED); + } + + public CustomerOrder updateStatusToConfirmed(){ + return updateStatus(Constants.ORDER_STATUS_CONFIRMED); + } + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "order_date": this.orderDate = (LocalDate) value; break; + + case "total_amount": this.totalAmount = (BigDecimal) value; break; + + case "status": this.status = (OrderStatus) value; break; + + case "customer": this.customer = (Customer) value; break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "order_line_list": this.orderLineList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "order_number": return this.orderNumber; + case "order_date": return this.orderDate; + case "total_amount": return this.totalAmount; + case "status": return this.status; + case "customer": return this.customer; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "order_line_list": return this.orderLineList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "orderNumber": return this.orderNumber; + case "orderDate": return this.orderDate; + case "totalAmount": return this.totalAmount; + case "status": return this.status; + case "customer": return this.customer; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..04b7ef192 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,157 @@ + +package com.teaql.ordermanagementservice.customerorder; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerChecker; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineChecker; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + customerOrder.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customerOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(customerOrder.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + customerOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_date"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("total_amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "total_amount"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "status"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("customer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkOrderDate(_context, customerOrder.getProperty(CustomerOrder.ORDER_DATE_PROPERTY), newLocation(_parentLocation, "order_date")); + checkTotalAmount(_context, customerOrder.getProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY), newLocation(_parentLocation, "total_amount")); + checkStatus(_context, customerOrder.getProperty(CustomerOrder.STATUS_PROPERTY), newLocation(_parentLocation, "status")); + checkCustomer(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROPERTY), newLocation(_parentLocation, "customer")); + checkCommercePlatform(_context, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, customerOrder.getProperty(CustomerOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, customerOrder.getProperty(CustomerOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; customerOrder.getOrderLineList() != null && i < customerOrder.getOrderLineList().size(); i++){ + OrderLine orderLine = customerOrder.getOrderLineList().get(i); + new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); + } + } + + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkOrderDate(UserContext _context, LocalDate orderDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderDate); + if((orderDate == null)){ + return; + } + } + public void checkTotalAmount(UserContext _context, BigDecimal totalAmount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, totalAmount); + if((totalAmount == null)){ + return; + } + } + public void checkStatus(UserContext _context, OrderStatus status, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, status); + if((status == null)){ + return; + } + new OrderStatusChecker().checkAndFix(_context, status, _parentLocation); + } + public void checkCustomer(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customer); + if((customer == null)){ + return; + } + new CustomerChecker().checkAndFix(_context, customer, _parentLocation); + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..68f35772a --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,115 @@ + +package com.teaql.ordermanagementservice.customerorder; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerExpression; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineListExpression; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public Expression getOrderDate(){ + return loaded("order_date", "getOrderDate", CustomerOrder::getOrderDate); + } + public CustomerOrderExpression updateOrderDate(LocalDate orderDate){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderDate(orderDate)); + } + + public Expression getTotalAmount(){ + return loaded("total_amount", "getTotalAmount", CustomerOrder::getTotalAmount); + } + public CustomerOrderExpression updateTotalAmount(BigDecimal totalAmount){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateTotalAmount(totalAmount)); + } + + public OrderStatusExpression getStatus(){ + return new OrderStatusExpression(loaded("status", "getStatus", CustomerOrder::getStatus)); + } + + public CustomerOrderExpression updateStatusToPending(){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToPending()); + } + public CustomerOrderExpression updateStatusToConfirmed(){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToConfirmed()); + } + + public CustomerExpression getCustomer(){ + return new CustomerExpression(loaded("customer", "getCustomer", CustomerOrder::getCustomer)); + } + + public CustomerOrderExpression updateCustomer(Customer customer){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomer(customer)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", CustomerOrder::getCommercePlatform)); + } + + public CustomerOrderExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCommercePlatform(commercePlatform)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", CustomerOrder::getCreateTime); + } + public CustomerOrderExpression updateCreateTime(LocalDateTime createTime){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", CustomerOrder::getUpdateTime); + } + public CustomerOrderExpression updateUpdateTime(LocalDateTime updateTime){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateUpdateTime(updateTime)); + } + + public OrderLineListExpression getOrderLineList(){ + return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", CustomerOrder::getOrderLineList)); + } + public CustomerOrderExpression addOrderLine(OrderLine orderLine){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderLine(orderLine)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..144428aa9 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..cad513172 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,1742 @@ + +package com.teaql.ordermanagementservice.customerorder; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; +import com.teaql.ordermanagementservice.customer.Customer; +import com.teaql.ordermanagementservice.customer.CustomerRequest; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineRequest; +import com.teaql.ordermanagementservice.orderstatus.OrderStatus; +import com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatusIdOnly().selectCustomerIdOnly().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + selectProperty(CustomerOrder.STATUS_PROPERTY); + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + selectProperty(CustomerOrder.CREATE_TIME_PROPERTY); + selectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatus().selectCustomer().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + selectOrderLineList(); + return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatus().selectCustomer().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderDate(){ + selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + /** + * fill the orderDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderDate) to fetch orderDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderDate(){ + unselectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + public CustomerOrderRequest selectTotalAmount(){ + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + /** + * fill the totalAmount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalAmount) to fetch totalAmount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the totalAmount with customized aggrFunction, TEAQL uses ({aggrFunction}(totalAmount) AS totalAmount to fetch totalAmount property. + * @param aggrFunction aggrFunction + */ + public CustomerOrderRequest selectTotalAmount(AggrFunction aggrFunction){ + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY, aggrFunction); + return this; + } + + + public CustomerOrderRequest unselectTotalAmount(){ + unselectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest selectStatusIdOnly(){ + selectProperty(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest selectStatus(){ + return selectStatusWith(Q.orderStatuses().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectStatusWith(OrderStatusRequest status){ + selectProperty(CustomerOrder.STATUS_PROPERTY); + enhanceRelation(CustomerOrder.STATUS_PROPERTY, status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectStatusWith", null, CustomerOrder.STATUS_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectStatus(){ + unselectProperty(CustomerOrder.STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest selectCustomerIdOnly(){ + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCustomer(){ + return selectCustomerWith(Q.customers().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCustomerWith(CustomerRequest customer){ + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + enhanceRelation(CustomerOrder.CUSTOMER_PROPERTY, customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerWith", null, CustomerOrder.CUSTOMER_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCustomer(){ + unselectProperty(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + public CustomerOrderRequest selectCommercePlatformIdOnly(){ + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCommercePlatform(){ + unselectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest selectCreateTime(){ + selectProperty(CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectCreateTime(){ + unselectProperty(CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + public CustomerOrderRequest selectUpdateTime(){ + selectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectUpdateTime(){ + unselectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderLineList(){ + return selectOrderLineListWith(Q.orderLines().selectSelf()); + } + + public CustomerOrderRequest selectOrderLineListWith(OrderLineRequest orderLineList){ + enhanceRelation(CustomerOrder.ORDER_LINE_LIST_PROPERTY, orderLineList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByOrderDate(LocalDate... orderDate){ + if (orderDate == null || orderDate.length == 0) { + throw new IllegalArgumentException("filterByOrderDate parameter orderDate cannot be empty"); + } + return appendSearchCriteria(createOrderDateCriteria(Operator.EQUAL, (Object[])orderDate)); + } + + public CustomerOrderRequest withOrderDate(Operator operator, Object... values){ + return appendSearchCriteria(createOrderDateCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderDateIsUnknown(){ + return withOrderDate(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderDateIsKnown(){ + return withOrderDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_DATE_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderDateIs(LocalDate orderDate){ + return withOrderDate(Operator.EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateIsNot(LocalDate orderDate){ + return withOrderDate(Operator.NOT_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateIn(LocalDate... orderDate){ + return withOrderDate(Operator.IN, (Object[])orderDate); + } + + public CustomerOrderRequest withOrderDateNotIn(LocalDate... orderDate){ + return withOrderDate(Operator.NOT_IN, (Object[])orderDate); + } + public CustomerOrderRequest withOrderDateGreaterThan(LocalDate orderDate){ + return withOrderDate(Operator.GREATER_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateGreaterThanOrEqualTo(LocalDate orderDate){ + return withOrderDate(Operator.GREATER_THAN_OR_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateLessThan(LocalDate orderDate){ + return withOrderDate(Operator.LESS_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateLessThanOrEqualTo(LocalDate orderDate){ + return withOrderDate(Operator.LESS_THAN_OR_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateBetween(LocalDate startOfOrderDate, LocalDate endOfOrderDate){ + return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); + } + public CustomerOrderRequest withOrderDateBefore(LocalDate orderDate){ + return withOrderDate(Operator.LESS_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateBefore(Date orderDate){ + return withOrderDate(Operator.LESS_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateAfter(LocalDate orderDate){ + return withOrderDate(Operator.GREATER_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateAfter(Date orderDate){ + return withOrderDate(Operator.GREATER_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateBetween(Date startOfOrderDate, Date endOfOrderDate){ + return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); + } + + + + + public CustomerOrderRequest filterByTotalAmount(BigDecimal... totalAmount){ + if (totalAmount == null || totalAmount.length == 0) { + throw new IllegalArgumentException("filterByTotalAmount parameter totalAmount cannot be empty"); + } + return appendSearchCriteria(createTotalAmountCriteria(Operator.EQUAL, (Object[])totalAmount)); + } + + public CustomerOrderRequest withTotalAmount(Operator operator, Object... values){ + return appendSearchCriteria(createTotalAmountCriteria(operator, values)); + } + + public CustomerOrderRequest withTotalAmountIsUnknown(){ + return withTotalAmount(Operator.IS_NULL); + } + + public CustomerOrderRequest withTotalAmountIsKnown(){ + return withTotalAmount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTotalAmountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.TOTAL_AMOUNT_PROPERTY, operator, values); + } + + public CustomerOrderRequest withTotalAmountIs(BigDecimal totalAmount){ + return withTotalAmount(Operator.EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountIsNot(BigDecimal totalAmount){ + return withTotalAmount(Operator.NOT_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountIn(BigDecimal... totalAmount){ + return withTotalAmount(Operator.IN, (Object[])totalAmount); + } + + public CustomerOrderRequest withTotalAmountNotIn(BigDecimal... totalAmount){ + return withTotalAmount(Operator.NOT_IN, (Object[])totalAmount); + } + public CustomerOrderRequest withTotalAmountGreaterThan(BigDecimal totalAmount){ + return withTotalAmount(Operator.GREATER_THAN, totalAmount); + } + + public CustomerOrderRequest withTotalAmountGreaterThanOrEqualTo(BigDecimal totalAmount){ + return withTotalAmount(Operator.GREATER_THAN_OR_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountLessThan(BigDecimal totalAmount){ + return withTotalAmount(Operator.LESS_THAN, totalAmount); + } + + public CustomerOrderRequest withTotalAmountLessThanOrEqualTo(BigDecimal totalAmount){ + return withTotalAmount(Operator.LESS_THAN_OR_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountBetween(BigDecimal startOfTotalAmount, BigDecimal endOfTotalAmount){ + return withTotalAmount(Operator.BETWEEN, startOfTotalAmount, endOfTotalAmount); + } + + + + public CustomerOrderRequest filterByStatus(OrderStatus... status){ + if (status == null || status.length == 0) { + throw new IllegalArgumentException("filterByStatus parameter status cannot be empty"); + } + return appendSearchCriteria(createStatusCriteria(Operator.EQUAL, (Object[])status)); + } + + public CustomerOrderRequest withStatus(Operator operator, Object... values){ + return appendSearchCriteria(createStatusCriteria(operator, values)); + } + + public CustomerOrderRequest withStatusIsUnknown(){ + return withStatus(Operator.IS_NULL); + } + + public CustomerOrderRequest withStatusIsKnown(){ + return withStatus(Operator.IS_NOT_NULL); + } + + public SearchCriteria createStatusCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.STATUS_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByStatus(Long status){ + if(status == null){ + return this; + } + return withStatus(Operator.EQUAL, status); + } + public CustomerOrderRequest withStatusMatching(OrderStatusRequest status){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutStatusMatching(OrderStatusRequest status){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByCustomer(Customer... customer){ + if (customer == null || customer.length == 0) { + throw new IllegalArgumentException("filterByCustomer parameter customer cannot be empty"); + } + return appendSearchCriteria(createCustomerCriteria(Operator.EQUAL, (Object[])customer)); + } + + public CustomerOrderRequest withCustomer(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerCriteria(operator, values)); + } + + public CustomerOrderRequest withCustomerIsUnknown(){ + return withCustomer(Operator.IS_NULL); + } + + public CustomerOrderRequest withCustomerIsKnown(){ + return withCustomer(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCustomer(Long customer){ + if(customer == null){ + return this; + } + return withCustomer(Operator.EQUAL, customer); + } + public CustomerOrderRequest withCustomerMatching(CustomerRequest customer){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCustomerMatching(CustomerRequest customer){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public CustomerOrderRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public CustomerOrderRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public CustomerOrderRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public CustomerOrderRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public CustomerOrderRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public CustomerOrderRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public CustomerOrderRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.CREATE_TIME_PROPERTY, operator, values); + } + + public CustomerOrderRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public CustomerOrderRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public CustomerOrderRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public CustomerOrderRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public CustomerOrderRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CustomerOrderRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public CustomerOrderRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CustomerOrderRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public CustomerOrderRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public CustomerOrderRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CustomerOrderRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public CustomerOrderRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CustomerOrderRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public CustomerOrderRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public CustomerOrderRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public CustomerOrderRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public CustomerOrderRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public CustomerOrderRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.UPDATE_TIME_PROPERTY, operator, values); + } + + public CustomerOrderRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public CustomerOrderRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public CustomerOrderRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public CustomerOrderRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public CustomerOrderRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CustomerOrderRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public CustomerOrderRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CustomerOrderRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public CustomerOrderRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public CustomerOrderRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CustomerOrderRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public CustomerOrderRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CustomerOrderRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public CustomerOrderRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerOrderRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderLineRequest, OrderLine.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutOrderLineListMatching(OrderLineRequest orderLineRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderLineRequest, OrderLine.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest haveOrderLines(){ + return withOrderLineListMatching(Q.orderLines().unlimited()); + } + + public CustomerOrderRequest haveNoOrderLines(){ + return withoutOrderLineListMatching(Q.orderLines().unlimited()); + } + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest minTotalAmount(){ + return minTotalAmountAs(prefix("minOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest minTotalAmountAs(String retName){ + super.min(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest maxTotalAmount(){ + return maxTotalAmountAs(prefix("maxOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest maxTotalAmountAs(String retName){ + super.max(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest sumTotalAmount(){ + return sumTotalAmountAs(prefix("sumOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest sumTotalAmountAs(String retName){ + super.sum(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest avgTotalAmount(){ + return avgTotalAmountAs(prefix("avgOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest avgTotalAmountAs(String retName){ + super.avg(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest standardDeviationTotalAmount(){ + return standardDeviationTotalAmountAs(prefix("standardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest standardDeviationTotalAmountAs(String retName){ + super.standardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmount(){ + return squareRootOfPopulationStandardDeviationTotalAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest sampleVarianceTotalAmount(){ + return sampleVarianceTotalAmountAs(prefix("sampleVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest sampleVarianceTotalAmountAs(String retName){ + super.sampleVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest samplePopulationVarianceTotalAmount(){ + return samplePopulationVarianceTotalAmountAs(prefix("samplePopulationVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest samplePopulationVarianceTotalAmountAs(String retName){ + super.samplePopulationVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest groupByStatusWithDetails(){ + return groupByStatusWithDetails(Q.orderStatuses().unlimited()); + } + + public CustomerOrderRequest groupByStatusWithDetails(OrderStatusRequest subRequest){ + aggregate(CustomerOrder.STATUS_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupByCustomerWithDetails(){ + return groupByCustomerWithDetails(Q.customers().unlimited()); + } + + public CustomerOrderRequest groupByCustomerWithDetails(CustomerRequest subRequest){ + aggregate(CustomerOrder.CUSTOMER_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public CustomerOrderRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderDate(){ + return countDistinctOrderDateAs("order_date_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderDateAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctTotalAmount(){ + return countDistinctTotalAmountAs("total_amount_distinct_count"); + } + + public CustomerOrderRequest countDistinctTotalAmountAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctStatus(){ + return countDistinctStatusAs("status_distinct_count"); + } + + public CustomerOrderRequest countDistinctStatusAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCustomer(){ + return countDistinctCustomerAs("customer_distinct_count"); + } + + public CustomerOrderRequest countDistinctCustomerAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public CustomerOrderRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public CustomerOrderRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public CustomerOrderRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ + aggregate(CustomerOrder.ORDER_LINE_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderDate(){ + groupBy(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderDateAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByTotalAmount(){ + groupBy(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByTotalAmountAs(String retName){ + groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByTotalAmountWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByStatusWith(OrderStatusRequest subRequest){ + groupBy(CustomerOrder.STATUS_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByStatusWith", null, "status")); + return this; + } + public CustomerOrderRequest groupByStatus(){ + groupBy(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByStatusAs(String retName){ + groupBy(retName, CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByStatusWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.STATUS_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCustomerWith(CustomerRequest subRequest){ + groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerWith", null, "customer")); + return this; + } + public CustomerOrderRequest groupByCustomer(){ + groupBy(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerAs(String retName){ + groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public CustomerOrderRequest groupByCommercePlatform(){ + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByCreateTime(){ + groupBy(CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCreateTimeAs(String retName){ + groupBy(retName, CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.CREATE_TIME_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByUpdateTime(){ + groupBy(CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.UPDATE_TIME_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + public CustomerOrderRequest withStatusIsPending(){ + filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_PENDING); + return this; + } + + + public CustomerOrderRequest withStatusIsConfirmed(){ + filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_CONFIRMED); + return this; + } + + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderDateAscending(){ + addOrderByAscending(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderDateDescending(){ + addOrderByDescending(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByTotalAmountAscending(){ + addOrderByAscending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByTotalAmountDescending(){ + addOrderByDescending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByStatusAscending(){ + addOrderByAscending(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByStatusDescending(){ + addOrderByDescending(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerAscending(){ + addOrderByAscending(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerDescending(){ + addOrderByDescending(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCommercePlatformAscending(){ + addOrderByAscending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCommercePlatformDescending(){ + addOrderByDescending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCreateTimeAscending(){ + addOrderByAscending(CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCreateTimeDescending(){ + addOrderByDescending(CustomerOrder.CREATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByUpdateTimeAscending(){ + addOrderByAscending(CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByUpdateTimeDescending(){ + addOrderByDescending(CustomerOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest){ + return statsFromOrderLinesAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromOrderLines(OrderLineRequest subRequest){ + return statsFromOrderLinesAs(REFINEMENTS, subRequest); + } + public OrderStatusRequest rollUpToStatus(){ + OrderStatusRequest status = Q.orderStatuses().unlimited(); + this.internalRollUpTo("status", status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToStatus", null, "status")); + return status; + } + + public CustomerRequest rollUpToCustomer(){ + CustomerRequest customer = Q.customers().unlimited(); + this.internalRollUpTo("customer", customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomer", null, "customer")); + return customer; + } + + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + + + public CustomerOrderRequest countOrderLines(){ + addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderLinesAs(String name){ + addRelationCount(name, Q.orderLines().unlimited(), OrderLine.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ + addRelationCount(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest minQuantityOfOrderLines(){ + addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest minQuantityOfOrderLinesAs(String name){ + return minQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest maxQuantityOfOrderLines(){ + addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name){ + return maxQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sumQuantityOfOrderLines(){ + addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name){ + return sumQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest avgQuantityOfOrderLines(){ + addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name){ + return avgQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest standardDeviationQuantityOfOrderLines(){ + addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String name){ + return standardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ + addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ + return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sampleVarianceQuantityOfOrderLines(){ + addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name){ + return sampleVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLines(){ + addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ + return samplePopulationVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status){ + return facetByStatusAs(facetName, status, true); + } + + public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.STATUS_PROPERTY, status, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByStatusAs", facetName, CustomerOrder.STATUS_PROPERTY)); + return this; + } + public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer){ + return facetByCustomerAs(facetName, customer, true); + } + + public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.CUSTOMER_PROPERTY, customer, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerAs", facetName, CustomerOrder.CUSTOMER_PROPERTY)); + return this; + } + public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java new file mode 100644 index 000000000..00d93ae47 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java @@ -0,0 +1,232 @@ + +package com.teaql.ordermanagementservice.orderline; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.product.Product; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderLine extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderLine"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "561e1330c3f6785b4b09c99056d83367e88ffa0c3bc41bf7be5a42ba53982496"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("product", 2), java.util.Map.entry("product_name", 3), java.util.Map.entry("sku", 4), java.util.Map.entry("quantity", 5), java.util.Map.entry("commerce_platform", 6), java.util.Map.entry("create_time", 7), java.util.Map.entry("version", 8)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("product", java.util.List.of("product", "product")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderLine.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String PRODUCT_PROPERTY = "product"; + public static final String PRODUCT_NAME_PROPERTY = "product_name"; + public static final String SKU_PROPERTY = "sku"; + public static final String QUANTITY_PROPERTY = "quantity"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + private CustomerOrder customerOrder; + + private Product product; + + private String productName; + + private String sku; + + private Integer quantity; + + private CommercePlatform commercePlatform; + + private LocalDateTime createTime; + + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public Product getProduct(){ + return this.product; + } + + public String getProductName(){ + return this.productName; + } + + public String getSku(){ + return this.sku; + } + + public Integer getQuantity(){ + return this.quantity; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public OrderLine updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public OrderLine updateProduct(Product product){ + if(isPropertyLoaded(PRODUCT_PROPERTY) && Objects.equals(this.product, product)){ + return this; + } + handleUpdate(PRODUCT_PROPERTY, getProduct(), product); + this.product = product; + return this; + } + + public OrderLine updateProductName(String productName){ + productName = (productName == null ? null : productName.trim()); + if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ + return this; + } + handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); + this.productName = productName; + return this; + } + + public OrderLine updateSku(String sku){ + sku = (sku == null ? null : sku.trim()); + if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ + return this; + } + handleUpdate(SKU_PROPERTY, getSku(), sku); + this.sku = sku; + return this; + } + + public OrderLine updateQuantity(Integer quantity){ + if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ + return this; + } + handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); + this.quantity = quantity; + return this; + } + + public OrderLine updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public OrderLine updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + + public static OrderLine refer(Long id){ + OrderLine refer = new OrderLine(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderLine comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "product": this.product = (Product) value; break; + + case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; + + case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; + + case "quantity": this.quantity = (Integer) value; break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "product": return this.product; + case "product_name": return this.productName; + case "sku": return this.sku; + case "quantity": return this.quantity; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "product": return this.product; + case "productName": return this.productName; + case "sku": return this.sku; + case "quantity": return this.quantity; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java new file mode 100644 index 000000000..299ce5191 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java @@ -0,0 +1,126 @@ + +package com.teaql.ordermanagementservice.orderline; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class OrderLineChecker implements Checker{ + + public String type(){ + return OrderLine.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderLine orderLine, ObjectLocation _parentLocation){ + if(needCheck(_context, orderLine)){ + markAsChecked(_context, orderLine); + doCheck(_context, orderLine, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderLine orderLine, ObjectLocation _parentLocation){ + if((orderLine == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderLine); + if(orderLine.needPersist()){ + } + if(orderLine.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + orderLine.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(orderLine.updateItem()){ + if(!orderLine.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("product")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("product_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("sku")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("quantity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!orderLine.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, orderLine.getProperty(OrderLine.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkProduct(_context, orderLine.getProperty(OrderLine.PRODUCT_PROPERTY), newLocation(_parentLocation, "product")); + checkProductName(_context, orderLine.getProperty(OrderLine.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); + checkSku(_context, orderLine.getProperty(OrderLine.SKU_PROPERTY), newLocation(_parentLocation, "sku")); + checkQuantity(_context, orderLine.getProperty(OrderLine.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); + checkCommercePlatform(_context, orderLine.getProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, orderLine.getProperty(OrderLine.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkProduct(UserContext _context, Product product, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, product); + if((product == null)){ + return; + } + new ProductChecker().checkAndFix(_context, product, _parentLocation); + } + public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, productName); + if((productName == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, productName); + + } + public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sku); + if((sku == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, sku); + + } + public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quantity); + if((quantity == null)){ + return; + } + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java new file mode 100644 index 000000000..4b0e96834 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java @@ -0,0 +1,95 @@ + +package com.teaql.ordermanagementservice.orderline; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderExpression; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class OrderLineExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderLineExpression(Expression expression){ + super(expression); + } + + public OrderLineExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderLineExpression updateId(Long id){ + return new OrderLineExpression(this, $it -> {((OrderLine)$it).__internalSet("id", id); return this;}); + } + + public OrderLineExpression save(UserContext userContext){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderLineExpression save(String intent, UserContext userContext){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderLine::getCustomerOrder)); + } + + public OrderLineExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCustomerOrder(customerOrder)); + } + + public ProductExpression getProduct(){ + return new ProductExpression(loaded("product", "getProduct", OrderLine::getProduct)); + } + + public OrderLineExpression updateProduct(Product product){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateProduct(product)); + } + + public Expression getProductName(){ + return loaded("product_name", "getProductName", OrderLine::getProductName); + } + public OrderLineExpression updateProductName(String productName){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateProductName(productName)); + } + + public Expression getSku(){ + return loaded("sku", "getSku", OrderLine::getSku); + } + public OrderLineExpression updateSku(String sku){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateSku(sku)); + } + + public Expression getQuantity(){ + return loaded("quantity", "getQuantity", OrderLine::getQuantity); + } + public OrderLineExpression updateQuantity(Integer quantity){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateQuantity(quantity)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderLine::getCommercePlatform)); + } + + public OrderLineExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCommercePlatform(commercePlatform)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", OrderLine::getCreateTime); + } + public OrderLineExpression updateCreateTime(LocalDateTime createTime){ + return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCreateTime(createTime)); + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java new file mode 100644 index 000000000..b7e5eeb32 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.orderline; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderLineListExpression extends SmartListExpression { + public OrderLineListExpression(Expression> expression){ + super(expression); + } + + public OrderLineListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderLineExpression first() { + return new OrderLineExpression(super.first()); + } + + public OrderLineExpression get(int index) { + return new OrderLineExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java new file mode 100644 index 000000000..420e2e78d --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java @@ -0,0 +1,1402 @@ + +package com.teaql.ordermanagementservice.orderline; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; +import com.teaql.ordermanagementservice.product.Product; +import com.teaql.ordermanagementservice.product.ProductRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class OrderLineRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderLineRequest(Class returnType){ + this(returnType, () -> (T) new OrderLine()); + } + + protected OrderLineRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderLineRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderLineRequest copy(){ + return (OrderLineRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderLineRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderLineRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderLineRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderLineRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderLineRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderLineRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderLineRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderLineRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderLineRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderLineRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderLineRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderLineRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderLineRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderLineRequest matchingAnyOf(OrderLineRequest orderLine){ + super.internalMatchAny(orderLine); + return this; + } + + public OrderLineRequest matchingIdsOf(OrderLineRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderLine.ID_PROPERTY, request, OrderLine.ID_PROPERTY)); + } + + public OrderLineRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderLineRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderLineRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderLineRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectProductIdOnly().selectProductName().selectSku().selectQuantity().selectCommercePlatformIdOnly().selectCreateTime().selectVersion(); + } + + public OrderLineRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderLineRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderLine.ID_PROPERTY); + selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderLine.PRODUCT_PROPERTY); + selectProperty(OrderLine.PRODUCT_NAME_PROPERTY); + selectProperty(OrderLine.SKU_PROPERTY); + selectProperty(OrderLine.QUANTITY_PROPERTY); + selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); + selectProperty(OrderLine.CREATE_TIME_PROPERTY); + selectProperty(OrderLine.VERSION_PROPERTY); + return this; + } + + public OrderLineRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectProduct().selectProductName().selectSku().selectQuantity().selectCommercePlatform().selectCreateTime().selectVersion(); + } + + public OrderLineRequest selectChildren(){ + super.selectAny(); + return selectId().selectCustomerOrder().selectProduct().selectProductName().selectSku().selectQuantity().selectCommercePlatform().selectCreateTime().selectVersion(); + } + + + public OrderLineRequest selectId(){ + selectProperty(OrderLine.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderLineRequest unselectId(){ + unselectProperty(OrderLine.ID_PROPERTY); + return this; + } + public OrderLineRequest selectCustomerOrderIdOnly(){ + selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderLineRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public OrderLineRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderLine.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public OrderLineRequest unselectCustomerOrder(){ + unselectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderLineRequest selectProductIdOnly(){ + selectProperty(OrderLine.PRODUCT_PROPERTY); + return this; + } + + public OrderLineRequest selectProduct(){ + return selectProductWith(Q.products().unlimited().selectSelf()); + } + + public OrderLineRequest selectProductWith(ProductRequest product){ + selectProperty(OrderLine.PRODUCT_PROPERTY); + enhanceRelation(OrderLine.PRODUCT_PROPERTY, product, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectProductWith", null, OrderLine.PRODUCT_PROPERTY)); + return this; + } + + public OrderLineRequest unselectProduct(){ + unselectProperty(OrderLine.PRODUCT_PROPERTY); + return this; + } + public OrderLineRequest selectProductName(){ + selectProperty(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + + /** + * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderLineRequest unselectProductName(){ + unselectProperty(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderLineRequest selectSku(){ + selectProperty(OrderLine.SKU_PROPERTY); + return this; + } + + /** + * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderLineRequest unselectSku(){ + unselectProperty(OrderLine.SKU_PROPERTY); + return this; + } + public OrderLineRequest selectQuantity(){ + selectProperty(OrderLine.QUANTITY_PROPERTY); + return this; + } + + /** + * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. + * @param aggrFunction aggrFunction + */ + public OrderLineRequest selectQuantity(AggrFunction aggrFunction){ + selectProperty(OrderLine.QUANTITY_PROPERTY, aggrFunction); + return this; + } + + + public OrderLineRequest unselectQuantity(){ + unselectProperty(OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest selectCommercePlatformIdOnly(){ + selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderLineRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public OrderLineRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderLine.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public OrderLineRequest unselectCommercePlatform(){ + unselectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderLineRequest selectCreateTime(){ + selectProperty(OrderLine.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderLineRequest unselectCreateTime(){ + unselectProperty(OrderLine.CREATE_TIME_PROPERTY); + return this; + } + public OrderLineRequest selectVersion(){ + selectProperty(OrderLine.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderLineRequest unselectVersion(){ + unselectProperty(OrderLine.VERSION_PROPERTY); + return this; + } + + public OrderLineRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.ID_PROPERTY, operator, values); + } + + public OrderLineRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderLineRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderLineRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderLineRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderLineRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public OrderLineRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public OrderLineRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public OrderLineRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public OrderLineRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public OrderLineRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public OrderLineRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public OrderLineRequest filterByProduct(Product... product){ + if (product == null || product.length == 0) { + throw new IllegalArgumentException("filterByProduct parameter product cannot be empty"); + } + return appendSearchCriteria(createProductCriteria(Operator.EQUAL, (Object[])product)); + } + + public OrderLineRequest withProduct(Operator operator, Object... values){ + return appendSearchCriteria(createProductCriteria(operator, values)); + } + + public OrderLineRequest withProductIsUnknown(){ + return withProduct(Operator.IS_NULL); + } + + public OrderLineRequest withProductIsKnown(){ + return withProduct(Operator.IS_NOT_NULL); + } + + public SearchCriteria createProductCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.PRODUCT_PROPERTY, operator, values); + } + + public OrderLineRequest filterByProduct(Long product){ + if(product == null){ + return this; + } + return withProduct(Operator.EQUAL, product); + } + public OrderLineRequest withProductMatching(ProductRequest product){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.PRODUCT_PROPERTY, product, Product.ID_PROPERTY)); + } + + public OrderLineRequest withoutProductMatching(ProductRequest product){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderLine.PRODUCT_PROPERTY, product, Product.ID_PROPERTY))); + } + + public OrderLineRequest filterByProductName(String... productName){ + if (productName == null || productName.length == 0) { + throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); + } + return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); + } + + public OrderLineRequest withProductName(Operator operator, Object... values){ + return appendSearchCriteria(createProductNameCriteria(operator, values)); + } + + public OrderLineRequest withProductNameIsUnknown(){ + return withProductName(Operator.IS_NULL); + } + + public OrderLineRequest withProductNameIsKnown(){ + return withProductName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.PRODUCT_NAME_PROPERTY, operator, values); + } + + public OrderLineRequest withProductNameIsNot(String productName){ + return withProductName(Operator.NOT_EQUAL, productName); + } + + public OrderLineRequest withProductNameIn(String... productName){ + return withProductName(Operator.IN, (Object[])productName); + } + + public OrderLineRequest withProductNameNotIn(String... productName){ + return withProductName(Operator.NOT_IN, (Object[])productName); + } + public OrderLineRequest withProductNameGreaterThan(String productName){ + return withProductName(Operator.GREATER_THAN, productName); + } + + public OrderLineRequest withProductNameGreaterThanOrEqualTo(String productName){ + return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); + } + + public OrderLineRequest withProductNameLessThan(String productName){ + return withProductName(Operator.LESS_THAN, productName); + } + + public OrderLineRequest withProductNameLessThanOrEqualTo(String productName){ + return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); + } + + public OrderLineRequest withProductNameBetween(String startOfProductName, String endOfProductName){ + return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); + } + public OrderLineRequest withProductNameStartingWith(String productName){ + return withProductName(Operator.BEGIN_WITH, productName); + } + public OrderLineRequest withProductNameContaining(String productName){ + return withProductName(Operator.CONTAIN, productName); + } + + public OrderLineRequest withProductNameNotContaining(String productName){ + return withProductName(Operator.NOT_CONTAIN, productName); + } + + public OrderLineRequest withProductNameNotStartingWith(String productName){ + return withProductName(Operator.NOT_BEGIN_WITH, productName); + } + + public OrderLineRequest withProductNameEndingWith(String productName){ + return withProductName(Operator.END_WITH, productName); + } + + public OrderLineRequest withProductNameNotEndingWith(String productName){ + return withProductName(Operator.NOT_END_WITH, productName); + } + + public OrderLineRequest withProductNameIs(String productName){ + return withProductName(Operator.EQUAL, productName); + } + + public OrderLineRequest withProductNameSoundingLike(String productName){ + return withProductName(Operator.SOUNDS_LIKE, productName); + } + + + + public OrderLineRequest filterBySku(String... sku){ + if (sku == null || sku.length == 0) { + throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); + } + return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); + } + + public OrderLineRequest withSku(Operator operator, Object... values){ + return appendSearchCriteria(createSkuCriteria(operator, values)); + } + + public OrderLineRequest withSkuIsUnknown(){ + return withSku(Operator.IS_NULL); + } + + public OrderLineRequest withSkuIsKnown(){ + return withSku(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSkuCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.SKU_PROPERTY, operator, values); + } + + public OrderLineRequest withSkuIsNot(String sku){ + return withSku(Operator.NOT_EQUAL, sku); + } + + public OrderLineRequest withSkuIn(String... sku){ + return withSku(Operator.IN, (Object[])sku); + } + + public OrderLineRequest withSkuNotIn(String... sku){ + return withSku(Operator.NOT_IN, (Object[])sku); + } + public OrderLineRequest withSkuGreaterThan(String sku){ + return withSku(Operator.GREATER_THAN, sku); + } + + public OrderLineRequest withSkuGreaterThanOrEqualTo(String sku){ + return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); + } + + public OrderLineRequest withSkuLessThan(String sku){ + return withSku(Operator.LESS_THAN, sku); + } + + public OrderLineRequest withSkuLessThanOrEqualTo(String sku){ + return withSku(Operator.LESS_THAN_OR_EQUAL, sku); + } + + public OrderLineRequest withSkuBetween(String startOfSku, String endOfSku){ + return withSku(Operator.BETWEEN, startOfSku, endOfSku); + } + public OrderLineRequest withSkuStartingWith(String sku){ + return withSku(Operator.BEGIN_WITH, sku); + } + public OrderLineRequest withSkuContaining(String sku){ + return withSku(Operator.CONTAIN, sku); + } + + public OrderLineRequest withSkuNotContaining(String sku){ + return withSku(Operator.NOT_CONTAIN, sku); + } + + public OrderLineRequest withSkuNotStartingWith(String sku){ + return withSku(Operator.NOT_BEGIN_WITH, sku); + } + + public OrderLineRequest withSkuEndingWith(String sku){ + return withSku(Operator.END_WITH, sku); + } + + public OrderLineRequest withSkuNotEndingWith(String sku){ + return withSku(Operator.NOT_END_WITH, sku); + } + + public OrderLineRequest withSkuIs(String sku){ + return withSku(Operator.EQUAL, sku); + } + + public OrderLineRequest withSkuSoundingLike(String sku){ + return withSku(Operator.SOUNDS_LIKE, sku); + } + + + + public OrderLineRequest filterByQuantity(Integer... quantity){ + if (quantity == null || quantity.length == 0) { + throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); + } + return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); + } + + public OrderLineRequest withQuantity(Operator operator, Object... values){ + return appendSearchCriteria(createQuantityCriteria(operator, values)); + } + + public OrderLineRequest withQuantityIsUnknown(){ + return withQuantity(Operator.IS_NULL); + } + + public OrderLineRequest withQuantityIsKnown(){ + return withQuantity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.QUANTITY_PROPERTY, operator, values); + } + + public OrderLineRequest withQuantityIs(Integer quantity){ + return withQuantity(Operator.EQUAL, quantity); + } + + public OrderLineRequest withQuantityIsNot(Integer quantity){ + return withQuantity(Operator.NOT_EQUAL, quantity); + } + + public OrderLineRequest withQuantityIn(Integer... quantity){ + return withQuantity(Operator.IN, (Object[])quantity); + } + + public OrderLineRequest withQuantityNotIn(Integer... quantity){ + return withQuantity(Operator.NOT_IN, (Object[])quantity); + } + public OrderLineRequest withQuantityGreaterThan(Integer quantity){ + return withQuantity(Operator.GREATER_THAN, quantity); + } + + public OrderLineRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); + } + + public OrderLineRequest withQuantityLessThan(Integer quantity){ + return withQuantity(Operator.LESS_THAN, quantity); + } + + public OrderLineRequest withQuantityLessThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); + } + + public OrderLineRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ + return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); + } + + + + public OrderLineRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public OrderLineRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public OrderLineRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public OrderLineRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public OrderLineRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public OrderLineRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public OrderLineRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public OrderLineRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public OrderLineRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public OrderLineRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public OrderLineRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.CREATE_TIME_PROPERTY, operator, values); + } + + public OrderLineRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public OrderLineRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public OrderLineRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public OrderLineRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public OrderLineRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderLineRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public OrderLineRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderLineRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public OrderLineRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public OrderLineRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderLineRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderLineRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderLineRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderLineRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public OrderLineRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderLineRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderLineRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderLineRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderLine.VERSION_PROPERTY, operator, values); + } + + public OrderLineRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderLineRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderLineRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderLineRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderLineRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderLineRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderLineRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderLineRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderLineRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderLineRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderLineRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderLineRequest minQuantity(){ + return minQuantityAs(prefix("minOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest minQuantityAs(String retName){ + super.min(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest maxQuantity(){ + return maxQuantityAs(prefix("maxOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest maxQuantityAs(String retName){ + super.max(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest sumQuantity(){ + return sumQuantityAs(prefix("sumOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest sumQuantityAs(String retName){ + super.sum(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest avgQuantity(){ + return avgQuantityAs(prefix("avgOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest avgQuantityAs(String retName){ + super.avg(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest standardDeviationQuantity(){ + return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest standardDeviationQuantityAs(String retName){ + super.standardDeviation(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest squareRootOfPopulationStandardDeviationQuantity(){ + return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest sampleVarianceQuantity(){ + return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest sampleVarianceQuantityAs(String retName){ + super.sampleVariance(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest samplePopulationVarianceQuantity(){ + return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderLine.QUANTITY_PROPERTY)); + } + + public OrderLineRequest samplePopulationVarianceQuantityAs(String retName){ + super.samplePopulationVariance(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public OrderLineRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderLine.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + public OrderLineRequest groupByProductWithDetails(){ + return groupByProductWithDetails(Q.products().unlimited()); + } + + public OrderLineRequest groupByProductWithDetails(ProductRequest subRequest){ + aggregate(OrderLine.PRODUCT_PROPERTY, subRequest); + return this; + } + + + + + public OrderLineRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public OrderLineRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(OrderLine.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + public OrderLineRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderLineRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderLine.ID_PROPERTY); + return this; + } + public OrderLineRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderLineRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderLineRequest countDistinctProduct(){ + return countDistinctProductAs("product_distinct_count"); + } + + public OrderLineRequest countDistinctProductAs(String alias){ + super.countDistinctProperty(alias, OrderLine.PRODUCT_PROPERTY); + return this; + } + public OrderLineRequest countDistinctProductName(){ + return countDistinctProductNameAs("product_name_distinct_count"); + } + + public OrderLineRequest countDistinctProductNameAs(String alias){ + super.countDistinctProperty(alias, OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderLineRequest countDistinctSku(){ + return countDistinctSkuAs("sku_distinct_count"); + } + + public OrderLineRequest countDistinctSkuAs(String alias){ + super.countDistinctProperty(alias, OrderLine.SKU_PROPERTY); + return this; + } + public OrderLineRequest countDistinctQuantity(){ + return countDistinctQuantityAs("quantity_distinct_count"); + } + + public OrderLineRequest countDistinctQuantityAs(String alias){ + super.countDistinctProperty(alias, OrderLine.QUANTITY_PROPERTY); + return this; + } + public OrderLineRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public OrderLineRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderLineRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public OrderLineRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderLine.CREATE_TIME_PROPERTY); + return this; + } + public OrderLineRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderLineRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderLine.VERSION_PROPERTY); + return this; + } + + public OrderLineRequest groupById(){ + groupBy(OrderLine.ID_PROPERTY); + return this; + } + + public OrderLineRequest groupByIdAs(String retName){ + groupBy(retName, OrderLine.ID_PROPERTY); + return this; + } + + public OrderLineRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.ID_PROPERTY, function); + return this; + } + public OrderLineRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(OrderLine.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public OrderLineRequest groupByCustomerOrder(){ + groupBy(OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderLineRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderLineRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + public OrderLineRequest groupByProductWith(ProductRequest subRequest){ + groupBy(OrderLine.PRODUCT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByProductWith", null, "product")); + return this; + } + public OrderLineRequest groupByProduct(){ + groupBy(OrderLine.PRODUCT_PROPERTY); + return this; + } + + public OrderLineRequest groupByProductAs(String retName){ + groupBy(retName, OrderLine.PRODUCT_PROPERTY); + return this; + } + + public OrderLineRequest groupByProductWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.PRODUCT_PROPERTY, function); + return this; + } + + public OrderLineRequest groupByProductName(){ + groupBy(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderLineRequest groupByProductNameAs(String retName){ + groupBy(retName, OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderLineRequest groupByProductNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.PRODUCT_NAME_PROPERTY, function); + return this; + } + + public OrderLineRequest groupBySku(){ + groupBy(OrderLine.SKU_PROPERTY); + return this; + } + + public OrderLineRequest groupBySkuAs(String retName){ + groupBy(retName, OrderLine.SKU_PROPERTY); + return this; + } + + public OrderLineRequest groupBySkuWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.SKU_PROPERTY, function); + return this; + } + + public OrderLineRequest groupByQuantity(){ + groupBy(OrderLine.QUANTITY_PROPERTY); + return this; + } + + public OrderLineRequest groupByQuantityAs(String retName){ + groupBy(retName, OrderLine.QUANTITY_PROPERTY); + return this; + } + + public OrderLineRequest groupByQuantityWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.QUANTITY_PROPERTY, function); + return this; + } + public OrderLineRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(OrderLine.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public OrderLineRequest groupByCommercePlatform(){ + groupBy(OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderLineRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderLineRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public OrderLineRequest groupByCreateTime(){ + groupBy(OrderLine.CREATE_TIME_PROPERTY); + return this; + } + + public OrderLineRequest groupByCreateTimeAs(String retName){ + groupBy(retName, OrderLine.CREATE_TIME_PROPERTY); + return this; + } + + public OrderLineRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.CREATE_TIME_PROPERTY, function); + return this; + } + + public OrderLineRequest groupByVersion(){ + groupBy(OrderLine.VERSION_PROPERTY); + return this; + } + + public OrderLineRequest groupByVersionAs(String retName){ + groupBy(retName, OrderLine.VERSION_PROPERTY); + return this; + } + + public OrderLineRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderLine.VERSION_PROPERTY, function); + return this; + } + + + + public OrderLineRequest orderByIdAscending(){ + addOrderByAscending(OrderLine.ID_PROPERTY); + return this; + } + + public OrderLineRequest orderByIdDescending(){ + addOrderByDescending(OrderLine.ID_PROPERTY); + return this; + } + + public OrderLineRequest orderByCustomerOrderAscending(){ + addOrderByAscending(OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderLineRequest orderByCustomerOrderDescending(){ + addOrderByDescending(OrderLine.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderLineRequest orderByProductAscending(){ + addOrderByAscending(OrderLine.PRODUCT_PROPERTY); + return this; + } + + public OrderLineRequest orderByProductDescending(){ + addOrderByDescending(OrderLine.PRODUCT_PROPERTY); + return this; + } + + public OrderLineRequest orderByProductNameAscending(){ + addOrderByAscending(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderLineRequest orderByProductNameDescending(){ + addOrderByDescending(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderLineRequest orderByProductNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderLineRequest orderByProductNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderLine.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderLineRequest orderBySkuAscending(){ + addOrderByAscending(OrderLine.SKU_PROPERTY); + return this; + } + + public OrderLineRequest orderBySkuDescending(){ + addOrderByDescending(OrderLine.SKU_PROPERTY); + return this; + } + public OrderLineRequest orderBySkuAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderLine.SKU_PROPERTY); + return this; + } + + public OrderLineRequest orderBySkuDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderLine.SKU_PROPERTY); + return this; + } + public OrderLineRequest orderByQuantityAscending(){ + addOrderByAscending(OrderLine.QUANTITY_PROPERTY); + return this; + } + + public OrderLineRequest orderByQuantityDescending(){ + addOrderByDescending(OrderLine.QUANTITY_PROPERTY); + return this; + } + + public OrderLineRequest orderByCommercePlatformAscending(){ + addOrderByAscending(OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderLineRequest orderByCommercePlatformDescending(){ + addOrderByDescending(OrderLine.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderLineRequest orderByCreateTimeAscending(){ + addOrderByAscending(OrderLine.CREATE_TIME_PROPERTY); + return this; + } + + public OrderLineRequest orderByCreateTimeDescending(){ + addOrderByDescending(OrderLine.CREATE_TIME_PROPERTY); + return this; + } + + public OrderLineRequest orderByVersionAscending(){ + addOrderByAscending(OrderLine.VERSION_PROPERTY); + return this; + } + + public OrderLineRequest orderByVersionDescending(){ + addOrderByDescending(OrderLine.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + public ProductRequest rollUpToProduct(){ + ProductRequest product = Q.products().unlimited(); + this.internalRollUpTo("product", product, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToProduct", null, "product")); + return product; + } + + + + + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + + + public OrderLineRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public OrderLineRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderLine.CUSTOMER_ORDER_PROPERTY)); + return this; + } + public OrderLineRequest facetByProductAs(String facetName, ProductRequest product){ + return facetByProductAs(facetName, product, true); + } + + public OrderLineRequest facetByProductAs(String facetName, ProductRequest product, boolean includeAllFacets){ + addFacet(facetName, OrderLine.PRODUCT_PROPERTY, product, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByProductAs", facetName, OrderLine.PRODUCT_PROPERTY)); + return this; + } + public OrderLineRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public OrderLineRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderLineRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderLineRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderLineRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderLineRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderLineRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderLineRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java new file mode 100644 index 000000000..69f4b3ab6 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java @@ -0,0 +1,232 @@ + +package com.teaql.ordermanagementservice.ordersearchpreset; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderSearchPreset extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderSearchPreset"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7370ba923091e78805facef9877cc6c566871604f4974bb9d2fb39be83dcdf83"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("filter_json", 2), java.util.Map.entry("request_id", 3), java.util.Map.entry("owner_user_id", 4), java.util.Map.entry("commerce_platform", 5), java.util.Map.entry("create_time", 6), java.util.Map.entry("update_time", 7), java.util.Map.entry("version", 8)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("filter_json", java.util.List.of("filterJson", "filter_json")), java.util.Map.entry("request_id", java.util.List.of("requestId", "request_id")), java.util.Map.entry("owner_user_id", java.util.List.of("ownerUserId", "owner_user_id")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderSearchPreset.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String FILTER_JSON_PROPERTY = "filter_json"; + public static final String REQUEST_ID_PROPERTY = "request_id"; + public static final String OWNER_USER_ID_PROPERTY = "owner_user_id"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private String name; + + private String filterJson; + + private String requestId; + + private String ownerUserId; + + private CommercePlatform commercePlatform; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public String getName(){ + return this.name; + } + + public String getFilterJson(){ + return this.filterJson; + } + + public String getRequestId(){ + return this.requestId; + } + + public String getOwnerUserId(){ + return this.ownerUserId; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public OrderSearchPreset updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public OrderSearchPreset updateFilterJson(String filterJson){ + filterJson = (filterJson == null ? null : filterJson.trim()); + if(isPropertyLoaded(FILTER_JSON_PROPERTY) && Objects.equals(this.filterJson, filterJson)){ + return this; + } + handleUpdate(FILTER_JSON_PROPERTY, getFilterJson(), filterJson); + this.filterJson = filterJson; + return this; + } + + public OrderSearchPreset updateRequestId(String requestId){ + requestId = (requestId == null ? null : requestId.trim()); + if(isPropertyLoaded(REQUEST_ID_PROPERTY) && Objects.equals(this.requestId, requestId)){ + return this; + } + handleUpdate(REQUEST_ID_PROPERTY, getRequestId(), requestId); + this.requestId = requestId; + return this; + } + + public OrderSearchPreset updateOwnerUserId(String ownerUserId){ + ownerUserId = (ownerUserId == null ? null : ownerUserId.trim()); + if(isPropertyLoaded(OWNER_USER_ID_PROPERTY) && Objects.equals(this.ownerUserId, ownerUserId)){ + return this; + } + handleUpdate(OWNER_USER_ID_PROPERTY, getOwnerUserId(), ownerUserId); + this.ownerUserId = ownerUserId; + return this; + } + + public OrderSearchPreset updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public OrderSearchPreset updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public OrderSearchPreset updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static OrderSearchPreset refer(Long id){ + OrderSearchPreset refer = new OrderSearchPreset(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderSearchPreset comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "filter_json": this.filterJson = (value == null ? null : ((String)value).trim()); break; + + case "request_id": this.requestId = (value == null ? null : ((String)value).trim()); break; + + case "owner_user_id": this.ownerUserId = (value == null ? null : ((String)value).trim()); break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "filter_json": return this.filterJson; + case "request_id": return this.requestId; + case "owner_user_id": return this.ownerUserId; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "filterJson": return this.filterJson; + case "requestId": return this.requestId; + case "ownerUserId": return this.ownerUserId; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java new file mode 100644 index 000000000..566a351c7 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java @@ -0,0 +1,139 @@ + +package com.teaql.ordermanagementservice.ordersearchpreset; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class OrderSearchPresetChecker implements Checker{ + + public String type(){ + return OrderSearchPreset.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ + if(needCheck(_context, orderSearchPreset)){ + markAsChecked(_context, orderSearchPreset); + doCheck(_context, orderSearchPreset, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ + if((orderSearchPreset == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderSearchPreset); + if(orderSearchPreset.needPersist()){ + } + if(orderSearchPreset.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + orderSearchPreset.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderSearchPreset.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(orderSearchPreset.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderSearchPreset.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!orderSearchPreset.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("filter_json")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "filter_json"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("request_id")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "request_id"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("owner_user_id")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "owner_user_id"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!orderSearchPreset.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, orderSearchPreset.getProperty(OrderSearchPreset.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkFilterJson(_context, orderSearchPreset.getProperty(OrderSearchPreset.FILTER_JSON_PROPERTY), newLocation(_parentLocation, "filter_json")); + checkRequestId(_context, orderSearchPreset.getProperty(OrderSearchPreset.REQUEST_ID_PROPERTY), newLocation(_parentLocation, "request_id")); + checkOwnerUserId(_context, orderSearchPreset.getProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY), newLocation(_parentLocation, "owner_user_id")); + checkCommercePlatform(_context, orderSearchPreset.getProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, orderSearchPreset.getProperty(OrderSearchPreset.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, orderSearchPreset.getProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkFilterJson(UserContext _context, String filterJson, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, filterJson); + if((filterJson == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, filterJson); + + } + public void checkRequestId(UserContext _context, String requestId, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, requestId); + if((requestId == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, requestId); + + } + public void checkOwnerUserId(UserContext _context, String ownerUserId, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, ownerUserId); + if((ownerUserId == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, ownerUserId); + + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java new file mode 100644 index 000000000..91c9653dc --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java @@ -0,0 +1,89 @@ + +package com.teaql.ordermanagementservice.ordersearchpreset; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class OrderSearchPresetExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderSearchPresetExpression(Expression expression){ + super(expression); + } + + public OrderSearchPresetExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderSearchPresetExpression updateId(Long id){ + return new OrderSearchPresetExpression(this, $it -> {((OrderSearchPreset)$it).__internalSet("id", id); return this;}); + } + + public OrderSearchPresetExpression save(UserContext userContext){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderSearchPresetExpression save(String intent, UserContext userContext){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", OrderSearchPreset::getName); + } + public OrderSearchPresetExpression updateName(String name){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateName(name)); + } + + public Expression getFilterJson(){ + return loaded("filter_json", "getFilterJson", OrderSearchPreset::getFilterJson); + } + public OrderSearchPresetExpression updateFilterJson(String filterJson){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateFilterJson(filterJson)); + } + + public Expression getRequestId(){ + return loaded("request_id", "getRequestId", OrderSearchPreset::getRequestId); + } + public OrderSearchPresetExpression updateRequestId(String requestId){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateRequestId(requestId)); + } + + public Expression getOwnerUserId(){ + return loaded("owner_user_id", "getOwnerUserId", OrderSearchPreset::getOwnerUserId); + } + public OrderSearchPresetExpression updateOwnerUserId(String ownerUserId){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateOwnerUserId(ownerUserId)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderSearchPreset::getCommercePlatform)); + } + + public OrderSearchPresetExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateCommercePlatform(commercePlatform)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", OrderSearchPreset::getCreateTime); + } + public OrderSearchPresetExpression updateCreateTime(LocalDateTime createTime){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", OrderSearchPreset::getUpdateTime); + } + public OrderSearchPresetExpression updateUpdateTime(LocalDateTime updateTime){ + return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java new file mode 100644 index 000000000..a3cefd1e4 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.ordersearchpreset; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderSearchPresetListExpression extends SmartListExpression { + public OrderSearchPresetListExpression(Expression> expression){ + super(expression); + } + + public OrderSearchPresetListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderSearchPresetExpression first() { + return new OrderSearchPresetExpression(super.first()); + } + + public OrderSearchPresetExpression get(int index) { + return new OrderSearchPresetExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java new file mode 100644 index 000000000..8ca8b107f --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java @@ -0,0 +1,1390 @@ + +package com.teaql.ordermanagementservice.ordersearchpreset; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class OrderSearchPresetRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderSearchPresetRequest(Class returnType){ + this(returnType, () -> (T) new OrderSearchPreset()); + } + + protected OrderSearchPresetRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderSearchPresetRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderSearchPresetRequest copy(){ + return (OrderSearchPresetRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderSearchPresetRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderSearchPresetRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderSearchPresetRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderSearchPresetRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderSearchPresetRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderSearchPresetRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderSearchPresetRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderSearchPresetRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderSearchPresetRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderSearchPresetRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderSearchPresetRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderSearchPresetRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderSearchPresetRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderSearchPresetRequest matchingAnyOf(OrderSearchPresetRequest orderSearchPreset){ + super.internalMatchAny(orderSearchPreset); + return this; + } + + public OrderSearchPresetRequest matchingIdsOf(OrderSearchPresetRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderSearchPreset.ID_PROPERTY, request, OrderSearchPreset.ID_PROPERTY)); + } + + public OrderSearchPresetRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderSearchPresetRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderSearchPresetRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderSearchPresetRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public OrderSearchPresetRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderSearchPresetRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderSearchPreset.ID_PROPERTY); + selectProperty(OrderSearchPreset.NAME_PROPERTY); + selectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); + selectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); + selectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + selectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); + selectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); + selectProperty(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + public OrderSearchPresetRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public OrderSearchPresetRequest selectChildren(){ + super.selectAny(); + return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public OrderSearchPresetRequest selectId(){ + selectProperty(OrderSearchPreset.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectId(){ + unselectProperty(OrderSearchPreset.ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectName(){ + selectProperty(OrderSearchPreset.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectName(){ + unselectProperty(OrderSearchPreset.NAME_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectFilterJson(){ + selectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + + /** + * fill the filterJson with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS filterJson) to fetch filterJson property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectFilterJson(){ + unselectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectRequestId(){ + selectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + + /** + * fill the requestId with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requestId) to fetch requestId property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectRequestId(){ + unselectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectOwnerUserId(){ + selectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + + /** + * fill the ownerUserId with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS ownerUserId) to fetch ownerUserId property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectOwnerUserId(){ + unselectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectCommercePlatformIdOnly(){ + selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderSearchPresetRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public OrderSearchPresetRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public OrderSearchPresetRequest unselectCommercePlatform(){ + unselectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectCreateTime(){ + selectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectCreateTime(){ + unselectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectUpdateTime(){ + selectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectUpdateTime(){ + unselectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + public OrderSearchPresetRequest selectVersion(){ + selectProperty(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderSearchPresetRequest unselectVersion(){ + unselectProperty(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + public OrderSearchPresetRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.ID_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderSearchPresetRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderSearchPresetRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderSearchPresetRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderSearchPresetRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public OrderSearchPresetRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public OrderSearchPresetRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.NAME_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public OrderSearchPresetRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public OrderSearchPresetRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public OrderSearchPresetRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public OrderSearchPresetRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public OrderSearchPresetRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public OrderSearchPresetRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public OrderSearchPresetRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public OrderSearchPresetRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public OrderSearchPresetRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public OrderSearchPresetRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public OrderSearchPresetRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public OrderSearchPresetRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public OrderSearchPresetRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public OrderSearchPresetRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public OrderSearchPresetRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public OrderSearchPresetRequest filterByFilterJson(String... filterJson){ + if (filterJson == null || filterJson.length == 0) { + throw new IllegalArgumentException("filterByFilterJson parameter filterJson cannot be empty"); + } + return appendSearchCriteria(createFilterJsonCriteria(Operator.EQUAL, (Object[])filterJson)); + } + + public OrderSearchPresetRequest withFilterJson(Operator operator, Object... values){ + return appendSearchCriteria(createFilterJsonCriteria(operator, values)); + } + + public OrderSearchPresetRequest withFilterJsonIsUnknown(){ + return withFilterJson(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withFilterJsonIsKnown(){ + return withFilterJson(Operator.IS_NOT_NULL); + } + + public SearchCriteria createFilterJsonCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.FILTER_JSON_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withFilterJsonIsNot(String filterJson){ + return withFilterJson(Operator.NOT_EQUAL, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonIn(String... filterJson){ + return withFilterJson(Operator.IN, (Object[])filterJson); + } + + public OrderSearchPresetRequest withFilterJsonNotIn(String... filterJson){ + return withFilterJson(Operator.NOT_IN, (Object[])filterJson); + } + public OrderSearchPresetRequest withFilterJsonGreaterThan(String filterJson){ + return withFilterJson(Operator.GREATER_THAN, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonGreaterThanOrEqualTo(String filterJson){ + return withFilterJson(Operator.GREATER_THAN_OR_EQUAL, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonLessThan(String filterJson){ + return withFilterJson(Operator.LESS_THAN, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonLessThanOrEqualTo(String filterJson){ + return withFilterJson(Operator.LESS_THAN_OR_EQUAL, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonBetween(String startOfFilterJson, String endOfFilterJson){ + return withFilterJson(Operator.BETWEEN, startOfFilterJson, endOfFilterJson); + } + public OrderSearchPresetRequest withFilterJsonStartingWith(String filterJson){ + return withFilterJson(Operator.BEGIN_WITH, filterJson); + } + public OrderSearchPresetRequest withFilterJsonContaining(String filterJson){ + return withFilterJson(Operator.CONTAIN, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonNotContaining(String filterJson){ + return withFilterJson(Operator.NOT_CONTAIN, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonNotStartingWith(String filterJson){ + return withFilterJson(Operator.NOT_BEGIN_WITH, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonEndingWith(String filterJson){ + return withFilterJson(Operator.END_WITH, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonNotEndingWith(String filterJson){ + return withFilterJson(Operator.NOT_END_WITH, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonIs(String filterJson){ + return withFilterJson(Operator.EQUAL, filterJson); + } + + public OrderSearchPresetRequest withFilterJsonSoundingLike(String filterJson){ + return withFilterJson(Operator.SOUNDS_LIKE, filterJson); + } + + + + public OrderSearchPresetRequest filterByRequestId(String... requestId){ + if (requestId == null || requestId.length == 0) { + throw new IllegalArgumentException("filterByRequestId parameter requestId cannot be empty"); + } + return appendSearchCriteria(createRequestIdCriteria(Operator.EQUAL, (Object[])requestId)); + } + + public OrderSearchPresetRequest withRequestId(Operator operator, Object... values){ + return appendSearchCriteria(createRequestIdCriteria(operator, values)); + } + + public OrderSearchPresetRequest withRequestIdIsUnknown(){ + return withRequestId(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withRequestIdIsKnown(){ + return withRequestId(Operator.IS_NOT_NULL); + } + + public SearchCriteria createRequestIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.REQUEST_ID_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withRequestIdIsNot(String requestId){ + return withRequestId(Operator.NOT_EQUAL, requestId); + } + + public OrderSearchPresetRequest withRequestIdIn(String... requestId){ + return withRequestId(Operator.IN, (Object[])requestId); + } + + public OrderSearchPresetRequest withRequestIdNotIn(String... requestId){ + return withRequestId(Operator.NOT_IN, (Object[])requestId); + } + public OrderSearchPresetRequest withRequestIdGreaterThan(String requestId){ + return withRequestId(Operator.GREATER_THAN, requestId); + } + + public OrderSearchPresetRequest withRequestIdGreaterThanOrEqualTo(String requestId){ + return withRequestId(Operator.GREATER_THAN_OR_EQUAL, requestId); + } + + public OrderSearchPresetRequest withRequestIdLessThan(String requestId){ + return withRequestId(Operator.LESS_THAN, requestId); + } + + public OrderSearchPresetRequest withRequestIdLessThanOrEqualTo(String requestId){ + return withRequestId(Operator.LESS_THAN_OR_EQUAL, requestId); + } + + public OrderSearchPresetRequest withRequestIdBetween(String startOfRequestId, String endOfRequestId){ + return withRequestId(Operator.BETWEEN, startOfRequestId, endOfRequestId); + } + public OrderSearchPresetRequest withRequestIdStartingWith(String requestId){ + return withRequestId(Operator.BEGIN_WITH, requestId); + } + public OrderSearchPresetRequest withRequestIdContaining(String requestId){ + return withRequestId(Operator.CONTAIN, requestId); + } + + public OrderSearchPresetRequest withRequestIdNotContaining(String requestId){ + return withRequestId(Operator.NOT_CONTAIN, requestId); + } + + public OrderSearchPresetRequest withRequestIdNotStartingWith(String requestId){ + return withRequestId(Operator.NOT_BEGIN_WITH, requestId); + } + + public OrderSearchPresetRequest withRequestIdEndingWith(String requestId){ + return withRequestId(Operator.END_WITH, requestId); + } + + public OrderSearchPresetRequest withRequestIdNotEndingWith(String requestId){ + return withRequestId(Operator.NOT_END_WITH, requestId); + } + + public OrderSearchPresetRequest withRequestIdIs(String requestId){ + return withRequestId(Operator.EQUAL, requestId); + } + + public OrderSearchPresetRequest withRequestIdSoundingLike(String requestId){ + return withRequestId(Operator.SOUNDS_LIKE, requestId); + } + + + + public OrderSearchPresetRequest filterByOwnerUserId(String... ownerUserId){ + if (ownerUserId == null || ownerUserId.length == 0) { + throw new IllegalArgumentException("filterByOwnerUserId parameter ownerUserId cannot be empty"); + } + return appendSearchCriteria(createOwnerUserIdCriteria(Operator.EQUAL, (Object[])ownerUserId)); + } + + public OrderSearchPresetRequest withOwnerUserId(Operator operator, Object... values){ + return appendSearchCriteria(createOwnerUserIdCriteria(operator, values)); + } + + public OrderSearchPresetRequest withOwnerUserIdIsUnknown(){ + return withOwnerUserId(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withOwnerUserIdIsKnown(){ + return withOwnerUserId(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOwnerUserIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.OWNER_USER_ID_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withOwnerUserIdIsNot(String ownerUserId){ + return withOwnerUserId(Operator.NOT_EQUAL, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdIn(String... ownerUserId){ + return withOwnerUserId(Operator.IN, (Object[])ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdNotIn(String... ownerUserId){ + return withOwnerUserId(Operator.NOT_IN, (Object[])ownerUserId); + } + public OrderSearchPresetRequest withOwnerUserIdGreaterThan(String ownerUserId){ + return withOwnerUserId(Operator.GREATER_THAN, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdGreaterThanOrEqualTo(String ownerUserId){ + return withOwnerUserId(Operator.GREATER_THAN_OR_EQUAL, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdLessThan(String ownerUserId){ + return withOwnerUserId(Operator.LESS_THAN, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdLessThanOrEqualTo(String ownerUserId){ + return withOwnerUserId(Operator.LESS_THAN_OR_EQUAL, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdBetween(String startOfOwnerUserId, String endOfOwnerUserId){ + return withOwnerUserId(Operator.BETWEEN, startOfOwnerUserId, endOfOwnerUserId); + } + public OrderSearchPresetRequest withOwnerUserIdStartingWith(String ownerUserId){ + return withOwnerUserId(Operator.BEGIN_WITH, ownerUserId); + } + public OrderSearchPresetRequest withOwnerUserIdContaining(String ownerUserId){ + return withOwnerUserId(Operator.CONTAIN, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdNotContaining(String ownerUserId){ + return withOwnerUserId(Operator.NOT_CONTAIN, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdNotStartingWith(String ownerUserId){ + return withOwnerUserId(Operator.NOT_BEGIN_WITH, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdEndingWith(String ownerUserId){ + return withOwnerUserId(Operator.END_WITH, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdNotEndingWith(String ownerUserId){ + return withOwnerUserId(Operator.NOT_END_WITH, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdIs(String ownerUserId){ + return withOwnerUserId(Operator.EQUAL, ownerUserId); + } + + public OrderSearchPresetRequest withOwnerUserIdSoundingLike(String ownerUserId){ + return withOwnerUserId(Operator.SOUNDS_LIKE, ownerUserId); + } + + + + public OrderSearchPresetRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public OrderSearchPresetRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public OrderSearchPresetRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public OrderSearchPresetRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public OrderSearchPresetRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public OrderSearchPresetRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public OrderSearchPresetRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public OrderSearchPresetRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.CREATE_TIME_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public OrderSearchPresetRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public OrderSearchPresetRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public OrderSearchPresetRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public OrderSearchPresetRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderSearchPresetRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public OrderSearchPresetRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderSearchPresetRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public OrderSearchPresetRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public OrderSearchPresetRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderSearchPresetRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderSearchPresetRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderSearchPresetRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderSearchPresetRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public OrderSearchPresetRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public OrderSearchPresetRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public OrderSearchPresetRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.UPDATE_TIME_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public OrderSearchPresetRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public OrderSearchPresetRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderSearchPresetRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public OrderSearchPresetRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderSearchPresetRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderSearchPresetRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderSearchPresetRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderSearchPreset.VERSION_PROPERTY, operator, values); + } + + public OrderSearchPresetRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderSearchPresetRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderSearchPresetRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderSearchPresetRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderSearchPresetRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderSearchPresetRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderSearchPresetRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderSearchPresetRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderSearchPresetRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderSearchPresetRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderSearchPresetRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderSearchPresetRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public OrderSearchPresetRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public OrderSearchPresetRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.NAME_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctFilterJson(){ + return countDistinctFilterJsonAs("filter_json_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctFilterJsonAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctRequestId(){ + return countDistinctRequestIdAs("request_id_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctRequestIdAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctOwnerUserId(){ + return countDistinctOwnerUserIdAs("owner_user_id_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctOwnerUserIdAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + public OrderSearchPresetRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderSearchPresetRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupById(){ + groupBy(OrderSearchPreset.ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByIdAs(String retName){ + groupBy(retName, OrderSearchPreset.ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.ID_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByName(){ + groupBy(OrderSearchPreset.NAME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByNameAs(String retName){ + groupBy(retName, OrderSearchPreset.NAME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.NAME_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByFilterJson(){ + groupBy(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByFilterJsonAs(String retName){ + groupBy(retName, OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByFilterJsonWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.FILTER_JSON_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByRequestId(){ + groupBy(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByRequestIdAs(String retName){ + groupBy(retName, OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByRequestIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.REQUEST_ID_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByOwnerUserId(){ + groupBy(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByOwnerUserIdAs(String retName){ + groupBy(retName, OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByOwnerUserIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.OWNER_USER_ID_PROPERTY, function); + return this; + } + public OrderSearchPresetRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public OrderSearchPresetRequest groupByCommercePlatform(){ + groupBy(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByCreateTime(){ + groupBy(OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByCreateTimeAs(String retName){ + groupBy(retName, OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.CREATE_TIME_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByUpdateTime(){ + groupBy(OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.UPDATE_TIME_PROPERTY, function); + return this; + } + + public OrderSearchPresetRequest groupByVersion(){ + groupBy(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByVersionAs(String retName){ + groupBy(retName, OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + public OrderSearchPresetRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderSearchPreset.VERSION_PROPERTY, function); + return this; + } + + + + public OrderSearchPresetRequest orderByIdAscending(){ + addOrderByAscending(OrderSearchPreset.ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByIdDescending(){ + addOrderByDescending(OrderSearchPreset.ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByNameAscending(){ + addOrderByAscending(OrderSearchPreset.NAME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByNameDescending(){ + addOrderByDescending(OrderSearchPreset.NAME_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderSearchPreset.NAME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderSearchPreset.NAME_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByFilterJsonAscending(){ + addOrderByAscending(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByFilterJsonDescending(){ + addOrderByDescending(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByFilterJsonAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByFilterJsonDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderSearchPreset.FILTER_JSON_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByRequestIdAscending(){ + addOrderByAscending(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByRequestIdDescending(){ + addOrderByDescending(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByRequestIdAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByRequestIdDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderSearchPreset.REQUEST_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByOwnerUserIdAscending(){ + addOrderByAscending(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByOwnerUserIdDescending(){ + addOrderByDescending(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByOwnerUserIdAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByOwnerUserIdDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderSearchPreset.OWNER_USER_ID_PROPERTY); + return this; + } + public OrderSearchPresetRequest orderByCommercePlatformAscending(){ + addOrderByAscending(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByCommercePlatformDescending(){ + addOrderByDescending(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByCreateTimeAscending(){ + addOrderByAscending(OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByCreateTimeDescending(){ + addOrderByDescending(OrderSearchPreset.CREATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByUpdateTimeAscending(){ + addOrderByAscending(OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByUpdateTimeDescending(){ + addOrderByDescending(OrderSearchPreset.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByVersionAscending(){ + addOrderByAscending(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + public OrderSearchPresetRequest orderByVersionDescending(){ + addOrderByDescending(OrderSearchPreset.VERSION_PROPERTY); + return this; + } + + + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + + + + public OrderSearchPresetRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public OrderSearchPresetRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderSearchPresetRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderSearchPresetRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderSearchPresetRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderSearchPresetRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderSearchPresetRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderSearchPresetRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java new file mode 100644 index 000000000..e44b5a8a9 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java @@ -0,0 +1,214 @@ + +package com.teaql.ordermanagementservice.orderstatus; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderStatus extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderStatus"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f26f586dd82cdacffeee3bb7fe1ac1ef7385535d6ef257cd764ee435607e21c9"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("code", 2), java.util.Map.entry("color", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("commerce_platform", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("color", java.util.List.of("color", "color")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderStatus.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CODE_PROPERTY = "code"; + public static final String COLOR_PROPERTY = "color"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private String code; + + private String color; + + private BigDecimal displayOrder; + + private CommercePlatform commercePlatform; + + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public String getCode(){ + return this.code; + } + + public String getColor(){ + return this.color; + } + + public BigDecimal getDisplayOrder(){ + return this.displayOrder; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public OrderStatus updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public OrderStatus updateCode(String code){ + code = (code == null ? null : code.trim()); + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ + return this; + } + handleUpdate(CODE_PROPERTY, getCode(), code); + this.code = code; + return this; + } + + public OrderStatus updateColor(String color){ + color = (color == null ? null : color.trim()); + if(isPropertyLoaded(COLOR_PROPERTY) && Objects.equals(this.color, color)){ + return this; + } + handleUpdate(COLOR_PROPERTY, getColor(), color); + this.color = color; + return this; + } + + public OrderStatus updateDisplayOrder(BigDecimal displayOrder){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ + return this; + } + handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); + this.displayOrder = displayOrder; + return this; + } + + public OrderStatus updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public OrderStatus addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateProperty(CustomerOrder.STATUS_PROPERTY, this); + return this; + } + + public static OrderStatus refer(Long id){ + OrderStatus refer = new OrderStatus(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderStatus comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "code": this.code = (value == null ? null : ((String)value).trim()); break; + + case "color": this.color = (value == null ? null : ((String)value).trim()); break; + + case "display_order": this.displayOrder = (BigDecimal) value; break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "code": return this.code; + case "color": return this.color; + case "display_order": return this.displayOrder; + case "commerce_platform": return this.commercePlatform; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "code": return this.code; + case "color": return this.color; + case "displayOrder": return this.displayOrder; + case "commercePlatform": return this.commercePlatform; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java new file mode 100644 index 000000000..8ef805422 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java @@ -0,0 +1,98 @@ + +package com.teaql.ordermanagementservice.orderstatus; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class OrderStatusChecker implements Checker{ + + public String type(){ + return OrderStatus.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ + if(needCheck(_context, orderStatus)){ + markAsChecked(_context, orderStatus); + doCheck(_context, orderStatus, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ + if((orderStatus == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderStatus); + if(orderStatus.needPersist()){ + } + if(orderStatus.newItem()){ + }else if(orderStatus.updateItem()){ + if(!orderStatus.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("color")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "color"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("display_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, orderStatus.getProperty(OrderStatus.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, orderStatus.getProperty(OrderStatus.CODE_PROPERTY), newLocation(_parentLocation, "code")); + checkColor(_context, orderStatus.getProperty(OrderStatus.COLOR_PROPERTY), newLocation(_parentLocation, "color")); + checkDisplayOrder(_context, orderStatus.getProperty(OrderStatus.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); + checkCommercePlatform(_context, orderStatus.getProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + for(int i = 0; orderStatus.getCustomerOrderList() != null && i < orderStatus.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = orderStatus.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); + if((code == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, code); + + } + public void checkColor(UserContext _context, String color, ObjectLocation _parentLocation){ + if((color == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, color); + + } + public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ + if((displayOrder == null)){ + return; + } + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java new file mode 100644 index 000000000..0b3343d3a --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java @@ -0,0 +1,83 @@ + +package com.teaql.ordermanagementservice.orderstatus; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class OrderStatusExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderStatusExpression(Expression expression){ + super(expression); + } + + public OrderStatusExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderStatusExpression updateId(Long id){ + return new OrderStatusExpression(this, $it -> {((OrderStatus)$it).__internalSet("id", id); return this;}); + } + + public OrderStatusExpression save(UserContext userContext){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderStatusExpression save(String intent, UserContext userContext){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", OrderStatus::getName); + } + public OrderStatusExpression updateName(String name){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateName(name)); + } + + public Expression getCode(){ + return loaded("code", "getCode", OrderStatus::getCode); + } + public OrderStatusExpression updateCode(String code){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCode(code)); + } + + public Expression getColor(){ + return loaded("color", "getColor", OrderStatus::getColor); + } + public OrderStatusExpression updateColor(String color){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateColor(color)); + } + + public Expression getDisplayOrder(){ + return loaded("display_order", "getDisplayOrder", OrderStatus::getDisplayOrder); + } + public OrderStatusExpression updateDisplayOrder(BigDecimal displayOrder){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateDisplayOrder(displayOrder)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderStatus::getCommercePlatform)); + } + + public OrderStatusExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCommercePlatform(commercePlatform)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", OrderStatus::getCustomerOrderList)); + } + public OrderStatusExpression addCustomerOrder(CustomerOrder customerOrder){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java new file mode 100644 index 000000000..5e1f5e979 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.orderstatus; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderStatusListExpression extends SmartListExpression { + public OrderStatusListExpression(Expression> expression){ + super(expression); + } + + public OrderStatusListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderStatusExpression first() { + return new OrderStatusExpression(super.first()); + } + + public OrderStatusExpression get(int index) { + return new OrderStatusExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java new file mode 100644 index 000000000..7196f1575 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java @@ -0,0 +1,1374 @@ + +package com.teaql.ordermanagementservice.orderstatus; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; +import com.teaql.ordermanagementservice.customerorder.CustomerOrder; +import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class OrderStatusRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderStatusRequest(Class returnType){ + this(returnType, () -> (T) new OrderStatus()); + } + + protected OrderStatusRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderStatusRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderStatusRequest copy(){ + return (OrderStatusRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderStatusRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderStatusRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderStatusRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderStatusRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderStatusRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderStatusRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderStatusRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderStatusRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderStatusRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderStatusRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderStatusRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderStatusRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderStatusRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderStatusRequest matchingAnyOf(OrderStatusRequest orderStatus){ + super.internalMatchAny(orderStatus); + return this; + } + + public OrderStatusRequest matchingIdsOf(OrderStatusRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderStatus.ID_PROPERTY, request, OrderStatus.ID_PROPERTY)); + } + + public OrderStatusRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderStatusRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderStatusRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderStatusRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatformIdOnly().selectVersion(); + } + + public OrderStatusRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderStatusRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderStatus.ID_PROPERTY); + selectProperty(OrderStatus.NAME_PROPERTY); + selectProperty(OrderStatus.CODE_PROPERTY); + selectProperty(OrderStatus.COLOR_PROPERTY); + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + selectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatform().selectVersion(); + } + + public OrderStatusRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatform().selectVersion(); + } + + + public OrderStatusRequest selectId(){ + selectProperty(OrderStatus.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectId(){ + unselectProperty(OrderStatus.ID_PROPERTY); + return this; + } + public OrderStatusRequest selectName(){ + selectProperty(OrderStatus.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectName(){ + unselectProperty(OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest selectCode(){ + selectProperty(OrderStatus.CODE_PROPERTY); + return this; + } + + /** + * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectCode(){ + unselectProperty(OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest selectColor(){ + selectProperty(OrderStatus.COLOR_PROPERTY); + return this; + } + + /** + * fill the color with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS color) to fetch color property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectColor(){ + unselectProperty(OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest selectDisplayOrder(){ + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + /** + * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. + * @param aggrFunction aggrFunction + */ + public OrderStatusRequest selectDisplayOrder(AggrFunction aggrFunction){ + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY, aggrFunction); + return this; + } + + + public OrderStatusRequest unselectDisplayOrder(){ + unselectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest selectCommercePlatformIdOnly(){ + selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public OrderStatusRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public OrderStatusRequest unselectCommercePlatform(){ + unselectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderStatusRequest selectVersion(){ + selectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectVersion(){ + unselectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + public OrderStatusRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public OrderStatusRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.ID_PROPERTY, operator, values); + } + + public OrderStatusRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderStatusRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderStatusRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderStatusRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderStatusRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public OrderStatusRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public OrderStatusRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public OrderStatusRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.NAME_PROPERTY, operator, values); + } + + public OrderStatusRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public OrderStatusRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public OrderStatusRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public OrderStatusRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public OrderStatusRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public OrderStatusRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public OrderStatusRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public OrderStatusRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public OrderStatusRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public OrderStatusRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public OrderStatusRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public OrderStatusRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public OrderStatusRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public OrderStatusRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public OrderStatusRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public OrderStatusRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public OrderStatusRequest filterByCode(String... code){ + if (code == null || code.length == 0) { + throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); + } + return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); + } + + public OrderStatusRequest withCode(Operator operator, Object... values){ + return appendSearchCriteria(createCodeCriteria(operator, values)); + } + + public OrderStatusRequest withCodeIsUnknown(){ + return withCode(Operator.IS_NULL); + } + + public OrderStatusRequest withCodeIsKnown(){ + return withCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.CODE_PROPERTY, operator, values); + } + + public OrderStatusRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public OrderStatusRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public OrderStatusRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } + public OrderStatusRequest withCodeGreaterThan(String code){ + return withCode(Operator.GREATER_THAN, code); + } + + public OrderStatusRequest withCodeGreaterThanOrEqualTo(String code){ + return withCode(Operator.GREATER_THAN_OR_EQUAL, code); + } + + public OrderStatusRequest withCodeLessThan(String code){ + return withCode(Operator.LESS_THAN, code); + } + + public OrderStatusRequest withCodeLessThanOrEqualTo(String code){ + return withCode(Operator.LESS_THAN_OR_EQUAL, code); + } + + public OrderStatusRequest withCodeBetween(String startOfCode, String endOfCode){ + return withCode(Operator.BETWEEN, startOfCode, endOfCode); + } + public OrderStatusRequest withCodeStartingWith(String code){ + return withCode(Operator.BEGIN_WITH, code); + } + public OrderStatusRequest withCodeContaining(String code){ + return withCode(Operator.CONTAIN, code); + } + + public OrderStatusRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public OrderStatusRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + + public OrderStatusRequest withCodeEndingWith(String code){ + return withCode(Operator.END_WITH, code); + } + + public OrderStatusRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + + public OrderStatusRequest withCodeIs(String code){ + return withCode(Operator.EQUAL, code); + } + + public OrderStatusRequest withCodeSoundingLike(String code){ + return withCode(Operator.SOUNDS_LIKE, code); + } + + + + public OrderStatusRequest filterByColor(String... color){ + if (color == null || color.length == 0) { + throw new IllegalArgumentException("filterByColor parameter color cannot be empty"); + } + return appendSearchCriteria(createColorCriteria(Operator.EQUAL, (Object[])color)); + } + + public OrderStatusRequest withColor(Operator operator, Object... values){ + return appendSearchCriteria(createColorCriteria(operator, values)); + } + + public OrderStatusRequest withColorIsUnknown(){ + return withColor(Operator.IS_NULL); + } + + public OrderStatusRequest withColorIsKnown(){ + return withColor(Operator.IS_NOT_NULL); + } + + public SearchCriteria createColorCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.COLOR_PROPERTY, operator, values); + } + + public OrderStatusRequest withColorIsNot(String color){ + return withColor(Operator.NOT_EQUAL, color); + } + + public OrderStatusRequest withColorIn(String... color){ + return withColor(Operator.IN, (Object[])color); + } + + public OrderStatusRequest withColorNotIn(String... color){ + return withColor(Operator.NOT_IN, (Object[])color); + } + public OrderStatusRequest withColorGreaterThan(String color){ + return withColor(Operator.GREATER_THAN, color); + } + + public OrderStatusRequest withColorGreaterThanOrEqualTo(String color){ + return withColor(Operator.GREATER_THAN_OR_EQUAL, color); + } + + public OrderStatusRequest withColorLessThan(String color){ + return withColor(Operator.LESS_THAN, color); + } + + public OrderStatusRequest withColorLessThanOrEqualTo(String color){ + return withColor(Operator.LESS_THAN_OR_EQUAL, color); + } + + public OrderStatusRequest withColorBetween(String startOfColor, String endOfColor){ + return withColor(Operator.BETWEEN, startOfColor, endOfColor); + } + public OrderStatusRequest withColorStartingWith(String color){ + return withColor(Operator.BEGIN_WITH, color); + } + public OrderStatusRequest withColorContaining(String color){ + return withColor(Operator.CONTAIN, color); + } + + public OrderStatusRequest withColorNotContaining(String color){ + return withColor(Operator.NOT_CONTAIN, color); + } + + public OrderStatusRequest withColorNotStartingWith(String color){ + return withColor(Operator.NOT_BEGIN_WITH, color); + } + + public OrderStatusRequest withColorEndingWith(String color){ + return withColor(Operator.END_WITH, color); + } + + public OrderStatusRequest withColorNotEndingWith(String color){ + return withColor(Operator.NOT_END_WITH, color); + } + + public OrderStatusRequest withColorIs(String color){ + return withColor(Operator.EQUAL, color); + } + + public OrderStatusRequest withColorSoundingLike(String color){ + return withColor(Operator.SOUNDS_LIKE, color); + } + + + + public OrderStatusRequest filterByDisplayOrder(BigDecimal... displayOrder){ + if (displayOrder == null || displayOrder.length == 0) { + throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); + } + return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); + } + + public OrderStatusRequest withDisplayOrder(Operator operator, Object... values){ + return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); + } + + public OrderStatusRequest withDisplayOrderIsUnknown(){ + return withDisplayOrder(Operator.IS_NULL); + } + + public OrderStatusRequest withDisplayOrderIsKnown(){ + return withDisplayOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.DISPLAY_ORDER_PROPERTY, operator, values); + } + + public OrderStatusRequest withDisplayOrderIs(BigDecimal displayOrder){ + return withDisplayOrder(Operator.EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderIsNot(BigDecimal displayOrder){ + return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.IN, (Object[])displayOrder); + } + + public OrderStatusRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); + } + public OrderStatusRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN, displayOrder); + } + + public OrderStatusRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderLessThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN, displayOrder); + } + + public OrderStatusRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ + return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); + } + + + + public OrderStatusRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public OrderStatusRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public OrderStatusRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public OrderStatusRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public OrderStatusRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public OrderStatusRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public OrderStatusRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public OrderStatusRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderStatusRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderStatusRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderStatusRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.VERSION_PROPERTY, operator, values); + } + + public OrderStatusRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderStatusRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderStatusRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderStatusRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderStatusRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderStatusRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderStatusRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderStatusRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderStatusRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public OrderStatusRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY)); + } + + public OrderStatusRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY))); + } + + public OrderStatusRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public OrderStatusRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public OrderStatusRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderStatusRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderStatusRequest minDisplayOrder(){ + return minDisplayOrderAs(prefix("minOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest minDisplayOrderAs(String retName){ + super.min(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest maxDisplayOrder(){ + return maxDisplayOrderAs(prefix("maxOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest maxDisplayOrderAs(String retName){ + super.max(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest sumDisplayOrder(){ + return sumDisplayOrderAs(prefix("sumOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest sumDisplayOrderAs(String retName){ + super.sum(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest avgDisplayOrder(){ + return avgDisplayOrderAs(prefix("avgOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest avgDisplayOrderAs(String retName){ + super.avg(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest standardDeviationDisplayOrder(){ + return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest standardDeviationDisplayOrderAs(String retName){ + super.standardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ + return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest sampleVarianceDisplayOrder(){ + return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest sampleVarianceDisplayOrderAs(String retName){ + super.sampleVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest samplePopulationVarianceDisplayOrder(){ + return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest samplePopulationVarianceDisplayOrderAs(String retName){ + super.samplePopulationVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public OrderStatusRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(OrderStatus.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + public OrderStatusRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderStatusRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.ID_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderStatusRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public OrderStatusRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctColor(){ + return countDistinctColorAs("color_distinct_count"); + } + + public OrderStatusRequest countDistinctColorAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public OrderStatusRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public OrderStatusRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderStatusRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.VERSION_PROPERTY); + return this; + } + public OrderStatusRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public OrderStatusRequest groupById(){ + groupBy(OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest groupByIdAs(String retName){ + groupBy(retName, OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.ID_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByName(){ + groupBy(OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest groupByNameAs(String retName){ + groupBy(retName, OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.NAME_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByCode(){ + groupBy(OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest groupByCodeAs(String retName){ + groupBy(retName, OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest groupByCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.CODE_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByColor(){ + groupBy(OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest groupByColorAs(String retName){ + groupBy(retName, OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest groupByColorWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.COLOR_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByDisplayOrder(){ + groupBy(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest groupByDisplayOrderAs(String retName){ + groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY, function); + return this; + } + public OrderStatusRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(OrderStatus.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public OrderStatusRequest groupByCommercePlatform(){ + groupBy(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByVersion(){ + groupBy(OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest groupByVersionAs(String retName){ + groupBy(retName, OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.VERSION_PROPERTY, function); + return this; + } + + + + public OrderStatusRequest orderByIdAscending(){ + addOrderByAscending(OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest orderByIdDescending(){ + addOrderByDescending(OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest orderByNameAscending(){ + addOrderByAscending(OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest orderByNameDescending(){ + addOrderByDescending(OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest orderByCodeAscending(){ + addOrderByAscending(OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest orderByCodeDescending(){ + addOrderByDescending(OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest orderByCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest orderByCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest orderByColorAscending(){ + addOrderByAscending(OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest orderByColorDescending(){ + addOrderByDescending(OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest orderByColorAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest orderByColorDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest orderByDisplayOrderAscending(){ + addOrderByAscending(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest orderByDisplayOrderDescending(){ + addOrderByDescending(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest orderByCommercePlatformAscending(){ + addOrderByAscending(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest orderByCommercePlatformDescending(){ + addOrderByDescending(OrderStatus.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest orderByVersionAscending(){ + addOrderByAscending(OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest orderByVersionDescending(){ + addOrderByDescending(OrderStatus.VERSION_PROPERTY); + return this; + } + + + public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + public OrderStatusRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest minTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name){ + return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest maxTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name){ + return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest sumTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name){ + return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest avgTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name){ + return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ + return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ + return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public OrderStatusRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderStatusRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderStatusRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderStatusRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderStatusRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderStatusRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderStatusRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java new file mode 100644 index 000000000..f7dddf0e5 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java @@ -0,0 +1,234 @@ + +package com.teaql.ordermanagementservice.product; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Product extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Product"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "53d713469d480508489d19bea0bdb683bf3d6b9b5c37b81ba4c247b0200f2d0d"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("sku", 2), java.util.Map.entry("image_url", 3), java.util.Map.entry("commerce_platform", 4), java.util.Map.entry("create_time", 5), java.util.Map.entry("update_time", 6), java.util.Map.entry("version", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("image_url", java.util.List.of("imageUrl", "image_url")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_line_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Product.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SKU_PROPERTY = "sku"; + public static final String IMAGE_URL_PROPERTY = "image_url"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; + private String name; + + private String sku; + + private String imageUrl; + + private CommercePlatform commercePlatform; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList orderLineList; + + public String getName(){ + return this.name; + } + + public String getSku(){ + return this.sku; + } + + public String getImageUrl(){ + return this.imageUrl; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getOrderLineList(){ + return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; + } + public Product updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Product updateSku(String sku){ + sku = (sku == null ? null : sku.trim()); + if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ + return this; + } + handleUpdate(SKU_PROPERTY, getSku(), sku); + this.sku = sku; + return this; + } + + public Product updateImageUrl(String imageUrl){ + imageUrl = (imageUrl == null ? null : imageUrl.trim()); + if(isPropertyLoaded(IMAGE_URL_PROPERTY) && Objects.equals(this.imageUrl, imageUrl)){ + return this; + } + handleUpdate(IMAGE_URL_PROPERTY, getImageUrl(), imageUrl); + this.imageUrl = imageUrl; + return this; + } + + public Product updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public Product updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public Product updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public Product addOrderLine(OrderLine orderLine){ + if (orderLine == null){ + return this; + } + + if(null == this.orderLineList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderLineList = teaqlUnloadedItems.map(value -> value); + } + + this.orderLineList.add(orderLine); + orderLine.updateProduct(this); + return this; + } + + public static Product refer(Long id){ + Product refer = new Product(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Product comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; + + case "image_url": this.imageUrl = (value == null ? null : ((String)value).trim()); break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "order_line_list": this.orderLineList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "sku": return this.sku; + case "image_url": return this.imageUrl; + case "commerce_platform": return this.commercePlatform; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "order_line_list": return this.orderLineList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "sku": return this.sku; + case "imageUrl": return this.imageUrl; + case "commercePlatform": return this.commercePlatform; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java new file mode 100644 index 000000000..2bbb9c1c5 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java @@ -0,0 +1,132 @@ + +package com.teaql.ordermanagementservice.product; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class ProductChecker implements Checker{ + + public String type(){ + return Product.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Product product, ObjectLocation _parentLocation){ + if(needCheck(_context, product)){ + markAsChecked(_context, product); + doCheck(_context, product, _parentLocation); + } + } + + public void doCheck(UserContext _context, Product product, ObjectLocation _parentLocation){ + if((product == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, product); + if(product.needPersist()){ + } + if(product.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + product.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + product.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(product.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + product.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!product.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("sku")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("image_url")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "image_url"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!product.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, product.getProperty(Product.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkSku(_context, product.getProperty(Product.SKU_PROPERTY), newLocation(_parentLocation, "sku")); + checkImageUrl(_context, product.getProperty(Product.IMAGE_URL_PROPERTY), newLocation(_parentLocation, "image_url")); + checkCommercePlatform(_context, product.getProperty(Product.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + checkCreateTime(_context, product.getProperty(Product.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, product.getProperty(Product.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; product.getOrderLineList() != null && i < product.getOrderLineList().size(); i++){ + OrderLine orderLine = product.getOrderLineList().get(i); + new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sku); + if((sku == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, sku); + + } + public void checkImageUrl(UserContext _context, String imageUrl, ObjectLocation _parentLocation){ + if((imageUrl == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, imageUrl); + + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java new file mode 100644 index 000000000..f548bbf54 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java @@ -0,0 +1,90 @@ + +package com.teaql.ordermanagementservice.product; + +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class ProductExpression extends ExpressionAdaptor implements BaseEntityExpression { + public ProductExpression(Expression expression){ + super(expression); + } + + public ProductExpression(Expression expression, Function function){ + super(expression, function); + } + + public ProductExpression updateId(Long id){ + return new ProductExpression(this, $it -> {((Product)$it).__internalSet("id", id); return this;}); + } + + public ProductExpression save(UserContext userContext){ + return new ProductExpression(this, $it -> ((Product)$it).auditAs("Saved by Expression").save(userContext)); + } + + public ProductExpression save(String intent, UserContext userContext){ + return new ProductExpression(this, $it -> ((Product)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Product::getName); + } + public ProductExpression updateName(String name){ + return new ProductExpression(this, $it -> ((Product)$it).updateName(name)); + } + + public Expression getSku(){ + return loaded("sku", "getSku", Product::getSku); + } + public ProductExpression updateSku(String sku){ + return new ProductExpression(this, $it -> ((Product)$it).updateSku(sku)); + } + + public Expression getImageUrl(){ + return loaded("image_url", "getImageUrl", Product::getImageUrl); + } + public ProductExpression updateImageUrl(String imageUrl){ + return new ProductExpression(this, $it -> ((Product)$it).updateImageUrl(imageUrl)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", Product::getCommercePlatform)); + } + + public ProductExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new ProductExpression(this, $it -> ((Product)$it).updateCommercePlatform(commercePlatform)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", Product::getCreateTime); + } + public ProductExpression updateCreateTime(LocalDateTime createTime){ + return new ProductExpression(this, $it -> ((Product)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", Product::getUpdateTime); + } + public ProductExpression updateUpdateTime(LocalDateTime updateTime){ + return new ProductExpression(this, $it -> ((Product)$it).updateUpdateTime(updateTime)); + } + + public OrderLineListExpression getOrderLineList(){ + return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", Product::getOrderLineList)); + } + public ProductExpression addOrderLine(OrderLine orderLine){ + return new ProductExpression(this, $it -> ((Product)$it).addOrderLine(orderLine)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java new file mode 100644 index 000000000..badb04618 --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordermanagementservice.product; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class ProductListExpression extends SmartListExpression { + public ProductListExpression(Expression> expression){ + super(expression); + } + + public ProductListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public ProductExpression first() { + return new ProductExpression(super.first()); + } + + public ProductExpression get(int index) { + return new ProductExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java new file mode 100644 index 000000000..87244ae9c --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java @@ -0,0 +1,1458 @@ + +package com.teaql.ordermanagementservice.product; + +import com.teaql.ordermanagementservice.Q; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; +import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; +import com.teaql.ordermanagementservice.orderline.OrderLine; +import com.teaql.ordermanagementservice.orderline.OrderLineRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class ProductRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public ProductRequest(Class returnType){ + this(returnType, () -> (T) new Product()); + } + + protected ProductRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public ProductRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ProductRequest copy(){ + return (ProductRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ProductRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public ProductRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public ProductRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public ProductRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public ProductRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public ProductRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ProductRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ProductRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ProductRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ProductRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public ProductRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (ProductRequest)super.appendSearchCriteria(searchCriteria); + } + + public ProductRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public ProductRequest matchingAnyOf(ProductRequest product){ + super.internalMatchAny(product); + return this; + } + + public ProductRequest matchingIdsOf(ProductRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Product.ID_PROPERTY, request, Product.ID_PROPERTY)); + } + + public ProductRequest enhanceChildrenIfNeeded(){ + return this; + } + + public ProductRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public ProductRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public ProductRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ProductRequest selectSelfFields(){ + return selectSelf(); + } + + public ProductRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Product.ID_PROPERTY); + selectProperty(Product.NAME_PROPERTY); + selectProperty(Product.SKU_PROPERTY); + selectProperty(Product.IMAGE_URL_PROPERTY); + selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); + selectProperty(Product.CREATE_TIME_PROPERTY); + selectProperty(Product.UPDATE_TIME_PROPERTY); + selectProperty(Product.VERSION_PROPERTY); + return this; + } + + public ProductRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public ProductRequest selectChildren(){ + super.selectAny(); + selectOrderLineList(); + return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public ProductRequest selectId(){ + selectProperty(Product.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectId(){ + unselectProperty(Product.ID_PROPERTY); + return this; + } + public ProductRequest selectName(){ + selectProperty(Product.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectName(){ + unselectProperty(Product.NAME_PROPERTY); + return this; + } + public ProductRequest selectSku(){ + selectProperty(Product.SKU_PROPERTY); + return this; + } + + /** + * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectSku(){ + unselectProperty(Product.SKU_PROPERTY); + return this; + } + public ProductRequest selectImageUrl(){ + selectProperty(Product.IMAGE_URL_PROPERTY); + return this; + } + + /** + * fill the imageUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS imageUrl) to fetch imageUrl property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectImageUrl(){ + unselectProperty(Product.IMAGE_URL_PROPERTY); + return this; + } + public ProductRequest selectCommercePlatformIdOnly(){ + selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public ProductRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public ProductRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, Product.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public ProductRequest unselectCommercePlatform(){ + unselectProperty(Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public ProductRequest selectCreateTime(){ + selectProperty(Product.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectCreateTime(){ + unselectProperty(Product.CREATE_TIME_PROPERTY); + return this; + } + public ProductRequest selectUpdateTime(){ + selectProperty(Product.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectUpdateTime(){ + unselectProperty(Product.UPDATE_TIME_PROPERTY); + return this; + } + public ProductRequest selectVersion(){ + selectProperty(Product.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ProductRequest unselectVersion(){ + unselectProperty(Product.VERSION_PROPERTY); + return this; + } + public ProductRequest selectOrderLineList(){ + return selectOrderLineListWith(Q.orderLines().selectSelf()); + } + + public ProductRequest selectOrderLineListWith(OrderLineRequest orderLineList){ + enhanceRelation(Product.ORDER_LINE_LIST_PROPERTY, orderLineList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.ID_PROPERTY, operator, values); + } + + public ProductRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public ProductRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public ProductRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ProductRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public ProductRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public ProductRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public ProductRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public ProductRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.NAME_PROPERTY, operator, values); + } + + public ProductRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public ProductRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public ProductRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public ProductRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public ProductRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public ProductRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public ProductRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public ProductRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public ProductRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public ProductRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public ProductRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public ProductRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public ProductRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public ProductRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public ProductRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public ProductRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public ProductRequest filterBySku(String... sku){ + if (sku == null || sku.length == 0) { + throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); + } + return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); + } + + public ProductRequest withSku(Operator operator, Object... values){ + return appendSearchCriteria(createSkuCriteria(operator, values)); + } + + public ProductRequest withSkuIsUnknown(){ + return withSku(Operator.IS_NULL); + } + + public ProductRequest withSkuIsKnown(){ + return withSku(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSkuCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.SKU_PROPERTY, operator, values); + } + + public ProductRequest withSkuIsNot(String sku){ + return withSku(Operator.NOT_EQUAL, sku); + } + + public ProductRequest withSkuIn(String... sku){ + return withSku(Operator.IN, (Object[])sku); + } + + public ProductRequest withSkuNotIn(String... sku){ + return withSku(Operator.NOT_IN, (Object[])sku); + } + public ProductRequest withSkuGreaterThan(String sku){ + return withSku(Operator.GREATER_THAN, sku); + } + + public ProductRequest withSkuGreaterThanOrEqualTo(String sku){ + return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); + } + + public ProductRequest withSkuLessThan(String sku){ + return withSku(Operator.LESS_THAN, sku); + } + + public ProductRequest withSkuLessThanOrEqualTo(String sku){ + return withSku(Operator.LESS_THAN_OR_EQUAL, sku); + } + + public ProductRequest withSkuBetween(String startOfSku, String endOfSku){ + return withSku(Operator.BETWEEN, startOfSku, endOfSku); + } + public ProductRequest withSkuStartingWith(String sku){ + return withSku(Operator.BEGIN_WITH, sku); + } + public ProductRequest withSkuContaining(String sku){ + return withSku(Operator.CONTAIN, sku); + } + + public ProductRequest withSkuNotContaining(String sku){ + return withSku(Operator.NOT_CONTAIN, sku); + } + + public ProductRequest withSkuNotStartingWith(String sku){ + return withSku(Operator.NOT_BEGIN_WITH, sku); + } + + public ProductRequest withSkuEndingWith(String sku){ + return withSku(Operator.END_WITH, sku); + } + + public ProductRequest withSkuNotEndingWith(String sku){ + return withSku(Operator.NOT_END_WITH, sku); + } + + public ProductRequest withSkuIs(String sku){ + return withSku(Operator.EQUAL, sku); + } + + public ProductRequest withSkuSoundingLike(String sku){ + return withSku(Operator.SOUNDS_LIKE, sku); + } + + + + public ProductRequest filterByImageUrl(String... imageUrl){ + if (imageUrl == null || imageUrl.length == 0) { + throw new IllegalArgumentException("filterByImageUrl parameter imageUrl cannot be empty"); + } + return appendSearchCriteria(createImageUrlCriteria(Operator.EQUAL, (Object[])imageUrl)); + } + + public ProductRequest withImageUrl(Operator operator, Object... values){ + return appendSearchCriteria(createImageUrlCriteria(operator, values)); + } + + public ProductRequest withImageUrlIsUnknown(){ + return withImageUrl(Operator.IS_NULL); + } + + public ProductRequest withImageUrlIsKnown(){ + return withImageUrl(Operator.IS_NOT_NULL); + } + + public SearchCriteria createImageUrlCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.IMAGE_URL_PROPERTY, operator, values); + } + + public ProductRequest withImageUrlIsNot(String imageUrl){ + return withImageUrl(Operator.NOT_EQUAL, imageUrl); + } + + public ProductRequest withImageUrlIn(String... imageUrl){ + return withImageUrl(Operator.IN, (Object[])imageUrl); + } + + public ProductRequest withImageUrlNotIn(String... imageUrl){ + return withImageUrl(Operator.NOT_IN, (Object[])imageUrl); + } + public ProductRequest withImageUrlGreaterThan(String imageUrl){ + return withImageUrl(Operator.GREATER_THAN, imageUrl); + } + + public ProductRequest withImageUrlGreaterThanOrEqualTo(String imageUrl){ + return withImageUrl(Operator.GREATER_THAN_OR_EQUAL, imageUrl); + } + + public ProductRequest withImageUrlLessThan(String imageUrl){ + return withImageUrl(Operator.LESS_THAN, imageUrl); + } + + public ProductRequest withImageUrlLessThanOrEqualTo(String imageUrl){ + return withImageUrl(Operator.LESS_THAN_OR_EQUAL, imageUrl); + } + + public ProductRequest withImageUrlBetween(String startOfImageUrl, String endOfImageUrl){ + return withImageUrl(Operator.BETWEEN, startOfImageUrl, endOfImageUrl); + } + public ProductRequest withImageUrlStartingWith(String imageUrl){ + return withImageUrl(Operator.BEGIN_WITH, imageUrl); + } + public ProductRequest withImageUrlContaining(String imageUrl){ + return withImageUrl(Operator.CONTAIN, imageUrl); + } + + public ProductRequest withImageUrlNotContaining(String imageUrl){ + return withImageUrl(Operator.NOT_CONTAIN, imageUrl); + } + + public ProductRequest withImageUrlNotStartingWith(String imageUrl){ + return withImageUrl(Operator.NOT_BEGIN_WITH, imageUrl); + } + + public ProductRequest withImageUrlEndingWith(String imageUrl){ + return withImageUrl(Operator.END_WITH, imageUrl); + } + + public ProductRequest withImageUrlNotEndingWith(String imageUrl){ + return withImageUrl(Operator.NOT_END_WITH, imageUrl); + } + + public ProductRequest withImageUrlIs(String imageUrl){ + return withImageUrl(Operator.EQUAL, imageUrl); + } + + public ProductRequest withImageUrlSoundingLike(String imageUrl){ + return withImageUrl(Operator.SOUNDS_LIKE, imageUrl); + } + + + + public ProductRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public ProductRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public ProductRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public ProductRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public ProductRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public ProductRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public ProductRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public ProductRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public ProductRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public ProductRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public ProductRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.CREATE_TIME_PROPERTY, operator, values); + } + + public ProductRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public ProductRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public ProductRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public ProductRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public ProductRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ProductRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public ProductRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ProductRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public ProductRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public ProductRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ProductRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public ProductRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ProductRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public ProductRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public ProductRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public ProductRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public ProductRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public ProductRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.UPDATE_TIME_PROPERTY, operator, values); + } + + public ProductRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public ProductRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public ProductRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public ProductRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public ProductRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ProductRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public ProductRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ProductRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public ProductRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public ProductRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ProductRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public ProductRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ProductRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public ProductRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public ProductRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public ProductRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public ProductRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public ProductRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Product.VERSION_PROPERTY, operator, values); + } + + public ProductRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ProductRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ProductRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ProductRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public ProductRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public ProductRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public ProductRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public ProductRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public ProductRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public ProductRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Product.ID_PROPERTY, orderLineRequest, OrderLine.PRODUCT_PROPERTY)); + } + + public ProductRequest withoutOrderLineListMatching(OrderLineRequest orderLineRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Product.ID_PROPERTY, orderLineRequest, OrderLine.PRODUCT_PROPERTY))); + } + + public ProductRequest haveOrderLines(){ + return withOrderLineListMatching(Q.orderLines().unlimited()); + } + + public ProductRequest haveNoOrderLines(){ + return withoutOrderLineListMatching(Q.orderLines().unlimited()); + } + + public ProductRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public ProductRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public ProductRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public ProductRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(Product.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public ProductRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ProductRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Product.ID_PROPERTY); + return this; + } + public ProductRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public ProductRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Product.NAME_PROPERTY); + return this; + } + public ProductRequest countDistinctSku(){ + return countDistinctSkuAs("sku_distinct_count"); + } + + public ProductRequest countDistinctSkuAs(String alias){ + super.countDistinctProperty(alias, Product.SKU_PROPERTY); + return this; + } + public ProductRequest countDistinctImageUrl(){ + return countDistinctImageUrlAs("image_url_distinct_count"); + } + + public ProductRequest countDistinctImageUrlAs(String alias){ + super.countDistinctProperty(alias, Product.IMAGE_URL_PROPERTY); + return this; + } + public ProductRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public ProductRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public ProductRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public ProductRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Product.CREATE_TIME_PROPERTY); + return this; + } + public ProductRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public ProductRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Product.UPDATE_TIME_PROPERTY); + return this; + } + public ProductRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ProductRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Product.VERSION_PROPERTY); + return this; + } + public ProductRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ + aggregate(Product.ORDER_LINE_LIST_PROPERTY, subRequest); + return this; + } + + public ProductRequest groupById(){ + groupBy(Product.ID_PROPERTY); + return this; + } + + public ProductRequest groupByIdAs(String retName){ + groupBy(retName, Product.ID_PROPERTY); + return this; + } + + public ProductRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.ID_PROPERTY, function); + return this; + } + + public ProductRequest groupByName(){ + groupBy(Product.NAME_PROPERTY); + return this; + } + + public ProductRequest groupByNameAs(String retName){ + groupBy(retName, Product.NAME_PROPERTY); + return this; + } + + public ProductRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.NAME_PROPERTY, function); + return this; + } + + public ProductRequest groupBySku(){ + groupBy(Product.SKU_PROPERTY); + return this; + } + + public ProductRequest groupBySkuAs(String retName){ + groupBy(retName, Product.SKU_PROPERTY); + return this; + } + + public ProductRequest groupBySkuWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.SKU_PROPERTY, function); + return this; + } + + public ProductRequest groupByImageUrl(){ + groupBy(Product.IMAGE_URL_PROPERTY); + return this; + } + + public ProductRequest groupByImageUrlAs(String retName){ + groupBy(retName, Product.IMAGE_URL_PROPERTY); + return this; + } + + public ProductRequest groupByImageUrlWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.IMAGE_URL_PROPERTY, function); + return this; + } + public ProductRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(Product.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public ProductRequest groupByCommercePlatform(){ + groupBy(Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public ProductRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public ProductRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public ProductRequest groupByCreateTime(){ + groupBy(Product.CREATE_TIME_PROPERTY); + return this; + } + + public ProductRequest groupByCreateTimeAs(String retName){ + groupBy(retName, Product.CREATE_TIME_PROPERTY); + return this; + } + + public ProductRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.CREATE_TIME_PROPERTY, function); + return this; + } + + public ProductRequest groupByUpdateTime(){ + groupBy(Product.UPDATE_TIME_PROPERTY); + return this; + } + + public ProductRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, Product.UPDATE_TIME_PROPERTY); + return this; + } + + public ProductRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.UPDATE_TIME_PROPERTY, function); + return this; + } + + public ProductRequest groupByVersion(){ + groupBy(Product.VERSION_PROPERTY); + return this; + } + + public ProductRequest groupByVersionAs(String retName){ + groupBy(retName, Product.VERSION_PROPERTY); + return this; + } + + public ProductRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Product.VERSION_PROPERTY, function); + return this; + } + + + + public ProductRequest orderByIdAscending(){ + addOrderByAscending(Product.ID_PROPERTY); + return this; + } + + public ProductRequest orderByIdDescending(){ + addOrderByDescending(Product.ID_PROPERTY); + return this; + } + + public ProductRequest orderByNameAscending(){ + addOrderByAscending(Product.NAME_PROPERTY); + return this; + } + + public ProductRequest orderByNameDescending(){ + addOrderByDescending(Product.NAME_PROPERTY); + return this; + } + public ProductRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Product.NAME_PROPERTY); + return this; + } + + public ProductRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Product.NAME_PROPERTY); + return this; + } + public ProductRequest orderBySkuAscending(){ + addOrderByAscending(Product.SKU_PROPERTY); + return this; + } + + public ProductRequest orderBySkuDescending(){ + addOrderByDescending(Product.SKU_PROPERTY); + return this; + } + public ProductRequest orderBySkuAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Product.SKU_PROPERTY); + return this; + } + + public ProductRequest orderBySkuDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Product.SKU_PROPERTY); + return this; + } + public ProductRequest orderByImageUrlAscending(){ + addOrderByAscending(Product.IMAGE_URL_PROPERTY); + return this; + } + + public ProductRequest orderByImageUrlDescending(){ + addOrderByDescending(Product.IMAGE_URL_PROPERTY); + return this; + } + public ProductRequest orderByImageUrlAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Product.IMAGE_URL_PROPERTY); + return this; + } + + public ProductRequest orderByImageUrlDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Product.IMAGE_URL_PROPERTY); + return this; + } + public ProductRequest orderByCommercePlatformAscending(){ + addOrderByAscending(Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public ProductRequest orderByCommercePlatformDescending(){ + addOrderByDescending(Product.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public ProductRequest orderByCreateTimeAscending(){ + addOrderByAscending(Product.CREATE_TIME_PROPERTY); + return this; + } + + public ProductRequest orderByCreateTimeDescending(){ + addOrderByDescending(Product.CREATE_TIME_PROPERTY); + return this; + } + + public ProductRequest orderByUpdateTimeAscending(){ + addOrderByAscending(Product.UPDATE_TIME_PROPERTY); + return this; + } + + public ProductRequest orderByUpdateTimeDescending(){ + addOrderByDescending(Product.UPDATE_TIME_PROPERTY); + return this; + } + + public ProductRequest orderByVersionAscending(){ + addOrderByAscending(Product.VERSION_PROPERTY); + return this; + } + + public ProductRequest orderByVersionDescending(){ + addOrderByDescending(Product.VERSION_PROPERTY); + return this; + } + + + public ProductRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest){ + return statsFromOrderLinesAs(name, subRequest, false); + } + + public ProductRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest statsFromOrderLines(OrderLineRequest subRequest){ + return statsFromOrderLinesAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + + + public ProductRequest countOrderLines(){ + addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.PRODUCT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest countOrderLinesAs(String name){ + addRelationCount(name, Q.orderLines().unlimited(), OrderLine.PRODUCT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ + addRelationCount(name, subRequest, OrderLine.PRODUCT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest minQuantityOfOrderLines(){ + addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest minQuantityOfOrderLinesAs(String name){ + return minQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest maxQuantityOfOrderLines(){ + addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest maxQuantityOfOrderLinesAs(String name){ + return maxQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest sumQuantityOfOrderLines(){ + addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest sumQuantityOfOrderLinesAs(String name){ + return sumQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest avgQuantityOfOrderLines(){ + addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest avgQuantityOfOrderLinesAs(String name){ + return avgQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest standardDeviationQuantityOfOrderLines(){ + addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name){ + return standardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ + addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ + return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest sampleVarianceQuantityOfOrderLines(){ + addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name){ + return sampleVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + public ProductRequest samplePopulationVarianceQuantityOfOrderLines(){ + addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), + OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ + return samplePopulationVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); + } + + public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, + OrderLine.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); + return this; + } + + public ProductRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public ProductRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, Product.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public ProductRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public ProductRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public ProductRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public ProductRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public ProductRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public ProductRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..a17a410ee --- /dev/null +++ b/examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.ordermanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/order-management/java-app-console/pom.xml b/examples/order-management/java-app-console/pom.xml index 1c090fee5..cc4d82214 100644 --- a/examples/order-management/java-app-console/pom.xml +++ b/examples/order-management/java-app-console/pom.xml @@ -36,7 +36,7 @@ org.codehaus.mojo exec-maven-plugin 3.5.0 - com.teaql.example.OrderManagementApp + com.teaql.ordermanagementservice.App diff --git a/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/App.java b/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/App.java new file mode 100644 index 000000000..b2a16beaf --- /dev/null +++ b/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/App.java @@ -0,0 +1,9 @@ +package com.teaql.ordermanagementservice; + +/** Native workspace entry for the maintained Order business application. */ +public final class App { + private App() {} + public static void main(String[] args) throws Exception { + com.teaql.example.OrderManagementApp.main(args); + } +} diff --git a/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/CustomUserContext.java b/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/CustomUserContext.java new file mode 100644 index 000000000..3d9601676 --- /dev/null +++ b/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.ordermanagementservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements OrderManagementServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/WorkspaceTeaQLDatabase.java b/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..24a104c6b --- /dev/null +++ b/examples/order-management/java-app-console/src/main/java/com/teaql/ordermanagementservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.ordermanagementservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/src/main/resources/application.properties b/examples/order-management/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..0ae0fede8 --- /dev/null +++ b/examples/order-management/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:ordermanagementservice.db diff --git a/examples/order-management/java-app-console/teaql-i18n.json b/examples/order-management/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..f8c1a3b25 --- /dev/null +++ b/examples/order-management/java-app-console/teaql-i18n.json @@ -0,0 +1,158 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.orderLine.quantity": "Quantity", + "property.customerOrder.createTime": "Create Time", + "property.customerOrder.updateTime": "Update Time", + "property.product.id": "Id", + "property.orderLine.createTime": "Create Time", + "entity.commercePlatform": "Commerce Platform", + "property.orderSearchPreset.requestId": "Request Id", + "property.product.version": "Version", + "property.product.createTime": "Create Time", + "property.orderSearchPreset.ownerUserId": "Owner User Id", + "entity.customerOrder": "Customer Order", + "entity.orderLine": "Order Line", + "property.product.name": "Name", + "property.orderLine.commercePlatform": "Commerce Platform", + "property.product.updateTime": "Update Time", + "property.customerOrder.totalAmount": "Total Amount", + "property.customerOrder.version": "Version", + "property.orderLine.productName": "Product Name", + "property.customer.version": "Version", + "property.orderSearchPreset.filterJson": "Filter Json", + "property.customer.id": "Id", + "property.orderLine.id": "Id", + "property.orderSearchPreset.name": "Name", + "property.customerOrder.customer": "Customer", + "property.orderLine.product": "Product", + "property.orderStatus.name": "Name", + "property.orderLine.sku": "Sku", + "property.customer.createTime": "Create Time", + "property.customerOrder.orderNumber": "Order Number", + "property.commercePlatform.name": "Name", + "property.orderStatus.commercePlatform": "Commerce Platform", + "property.product.commercePlatform": "Commerce Platform", + "property.commercePlatform.id": "Id", + "property.orderStatus.version": "Version", + "property.customer.updateTime": "Update Time", + "property.customer.commercePlatform": "Commerce Platform", + "property.orderStatus.code": "Code", + "property.orderSearchPreset.id": "Id", + "property.customerOrder.orderDate": "Order Date", + "property.commercePlatform.updateTime": "Update Time", + "property.customer.email": "Email", + "property.orderSearchPreset.createTime": "Create Time", + "property.orderStatus.displayOrder": "Display Order", + "property.orderSearchPreset.version": "Version", + "entity.customer": "Customer", + "property.customerOrder.id": "Id", + "entity.product": "Product", + "property.orderLine.customerOrder": "Customer Order", + "property.orderStatus.color": "Color", + "property.commercePlatform.createTime": "Create Time", + "property.customerOrder.commercePlatform": "Commerce Platform", + "property.orderSearchPreset.updateTime": "Update Time", + "property.product.sku": "Sku", + "property.orderSearchPreset.commercePlatform": "Commerce Platform", + "property.orderStatus.id": "Id", + "property.product.imageUrl": "Image Url", + "property.orderLine.version": "Version", + "entity.orderStatus": "Order Status", + "entity.orderSearchPreset": "Order Search Preset", + "property.customer.name": "Name", + "property.customerOrder.status": "Status", + "property.commercePlatform.version": "Version" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/order-management/java-app-console/teaql/checker-model.json b/examples/order-management/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..7c0aa2307 --- /dev/null +++ b/examples/order-management/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:feb0a6c97f37d35282317bf77fbd60ffde5a4dc18d6f6a371fd40d2c37d6c975","entities":{"CommercePlatform":{"labels":{"en":"commerce platform"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer_list","targetType":"Customer","labels":{"en":"customer"},"aliases":["CustomerList","customerList"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_line_list","targetType":"OrderLine","labels":{"en":"order line"},"aliases":["OrderLineList","orderLineList"]},{"name":"order_search_preset_list","targetType":"OrderSearchPreset","labels":{"en":"order search preset"},"aliases":["OrderSearchPresetList","orderSearchPresetList"]},{"name":"order_status_list","targetType":"OrderStatus","labels":{"en":"order status"},"aliases":["OrderStatusList","orderStatusList"]},{"name":"product_list","targetType":"Product","labels":{"en":"product"},"aliases":["ProductList","productList"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Customer":{"labels":{"en":"customer"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"email","labels":{"en":"email"},"aliases":["Email"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerOrder":{"labels":{"en":"customer order"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer","targetType":"Customer","labels":{"en":"customer"},"aliases":["Customer"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_date","labels":{"en":"order date"},"aliases":["OrderDate","orderDate"]},{"name":"order_line_list","targetType":"OrderLine","labels":{"en":"order line"},"aliases":["OrderLineList","orderLineList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"status","targetType":"OrderStatus","labels":{"en":"status"},"aliases":["Status"]},{"name":"total_amount","labels":{"en":"total amount"},"aliases":["TotalAmount","totalAmount"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderLine":{"labels":{"en":"order line"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"product","targetType":"Product","labels":{"en":"product"},"aliases":["Product"]},{"name":"product_name","labels":{"en":"product name"},"aliases":["ProductName","productName"]},{"name":"quantity","labels":{"en":"quantity"},"aliases":["Quantity"]},{"name":"sku","labels":{"en":"sku"},"aliases":["Sku"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderSearchPreset":{"labels":{"en":"order search preset"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"filter_json","labels":{"en":"filter json"},"aliases":["FilterJson","filterJson"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"owner_user_id","labels":{"en":"owner user id"},"aliases":["OwnerUserId","ownerUserId"]},{"name":"request_id","labels":{"en":"request id"},"aliases":["RequestId","requestId"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderStatus":{"labels":{"en":"order status"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"color","labels":{"en":"color"},"aliases":["Color"]},{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Product":{"labels":{"en":"product"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"image_url","labels":{"en":"image url"},"aliases":["ImageUrl","imageUrl"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_line_list","targetType":"OrderLine","labels":{"en":"order line"},"aliases":["OrderLineList","orderLineList"]},{"name":"sku","labels":{"en":"sku"},"aliases":["Sku"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/order-management/java-app-console/teaql/model-provenance.json b/examples/order-management/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..388505b1b --- /dev/null +++ b/examples/order-management/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:435fe8c41af71e1697114bc69ad7a8162f46bda3fb2cd0eacf4a286c06c2922e","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/order-management/showcase.json b/examples/order-management/showcase.json new file mode 100644 index 000000000..0f5cc147c --- /dev/null +++ b/examples/order-management/showcase.json @@ -0,0 +1,53 @@ +{ + "expected": { + "exactAmount": "129.95", + "orderDate": "2026-08-12", + "orderNumber": "WEB-2026-001", + "orders": 1, + "originalBusinessSourcesUnchanged": true, + "presets": 1, + "sameDatabaseRuns": 2 + }, + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/order-management", + "library": { + "generatedFilesManifestSHA256": "3aaef0ccd2aad4a0cd6165aea29f6d113876e2fdbb0fbd4f1bb091588df12d60", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "8b11ee844c2be184e194d8116994fb5fe95299dd593bfed83ec06d71ada0411d" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-generation/receipt.json", + "receiptSHA256": "5041246b7c9f452219d943efa393ea380ce7f7e172da739a945bb49da2ba5db2" + }, + "scene": "Order terminal and whole-graph customer mutation policy", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/main/java/com/teaql/example/MutationAuthority.java", + "src/main/java/com/teaql/example/OrderManagementApp.java", + "src/main/java/com/teaql/example/OrderMutationPolicy.java", + "src/main/java/com/teaql/ordermanagementservice/App.java", + "Makefile" + ], + "generatedFilesManifestSHA256": "af0df75974d561910dc1ff9119e04668b5529fbfd425a1226e39560797360985", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/order-management/verify.sh b/examples/order-management/verify.sh new file mode 100644 index 000000000..6ffe58764 --- /dev/null +++ b/examples/order-management/verify.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +: "${TEAQL_MAVEN_DEPENDENCY_CACHE:?Use the documented isolated source qualifier for this gate}" +if [[ -n "${TEAQL_ORDER_EVIDENCE_DIR:-}" ]]; then + evidence="$TEAQL_ORDER_EVIDENCE_DIR" + mkdir "$evidence" +else + evidence="$(mktemp -d -t teaql-java-order-evidence.XXXXXXXX)" +fi +scratch="$(mktemp -d -t teaql-java-order-build.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +fingerprint() { + (cd "$example" && find pom.xml java-lib-core java-app-console -type f \ + ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) +} +fingerprint > "$evidence/source-before.sha256" +python3 -B - "$example" "$scratch" <<'PY' +from pathlib import Path +import shutil, sys +source, destination = map(Path, sys.argv[1:]) +shutil.copyfile(source / 'pom.xml', destination / 'pom.xml') +for scope in ['java-lib-core', 'java-app-console']: + for path in (source / scope).rglob('*'): + assert not path.is_symlink(), path + shutil.copytree(source / scope, destination / scope, ignore=shutil.ignore_patterns('target', '.git')) +PY +mvn -o -f "$scratch/pom.xml" install -DskipTests > "$evidence/consumer-build.log" 2>&1 +mkdir "$evidence/consumer" +for round in 1 2; do + (cd "$evidence/consumer" && timeout --kill-after=10s 180s \ + mvn -o -f "$scratch/pom.xml" exec:java -pl java-app-console) \ + > "$evidence/run-$round.log" 2>&1 +done +fingerprint > "$evidence/source-after.sha256" +cmp "$evidence/source-before.sha256" "$evidence/source-after.sha256" +python3 -B - "$evidence" "$scratch" "$TEAQL_MAVEN_DEPENDENCY_CACHE" <<'PY' +import hashlib, json, pathlib, sqlite3, sys, xml.etree.ElementTree as ET +root, scratch, cache = map(pathlib.Path, sys.argv[1:]) +for round in [1, 2]: + text = (root / f'run-{round}.log').read_text() + for marker in ['[schema] ensured 7 generated entity tables', '[query] matched 1 order(s)', + 'WEB-2026-001 2026-08-12 129.95', + '[mutation-policy] denied high-value graph before persistence; verified 0 order rows', + 'BUILD SUCCESS']: + assert marker in text, marker + marker = ('[seed] inserted deterministic customer and order' if round == 1 else + '[seed] deterministic data already exists; no duplicate rows added') + assert marker in text, marker +pom = ET.parse(scratch / 'java-lib-core/lib/pom.xml').getroot() +namespace = {'m': 'http://maven.apache.org/POM/4.0.0'} +group, name, version = [pom.find('m:' + key, namespace).text for key in ['groupId', 'artifactId', 'version']] +jar = scratch / 'java-lib-core/lib/target' / f'{name}-{version}.jar' +installed = cache / group.replace('.', '/') / name / version / jar.name +assert jar.is_file() and installed.is_file() and jar.read_bytes() == installed.read_bytes() +database = root / 'consumer/.local/order.db' +with sqlite3.connect(database.resolve().as_uri() + '?mode=ro&immutable=1', uri=True) as connection: + rows = connection.execute('SELECT order_number,order_date,total_amount,version FROM customer_order_data ORDER BY id').fetchall() + assert len(rows) == 1 and rows[0][0:2] == ('WEB-2026-001', '2026-08-12'), rows + assert str(rows[0][2]) == '129.95' and rows[0][3] == 1, rows + presets = connection.execute('SELECT request_id,version FROM order_search_preset_data').fetchall() + assert presets == [('quick-start-pending-orders', 1)], presets + customers = connection.execute('SELECT name,version FROM customer_data').fetchall() + assert customers == [('Acme Retail', 1)], customers + assert connection.execute('SELECT count(*) FROM commerce_platform_data').fetchone() == (1,) + assert connection.execute('PRAGMA quick_check').fetchone() == ('ok',) +receipt = dict(schema='teaql.java-order-business/v1', passed=True, + originalBusinessSourcesUnchanged=True, nativeWorkspaceBridgeUsed=True, + sameDatabaseStarts=2, generatedScopesUnchanged=True, deniedGraphHasNoOrderOrCustomer=True, + artifactKind='new local source build; not a historical or published artifact', + installedDomainArtifactSHA256=hashlib.sha256(jar.read_bytes()).hexdigest(), + orders=rows, presets=presets, customers=customers, + databaseSHA256=hashlib.sha256(database.read_bytes()).hexdigest()) +(root / 'business-receipt.json').write_text(json.dumps(receipt, indent=2, sort_keys=True) + '\n') +print(json.dumps(dict(passed=True, sameDatabaseStarts=2, sourceArtifactInstalled=True))) +PY diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index e7fa0cabb..55b45ceb7 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -45,10 +45,7 @@ TEAQL_JAVA_SPRING_EVIDENCE_DIR="$evidence_dir/spring-transactions" \ mvn -q -f examples/school-management/java-lib-core/lib/pom.xml install -DskipTests mvn -q -f examples/school-management/java-app-console/pom.xml spring-boot:run \ -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/school-management.db" -mvn -q -f examples/order-management/pom.xml install -DskipTests -# The console resolves .local/order.db from its process directory. Never mutate -# the developer's retained database while verifying the runtime checkout. -(cd "$verification_dir" && mvn -q -f "$repo/examples/order-management/pom.xml" exec:java -pl java-app-console) +TEAQL_ORDER_EVIDENCE_DIR="$evidence_dir/order-management" bash examples/order-management/verify.sh bash examples/trace-chain/verify.sh bash examples/trace-chain/verify-standard-telemetry.sh bash examples/standard-order/verify.sh From c0a1d9a69e39dd18df5540fa0dac758b20fb3d9c Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 12:28:03 +0800 Subject: [PATCH 16/71] Record Java Order generated-workspace business qualification --- examples/order-management/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/order-management/showcase.json b/examples/order-management/showcase.json index 0f5cc147c..b1af2fa1d 100644 --- a/examples/order-management/showcase.json +++ b/examples/order-management/showcase.json @@ -30,9 +30,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-generation/receipt.json", "receiptSHA256": "5041246b7c9f452219d943efa393ea380ce7f7e172da739a945bb49da2ba5db2" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-order-scopes/runtime/order-management/business-receipt.json", + "businessReceiptSHA256": "27883d8ec19e24a82b03406e8531977ecdb213af492c2bf5bc69ef9dafecf238", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-order-scopes/receipt.json", + "nativeReceiptSHA256": "ac0eafbbe96387174b9f224cfb5aabe87a005615bd270acc9dbce355685fd25d", + "remainingFullRuntimeInventory": true, + "sourceCommit": "ce0eec9f271035f15eb6f147ac88de14b88de5f9" + }, "scene": "Order terminal and whole-graph customer mutation policy", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "verify.sh" From af7e8b4ada69c18c07f08b1dcf5a3b120bfc6fc3 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:18:47 +0800 Subject: [PATCH 17/71] Show WorkItem and Spring transaction business through native Java scopes --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- examples/conformance/Makefile | 36 +- examples/conformance/README.md | 3 + .../conformance/java-app-console/.gitignore | 53 ++ .../conformance/java-app-console/AGENTS.md | 66 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../conformance/java-app-console/Makefile | 8 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 +++ .../conformance/java-app-console/lib/pom.xml | 102 +++ .../BaseServiceConfiguration.java | 0 .../Checkers.java | 0 .../Constants.java | 0 .../runtimeexampleconformanceservice/E.java | 0 .../EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 .../runtimeexampleconformanceservice/Q.java | 0 .../Repositories.java | 0 ...eExampleConformanceServiceUserContext.java | 0 .../platform/Platform.java | 0 .../platform/PlatformChecker.java | 0 .../platform/PlatformExpression.java | 0 .../platform/PlatformListExpression.java | 0 .../platform/PlatformRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../workitem/WorkItem.java | 0 .../workitem/WorkItemChecker.java | 0 .../workitem/WorkItemExpression.java | 0 .../workitem/WorkItemListExpression.java | 0 .../workitem/WorkItemRequest.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 examples/conformance/java-app-console/pom.xml | 122 +++ .../GeneratedSpringTransactionTest.java | 0 .../runtimeexampleconformanceservice/App.java | 0 .../CustomUserContext.java | 0 .../WorkspaceTeaQLDatabase.java | 0 .../src/main/resources/application.properties | 0 .../java-app-console/teaql-i18n.json | 106 +++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 0 .../{ => java-lib-core}/lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 .../Checkers.java | 0 .../Constants.java | 9 + .../runtimeexampleconformanceservice/E.java | 18 + .../EntityMetaRegistry.java | 300 +++++++ .../GeneratedRuntimeModule.java | 37 + .../runtimeexampleconformanceservice/Q.java | 25 + .../Repositories.java | 0 ...eExampleConformanceServiceUserContext.java | 10 + .../platform/Platform.java | 130 +++ .../platform/PlatformChecker.java | 52 ++ .../platform/PlatformExpression.java | 51 ++ .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 623 +++++++++++++ .../sampledata/SampleDataService.java | 0 .../workitem/WorkItem.java | 149 ++++ .../workitem/WorkItemChecker.java | 71 ++ .../workitem/WorkItemExpression.java | 60 ++ .../workitem/WorkItemListExpression.java | 25 + .../workitem/WorkItemRequest.java | 832 ++++++++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/conformance/pom.xml | 129 +-- examples/conformance/showcase.json | 45 + .../spring-transactions/verify-local.cjs | 9 +- examples/conformance/verify.sh | 58 ++ examples/verify-runtime-examples.sh | 4 +- pom.xml | 4 +- scripts/verify-examples.sh | 6 +- .../verify-jackson-runtime-dependencies.sh | 2 +- 75 files changed, 3277 insertions(+), 167 deletions(-) create mode 100644 examples/conformance/java-app-console/.gitignore create mode 100644 examples/conformance/java-app-console/AGENTS.md create mode 100644 examples/conformance/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/conformance/java-app-console/Makefile create mode 100644 examples/conformance/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/conformance/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/conformance/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/conformance/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/conformance/java-app-console/lib/pom.xml rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java (100%) rename examples/conformance/{ => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) create mode 100644 examples/conformance/java-app-console/pom.xml rename examples/conformance/{spring-transactions => java-app-console/showcase-tests}/GeneratedSpringTransactionTest.java (100%) rename examples/conformance/{ => java-app-console}/src/main/java/com/teaql/runtimeexampleconformanceservice/App.java (100%) rename examples/conformance/{ => java-app-console}/src/main/java/com/teaql/runtimeexampleconformanceservice/CustomUserContext.java (100%) rename examples/conformance/{ => java-app-console}/src/main/java/com/teaql/runtimeexampleconformanceservice/WorkspaceTeaQLDatabase.java (100%) rename examples/conformance/{ => java-app-console}/src/main/resources/application.properties (100%) create mode 100644 examples/conformance/java-app-console/teaql-i18n.json rename examples/conformance/{ => java-app-console}/teaql/checker-model.json (100%) rename examples/conformance/{ => java-app-console}/teaql/model-provenance.json (100%) rename examples/conformance/{ => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java create mode 100644 examples/conformance/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/conformance/java-lib-core/teaql/checker-model.json create mode 100644 examples/conformance/java-lib-core/teaql/model-provenance.json create mode 100644 examples/conformance/showcase.json create mode 100644 examples/conformance/verify.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0141de895..0ed2233f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: - name: SpotBugs Check # Generated examples are verified by the dedicated Example Gate. They # intentionally do not inherit the runtime's SpotBugs build plugin. - run: mvn spotbugs:check -pl '!examples/conformance/lib,!examples/conformance' + run: mvn spotbugs:check -pl '!examples/conformance/java-lib-core/lib,!examples/conformance/java-app-console' - name: Verify trusted snapshot selection policy run: node --test .github/scripts/select-odc-snapshot.test.cjs - name: Verify snapshot freshness policy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66d146fd9..1ed681254 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,7 +53,7 @@ jobs: fi - name: Publish all Maven modules if: github.event_name == 'push' - run: mvn -B deploy -DskipTests -pl '!examples/conformance/lib,!examples/conformance' + run: mvn -B deploy -DskipTests -pl '!examples/conformance/java-lib-core/lib,!examples/conformance/java-app-console' env: TEAQL_MAVEN_USERNAME: ${{ secrets.TEAQL_MAVEN_USERNAME }} TEAQL_MAVEN_PASSWORD: ${{ secrets.TEAQL_MAVEN_PASSWORD }} diff --git a/examples/conformance/Makefile b/examples/conformance/Makefile index e44219d6c..50e2a2d78 100644 --- a/examples/conformance/Makefile +++ b/examples/conformance/Makefile @@ -1,33 +1,7 @@ - -# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. -# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. - -.PHONY: build test run clean help generate-lib - -# Default target -help: - @echo "Available commands:" - @echo " make generate-lib - Regenerate the TeaQL domain library" - @echo " make build - Build the Spring Boot application (mvn clean package)" - @echo " make test - Run application tests (mvn test)" - @echo " make run - Run the application locally (mvn spring-boot:run)" - @echo " make clean - Clean the project" - -generate-lib: - @echo "Regenerating TeaQL library..." - ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" - +.PHONY: build run test build: - mvn -f lib/pom.xml install -DskipTests - mvn clean package -DskipTests - + mvn install -DskipTests +run: build + mvn -f java-app-console/pom.xml spring-boot:run test: - mvn -f lib/pom.xml install -DskipTests - mvn test - -run: - mvn -f lib/pom.xml install -DskipTests - mvn spring-boot:run - -clean: - mvn clean + bash verify.sh diff --git a/examples/conformance/README.md b/examples/conformance/README.md index 3ab1ad9d5..1231bd5a6 100644 --- a/examples/conformance/README.md +++ b/examples/conformance/README.md @@ -1,5 +1,8 @@ # Java minimum runtime conformance example +`model.xml` owns `java-lib-core` and `java-app-console`. The original application and Spring transaction business source now live in the native workspace. `bash examples/conformance/verify.sh` uses source-built runtime/domain artifacts with isolated offline Maven, runs both lifecycle and eight Spring scenarios twice on retained databases, and removes owned scratch. See `showcase.json` for actual qualification state. + + This retained SQLite workspace is generated from `model.xml`. It verifies explicit `ensureSchema`, Checker rejection before persistence, Create, typed Q and `SmartList`, E loaded/null/not-loaded semantics, Update/version, and Delete. diff --git a/examples/conformance/java-app-console/.gitignore b/examples/conformance/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/conformance/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/conformance/java-app-console/AGENTS.md b/examples/conformance/java-app-console/AGENTS.md new file mode 100644 index 000000000..0fc0b95fd --- /dev/null +++ b/examples/conformance/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| work_item | Work Item | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/conformance/java-app-console/DOMAIN_API_GUIDE.md b/examples/conformance/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..647448172 --- /dev/null +++ b/examples/conformance/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/runtime-example-conformance-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| work_item | Work Item | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/conformance/java-app-console/Makefile b/examples/conformance/java-app-console/Makefile new file mode 100644 index 000000000..4ceb8be4e --- /dev/null +++ b/examples/conformance/java-app-console/Makefile @@ -0,0 +1,8 @@ +.PHONY: build run test +build: + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests + mvn package -DskipTests +run: build + mvn spring-boot:run +test: + node ../spring-transactions/verify-local.cjs diff --git a/examples/conformance/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/conformance/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..b1f92619e --- /dev/null +++ b/examples/conformance/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/runtime-example-conformance-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/conformance/java-app-console/STANDARD_TELEMETRY.md b/examples/conformance/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/conformance/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/conformance/java-app-console/TOOL_API_GUIDE.md b/examples/conformance/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..17624fcc4 --- /dev/null +++ b/examples/conformance/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/runtime-example-conformance-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/runtime-example-conformance-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/runtime-example-conformance-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/runtime-example-conformance-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/runtime-example-conformance-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/runtime-example-conformance-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/conformance/java-app-console/docs/teaql-java-crud-guide.md b/examples/conformance/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..2517df6c3 --- /dev/null +++ b/examples/conformance/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.runtimeexampleconformanceservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.runtimeexampleconformanceservice.Q; +import com.teaql.runtimeexampleconformanceservice.RuntimeExampleConformanceServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectWorkItemListWith(Q.workItems().selectSelf()) + .comment("load with workItemList") + .purpose("fetch child workItemList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `1`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest` \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/pom.xml b/examples/conformance/java-app-console/lib/pom.xml new file mode 100644 index 000000000..db3c36e66 --- /dev/null +++ b/examples/conformance/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + runtime-example-conformance-service-core + 1.0.0 + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java diff --git a/examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java similarity index 100% rename from examples/conformance/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java rename to examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java diff --git a/examples/conformance/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/conformance/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/conformance/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/conformance/java-app-console/pom.xml b/examples/conformance/java-app-console/pom.xml new file mode 100644 index 000000000..f32c5cea9 --- /dev/null +++ b/examples/conformance/java-app-console/pom.xml @@ -0,0 +1,122 @@ + + + + 4.0.0 + + com.teaql + runtime-example-conformance-service + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.0.0 + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + io.teaql + teaql-provider-spring-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework + spring-tx + + + com.teaql + runtime-example-conformance-service-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + ${project.build.directory}/deploy + + + + + repackage + + + + + + + diff --git a/examples/conformance/spring-transactions/GeneratedSpringTransactionTest.java b/examples/conformance/java-app-console/showcase-tests/GeneratedSpringTransactionTest.java similarity index 100% rename from examples/conformance/spring-transactions/GeneratedSpringTransactionTest.java rename to examples/conformance/java-app-console/showcase-tests/GeneratedSpringTransactionTest.java diff --git a/examples/conformance/src/main/java/com/teaql/runtimeexampleconformanceservice/App.java b/examples/conformance/java-app-console/src/main/java/com/teaql/runtimeexampleconformanceservice/App.java similarity index 100% rename from examples/conformance/src/main/java/com/teaql/runtimeexampleconformanceservice/App.java rename to examples/conformance/java-app-console/src/main/java/com/teaql/runtimeexampleconformanceservice/App.java diff --git a/examples/conformance/src/main/java/com/teaql/runtimeexampleconformanceservice/CustomUserContext.java b/examples/conformance/java-app-console/src/main/java/com/teaql/runtimeexampleconformanceservice/CustomUserContext.java similarity index 100% rename from examples/conformance/src/main/java/com/teaql/runtimeexampleconformanceservice/CustomUserContext.java rename to examples/conformance/java-app-console/src/main/java/com/teaql/runtimeexampleconformanceservice/CustomUserContext.java diff --git a/examples/conformance/src/main/java/com/teaql/runtimeexampleconformanceservice/WorkspaceTeaQLDatabase.java b/examples/conformance/java-app-console/src/main/java/com/teaql/runtimeexampleconformanceservice/WorkspaceTeaQLDatabase.java similarity index 100% rename from examples/conformance/src/main/java/com/teaql/runtimeexampleconformanceservice/WorkspaceTeaQLDatabase.java rename to examples/conformance/java-app-console/src/main/java/com/teaql/runtimeexampleconformanceservice/WorkspaceTeaQLDatabase.java diff --git a/examples/conformance/src/main/resources/application.properties b/examples/conformance/java-app-console/src/main/resources/application.properties similarity index 100% rename from examples/conformance/src/main/resources/application.properties rename to examples/conformance/java-app-console/src/main/resources/application.properties diff --git a/examples/conformance/java-app-console/teaql-i18n.json b/examples/conformance/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..83183cccd --- /dev/null +++ b/examples/conformance/java-app-console/teaql-i18n.json @@ -0,0 +1,106 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.workItem.title": "Title", + "entity.platform": "Platform", + "property.platform.id": "Id", + "entity.workItem": "Work Item", + "property.workItem.platform": "Platform", + "property.platform.version": "Version", + "property.workItem.description": "Description", + "property.workItem.id": "Id", + "property.workItem.version": "Version" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/conformance/teaql/checker-model.json b/examples/conformance/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/conformance/teaql/checker-model.json rename to examples/conformance/java-app-console/teaql/checker-model.json diff --git a/examples/conformance/teaql/model-provenance.json b/examples/conformance/java-app-console/teaql/model-provenance.json similarity index 100% rename from examples/conformance/teaql/model-provenance.json rename to examples/conformance/java-app-console/teaql/model-provenance.json diff --git a/examples/conformance/lib/pom.xml b/examples/conformance/java-lib-core/lib/pom.xml similarity index 100% rename from examples/conformance/lib/pom.xml rename to examples/conformance/java-lib-core/lib/pom.xml diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java new file mode 100644 index 000000000..6086e2f88 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.runtimeexampleconformanceservice; + +import com.teaql.runtimeexampleconformanceservice.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java new file mode 100644 index 000000000..68fd537c5 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java @@ -0,0 +1,18 @@ + +package com.teaql.runtimeexampleconformanceservice; + +import com.teaql.runtimeexampleconformanceservice.platform.Platform; +import com.teaql.runtimeexampleconformanceservice.platform.PlatformExpression; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static WorkItemExpression workItem(WorkItem workItem){ + return new WorkItemExpression(new ValueExpression(workItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.workItem()")); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java new file mode 100644 index 000000000..4f01a8f47 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java @@ -0,0 +1,300 @@ + +package com.teaql.runtimeexampleconformanceservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerWorkItem(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.teaql.runtimeexampleconformanceservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.runtimeexampleconformanceservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.runtimeexampleconformanceservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.teaql.runtimeexampleconformanceservice.platform.Platform::new); + entityDescriptor.with("name", "Platform") + + .with("module", "Example") + + .with("module_key", "example") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Runtime Example") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerWorkItem() { + FieldLayout.installGenerated(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class); + entityDescriptor.setEntitySupplier(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem::new); + entityDescriptor.with("name", "Work Item") + + .with("module", "Example") + + .with("module_key", "example") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor title = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY, String.class) + ; + PropertyDescriptor description = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.DESCRIPTION_PROPERTY, String.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.PLATFORM_PROPERTY, com.teaql.runtimeexampleconformanceservice.platform.Platform.INTERNAL_TYPE, com.teaql.runtimeexampleconformanceservice.platform.Platform.WORK_ITEM_LIST_PROPERTY, com.teaql.runtimeexampleconformanceservice.platform.Platform.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY).with("isPassword", "false") + + .with("max", "80") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("min", "1") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.DESCRIPTION_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..4a8cb2488 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.teaql.runtimeexampleconformanceservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.runtimeexampleconformanceservice.platform.PlatformChecker(), new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:f026153870cc54db18171cbbe02db1db174f3dea513e9d21e0ffe8af787ebaed\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]},{\"name\":\"work_item_list\",\"targetType\":\"WorkItem\",\"labels\":{\"en\":\"Work Item\"},\"aliases\":[\"WorkItemList\",\"workItemList\"]}]},\"WorkItem\":{\"labels\":{\"en\":\"Work Item\"},\"fields\":[{\"name\":\"description\",\"labels\":{\"en\":\"description\"},\"aliases\":[\"Description\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"title\",\"labels\":{\"en\":\"title\"},\"aliases\":[\"Title\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("WorkItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("title", "title"), java.util.Map.entry("description", "description"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.runtimeexampleconformanceservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.runtimeexampleconformanceservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Runtime Example"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java new file mode 100644 index 000000000..488630449 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java @@ -0,0 +1,25 @@ + +package com.teaql.runtimeexampleconformanceservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest platforms(){ + return new com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest(com.teaql.runtimeexampleconformanceservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest(com.teaql.runtimeexampleconformanceservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest workItems(){ + return new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest workItemsWithMinimalFields(){ + return new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java new file mode 100644 index 000000000..45d540e79 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.runtimeexampleconformanceservice; + +import io.teaql.core.UserContext; +public interface RuntimeExampleConformanceServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java new file mode 100644 index 000000000..b65672c65 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.teaql.runtimeexampleconformanceservice.platform; + +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e5c9f1d176ea19c50ebeacae413fa8885a3403d4d9ac9775fe79aecd0d931638"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "work_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String WORK_ITEM_LIST_PROPERTY = "work_item_list"; + private String name; + + private SmartList workItemList; + + public String getName(){ + return this.name; + } + + public SmartList getWorkItemList(){ + return this.workItemList == null ? SmartList.unloaded() : this.workItemList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addWorkItem(WorkItem workItem){ + if (workItem == null){ + return this; + } + + if(null == this.workItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.workItemList = teaqlUnloadedItems.map(value -> value); + } + + this.workItemList.add(workItem); + workItem.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "work_item_list": this.workItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "work_item_list": return this.workItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java new file mode 100644 index 000000000..54ee11319 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.runtimeexampleconformanceservice.platform; + +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getWorkItemList() != null && i < platform.getWorkItemList().size(); i++){ + WorkItem workItem = platform.getWorkItemList().get(i); + new WorkItemChecker().checkAndFix(_context, workItem, newLocation(_parentLocation, "work_item_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java new file mode 100644 index 000000000..4622a5e9d --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.runtimeexampleconformanceservice.platform; + +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public WorkItemListExpression getWorkItemList(){ + return new WorkItemListExpression(loaded("work_item_list", "getWorkItemList", Platform::getWorkItemList)); + } + public PlatformExpression addWorkItem(WorkItem workItem){ + return new PlatformExpression(this, $it -> ((Platform)$it).addWorkItem(workItem)); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..f9aba731e --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.runtimeexampleconformanceservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java new file mode 100644 index 000000000..0c64a37b9 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.runtimeexampleconformanceservice.platform; + +import com.teaql.runtimeexampleconformanceservice.Q; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; +import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectWorkItemList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectWorkItemList(){ + return selectWorkItemListWith(Q.workItems().selectSelf()); + } + + public PlatformRequest selectWorkItemListWith(WorkItemRequest workItemList){ + enhanceRelation(Platform.WORK_ITEM_LIST_PROPERTY, workItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectWorkItemListWith", null, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withWorkItemListMatching(WorkItemRequest workItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, workItemRequest, WorkItem.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutWorkItemListMatching(WorkItemRequest workItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, workItemRequest, WorkItem.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveWorkItems(){ + return withWorkItemListMatching(Q.workItems().unlimited()); + } + + public PlatformRequest haveNoWorkItems(){ + return withoutWorkItemListMatching(Q.workItems().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByWorkItemsWithDetails(WorkItemRequest subRequest){ + aggregate(Platform.WORK_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromWorkItemsAs(String name, WorkItemRequest subRequest){ + return statsFromWorkItemsAs(name, subRequest, false); + } + + public PlatformRequest statsFromWorkItemsAs(String name, WorkItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, WorkItem.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromWorkItemsAs", name, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromWorkItems(WorkItemRequest subRequest){ + return statsFromWorkItemsAs(REFINEMENTS, subRequest); + } + public PlatformRequest countWorkItems(){ + addRelationCount("Count", Q.workItems().unlimited(), WorkItem.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItems", null, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countWorkItemsAs(String name){ + addRelationCount(name, Q.workItems().unlimited(), WorkItem.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItemsAs", name, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countWorkItemsWith(String name, WorkItemRequest subRequest){ + addRelationCount(name, subRequest, WorkItem.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItemsWith", name, Platform.WORK_ITEM_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java new file mode 100644 index 000000000..e558c6cca --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java @@ -0,0 +1,149 @@ + +package com.teaql.runtimeexampleconformanceservice.workitem; + +import com.teaql.runtimeexampleconformanceservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class WorkItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "WorkItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "ff6df6930613256f676f63204201b7b20d7ecd9fa363bae51492c66e562f023c"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("title", 1), java.util.Map.entry("description", 2), java.util.Map.entry("platform", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("title", java.util.List.of("title", "title")), java.util.Map.entry("description", java.util.List.of("description", "description")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + WorkItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String TITLE_PROPERTY = "title"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String PLATFORM_PROPERTY = "platform"; + private String title; + + private String description; + + private Platform platform; + + + public String getTitle(){ + return this.title; + } + + public String getDescription(){ + return this.description; + } + + public Platform getPlatform(){ + return this.platform; + } + + public WorkItem updateTitle(String title){ + title = (title == null ? null : title.trim()); + if(isPropertyLoaded(TITLE_PROPERTY) && Objects.equals(this.title, title)){ + return this; + } + handleUpdate(TITLE_PROPERTY, getTitle(), title); + this.title = title; + return this; + } + + public WorkItem updateDescription(String description){ + description = (description == null ? null : description.trim()); + if(isPropertyLoaded(DESCRIPTION_PROPERTY) && Objects.equals(this.description, description)){ + return this; + } + handleUpdate(DESCRIPTION_PROPERTY, getDescription(), description); + this.description = description; + return this; + } + + public WorkItem updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + + public static WorkItem refer(Long id){ + WorkItem refer = new WorkItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public WorkItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "title": this.title = (value == null ? null : ((String)value).trim()); break; + + case "description": this.description = (value == null ? null : ((String)value).trim()); break; + + case "platform": this.platform = (Platform) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "title": return this.title; + case "description": return this.description; + case "platform": return this.platform; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "title": return this.title; + case "description": return this.description; + case "platform": return this.platform; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java new file mode 100644 index 000000000..bddd860d4 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java @@ -0,0 +1,71 @@ + +package com.teaql.runtimeexampleconformanceservice.workitem; + +import com.teaql.runtimeexampleconformanceservice.platform.Platform; +import com.teaql.runtimeexampleconformanceservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class WorkItemChecker implements Checker{ + + public String type(){ + return WorkItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, WorkItem workItem, ObjectLocation _parentLocation){ + if(needCheck(_context, workItem)){ + markAsChecked(_context, workItem); + doCheck(_context, workItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, WorkItem workItem, ObjectLocation _parentLocation){ + if((workItem == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, workItem); + if(workItem.needPersist()){ + } + if(workItem.newItem()){ + }else if(workItem.updateItem()){ + if(!workItem.isPropertyLoaded("title")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "title"), "Mutation requires a fully loaded entity"); + } + if(!workItem.isPropertyLoaded("description")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "description"), "Mutation requires a fully loaded entity"); + } + if(!workItem.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + + } + checkTitle(_context, workItem.getProperty(WorkItem.TITLE_PROPERTY), newLocation(_parentLocation, "title")); + checkDescription(_context, workItem.getProperty(WorkItem.DESCRIPTION_PROPERTY), newLocation(_parentLocation, "description")); + checkPlatform(_context, workItem.getProperty(WorkItem.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + } + + public void checkTitle(UserContext _context, String title, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, title); + if((title == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, title); + maxStringCheck(_context, _parentLocation, 80, title); + + } + public void checkDescription(UserContext _context, String description, ObjectLocation _parentLocation){ + if((description == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, description); + + } + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java new file mode 100644 index 000000000..89a84b043 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java @@ -0,0 +1,60 @@ + +package com.teaql.runtimeexampleconformanceservice.workitem; + +import com.teaql.runtimeexampleconformanceservice.platform.Platform; +import com.teaql.runtimeexampleconformanceservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class WorkItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public WorkItemExpression(Expression expression){ + super(expression); + } + + public WorkItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public WorkItemExpression updateId(Long id){ + return new WorkItemExpression(this, $it -> {((WorkItem)$it).__internalSet("id", id); return this;}); + } + + public WorkItemExpression save(UserContext userContext){ + return new WorkItemExpression(this, $it -> ((WorkItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public WorkItemExpression save(String intent, UserContext userContext){ + return new WorkItemExpression(this, $it -> ((WorkItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getTitle(){ + return loaded("title", "getTitle", WorkItem::getTitle); + } + public WorkItemExpression updateTitle(String title){ + return new WorkItemExpression(this, $it -> ((WorkItem)$it).updateTitle(title)); + } + + public Expression getDescription(){ + return loaded("description", "getDescription", WorkItem::getDescription); + } + public WorkItemExpression updateDescription(String description){ + return new WorkItemExpression(this, $it -> ((WorkItem)$it).updateDescription(description)); + } + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", WorkItem::getPlatform)); + } + + public WorkItemExpression updatePlatform(Platform platform){ + return new WorkItemExpression(this, $it -> ((WorkItem)$it).updatePlatform(platform)); + } + +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java new file mode 100644 index 000000000..6fa79a9d2 --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.runtimeexampleconformanceservice.workitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class WorkItemListExpression extends SmartListExpression { + public WorkItemListExpression(Expression> expression){ + super(expression); + } + + public WorkItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public WorkItemExpression first() { + return new WorkItemExpression(super.first()); + } + + public WorkItemExpression get(int index) { + return new WorkItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java new file mode 100644 index 000000000..fdbdc329c --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java @@ -0,0 +1,832 @@ + +package com.teaql.runtimeexampleconformanceservice.workitem; + +import com.teaql.runtimeexampleconformanceservice.Q; +import com.teaql.runtimeexampleconformanceservice.platform.Platform; +import com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class WorkItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public WorkItemRequest(Class returnType){ + this(returnType, () -> (T) new WorkItem()); + } + + protected WorkItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public WorkItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public WorkItemRequest copy(){ + return (WorkItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new WorkItemRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public WorkItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public WorkItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public WorkItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public WorkItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public WorkItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public WorkItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public WorkItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public WorkItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public WorkItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public WorkItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (WorkItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public WorkItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public WorkItemRequest matchingAnyOf(WorkItemRequest workItem){ + super.internalMatchAny(workItem); + return this; + } + + public WorkItemRequest matchingIdsOf(WorkItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + WorkItem.ID_PROPERTY, request, WorkItem.ID_PROPERTY)); + } + + public WorkItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public WorkItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public WorkItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public WorkItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTitle().selectDescription().selectPlatformIdOnly().selectVersion(); + } + + public WorkItemRequest selectSelfFields(){ + return selectSelf(); + } + + public WorkItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(WorkItem.ID_PROPERTY); + selectProperty(WorkItem.TITLE_PROPERTY); + selectProperty(WorkItem.DESCRIPTION_PROPERTY); + selectProperty(WorkItem.PLATFORM_PROPERTY); + selectProperty(WorkItem.VERSION_PROPERTY); + return this; + } + + public WorkItemRequest selectAll(){ + super.selectAll(); + return selectId().selectTitle().selectDescription().selectPlatform().selectVersion(); + } + + public WorkItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectTitle().selectDescription().selectPlatform().selectVersion(); + } + + + public WorkItemRequest selectId(){ + selectProperty(WorkItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public WorkItemRequest unselectId(){ + unselectProperty(WorkItem.ID_PROPERTY); + return this; + } + public WorkItemRequest selectTitle(){ + selectProperty(WorkItem.TITLE_PROPERTY); + return this; + } + + /** + * fill the title with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS title) to fetch title property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public WorkItemRequest unselectTitle(){ + unselectProperty(WorkItem.TITLE_PROPERTY); + return this; + } + public WorkItemRequest selectDescription(){ + selectProperty(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + + /** + * fill the description with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS description) to fetch description property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public WorkItemRequest unselectDescription(){ + unselectProperty(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + public WorkItemRequest selectPlatformIdOnly(){ + selectProperty(WorkItem.PLATFORM_PROPERTY); + return this; + } + + public WorkItemRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public WorkItemRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(WorkItem.PLATFORM_PROPERTY); + enhanceRelation(WorkItem.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, WorkItem.PLATFORM_PROPERTY)); + return this; + } + + public WorkItemRequest unselectPlatform(){ + unselectProperty(WorkItem.PLATFORM_PROPERTY); + return this; + } + public WorkItemRequest selectVersion(){ + selectProperty(WorkItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public WorkItemRequest unselectVersion(){ + unselectProperty(WorkItem.VERSION_PROPERTY); + return this; + } + + public WorkItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(WorkItem.ID_PROPERTY, operator, values); + } + + public WorkItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public WorkItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public WorkItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public WorkItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public WorkItemRequest filterByTitle(String... title){ + if (title == null || title.length == 0) { + throw new IllegalArgumentException("filterByTitle parameter title cannot be empty"); + } + return appendSearchCriteria(createTitleCriteria(Operator.EQUAL, (Object[])title)); + } + + public WorkItemRequest withTitle(Operator operator, Object... values){ + return appendSearchCriteria(createTitleCriteria(operator, values)); + } + + public WorkItemRequest withTitleIsUnknown(){ + return withTitle(Operator.IS_NULL); + } + + public WorkItemRequest withTitleIsKnown(){ + return withTitle(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTitleCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(WorkItem.TITLE_PROPERTY, operator, values); + } + + public WorkItemRequest withTitleIsNot(String title){ + return withTitle(Operator.NOT_EQUAL, title); + } + + public WorkItemRequest withTitleIn(String... title){ + return withTitle(Operator.IN, (Object[])title); + } + + public WorkItemRequest withTitleNotIn(String... title){ + return withTitle(Operator.NOT_IN, (Object[])title); + } + public WorkItemRequest withTitleGreaterThan(String title){ + return withTitle(Operator.GREATER_THAN, title); + } + + public WorkItemRequest withTitleGreaterThanOrEqualTo(String title){ + return withTitle(Operator.GREATER_THAN_OR_EQUAL, title); + } + + public WorkItemRequest withTitleLessThan(String title){ + return withTitle(Operator.LESS_THAN, title); + } + + public WorkItemRequest withTitleLessThanOrEqualTo(String title){ + return withTitle(Operator.LESS_THAN_OR_EQUAL, title); + } + + public WorkItemRequest withTitleBetween(String startOfTitle, String endOfTitle){ + return withTitle(Operator.BETWEEN, startOfTitle, endOfTitle); + } + public WorkItemRequest withTitleStartingWith(String title){ + return withTitle(Operator.BEGIN_WITH, title); + } + public WorkItemRequest withTitleContaining(String title){ + return withTitle(Operator.CONTAIN, title); + } + + public WorkItemRequest withTitleNotContaining(String title){ + return withTitle(Operator.NOT_CONTAIN, title); + } + + public WorkItemRequest withTitleNotStartingWith(String title){ + return withTitle(Operator.NOT_BEGIN_WITH, title); + } + + public WorkItemRequest withTitleEndingWith(String title){ + return withTitle(Operator.END_WITH, title); + } + + public WorkItemRequest withTitleNotEndingWith(String title){ + return withTitle(Operator.NOT_END_WITH, title); + } + + public WorkItemRequest withTitleIs(String title){ + return withTitle(Operator.EQUAL, title); + } + + public WorkItemRequest withTitleSoundingLike(String title){ + return withTitle(Operator.SOUNDS_LIKE, title); + } + + + + public WorkItemRequest filterByDescription(String... description){ + if (description == null || description.length == 0) { + throw new IllegalArgumentException("filterByDescription parameter description cannot be empty"); + } + return appendSearchCriteria(createDescriptionCriteria(Operator.EQUAL, (Object[])description)); + } + + public WorkItemRequest withDescription(Operator operator, Object... values){ + return appendSearchCriteria(createDescriptionCriteria(operator, values)); + } + + public WorkItemRequest withDescriptionIsUnknown(){ + return withDescription(Operator.IS_NULL); + } + + public WorkItemRequest withDescriptionIsKnown(){ + return withDescription(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDescriptionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(WorkItem.DESCRIPTION_PROPERTY, operator, values); + } + + public WorkItemRequest withDescriptionIsNot(String description){ + return withDescription(Operator.NOT_EQUAL, description); + } + + public WorkItemRequest withDescriptionIn(String... description){ + return withDescription(Operator.IN, (Object[])description); + } + + public WorkItemRequest withDescriptionNotIn(String... description){ + return withDescription(Operator.NOT_IN, (Object[])description); + } + public WorkItemRequest withDescriptionGreaterThan(String description){ + return withDescription(Operator.GREATER_THAN, description); + } + + public WorkItemRequest withDescriptionGreaterThanOrEqualTo(String description){ + return withDescription(Operator.GREATER_THAN_OR_EQUAL, description); + } + + public WorkItemRequest withDescriptionLessThan(String description){ + return withDescription(Operator.LESS_THAN, description); + } + + public WorkItemRequest withDescriptionLessThanOrEqualTo(String description){ + return withDescription(Operator.LESS_THAN_OR_EQUAL, description); + } + + public WorkItemRequest withDescriptionBetween(String startOfDescription, String endOfDescription){ + return withDescription(Operator.BETWEEN, startOfDescription, endOfDescription); + } + public WorkItemRequest withDescriptionStartingWith(String description){ + return withDescription(Operator.BEGIN_WITH, description); + } + public WorkItemRequest withDescriptionContaining(String description){ + return withDescription(Operator.CONTAIN, description); + } + + public WorkItemRequest withDescriptionNotContaining(String description){ + return withDescription(Operator.NOT_CONTAIN, description); + } + + public WorkItemRequest withDescriptionNotStartingWith(String description){ + return withDescription(Operator.NOT_BEGIN_WITH, description); + } + + public WorkItemRequest withDescriptionEndingWith(String description){ + return withDescription(Operator.END_WITH, description); + } + + public WorkItemRequest withDescriptionNotEndingWith(String description){ + return withDescription(Operator.NOT_END_WITH, description); + } + + public WorkItemRequest withDescriptionIs(String description){ + return withDescription(Operator.EQUAL, description); + } + + public WorkItemRequest withDescriptionSoundingLike(String description){ + return withDescription(Operator.SOUNDS_LIKE, description); + } + + + + public WorkItemRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public WorkItemRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public WorkItemRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public WorkItemRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(WorkItem.PLATFORM_PROPERTY, operator, values); + } + + public WorkItemRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public WorkItemRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(WorkItem.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public WorkItemRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(WorkItem.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public WorkItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public WorkItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public WorkItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public WorkItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(WorkItem.VERSION_PROPERTY, operator, values); + } + + public WorkItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public WorkItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public WorkItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public WorkItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public WorkItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public WorkItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public WorkItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public WorkItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public WorkItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public WorkItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public WorkItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public WorkItemRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public WorkItemRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(WorkItem.PLATFORM_PROPERTY, subRequest); + return this; + } + + + public WorkItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public WorkItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, WorkItem.ID_PROPERTY); + return this; + } + public WorkItemRequest countDistinctTitle(){ + return countDistinctTitleAs("title_distinct_count"); + } + + public WorkItemRequest countDistinctTitleAs(String alias){ + super.countDistinctProperty(alias, WorkItem.TITLE_PROPERTY); + return this; + } + public WorkItemRequest countDistinctDescription(){ + return countDistinctDescriptionAs("description_distinct_count"); + } + + public WorkItemRequest countDistinctDescriptionAs(String alias){ + super.countDistinctProperty(alias, WorkItem.DESCRIPTION_PROPERTY); + return this; + } + public WorkItemRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public WorkItemRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, WorkItem.PLATFORM_PROPERTY); + return this; + } + public WorkItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public WorkItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, WorkItem.VERSION_PROPERTY); + return this; + } + + public WorkItemRequest groupById(){ + groupBy(WorkItem.ID_PROPERTY); + return this; + } + + public WorkItemRequest groupByIdAs(String retName){ + groupBy(retName, WorkItem.ID_PROPERTY); + return this; + } + + public WorkItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, WorkItem.ID_PROPERTY, function); + return this; + } + + public WorkItemRequest groupByTitle(){ + groupBy(WorkItem.TITLE_PROPERTY); + return this; + } + + public WorkItemRequest groupByTitleAs(String retName){ + groupBy(retName, WorkItem.TITLE_PROPERTY); + return this; + } + + public WorkItemRequest groupByTitleWithFunction(String retName, AggrFunction function){ + groupBy(retName, WorkItem.TITLE_PROPERTY, function); + return this; + } + + public WorkItemRequest groupByDescription(){ + groupBy(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + + public WorkItemRequest groupByDescriptionAs(String retName){ + groupBy(retName, WorkItem.DESCRIPTION_PROPERTY); + return this; + } + + public WorkItemRequest groupByDescriptionWithFunction(String retName, AggrFunction function){ + groupBy(retName, WorkItem.DESCRIPTION_PROPERTY, function); + return this; + } + public WorkItemRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(WorkItem.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public WorkItemRequest groupByPlatform(){ + groupBy(WorkItem.PLATFORM_PROPERTY); + return this; + } + + public WorkItemRequest groupByPlatformAs(String retName){ + groupBy(retName, WorkItem.PLATFORM_PROPERTY); + return this; + } + + public WorkItemRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, WorkItem.PLATFORM_PROPERTY, function); + return this; + } + + public WorkItemRequest groupByVersion(){ + groupBy(WorkItem.VERSION_PROPERTY); + return this; + } + + public WorkItemRequest groupByVersionAs(String retName){ + groupBy(retName, WorkItem.VERSION_PROPERTY); + return this; + } + + public WorkItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, WorkItem.VERSION_PROPERTY, function); + return this; + } + + + + public WorkItemRequest orderByIdAscending(){ + addOrderByAscending(WorkItem.ID_PROPERTY); + return this; + } + + public WorkItemRequest orderByIdDescending(){ + addOrderByDescending(WorkItem.ID_PROPERTY); + return this; + } + + public WorkItemRequest orderByTitleAscending(){ + addOrderByAscending(WorkItem.TITLE_PROPERTY); + return this; + } + + public WorkItemRequest orderByTitleDescending(){ + addOrderByDescending(WorkItem.TITLE_PROPERTY); + return this; + } + public WorkItemRequest orderByTitleAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(WorkItem.TITLE_PROPERTY); + return this; + } + + public WorkItemRequest orderByTitleDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(WorkItem.TITLE_PROPERTY); + return this; + } + public WorkItemRequest orderByDescriptionAscending(){ + addOrderByAscending(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + + public WorkItemRequest orderByDescriptionDescending(){ + addOrderByDescending(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + public WorkItemRequest orderByDescriptionAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + + public WorkItemRequest orderByDescriptionDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(WorkItem.DESCRIPTION_PROPERTY); + return this; + } + public WorkItemRequest orderByPlatformAscending(){ + addOrderByAscending(WorkItem.PLATFORM_PROPERTY); + return this; + } + + public WorkItemRequest orderByPlatformDescending(){ + addOrderByDescending(WorkItem.PLATFORM_PROPERTY); + return this; + } + + public WorkItemRequest orderByVersionAscending(){ + addOrderByAscending(WorkItem.VERSION_PROPERTY); + return this; + } + + public WorkItemRequest orderByVersionDescending(){ + addOrderByDescending(WorkItem.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + public WorkItemRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public WorkItemRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, WorkItem.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, WorkItem.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public WorkItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public WorkItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public WorkItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public WorkItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public WorkItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public WorkItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..0414f0d7e --- /dev/null +++ b/examples/conformance/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.runtimeexampleconformanceservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/java-lib-core/teaql/checker-model.json b/examples/conformance/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..e5e26ed57 --- /dev/null +++ b/examples/conformance/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:f026153870cc54db18171cbbe02db1db174f3dea513e9d21e0ffe8af787ebaed","entities":{"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]},{"name":"work_item_list","targetType":"WorkItem","labels":{"en":"Work Item"},"aliases":["WorkItemList","workItemList"]}]},"WorkItem":{"labels":{"en":"Work Item"},"fields":[{"name":"description","labels":{"en":"description"},"aliases":["Description"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"title","labels":{"en":"title"},"aliases":["Title"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/conformance/java-lib-core/teaql/model-provenance.json b/examples/conformance/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..8acaa38ad --- /dev/null +++ b/examples/conformance/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:15e3876863021b944cb4a7d74ae399afca20e12d724328cf21ae9805289b83d5","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/conformance/pom.xml b/examples/conformance/pom.xml index f32c5cea9..302f7d0b0 100644 --- a/examples/conformance/pom.xml +++ b/examples/conformance/pom.xml @@ -1,122 +1,11 @@ - - - + 4.0.0 - - com.teaql - runtime-example-conformance-service - 0.0.1-SNAPSHOT - jar - - - 21 - 4.1.1 - 1.0.0 - UTF-8 - true - 6.3.0 - - - - - aliyun-public - https://maven.aliyun.com/nexus/content/groups/public/ - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - - - org.apache.tomcat.embed - tomcat-embed-core - 11.0.26 - - - org.apache.tomcat.embed - tomcat-embed-el - 11.0.26 - - - org.apache.tomcat.embed - tomcat-embed-websocket - 11.0.26 - - - - - - - io.teaql - teaql-provider-spring-jdbc - ${teaql.version} - - - io.teaql - teaql-data-service-sql - ${teaql.version} - - - com.zaxxer - HikariCP - - - org.xerial - sqlite-jdbc - 3.53.2.1 - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework - spring-tx - - - com.teaql - runtime-example-conformance-service-core - ${libversion} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - ${project.build.directory}/deploy - - - - - repackage - - - - - - + com.teaql.examples + work-item-showcase + 1.0.0 + pom + + java-lib-core/lib + java-app-console + diff --git a/examples/conformance/showcase.json b/examples/conformance/showcase.json new file mode 100644 index 000000000..cd8f848d7 --- /dev/null +++ b/examples/conformance/showcase.json @@ -0,0 +1,45 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/conformance", + "library": { + "generatedFilesManifestSHA256": "77e4e26185f8bd2e7f9254222d1295df8cf5a59d5d7e847cba4abbc520e8c7e9", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "0a59f66db2487fdd0430087dd5985ae780225c088ad800679cb57c593c6bcee7" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/work-item-generation/receipt.json", + "receiptSHA256": "99afd2b0806d9aec86d271cd5154f9447b895e9f3a5e69f2e95468bcd8a1644a" + }, + "scene": "WorkItem governed lifecycle and workspace-owned Spring transaction business scenarios", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "Makefile", + "showcase-tests/GeneratedSpringTransactionTest.java", + "src/main/java/com/teaql/runtimeexampleconformanceservice/WorkspaceTeaQLDatabase.java", + "src/main/java/com/teaql/runtimeexampleconformanceservice/App.java", + "src/main/java/com/teaql/runtimeexampleconformanceservice/CustomUserContext.java", + "src/main/resources/application.properties" + ], + "generatedFilesManifestSHA256": "da19ce1214da1fee5a30f8b68d6a9c51cca7ce30adf6297f15d0f2619b0de254", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/conformance/spring-transactions/verify-local.cjs b/examples/conformance/spring-transactions/verify-local.cjs index b87b1f489..85714df69 100644 --- a/examples/conformance/spring-transactions/verify-local.cjs +++ b/examples/conformance/spring-transactions/verify-local.cjs @@ -4,6 +4,7 @@ const fs=require('node:fs'),path=require('node:path'),os=require('node:os'),cp=r const assert=require('node:assert/strict'),crypto=require('node:crypto'); const {createOwnedRunner,ownedBytes}=require('../../fix-e-alignment/owned-command.cjs'); const ROOT=path.resolve(__dirname,'../../..'),REFERENCE='6d162bb0cff43335e570302a95a5abc721915b77'; +const TEST_SOURCE=path.join(ROOT,'examples/conformance/java-app-console/showcase-tests/GeneratedSpringTransactionTest.java'); const CASES=['admission','audit-delivery-failure','graph-write-failure','nested-rollback','outer-commit-noop','outer-rollback-retry','requires-new','savepoint-boundaries']; const sha=b=>crypto.createHash('sha256').update(b).digest('hex'); const digest=f=>sha(fs.readFileSync(f)); @@ -15,7 +16,7 @@ function source(){ return{commit:git('rev-parse','HEAD').toString().trim(),contentsSha256:hash.digest('hex'),files,dirty:git('status','--porcelain').toString()}; } function fixture(){ - const prefix='examples/conformance/lib/'; + const prefix='examples/conformance/java-lib-core/lib/'; const files=git('ls-files','-z','--',prefix).toString().split('\0').filter(Boolean).sort();assert(files.length>10); const hashes={};for(const n of files){hashes[n.slice(prefix.length)]=digest(path.join(ROOT,n));assert.equal(sha(git('show','HEAD:'+n)),hashes[n.slice(prefix.length)],'never edit generated library: '+n);} const model='examples/conformance/model.xml';assert.equal(digest(path.join(ROOT,model)),sha(git('show','HEAD:'+model))); @@ -52,7 +53,7 @@ async function main(){ } try{ const disk=fs.statfsSync(scratch);assert(disk.bavail*disk.bsize>8*1024**3); - const original=source();report.source=original;report.fixture=fixture();report.applicationSha256=digest(path.join(__dirname,'GeneratedSpringTransactionTest.java'));report.verifierSha256=digest(__filename); + const original=source();report.source=original;report.fixture=fixture();report.applicationSha256=digest(TEST_SOURCE);report.verifierSha256=digest(__filename); const runtime=path.join(scratch,'source'),consumer=path.join(scratch,'consumer'),maven=path.join(scratch,'maven'); fs.mkdirSync(runtime);report.testedProductionCommit=baseline?REFERENCE:original.commit; if(baseline){ @@ -61,9 +62,9 @@ async function main(){ }else for(const n of original.files){const to=path.join(runtime,n);fs.mkdirSync(path.dirname(to),{recursive:true});fs.copyFileSync(path.join(ROOT,n),to);} // This library is already a module of the runtime's reactor. Verify it in // place rather than introduce a second module with the same Maven identity. - for(const[n,h]of Object.entries(report.fixture.files))assert.equal(digest(path.join(runtime,'examples/conformance/lib',n)),h); + for(const[n,h]of Object.entries(report.fixture.files))assert.equal(digest(path.join(runtime,baseline?'examples/conformance/lib':'examples/conformance/java-lib-core/lib',n)),h); const tests=path.join(consumer,'src/test/java/com/teaql/runtimeexampleconformanceservice');fs.mkdirSync(tests,{recursive:true}); - fs.copyFileSync(path.join(__dirname,'GeneratedSpringTransactionTest.java'),path.join(tests,'GeneratedSpringTransactionTest.java')); + fs.copyFileSync(TEST_SOURCE,path.join(tests,'GeneratedSpringTransactionTest.java')); const version=fs.readFileSync(path.join(runtime,'pom.xml'),'utf8').match(/([^<]+)<\/version>/)[1]; const dependencies=['teaql-runtime','teaql-sqlite','teaql-provider-spring-jdbc','teaql-jackson'].map(n=>`io.teaql${n}${version}`).join(''); const pom=`4.0.0io.teaqlteaql-java-parent${version}../source/pom.xmlio.teaql.examplesteaql-spring-business-example${version}com.teaqlruntime-example-conformance-service-core1.0.0${dependencies}junitjunit4.13.2testorg.apache.maven.pluginsmaven-surefire-pluginfalse`; diff --git a/examples/conformance/verify.sh b/examples/conformance/verify.sh new file mode 100644 index 000000000..a5be144ff --- /dev/null +++ b/examples/conformance/verify.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" +: "${TEAQL_MAVEN_DEPENDENCY_CACHE:?Use the isolated source qualifier for this gate}" +if [[ -n "${TEAQL_CONFORMANCE_EVIDENCE_DIR:-}" ]]; then + evidence="$TEAQL_CONFORMANCE_EVIDENCE_DIR" + mkdir "$evidence" +else + evidence="$(mktemp -d -t teaql-java-work-item-evidence.XXXXXXXX)" +fi +scratch="$(mktemp -d -t teaql-java-work-item-build.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +fingerprint() { + (cd "$example" && find java-lib-core java-app-console -type f ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) +} +fingerprint > "$evidence/source-before.sha256" +python3 -B - "$example" "$scratch" <<'CHECK' +from pathlib import Path +import shutil,sys +source,destination=map(Path,sys.argv[1:]) +for scope in ['java-lib-core','java-app-console']: + for path in (source/scope).rglob('*'):assert not path.is_symlink(),path + shutil.copytree(source/scope,destination/scope,ignore=shutil.ignore_patterns('target','.git')) +CHECK +mvn -o -f "$scratch/java-lib-core/lib/pom.xml" install -DskipTests > "$evidence/library-build.log" 2>&1 +for round in 1 2; do + timeout --kill-after=10s 180s mvn -o -f "$scratch/java-app-console/pom.xml" spring-boot:run \ + "-Dspring-boot.run.arguments=--spring.main.web-application-type=none --server.port=0 --spring.datasource.url=jdbc:sqlite:$evidence/work-items.sqlite" > "$evidence/run-$round.log" 2>&1 + rg -Fq 'PASS Java minimum runtime conformance: 8/8' "$evidence/run-$round.log" +done +TEAQL_JAVA_SPRING_EVIDENCE_DIR="$evidence/spring-transactions" node "$example/spring-transactions/verify-local.cjs" > "$evidence/spring-transactions.log" 2>&1 +fingerprint > "$evidence/source-after.sha256" +cmp "$evidence/source-before.sha256" "$evidence/source-after.sha256" +python3 -B - "$evidence" "$scratch" "$TEAQL_MAVEN_DEPENDENCY_CACHE" <<'CHECK' +import hashlib,json,pathlib,sqlite3,sys,xml.etree.ElementTree as ET +root,scratch,cache=map(pathlib.Path,sys.argv[1:]);spring=json.loads((root/'spring-transactions/receipt.json').read_text()) +assert spring['passed'] and spring['cleanup']['scratchRemoved'] and len(spring['rounds'])==2 +assert all(len(row['observations'])==8 for row in spring['rounds']) +for round in [1,2]: + log=(root/f'run-{round}.log').read_text();assert 'PASS Java minimum runtime conformance: 8/8' in log and 'BUILD SUCCESS' in log +pom=ET.parse(scratch/'java-lib-core/lib/pom.xml').getroot();namespace={'m':'http://maven.apache.org/POM/4.0.0'} +group,name,version=[pom.find('m:'+key,namespace).text for key in ['groupId','artifactId','version']] +jar=scratch/'java-lib-core/lib/target'/f'{name}-{version}.jar';installed=cache/group.replace('.','/')/name/version/jar.name +assert jar.is_file() and installed.is_file() and jar.read_bytes()==installed.read_bytes() +database=root/'work-items.sqlite' +with sqlite3.connect(database.resolve().as_uri()+'?mode=ro&immutable=1',uri=True) as connection: + rows=connection.execute('SELECT title,version FROM work_item_data ORDER BY id').fetchall();assert len(rows)==2 and all(row[1]==-3 for row in rows),rows + assert connection.execute('PRAGMA quick_check').fetchone()==('ok',) +receipt=dict(schema='teaql.java-work-item-business/v1',passed=True,originalBusinessAndSpringTestSourcesByteExact=True, + starts=2,sameDatabase=True,databaseNeverReset=True,springBusinessCasesPerRound=8,springRounds=2, + nativeWorkspaceEntryUsed=True,generatedScopesUnchanged=True,artifactKind='new local source build; not a historical or published artifact', + installedDomainArtifactSHA256=hashlib.sha256(jar.read_bytes()).hexdigest(),workItems=rows, + springReceiptSHA256=hashlib.sha256((root/'spring-transactions/receipt.json').read_bytes()).hexdigest(), + databaseSHA256=hashlib.sha256(database.read_bytes()).hexdigest()) +(root/'business-receipt.json').write_text(json.dumps(receipt,indent=2,sort_keys=True)+'\n') +print(json.dumps(dict(passed=True,starts=2,springCasesPerRound=8,springRounds=2))) +CHECK diff --git a/examples/verify-runtime-examples.sh b/examples/verify-runtime-examples.sh index 8775f8cc0..a88897f05 100755 --- a/examples/verify-runtime-examples.sh +++ b/examples/verify-runtime-examples.sh @@ -19,7 +19,7 @@ trap cleanup EXIT mvn -q -f "$repo_dir/pom.xml" \ -Pruntime-examples \ - -pl examples/conformance,examples/school-management/java-app-console \ + -pl examples/conformance/java-app-console,examples/school-management/java-app-console \ -am package -DskipTests run_example() { @@ -78,7 +78,7 @@ run_example() { for repetition in 1 2; do run_example \ "conformance" \ - "$repo_dir/examples/conformance/target/deploy/runtime-example-conformance-service-0.0.1-SNAPSHOT.jar" \ + "$repo_dir/examples/conformance/java-app-console/target/deploy/runtime-example-conformance-service-0.0.1-SNAPSHOT.jar" \ "PASS Java minimum runtime conformance: 8/8" "$repetition" run_example \ diff --git a/pom.xml b/pom.xml index bbc22b998..fb1cf9be4 100644 --- a/pom.xml +++ b/pom.xml @@ -84,8 +84,8 @@ examples/round-trip-reference-runtime teaql-tfp-endpoint teaql-opentelemetry - examples/conformance/lib - examples/conformance + examples/conformance/java-lib-core/lib + examples/conformance/java-app-console diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 55b45ceb7..58d27da41 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -37,11 +37,7 @@ mvn -q -pl examples/security-foundations \ -Dtest=SecurityFoundationsExampleTest,SqlRelationMaskingTest test mvn -q -pl examples/round-trip-reference-runtime \ -Dtest=RoundTripReferenceRuntimeExampleTest test -mvn -q -f examples/conformance/lib/pom.xml install -DskipTests -mvn -q -f examples/conformance/pom.xml spring-boot:run \ - -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/conformance.db" -TEAQL_JAVA_SPRING_EVIDENCE_DIR="$evidence_dir/spring-transactions" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/conformance/spring-transactions/verify-local.cjs" +TEAQL_CONFORMANCE_EVIDENCE_DIR="$evidence_dir/conformance" bash examples/conformance/verify.sh mvn -q -f examples/school-management/java-lib-core/lib/pom.xml install -DskipTests mvn -q -f examples/school-management/java-app-console/pom.xml spring-boot:run \ -Dspring-boot.run.arguments="--spring.main.web-application-type=none --spring.datasource.url=jdbc:sqlite:$verification_dir/school-management.db" diff --git a/scripts/verify-jackson-runtime-dependencies.sh b/scripts/verify-jackson-runtime-dependencies.sh index 37a84a6ec..f836b9fca 100644 --- a/scripts/verify-jackson-runtime-dependencies.sh +++ b/scripts/verify-jackson-runtime-dependencies.sh @@ -6,7 +6,7 @@ cd "$repo" # Generated applications have their own dependency management. This gate # verifies published runtime modules and the parent-owned Business ID example. -tree=$(mvn -B -pl '!examples/conformance/lib,!examples/conformance' \ +tree=$(mvn -B -pl '!examples/conformance/java-lib-core/lib,!examples/conformance/java-app-console' \ dependency:tree \ -Dincludes=com.fasterxml.jackson.core:jackson-databind,com.fasterxml.jackson.core:jackson-core,com.fasterxml.jackson.core:jackson-annotations \ -DoutputType=text) From 77356ae5eed605a72ead6110f4be72f17e34a240 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:21:54 +0800 Subject: [PATCH 18/71] Record focused java examples/conformance business qualification --- examples/conformance/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/conformance/showcase.json b/examples/conformance/showcase.json index cd8f848d7..0306d1a96 100644 --- a/examples/conformance/showcase.json +++ b/examples/conformance/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/work-item-generation/receipt.json", "receiptSHA256": "99afd2b0806d9aec86d271cd5154f9447b895e9f3a5e69f2e95468bcd8a1644a" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-work-item-native-scopes/runtime/conformance/business-receipt.json", + "businessReceiptSHA256": "e34a8d4de0960105de315925e610fed0520e3de4841987bfa0091244afbf8d56", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-work-item-native-scopes/receipt.json", + "nativeReceiptSHA256": "bbb8e47e2d37b6231bcae00959fc6ef1303fcc13b0e75904e3ba81f270a400c4", + "remainingFullRuntimeInventory": true, + "sourceCommit": "af7e8b4ada69c18c07f08b1dcf5a3b120bfc6fc3" + }, "scene": "WorkItem governed lifecycle and workspace-owned Spring transaction business scenarios", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "verify.sh" From 33932f31196ff8a3d00b087598975132124c6749 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:39:19 +0800 Subject: [PATCH 19/71] Run purchase-order Fix and graph business cases inside native generated scopes --- .../fix-e-alignment/fixture-manifest.json | 7 +- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 67 + .../java-app-console/DOMAIN_API_GUIDE.md | 30 + .../fix-e-alignment/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 165 +++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../CheckerFixAdvancedUserContext.java | 0 .../teaql/checkerfixadvanced/Checkers.java | 0 .../teaql/checkerfixadvanced/Constants.java | 0 .../java/com/teaql/checkerfixadvanced/E.java | 0 .../EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 .../java/com/teaql/checkerfixadvanced/Q.java | 0 .../checkerfixadvanced/Repositories.java | 0 .../orderitem/OrderItem.java | 0 .../orderitem/OrderItemChecker.java | 0 .../orderitem/OrderItemExpression.java | 0 .../orderitem/OrderItemListExpression.java | 0 .../orderitem/OrderItemRequest.java | 0 .../purchaseorder/PurchaseOrder.java | 0 .../purchaseorder/PurchaseOrderChecker.java | 0 .../PurchaseOrderExpression.java | 0 .../PurchaseOrderListExpression.java | 0 .../purchaseorder/PurchaseOrderRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../checkerfixadvanced/tenant/Tenant.java | 0 .../tenant/TenantChecker.java | 0 .../tenant/TenantExpression.java | 0 .../tenant/TenantListExpression.java | 0 .../tenant/TenantRequest.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 .../fix-e-alignment/java-app-console/pom.xml | 12 + .../fixe}/CancelledNewGraphExampleTest.java | 0 .../fixe}/CheckerBoundaryExampleTest.java | 0 .../fixe}/ConcurrentQueryExampleTest.java | 0 .../examples/fixe}/ContextRootProbe.java | 0 .../fixe}/ContextRootSubtypeProbe.java | 0 .../fixe}/ExpressionBoundaryProbe.java | 0 .../fixe}/GeneratedFixEExampleTest.java | 0 .../io/teaql/examples/fixe}/LoadingProbe.java | 0 .../examples/fixe}/MixedGraphExampleTest.java | 0 .../fixe}/NewEntityIdExampleTest.java | 0 .../fixe}/OriginalLedgerExampleTest.java | 0 .../teaql/examples/fixe}/OwnershipProbe.java | 0 .../fixe}/PageStreamOwnershipProbe.java | 0 .../fixe}/PartialAncestorExampleTest.java | 0 .../fixe}/PartialAncestorRootExampleTest.java | 0 .../examples/fixe}/PostFixExampleTest.java | 0 .../fixe}/RequestIntentExampleTest.java | 0 .../fixe}/ReviewedPlanExampleTest.java | 0 .../com/teaql/checkerfixadvanced/App.java | 99 ++ .../checkerfixadvanced/CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 117 ++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 0 .../{generated => java-lib-core}/lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 .../CheckerFixAdvancedUserContext.java | 10 + .../teaql/checkerfixadvanced/Checkers.java | 0 .../teaql/checkerfixadvanced/Constants.java | 9 + .../java/com/teaql/checkerfixadvanced/E.java | 23 + .../EntityMetaRegistry.java | 610 ++++++++ .../GeneratedRuntimeModule.java | 38 + .../java/com/teaql/checkerfixadvanced/Q.java | 34 + .../checkerfixadvanced/Repositories.java | 0 .../orderitem/OrderItem.java | 211 +++ .../orderitem/OrderItemChecker.java | 139 ++ .../orderitem/OrderItemExpression.java | 86 ++ .../orderitem/OrderItemListExpression.java | 25 + .../orderitem/OrderItemRequest.java | 1266 ++++++++++++++++ .../purchaseorder/PurchaseOrder.java | 213 +++ .../purchaseorder/PurchaseOrderChecker.java | 129 ++ .../PurchaseOrderExpression.java | 83 ++ .../PurchaseOrderListExpression.java | 25 + .../purchaseorder/PurchaseOrderRequest.java | 1317 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../checkerfixadvanced/tenant/Tenant.java | 152 ++ .../tenant/TenantChecker.java | 59 + .../tenant/TenantExpression.java | 59 + .../tenant/TenantListExpression.java | 25 + .../tenant/TenantRequest.java | 835 +++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/fix-e-alignment/showcase.json | 57 + examples/fix-e-alignment/verify-local.cjs | 64 +- 93 files changed, 6319 insertions(+), 42 deletions(-) create mode 100644 examples/fix-e-alignment/java-app-console/.gitignore create mode 100644 examples/fix-e-alignment/java-app-console/AGENTS.md create mode 100644 examples/fix-e-alignment/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/fix-e-alignment/java-app-console/Makefile create mode 100644 examples/fix-e-alignment/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/fix-e-alignment/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/fix-e-alignment/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/fix-e-alignment/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/fix-e-alignment/java-app-console/lib/pom.xml rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/E.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java (100%) rename examples/fix-e-alignment/{generated => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) create mode 100644 examples/fix-e-alignment/java-app-console/pom.xml rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/CancelledNewGraphExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/CheckerBoundaryExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/ConcurrentQueryExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/ContextRootProbe.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/ContextRootSubtypeProbe.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/ExpressionBoundaryProbe.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/GeneratedFixEExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/LoadingProbe.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/MixedGraphExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/NewEntityIdExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/OriginalLedgerExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/OwnershipProbe.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/PageStreamOwnershipProbe.java (100%) rename examples/fix-e-alignment/{partial-ancestors => java-app-console/showcase-tests/io/teaql/examples/fixe}/PartialAncestorExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/PartialAncestorRootExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/PostFixExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/RequestIntentExampleTest.java (100%) rename examples/fix-e-alignment/{ => java-app-console/showcase-tests/io/teaql/examples/fixe}/ReviewedPlanExampleTest.java (100%) create mode 100644 examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/App.java create mode 100644 examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/CustomUserContext.java create mode 100644 examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/WorkspaceTeaQLDatabase.java create mode 100644 examples/fix-e-alignment/java-app-console/src/main/resources/application.properties create mode 100644 examples/fix-e-alignment/java-app-console/teaql-i18n.json rename examples/fix-e-alignment/{generated => java-app-console}/teaql/checker-model.json (100%) rename examples/fix-e-alignment/{generated => java-app-console}/teaql/model-provenance.json (100%) rename examples/fix-e-alignment/{generated => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/E.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java create mode 100644 examples/fix-e-alignment/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/fix-e-alignment/java-lib-core/teaql/checker-model.json create mode 100644 examples/fix-e-alignment/java-lib-core/teaql/model-provenance.json create mode 100644 examples/fix-e-alignment/showcase.json diff --git a/examples/fix-e-alignment/fixture-manifest.json b/examples/fix-e-alignment/fixture-manifest.json index 13c668d24..bb4378cf2 100644 --- a/examples/fix-e-alignment/fixture-manifest.json +++ b/examples/fix-e-alignment/fixture-manifest.json @@ -1,4 +1,5 @@ { + "applicationManifestsPreserved": false, "evaluatedScope": "java-lib-core", "evaluationErrors": 0, "evaluationWarnings": 4, @@ -34,18 +35,18 @@ "teaql/model-provenance.json": "80eb2676b8ca3b65b6eb913b1eaf159e848cd1234f5158af95ef388d89ec0d40" }, "generatedManifestSha256": "ea5da31929c18998e8eeec4b2abb3268a628f67935c38ac3dd141e05bf5f2f05", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/fix-e-alignment/model/receipt.json", + "generationReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/purchase-order-fix-generation/java/purchase-order-showcase/library/receipt.json", "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", "generatorRelease": "unreleased-source-021b1ed8", "language": "java", "modelSha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7", - "previousFixtureManifestSha256": "5809307211b49138b8795b692bc251d73912662cb8cee5f38a9785f9d7ec1992", + "previousFixtureManifestSha256": "d6b8b1f5e3c333ea1b7e8073db970e55e443907525a4010209b564fa4a2c95e7", "previousOrigin": { "commit": "da34cfe478db9ae8334ffa385b396ee786464ca0", "path": "examples/fix-e-alignment/fixture-manifest.json" }, - "producerReceiptSha256": "b674ff24ef4e83fc6ebdf7de11a7e3bbc79657e2e3e76be4f3b4a2675fa901ec", + "producerReceiptSha256": "828e7adddb320766585cb54e1cbe942076bcf546944aa7232cc5c3b7c90b98fa", "producerSource": { "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", diff --git a/examples/fix-e-alignment/java-app-console/.gitignore b/examples/fix-e-alignment/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/AGENTS.md b/examples/fix-e-alignment/java-app-console/AGENTS.md new file mode 100644 index 000000000..2a382e844 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/AGENTS.md @@ -0,0 +1,67 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| tenant | tenant | +| purchase_order | purchase_order | +| order_item | order_item | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/fix-e-alignment/java-app-console/DOMAIN_API_GUIDE.md b/examples/fix-e-alignment/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..69719f1a7 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,30 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/checker-fix-advanced.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| tenant | tenant | +| purchase_order | purchase_order | +| order_item | order_item | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/Makefile b/examples/fix-e-alignment/java-app-console/Makefile new file mode 100644 index 000000000..d70154818 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/checker-fix-advanced-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/checker-fix-advanced-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/fix-e-alignment/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..320a7e7ae --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/checker-fix-advanced.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/STANDARD_TELEMETRY.md b/examples/fix-e-alignment/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/fix-e-alignment/java-app-console/TOOL_API_GUIDE.md b/examples/fix-e-alignment/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..18d50956f --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/checker-fix-advanced.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/checker-fix-advanced.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/checker-fix-advanced.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/checker-fix-advanced.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/checker-fix-advanced.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/checker-fix-advanced.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/docs/teaql-java-crud-guide.md b/examples/fix-e-alignment/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..775a62c7b --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,165 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.checkerfixadvanced`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.CheckerFixAdvancedUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.tenants() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.tenants() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Tenant(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.tenants() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.tenants() + .selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()) + .comment("load with purchaseOrderList") + .purpose("fetch child purchaseOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.tenants() + .selectOrderItemListWith(Q.orderItems().selectSelf()) + .comment("load with orderItemList") + .purpose("fetch child orderItemList") + .executeForList(userContext); +``` + +```java +var list = Q.purchaseOrders() + .selectTenantWith(Q.tenants().selectSelf()) + .comment("load with tenant") + .purpose("fetch associated tenant") + .executeForList(userContext); +``` + + + + + +```java +var list = Q.purchaseOrders() + .selectOrderItemListWith(Q.orderItems().selectSelf()) + .comment("load with orderItemList") + .purpose("fetch child orderItemList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Tenant`: reverse relations `2`, query `Q.tenants()`, save `new Tenant().auditAs("comment").save(userContext)`, request `com.teaql.checkerfixadvanced.tenant.TenantRequest` +- `PurchaseOrder`: reverse relations `1`, query `Q.purchaseOrders()`, save `new PurchaseOrder().auditAs("comment").save(userContext)`, request `com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest` \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/pom.xml b/examples/fix-e-alignment/java-app-console/lib/pom.xml new file mode 100644 index 000000000..6dd4b0584 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + checker-fix-advanced-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/E.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/E.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/E.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/E.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java rename to examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java diff --git a/examples/fix-e-alignment/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/fix-e-alignment/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/fix-e-alignment/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/fix-e-alignment/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/fix-e-alignment/java-app-console/pom.xml b/examples/fix-e-alignment/java-app-console/pom.xml new file mode 100644 index 000000000..301f948ba --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/pom.xml @@ -0,0 +1,12 @@ +4.0.0 + io.teaqlteaql-java-parent6.3.0../../../pom.xml + io.teaql.examplesteaql-fix-e-example6.3.0 + + com.teaqlchecker-fix-advanced-core0.0.1-SNAPSHOT + io.teaqlteaql-runtime6.3.0 + io.teaqlteaql-sqlite6.3.0 + io.teaqlteaql-jackson6.3.0 + io.teaqlteaql-tfp-endpoint6.3.0 + com.fasterxml.jackson.datatypejackson-datatype-jsr310test + junitjunit4.13.2test + showcase-mainshowcase-testsorg.apache.maven.pluginsmaven-surefire-pluginfalse diff --git a/examples/fix-e-alignment/CancelledNewGraphExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/CancelledNewGraphExampleTest.java similarity index 100% rename from examples/fix-e-alignment/CancelledNewGraphExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/CancelledNewGraphExampleTest.java diff --git a/examples/fix-e-alignment/CheckerBoundaryExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/CheckerBoundaryExampleTest.java similarity index 100% rename from examples/fix-e-alignment/CheckerBoundaryExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/CheckerBoundaryExampleTest.java diff --git a/examples/fix-e-alignment/ConcurrentQueryExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ConcurrentQueryExampleTest.java similarity index 100% rename from examples/fix-e-alignment/ConcurrentQueryExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ConcurrentQueryExampleTest.java diff --git a/examples/fix-e-alignment/ContextRootProbe.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ContextRootProbe.java similarity index 100% rename from examples/fix-e-alignment/ContextRootProbe.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ContextRootProbe.java diff --git a/examples/fix-e-alignment/ContextRootSubtypeProbe.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ContextRootSubtypeProbe.java similarity index 100% rename from examples/fix-e-alignment/ContextRootSubtypeProbe.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ContextRootSubtypeProbe.java diff --git a/examples/fix-e-alignment/ExpressionBoundaryProbe.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ExpressionBoundaryProbe.java similarity index 100% rename from examples/fix-e-alignment/ExpressionBoundaryProbe.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ExpressionBoundaryProbe.java diff --git a/examples/fix-e-alignment/GeneratedFixEExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/GeneratedFixEExampleTest.java similarity index 100% rename from examples/fix-e-alignment/GeneratedFixEExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/GeneratedFixEExampleTest.java diff --git a/examples/fix-e-alignment/LoadingProbe.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/LoadingProbe.java similarity index 100% rename from examples/fix-e-alignment/LoadingProbe.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/LoadingProbe.java diff --git a/examples/fix-e-alignment/MixedGraphExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/MixedGraphExampleTest.java similarity index 100% rename from examples/fix-e-alignment/MixedGraphExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/MixedGraphExampleTest.java diff --git a/examples/fix-e-alignment/NewEntityIdExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/NewEntityIdExampleTest.java similarity index 100% rename from examples/fix-e-alignment/NewEntityIdExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/NewEntityIdExampleTest.java diff --git a/examples/fix-e-alignment/OriginalLedgerExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/OriginalLedgerExampleTest.java similarity index 100% rename from examples/fix-e-alignment/OriginalLedgerExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/OriginalLedgerExampleTest.java diff --git a/examples/fix-e-alignment/OwnershipProbe.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/OwnershipProbe.java similarity index 100% rename from examples/fix-e-alignment/OwnershipProbe.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/OwnershipProbe.java diff --git a/examples/fix-e-alignment/PageStreamOwnershipProbe.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PageStreamOwnershipProbe.java similarity index 100% rename from examples/fix-e-alignment/PageStreamOwnershipProbe.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PageStreamOwnershipProbe.java diff --git a/examples/fix-e-alignment/partial-ancestors/PartialAncestorExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PartialAncestorExampleTest.java similarity index 100% rename from examples/fix-e-alignment/partial-ancestors/PartialAncestorExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PartialAncestorExampleTest.java diff --git a/examples/fix-e-alignment/PartialAncestorRootExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PartialAncestorRootExampleTest.java similarity index 100% rename from examples/fix-e-alignment/PartialAncestorRootExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PartialAncestorRootExampleTest.java diff --git a/examples/fix-e-alignment/PostFixExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PostFixExampleTest.java similarity index 100% rename from examples/fix-e-alignment/PostFixExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/PostFixExampleTest.java diff --git a/examples/fix-e-alignment/RequestIntentExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/RequestIntentExampleTest.java similarity index 100% rename from examples/fix-e-alignment/RequestIntentExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/RequestIntentExampleTest.java diff --git a/examples/fix-e-alignment/ReviewedPlanExampleTest.java b/examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ReviewedPlanExampleTest.java similarity index 100% rename from examples/fix-e-alignment/ReviewedPlanExampleTest.java rename to examples/fix-e-alignment/java-app-console/showcase-tests/io/teaql/examples/fixe/ReviewedPlanExampleTest.java diff --git a/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/App.java b/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/App.java new file mode 100644 index 000000000..058854c25 --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/App.java @@ -0,0 +1,99 @@ + +package com.teaql.checkerfixadvanced; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/CustomUserContext.java b/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/CustomUserContext.java new file mode 100644 index 000000000..94ca9fc6d --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.checkerfixadvanced; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements CheckerFixAdvancedUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/WorkspaceTeaQLDatabase.java b/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..eca0860dd --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/src/main/java/com/teaql/checkerfixadvanced/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.checkerfixadvanced; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/src/main/resources/application.properties b/examples/fix-e-alignment/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..6dfdc1d9f --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:checkerfixadvanced.db diff --git a/examples/fix-e-alignment/java-app-console/teaql-i18n.json b/examples/fix-e-alignment/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..9964fc5dc --- /dev/null +++ b/examples/fix-e-alignment/java-app-console/teaql-i18n.json @@ -0,0 +1,117 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.orderItem.id": "Id", + "property.orderItem.createTime": "Create Time", + "property.purchaseOrder.id": "Id", + "property.orderItem.purchaseOrder": "Purchase Order", + "entity.orderItem": "Order Item", + "property.purchaseOrder.tenant": "Tenant", + "property.purchaseOrder.updateTime": "Update Time", + "property.orderItem.unitPrice": "Unit Price", + "property.purchaseOrder.internalNote": "Internal Note", + "property.tenant.id": "Id", + "property.orderItem.productName": "Product Name", + "entity.purchaseOrder": "Purchase Order", + "property.orderItem.tenant": "Tenant", + "property.orderItem.version": "Version", + "property.orderItem.updateTime": "Update Time", + "property.purchaseOrder.contactPhone": "Contact Phone", + "property.purchaseOrder.version": "Version", + "property.purchaseOrder.createTime": "Create Time", + "property.tenant.name": "Name", + "property.tenant.version": "Version", + "entity.tenant": "Tenant" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/generated/teaql/checker-model.json b/examples/fix-e-alignment/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/fix-e-alignment/generated/teaql/checker-model.json rename to examples/fix-e-alignment/java-app-console/teaql/checker-model.json diff --git a/examples/fix-e-alignment/generated/teaql/model-provenance.json b/examples/fix-e-alignment/java-app-console/teaql/model-provenance.json similarity index 100% rename from examples/fix-e-alignment/generated/teaql/model-provenance.json rename to examples/fix-e-alignment/java-app-console/teaql/model-provenance.json diff --git a/examples/fix-e-alignment/generated/lib/pom.xml b/examples/fix-e-alignment/java-lib-core/lib/pom.xml similarity index 100% rename from examples/fix-e-alignment/generated/lib/pom.xml rename to examples/fix-e-alignment/java-lib-core/lib/pom.xml diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java new file mode 100644 index 000000000..43c910926 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.checkerfixadvanced; + +import io.teaql.core.UserContext; +public interface CheckerFixAdvancedUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java new file mode 100644 index 000000000..6862c47e3 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.checkerfixadvanced; + +import com.teaql.checkerfixadvanced.tenant.Tenant; + +public interface Constants { + public static final long TENANT_ID = 1l; + public static final Tenant TENANT = Tenant.refer(TENANT_ID); +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/E.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/E.java new file mode 100644 index 000000000..307aeb458 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/E.java @@ -0,0 +1,23 @@ + +package com.teaql.checkerfixadvanced; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemExpression; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderExpression; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static TenantExpression tenant(Tenant tenant){ + return new TenantExpression(new ValueExpression(tenant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.tenant()")); + } + public static PurchaseOrderExpression purchaseOrder(PurchaseOrder purchaseOrder){ + return new PurchaseOrderExpression(new ValueExpression(purchaseOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.purchaseOrder()")); + } + public static OrderItemExpression orderItem(OrderItem orderItem){ + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java new file mode 100644 index 000000000..b173f7b31 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java @@ -0,0 +1,610 @@ + +package com.teaql.checkerfixadvanced; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerTenant(); + registerPurchaseOrder(); + registerOrderItem(); + } + private void registerTenant() { + FieldLayout.installGenerated(com.teaql.checkerfixadvanced.tenant.Tenant.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.tenant.Tenant.class); + entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.tenant.Tenant::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "80") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Tenant Name") + + .with("sqlType", "VARCHAR()") + + .with("min", "1") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerPurchaseOrder() { + FieldLayout.installGenerated(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor tenant = + entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE, com.teaql.checkerfixadvanced.tenant.Tenant.PURCHASE_ORDER_LIST_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.class) + ; + PropertyDescriptor contactPhone = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY, String.class) + ; + PropertyDescriptor internalNote = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("contextRoot", "true") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("isPassword", "false") + + .with("max", "32") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("min", "1") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderItem() { + FieldLayout.installGenerated(com.teaql.checkerfixadvanced.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.checkerfixadvanced.orderitem.OrderItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.orderitem.OrderItem.class); + entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.orderitem.OrderItem::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor purchaseOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_TYPE, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class) + ; + PropertyDescriptor tenant = + entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE, com.teaql.checkerfixadvanced.tenant.Tenant.ORDER_ITEM_LIST_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.class) + ; + PropertyDescriptor productName = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY, String.class) + ; + PropertyDescriptor unitPrice = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("contextRoot", "true") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + + .with("max", "80") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("min", "1") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") + + .with("max", "1000000") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("min", "0.01") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java new file mode 100644 index 000000000..5a86c62ad --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.checkerfixadvanced; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.checkerfixadvanced.tenant.TenantChecker(), new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker(), new com.teaql.checkerfixadvanced.orderitem.OrderItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:cbc03c71084d5ff17fe312ca583e790e692d2ecb065fe3a55ec2398eb9189248\",\"entities\":{\"OrderItem\":{\"labels\":{\"en\":\"order item\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"purchase_order\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrder\",\"purchaseOrder\"]},{\"name\":\"tenant\",\"targetType\":\"Tenant\",\"labels\":{\"en\":\"tenant\"},\"aliases\":[\"Tenant\"]},{\"name\":\"unit_price\",\"labels\":{\"en\":\"unit price\"},\"aliases\":[\"UnitPrice\",\"unitPrice\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PurchaseOrder\":{\"labels\":{\"en\":\"purchase order\"},\"fields\":[{\"name\":\"contact_phone\",\"labels\":{\"en\":\"contact phone\"},\"aliases\":[\"ContactPhone\",\"contactPhone\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"internal_note\",\"labels\":{\"en\":\"internal note\"},\"aliases\":[\"InternalNote\",\"internalNote\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"tenant\",\"targetType\":\"Tenant\",\"labels\":{\"en\":\"tenant\"},\"aliases\":[\"Tenant\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Tenant\":{\"labels\":{\"en\":\"tenant\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"purchase_order_list\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrderList\",\"purchaseOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Tenant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("PurchaseOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("tenant", "tenant"), java.util.Map.entry("contact_phone", "contactPhone"), java.util.Map.entry("internal_note", "internalNote"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("purchase_order", "purchaseOrder"), java.util.Map.entry("tenant", "tenant"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("unit_price", "unitPrice"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.tenants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.checkerfixadvanced.tenant.Tenant domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.checkerfixadvanced.tenant.Tenant(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Tenant Name"); + domainRoot.auditAs("create generated Domain Root Tenant").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Tenant", domainRoot.getId())); + } +} diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java new file mode 100644 index 000000000..cc57960a1 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.checkerfixadvanced; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.checkerfixadvanced.tenant.TenantRequest tenants(){ + return new com.teaql.checkerfixadvanced.tenant.TenantRequest(com.teaql.checkerfixadvanced.tenant.Tenant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.checkerfixadvanced.tenant.TenantRequest tenantsWithMinimalFields(){ + return new com.teaql.checkerfixadvanced.tenant.TenantRequest(com.teaql.checkerfixadvanced.tenant.Tenant.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest purchaseOrders(){ + return new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest purchaseOrdersWithMinimalFields(){ + return new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.checkerfixadvanced.orderitem.OrderItemRequest orderItems(){ + return new com.teaql.checkerfixadvanced.orderitem.OrderItemRequest(com.teaql.checkerfixadvanced.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.checkerfixadvanced.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ + return new com.teaql.checkerfixadvanced.orderitem.OrderItemRequest(com.teaql.checkerfixadvanced.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java new file mode 100644 index 000000000..894c1a9aa --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java @@ -0,0 +1,211 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7d17fd30f99ff7729c89502083418f85d482d6c6b7448972408e96e73ae79d75"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("purchase_order", 1), java.util.Map.entry("tenant", 2), java.util.Map.entry("product_name", 3), java.util.Map.entry("unit_price", 4), java.util.Map.entry("create_time", 5), java.util.Map.entry("update_time", 6), java.util.Map.entry("version", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("purchase_order", java.util.List.of("purchaseOrder", "purchase_order")), java.util.Map.entry("tenant", java.util.List.of("tenant", "tenant")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("unit_price", java.util.List.of("unitPrice", "unit_price")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PURCHASE_ORDER_PROPERTY = "purchase_order"; + public static final String TENANT_PROPERTY = "tenant"; + public static final String PRODUCT_NAME_PROPERTY = "product_name"; + public static final String UNIT_PRICE_PROPERTY = "unit_price"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private PurchaseOrder purchaseOrder; + + private Tenant tenant; + + private String productName; + + private BigDecimal unitPrice; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public PurchaseOrder getPurchaseOrder(){ + return this.purchaseOrder; + } + + public Tenant getTenant(){ + return this.tenant; + } + + public String getProductName(){ + return this.productName; + } + + public BigDecimal getUnitPrice(){ + return this.unitPrice; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public OrderItem updatePurchaseOrder(PurchaseOrder purchaseOrder){ + if(isPropertyLoaded(PURCHASE_ORDER_PROPERTY) && Objects.equals(this.purchaseOrder, purchaseOrder)){ + return this; + } + handleUpdate(PURCHASE_ORDER_PROPERTY, getPurchaseOrder(), purchaseOrder); + this.purchaseOrder = purchaseOrder; + return this; + } + + OrderItem updateTenant(Tenant tenant){ + if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ + return this; + } + handleUpdate(TENANT_PROPERTY, getTenant(), tenant); + this.tenant = tenant; + return this; + } + + public OrderItem updateProductName(String productName){ + productName = (productName == null ? null : productName.trim()); + if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ + return this; + } + handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); + this.productName = productName; + return this; + } + + public OrderItem updateUnitPrice(BigDecimal unitPrice){ + if(isPropertyLoaded(UNIT_PRICE_PROPERTY) && Objects.equals(this.unitPrice, unitPrice)){ + return this; + } + handleUpdate(UNIT_PRICE_PROPERTY, getUnitPrice(), unitPrice); + this.unitPrice = unitPrice; + return this; + } + + public OrderItem updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public OrderItem updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static OrderItem refer(Long id){ + OrderItem refer = new OrderItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "purchase_order": this.purchaseOrder = (PurchaseOrder) value; break; + + case "tenant": this.tenant = (Tenant) value; break; + + case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; + + case "unit_price": this.unitPrice = (BigDecimal) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "purchase_order": return this.purchaseOrder; + case "tenant": return this.tenant; + case "product_name": return this.productName; + case "unit_price": return this.unitPrice; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "purchaseOrder": return this.purchaseOrder; + case "tenant": return this.tenant; + case "productName": return this.productName; + case "unitPrice": return this.unitPrice; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java new file mode 100644 index 000000000..03b568650 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java @@ -0,0 +1,139 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +public class OrderItemChecker implements Checker{ + + public String type(){ + return OrderItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if(needCheck(_context, orderItem)){ + markAsChecked(_context, orderItem); + doCheck(_context, orderItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if((orderItem == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + verifyContextRoot(_context, orderItem, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); + + } + if(orderItem.newItem()){ + if(orderItem.getTenant() == null){ + orderItem.updateTenant(Tenant.refer(_context.requireActiveRoot("Tenant").id())); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "tenant", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "activeRoot:Tenant")); + }else{ + _context.verifyActiveRoot("Tenant", orderItem.getTenant().getId()); + } + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + orderItem.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderItem.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(orderItem.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + orderItem.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!orderItem.isPropertyLoaded("purchase_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "purchase_order"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("tenant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("product_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("unit_price")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "unit_price"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkPurchaseOrder(_context, orderItem.getProperty(OrderItem.PURCHASE_ORDER_PROPERTY), newLocation(_parentLocation, "purchase_order")); + checkTenant(_context, orderItem.getProperty(OrderItem.TENANT_PROPERTY), newLocation(_parentLocation, "tenant")); + checkProductName(_context, orderItem.getProperty(OrderItem.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); + checkUnitPrice(_context, orderItem.getProperty(OrderItem.UNIT_PRICE_PROPERTY), newLocation(_parentLocation, "unit_price")); + checkCreateTime(_context, orderItem.getProperty(OrderItem.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, orderItem.getProperty(OrderItem.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkPurchaseOrder(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, purchaseOrder); + if((purchaseOrder == null)){ + return; + } + new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, _parentLocation); + } + public void checkTenant(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, tenant); + if((tenant == null)){ + return; + } + new TenantChecker().checkAndFix(_context, tenant, _parentLocation); + } + public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, productName); + if((productName == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, productName); + maxStringCheck(_context, _parentLocation, 80, productName); + + } + public void checkUnitPrice(UserContext _context, BigDecimal unitPrice, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, unitPrice); + if((unitPrice == null)){ + return; + } + minNumberCheck(_context, _parentLocation, 0.01, unitPrice); + maxNumberCheck(_context, _parentLocation, 1000000, unitPrice); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java new file mode 100644 index 000000000..282d0ad15 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java @@ -0,0 +1,86 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderExpression; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderItemExpression(Expression expression){ + super(expression); + } + + public OrderItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderItemExpression updateId(Long id){ + return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); + } + + public OrderItemExpression save(UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderItemExpression save(String intent, UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PurchaseOrderExpression getPurchaseOrder(){ + return new PurchaseOrderExpression(loaded("purchase_order", "getPurchaseOrder", OrderItem::getPurchaseOrder)); + } + + public OrderItemExpression updatePurchaseOrder(PurchaseOrder purchaseOrder){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updatePurchaseOrder(purchaseOrder)); + } + + public TenantExpression getTenant(){ + return new TenantExpression(loaded("tenant", "getTenant", OrderItem::getTenant)); + } + + public OrderItemExpression updateTenant(Tenant tenant){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateTenant(tenant)); + } + + public Expression getProductName(){ + return loaded("product_name", "getProductName", OrderItem::getProductName); + } + public OrderItemExpression updateProductName(String productName){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateProductName(productName)); + } + + public Expression getUnitPrice(){ + return loaded("unit_price", "getUnitPrice", OrderItem::getUnitPrice); + } + public OrderItemExpression updateUnitPrice(BigDecimal unitPrice){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUnitPrice(unitPrice)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", OrderItem::getCreateTime); + } + public OrderItemExpression updateCreateTime(LocalDateTime createTime){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", OrderItem::getUpdateTime); + } + public OrderItemExpression updateUpdateTime(LocalDateTime updateTime){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java new file mode 100644 index 000000000..d1274ee3d --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderItemListExpression extends SmartListExpression { + public OrderItemListExpression(Expression> expression){ + super(expression); + } + + public OrderItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderItemExpression first() { + return new OrderItemExpression(super.first()); + } + + public OrderItemExpression get(int index) { + return new OrderItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java new file mode 100644 index 000000000..16b7677f5 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java @@ -0,0 +1,1266 @@ + +package com.teaql.checkerfixadvanced.orderitem; + +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class OrderItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderItemRequest(Class returnType){ + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ + super.internalMatchAny(orderItem); + return this; + } + + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + + public OrderItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPurchaseOrderIdOnly().selectTenantIdOnly().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public OrderItemRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + selectProperty(OrderItem.TENANT_PROPERTY); + selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + selectProperty(OrderItem.UNIT_PRICE_PROPERTY); + selectProperty(OrderItem.CREATE_TIME_PROPERTY); + selectProperty(OrderItem.UPDATE_TIME_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest selectAll(){ + super.selectAll(); + return selectId().selectPurchaseOrder().selectTenant().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public OrderItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectPurchaseOrder().selectTenant().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public OrderItemRequest selectId(){ + selectProperty(OrderItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectId(){ + unselectProperty(OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest selectPurchaseOrderIdOnly(){ + selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest selectPurchaseOrder(){ + return selectPurchaseOrderWith(Q.purchaseOrders().unlimited().selectSelf()); + } + + public OrderItemRequest selectPurchaseOrderWith(PurchaseOrderRequest purchaseOrder){ + selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + enhanceRelation(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderWith", null, OrderItem.PURCHASE_ORDER_PROPERTY)); + return this; + } + + public OrderItemRequest unselectPurchaseOrder(){ + unselectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + public OrderItemRequest selectTenantIdOnly(){ + selectProperty(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest selectTenant(){ + return selectTenantWith(Q.tenants().unlimited().selectSelf()); + } + + public OrderItemRequest selectTenantWith(TenantRequest tenant){ + selectProperty(OrderItem.TENANT_PROPERTY); + enhanceRelation(OrderItem.TENANT_PROPERTY, tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTenantWith", null, OrderItem.TENANT_PROPERTY)); + return this; + } + + public OrderItemRequest unselectTenant(){ + unselectProperty(OrderItem.TENANT_PROPERTY); + return this; + } + public OrderItemRequest selectProductName(){ + selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + /** + * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectProductName(){ + unselectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest selectUnitPrice(){ + selectProperty(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + /** + * fill the unitPrice with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS unitPrice) to fetch unitPrice property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the unitPrice with customized aggrFunction, TEAQL uses ({aggrFunction}(unitPrice) AS unitPrice to fetch unitPrice property. + * @param aggrFunction aggrFunction + */ + public OrderItemRequest selectUnitPrice(AggrFunction aggrFunction){ + selectProperty(OrderItem.UNIT_PRICE_PROPERTY, aggrFunction); + return this; + } + + + public OrderItemRequest unselectUnitPrice(){ + unselectProperty(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest selectCreateTime(){ + selectProperty(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectCreateTime(){ + unselectProperty(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest selectUpdateTime(){ + selectProperty(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectUpdateTime(){ + unselectProperty(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest selectVersion(){ + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectVersion(){ + unselectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); + } + + public OrderItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderItemRequest filterByPurchaseOrder(PurchaseOrder... purchaseOrder){ + if (purchaseOrder == null || purchaseOrder.length == 0) { + throw new IllegalArgumentException("filterByPurchaseOrder parameter purchaseOrder cannot be empty"); + } + return appendSearchCriteria(createPurchaseOrderCriteria(Operator.EQUAL, (Object[])purchaseOrder)); + } + + public OrderItemRequest withPurchaseOrder(Operator operator, Object... values){ + return appendSearchCriteria(createPurchaseOrderCriteria(operator, values)); + } + + public OrderItemRequest withPurchaseOrderIsUnknown(){ + return withPurchaseOrder(Operator.IS_NULL); + } + + public OrderItemRequest withPurchaseOrderIsKnown(){ + return withPurchaseOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPurchaseOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, operator, values); + } + + public OrderItemRequest filterByPurchaseOrder(Long purchaseOrder){ + if(purchaseOrder == null){ + return this; + } + return withPurchaseOrder(Operator.EQUAL, purchaseOrder); + } + public OrderItemRequest withPurchaseOrderMatching(PurchaseOrderRequest purchaseOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, PurchaseOrder.ID_PROPERTY)); + } + + public OrderItemRequest withoutPurchaseOrderMatching(PurchaseOrderRequest purchaseOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, PurchaseOrder.ID_PROPERTY))); + } + + public OrderItemRequest filterByTenant(Tenant... tenant){ + if (tenant == null || tenant.length == 0) { + throw new IllegalArgumentException("filterByTenant parameter tenant cannot be empty"); + } + return appendSearchCriteria(createTenantCriteria(Operator.EQUAL, (Object[])tenant)); + } + + public OrderItemRequest withTenant(Operator operator, Object... values){ + return appendSearchCriteria(createTenantCriteria(operator, values)); + } + + public OrderItemRequest withTenantIsUnknown(){ + return withTenant(Operator.IS_NULL); + } + + public OrderItemRequest withTenantIsKnown(){ + return withTenant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTenantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.TENANT_PROPERTY, operator, values); + } + + public OrderItemRequest filterByTenant(Long tenant){ + if(tenant == null){ + return this; + } + return withTenant(Operator.EQUAL, tenant); + } + public OrderItemRequest withTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY)); + } + + public OrderItemRequest withoutTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY))); + } + + public OrderItemRequest filterByProductName(String... productName){ + if (productName == null || productName.length == 0) { + throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); + } + return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); + } + + public OrderItemRequest withProductName(Operator operator, Object... values){ + return appendSearchCriteria(createProductNameCriteria(operator, values)); + } + + public OrderItemRequest withProductNameIsUnknown(){ + return withProductName(Operator.IS_NULL); + } + + public OrderItemRequest withProductNameIsKnown(){ + return withProductName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.PRODUCT_NAME_PROPERTY, operator, values); + } + + public OrderItemRequest withProductNameIsNot(String productName){ + return withProductName(Operator.NOT_EQUAL, productName); + } + + public OrderItemRequest withProductNameIn(String... productName){ + return withProductName(Operator.IN, (Object[])productName); + } + + public OrderItemRequest withProductNameNotIn(String... productName){ + return withProductName(Operator.NOT_IN, (Object[])productName); + } + public OrderItemRequest withProductNameGreaterThan(String productName){ + return withProductName(Operator.GREATER_THAN, productName); + } + + public OrderItemRequest withProductNameGreaterThanOrEqualTo(String productName){ + return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); + } + + public OrderItemRequest withProductNameLessThan(String productName){ + return withProductName(Operator.LESS_THAN, productName); + } + + public OrderItemRequest withProductNameLessThanOrEqualTo(String productName){ + return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); + } + + public OrderItemRequest withProductNameBetween(String startOfProductName, String endOfProductName){ + return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); + } + public OrderItemRequest withProductNameStartingWith(String productName){ + return withProductName(Operator.BEGIN_WITH, productName); + } + public OrderItemRequest withProductNameContaining(String productName){ + return withProductName(Operator.CONTAIN, productName); + } + + public OrderItemRequest withProductNameNotContaining(String productName){ + return withProductName(Operator.NOT_CONTAIN, productName); + } + + public OrderItemRequest withProductNameNotStartingWith(String productName){ + return withProductName(Operator.NOT_BEGIN_WITH, productName); + } + + public OrderItemRequest withProductNameEndingWith(String productName){ + return withProductName(Operator.END_WITH, productName); + } + + public OrderItemRequest withProductNameNotEndingWith(String productName){ + return withProductName(Operator.NOT_END_WITH, productName); + } + + public OrderItemRequest withProductNameIs(String productName){ + return withProductName(Operator.EQUAL, productName); + } + + public OrderItemRequest withProductNameSoundingLike(String productName){ + return withProductName(Operator.SOUNDS_LIKE, productName); + } + + + + public OrderItemRequest filterByUnitPrice(BigDecimal... unitPrice){ + if (unitPrice == null || unitPrice.length == 0) { + throw new IllegalArgumentException("filterByUnitPrice parameter unitPrice cannot be empty"); + } + return appendSearchCriteria(createUnitPriceCriteria(Operator.EQUAL, (Object[])unitPrice)); + } + + public OrderItemRequest withUnitPrice(Operator operator, Object... values){ + return appendSearchCriteria(createUnitPriceCriteria(operator, values)); + } + + public OrderItemRequest withUnitPriceIsUnknown(){ + return withUnitPrice(Operator.IS_NULL); + } + + public OrderItemRequest withUnitPriceIsKnown(){ + return withUnitPrice(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUnitPriceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.UNIT_PRICE_PROPERTY, operator, values); + } + + public OrderItemRequest withUnitPriceIs(BigDecimal unitPrice){ + return withUnitPrice(Operator.EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceIsNot(BigDecimal unitPrice){ + return withUnitPrice(Operator.NOT_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceIn(BigDecimal... unitPrice){ + return withUnitPrice(Operator.IN, (Object[])unitPrice); + } + + public OrderItemRequest withUnitPriceNotIn(BigDecimal... unitPrice){ + return withUnitPrice(Operator.NOT_IN, (Object[])unitPrice); + } + public OrderItemRequest withUnitPriceGreaterThan(BigDecimal unitPrice){ + return withUnitPrice(Operator.GREATER_THAN, unitPrice); + } + + public OrderItemRequest withUnitPriceGreaterThanOrEqualTo(BigDecimal unitPrice){ + return withUnitPrice(Operator.GREATER_THAN_OR_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceLessThan(BigDecimal unitPrice){ + return withUnitPrice(Operator.LESS_THAN, unitPrice); + } + + public OrderItemRequest withUnitPriceLessThanOrEqualTo(BigDecimal unitPrice){ + return withUnitPrice(Operator.LESS_THAN_OR_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceBetween(BigDecimal startOfUnitPrice, BigDecimal endOfUnitPrice){ + return withUnitPrice(Operator.BETWEEN, startOfUnitPrice, endOfUnitPrice); + } + + + + public OrderItemRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public OrderItemRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public OrderItemRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public OrderItemRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.CREATE_TIME_PROPERTY, operator, values); + } + + public OrderItemRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public OrderItemRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public OrderItemRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderItemRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderItemRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public OrderItemRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public OrderItemRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderItemRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public OrderItemRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderItemRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public OrderItemRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public OrderItemRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public OrderItemRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public OrderItemRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public OrderItemRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.UPDATE_TIME_PROPERTY, operator, values); + } + + public OrderItemRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public OrderItemRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public OrderItemRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public OrderItemRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public OrderItemRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public OrderItemRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public OrderItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); + } + + public OrderItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderItemRequest minUnitPrice(){ + return minUnitPriceAs(prefix("minOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest minUnitPriceAs(String retName){ + super.min(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest maxUnitPrice(){ + return maxUnitPriceAs(prefix("maxOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest maxUnitPriceAs(String retName){ + super.max(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest sumUnitPrice(){ + return sumUnitPriceAs(prefix("sumOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest sumUnitPriceAs(String retName){ + super.sum(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest avgUnitPrice(){ + return avgUnitPriceAs(prefix("avgOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest avgUnitPriceAs(String retName){ + super.avg(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest standardDeviationUnitPrice(){ + return standardDeviationUnitPriceAs(prefix("standardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest standardDeviationUnitPriceAs(String retName){ + super.standardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPrice(){ + return squareRootOfPopulationStandardDeviationUnitPriceAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPriceAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest sampleVarianceUnitPrice(){ + return sampleVarianceUnitPriceAs(prefix("sampleVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest sampleVarianceUnitPriceAs(String retName){ + super.sampleVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest samplePopulationVarianceUnitPrice(){ + return samplePopulationVarianceUnitPriceAs(prefix("samplePopulationVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest samplePopulationVarianceUnitPriceAs(String retName){ + super.samplePopulationVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest groupByPurchaseOrderWithDetails(){ + return groupByPurchaseOrderWithDetails(Q.purchaseOrders().unlimited()); + } + + public OrderItemRequest groupByPurchaseOrderWithDetails(PurchaseOrderRequest subRequest){ + aggregate(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest); + return this; + } + + public OrderItemRequest groupByTenantWithDetails(){ + return groupByTenantWithDetails(Q.tenants().unlimited()); + } + + public OrderItemRequest groupByTenantWithDetails(TenantRequest subRequest){ + aggregate(OrderItem.TENANT_PROPERTY, subRequest); + return this; + } + + + + + + + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctPurchaseOrder(){ + return countDistinctPurchaseOrderAs("purchase_order_distinct_count"); + } + + public OrderItemRequest countDistinctPurchaseOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctTenant(){ + return countDistinctTenantAs("tenant_distinct_count"); + } + + public OrderItemRequest countDistinctTenantAs(String alias){ + super.countDistinctProperty(alias, OrderItem.TENANT_PROPERTY); + return this; + } + public OrderItemRequest countDistinctProductName(){ + return countDistinctProductNameAs("product_name_distinct_count"); + } + + public OrderItemRequest countDistinctProductNameAs(String alias){ + super.countDistinctProperty(alias, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctUnitPrice(){ + return countDistinctUnitPriceAs("unit_price_distinct_count"); + } + + public OrderItemRequest countDistinctUnitPriceAs(String alias){ + super.countDistinctProperty(alias, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public OrderItemRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderItem.CREATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public OrderItemRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupById(){ + groupBy(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdAs(String retName){ + groupBy(retName, OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.ID_PROPERTY, function); + return this; + } + public OrderItemRequest groupByPurchaseOrderWith(PurchaseOrderRequest subRequest){ + groupBy(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPurchaseOrderWith", null, "purchase_order")); + return this; + } + public OrderItemRequest groupByPurchaseOrder(){ + groupBy(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByPurchaseOrderAs(String retName){ + groupBy(retName, OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByPurchaseOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.PURCHASE_ORDER_PROPERTY, function); + return this; + } + public OrderItemRequest groupByTenantWith(TenantRequest subRequest){ + groupBy(OrderItem.TENANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTenantWith", null, "tenant")); + return this; + } + public OrderItemRequest groupByTenant(){ + groupBy(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest groupByTenantAs(String retName){ + groupBy(retName, OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest groupByTenantWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.TENANT_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByProductName(){ + groupBy(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByProductNameAs(String retName){ + groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByProductNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByUnitPrice(){ + groupBy(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest groupByUnitPriceAs(String retName){ + groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest groupByUnitPriceWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByCreateTime(){ + groupBy(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByCreateTimeAs(String retName){ + groupBy(retName, OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.CREATE_TIME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByUpdateTime(){ + groupBy(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.UPDATE_TIME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByVersion(){ + groupBy(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionAs(String retName){ + groupBy(retName, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.VERSION_PROPERTY, function); + return this; + } + + + + public OrderItemRequest orderByIdAscending(){ + addOrderByAscending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByIdDescending(){ + addOrderByDescending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByPurchaseOrderAscending(){ + addOrderByAscending(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByPurchaseOrderDescending(){ + addOrderByDescending(OrderItem.PURCHASE_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByTenantAscending(){ + addOrderByAscending(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest orderByTenantDescending(){ + addOrderByDescending(OrderItem.TENANT_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameAscending(){ + addOrderByAscending(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameDescending(){ + addOrderByDescending(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByProductNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByUnitPriceAscending(){ + addOrderByAscending(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest orderByUnitPriceDescending(){ + addOrderByDescending(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest orderByCreateTimeAscending(){ + addOrderByAscending(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByCreateTimeDescending(){ + addOrderByDescending(OrderItem.CREATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByUpdateTimeAscending(){ + addOrderByAscending(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByUpdateTimeDescending(){ + addOrderByDescending(OrderItem.UPDATE_TIME_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionAscending(){ + addOrderByAscending(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionDescending(){ + addOrderByDescending(OrderItem.VERSION_PROPERTY); + return this; + } + + + public PurchaseOrderRequest rollUpToPurchaseOrder(){ + PurchaseOrderRequest purchaseOrder = Q.purchaseOrders().unlimited(); + this.internalRollUpTo("purchase_order", purchaseOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPurchaseOrder", null, "purchase_order")); + return purchaseOrder; + } + + public TenantRequest rollUpToTenant(){ + TenantRequest tenant = Q.tenants().unlimited(); + this.internalRollUpTo("tenant", tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTenant", null, "tenant")); + return tenant; + } + + + + + + + + public OrderItemRequest facetByPurchaseOrderAs(String facetName, PurchaseOrderRequest purchaseOrder){ + return facetByPurchaseOrderAs(facetName, purchaseOrder, true); + } + + public OrderItemRequest facetByPurchaseOrderAs(String facetName, PurchaseOrderRequest purchaseOrder, boolean includeAllFacets){ + addFacet(facetName, OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPurchaseOrderAs", facetName, OrderItem.PURCHASE_ORDER_PROPERTY)); + return this; + } + public OrderItemRequest facetByTenantAs(String facetName, TenantRequest tenant){ + return facetByTenantAs(facetName, tenant, true); + } + + public OrderItemRequest facetByTenantAs(String facetName, TenantRequest tenant, boolean includeAllFacets){ + addFacet(facetName, OrderItem.TENANT_PROPERTY, tenant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTenantAs", facetName, OrderItem.TENANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java new file mode 100644 index 000000000..c6a8dee57 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java @@ -0,0 +1,213 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class PurchaseOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "PurchaseOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "fc779222657a345b62cacc08e4beb1351e6097a5fd25927366703543a4afdd39"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("tenant", 1), java.util.Map.entry("contact_phone", 2), java.util.Map.entry("internal_note", 3), java.util.Map.entry("create_time", 4), java.util.Map.entry("update_time", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("tenant", java.util.List.of("tenant", "tenant")), java.util.Map.entry("contact_phone", java.util.List.of("contactPhone", "contact_phone")), java.util.Map.entry("internal_note", java.util.List.of("internalNote", "internal_note")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + PurchaseOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String TENANT_PROPERTY = "tenant"; + public static final String CONTACT_PHONE_PROPERTY = "contact_phone"; + public static final String INTERNAL_NOTE_PROPERTY = "internal_note"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private Tenant tenant; + + private String contactPhone; + + private String internalNote; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList orderItemList; + + public Tenant getTenant(){ + return this.tenant; + } + + public String getContactPhone(){ + return this.contactPhone; + } + + public String getInternalNote(){ + return this.internalNote; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getOrderItemList(){ + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; + } + PurchaseOrder updateTenant(Tenant tenant){ + if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ + return this; + } + handleUpdate(TENANT_PROPERTY, getTenant(), tenant); + this.tenant = tenant; + return this; + } + + public PurchaseOrder updateContactPhone(String contactPhone){ + contactPhone = (contactPhone == null ? null : contactPhone.trim()); + if(isPropertyLoaded(CONTACT_PHONE_PROPERTY) && Objects.equals(this.contactPhone, contactPhone)){ + return this; + } + handleUpdate(CONTACT_PHONE_PROPERTY, getContactPhone(), contactPhone); + this.contactPhone = contactPhone; + return this; + } + + public PurchaseOrder updateInternalNote(String internalNote){ + internalNote = (internalNote == null ? null : internalNote.trim()); + if(isPropertyLoaded(INTERNAL_NOTE_PROPERTY) && Objects.equals(this.internalNote, internalNote)){ + return this; + } + handleUpdate(INTERNAL_NOTE_PROPERTY, getInternalNote(), internalNote); + this.internalNote = internalNote; + return this; + } + + public PurchaseOrder updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public PurchaseOrder updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public PurchaseOrder addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); + } + + this.orderItemList.add(orderItem); + orderItem.updatePurchaseOrder(this); + return this; + } + + public static PurchaseOrder refer(Long id){ + PurchaseOrder refer = new PurchaseOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public PurchaseOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "tenant": this.tenant = (Tenant) value; break; + + case "contact_phone": this.contactPhone = (value == null ? null : ((String)value).trim()); break; + + case "internal_note": this.internalNote = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "tenant": return this.tenant; + case "contact_phone": return this.contactPhone; + case "internal_note": return this.internalNote; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "order_item_list": return this.orderItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "tenant": return this.tenant; + case "contactPhone": return this.contactPhone; + case "internalNote": return this.internalNote; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java new file mode 100644 index 000000000..8b7a23cb1 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java @@ -0,0 +1,129 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemChecker; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class PurchaseOrderChecker implements Checker{ + + public String type(){ + return PurchaseOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, purchaseOrder)){ + markAsChecked(_context, purchaseOrder); + doCheck(_context, purchaseOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if((purchaseOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, purchaseOrder); + if(purchaseOrder.needPersist()){ + verifyContextRoot(_context, purchaseOrder, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); + + } + if(purchaseOrder.newItem()){ + if(purchaseOrder.getTenant() == null){ + purchaseOrder.updateTenant(Tenant.refer(_context.requireActiveRoot("Tenant").id())); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "tenant", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "activeRoot:Tenant")); + }else{ + _context.verifyActiveRoot("Tenant", purchaseOrder.getTenant().getId()); + } + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + purchaseOrder.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + purchaseOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(purchaseOrder.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + purchaseOrder.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!purchaseOrder.isPropertyLoaded("tenant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("contact_phone")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "contact_phone"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("internal_note")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "internal_note"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkTenant(_context, purchaseOrder.getProperty(PurchaseOrder.TENANT_PROPERTY), newLocation(_parentLocation, "tenant")); + checkContactPhone(_context, purchaseOrder.getProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY), newLocation(_parentLocation, "contact_phone")); + checkInternalNote(_context, purchaseOrder.getProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY), newLocation(_parentLocation, "internal_note")); + checkCreateTime(_context, purchaseOrder.getProperty(PurchaseOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, purchaseOrder.getProperty(PurchaseOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; purchaseOrder.getOrderItemList() != null && i < purchaseOrder.getOrderItemList().size(); i++){ + OrderItem orderItem = purchaseOrder.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkTenant(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, tenant); + if((tenant == null)){ + return; + } + new TenantChecker().checkAndFix(_context, tenant, _parentLocation); + } + public void checkContactPhone(UserContext _context, String contactPhone, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contactPhone); + if((contactPhone == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, contactPhone); + maxStringCheck(_context, _parentLocation, 32, contactPhone); + + } + public void checkInternalNote(UserContext _context, String internalNote, ObjectLocation _parentLocation){ + if((internalNote == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, internalNote); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java new file mode 100644 index 000000000..0bd20c34e --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java @@ -0,0 +1,83 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemListExpression; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class PurchaseOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PurchaseOrderExpression(Expression expression){ + super(expression); + } + + public PurchaseOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public PurchaseOrderExpression updateId(Long id){ + return new PurchaseOrderExpression(this, $it -> {((PurchaseOrder)$it).__internalSet("id", id); return this;}); + } + + public PurchaseOrderExpression save(UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PurchaseOrderExpression save(String intent, UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public TenantExpression getTenant(){ + return new TenantExpression(loaded("tenant", "getTenant", PurchaseOrder::getTenant)); + } + + public PurchaseOrderExpression updateTenant(Tenant tenant){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateTenant(tenant)); + } + + public Expression getContactPhone(){ + return loaded("contact_phone", "getContactPhone", PurchaseOrder::getContactPhone); + } + public PurchaseOrderExpression updateContactPhone(String contactPhone){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateContactPhone(contactPhone)); + } + + public Expression getInternalNote(){ + return loaded("internal_note", "getInternalNote", PurchaseOrder::getInternalNote); + } + public PurchaseOrderExpression updateInternalNote(String internalNote){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateInternalNote(internalNote)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", PurchaseOrder::getCreateTime); + } + public PurchaseOrderExpression updateCreateTime(LocalDateTime createTime){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", PurchaseOrder::getUpdateTime); + } + public PurchaseOrderExpression updateUpdateTime(LocalDateTime updateTime){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateUpdateTime(updateTime)); + } + + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", PurchaseOrder::getOrderItemList)); + } + public PurchaseOrderExpression addOrderItem(OrderItem orderItem){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java new file mode 100644 index 000000000..89d8bd843 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PurchaseOrderListExpression extends SmartListExpression { + public PurchaseOrderListExpression(Expression> expression){ + super(expression); + } + + public PurchaseOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PurchaseOrderExpression first() { + return new PurchaseOrderExpression(super.first()); + } + + public PurchaseOrderExpression get(int index) { + return new PurchaseOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java new file mode 100644 index 000000000..f3b954456 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java @@ -0,0 +1,1317 @@ + +package com.teaql.checkerfixadvanced.purchaseorder; + +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemRequest; +import com.teaql.checkerfixadvanced.tenant.Tenant; +import com.teaql.checkerfixadvanced.tenant.TenantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class PurchaseOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PurchaseOrderRequest(Class returnType){ + this(returnType, () -> (T) new PurchaseOrder()); + } + + protected PurchaseOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PurchaseOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PurchaseOrderRequest copy(){ + return (PurchaseOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PurchaseOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PurchaseOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PurchaseOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PurchaseOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PurchaseOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PurchaseOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PurchaseOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PurchaseOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public PurchaseOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder){ + super.internalMatchAny(purchaseOrder); + return this; + } + + public PurchaseOrderRequest matchingIdsOf(PurchaseOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + PurchaseOrder.ID_PROPERTY, request, PurchaseOrder.ID_PROPERTY)); + } + + public PurchaseOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PurchaseOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PurchaseOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PurchaseOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectTenantIdOnly().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PurchaseOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public PurchaseOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(PurchaseOrder.ID_PROPERTY); + selectProperty(PurchaseOrder.TENANT_PROPERTY); + selectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); + selectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + selectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); + selectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectTenant().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PurchaseOrderRequest selectChildren(){ + super.selectAny(); + selectOrderItemList(); + return selectId().selectTenant().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public PurchaseOrderRequest selectId(){ + selectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectId(){ + unselectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest selectTenantIdOnly(){ + selectProperty(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectTenant(){ + return selectTenantWith(Q.tenants().unlimited().selectSelf()); + } + + public PurchaseOrderRequest selectTenantWith(TenantRequest tenant){ + selectProperty(PurchaseOrder.TENANT_PROPERTY); + enhanceRelation(PurchaseOrder.TENANT_PROPERTY, tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTenantWith", null, PurchaseOrder.TENANT_PROPERTY)); + return this; + } + + public PurchaseOrderRequest unselectTenant(){ + unselectProperty(PurchaseOrder.TENANT_PROPERTY); + return this; + } + public PurchaseOrderRequest selectContactPhone(){ + selectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + /** + * fill the contactPhone with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contactPhone) to fetch contactPhone property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectContactPhone(){ + unselectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest selectInternalNote(){ + selectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + /** + * fill the internalNote with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS internalNote) to fetch internalNote property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectInternalNote(){ + unselectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest selectCreateTime(){ + selectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectCreateTime(){ + unselectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest selectUpdateTime(){ + selectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectUpdateTime(){ + unselectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest selectVersion(){ + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectVersion(){ + unselectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + public PurchaseOrderRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public PurchaseOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.ID_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PurchaseOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PurchaseOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PurchaseOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PurchaseOrderRequest filterByTenant(Tenant... tenant){ + if (tenant == null || tenant.length == 0) { + throw new IllegalArgumentException("filterByTenant parameter tenant cannot be empty"); + } + return appendSearchCriteria(createTenantCriteria(Operator.EQUAL, (Object[])tenant)); + } + + public PurchaseOrderRequest withTenant(Operator operator, Object... values){ + return appendSearchCriteria(createTenantCriteria(operator, values)); + } + + public PurchaseOrderRequest withTenantIsUnknown(){ + return withTenant(Operator.IS_NULL); + } + + public PurchaseOrderRequest withTenantIsKnown(){ + return withTenant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTenantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.TENANT_PROPERTY, operator, values); + } + + public PurchaseOrderRequest filterByTenant(Long tenant){ + if(tenant == null){ + return this; + } + return withTenant(Operator.EQUAL, tenant); + } + public PurchaseOrderRequest withTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY)); + } + + public PurchaseOrderRequest withoutTenantMatching(TenantRequest tenant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(PurchaseOrder.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY))); + } + + public PurchaseOrderRequest filterByContactPhone(String... contactPhone){ + if (contactPhone == null || contactPhone.length == 0) { + throw new IllegalArgumentException("filterByContactPhone parameter contactPhone cannot be empty"); + } + return appendSearchCriteria(createContactPhoneCriteria(Operator.EQUAL, (Object[])contactPhone)); + } + + public PurchaseOrderRequest withContactPhone(Operator operator, Object... values){ + return appendSearchCriteria(createContactPhoneCriteria(operator, values)); + } + + public PurchaseOrderRequest withContactPhoneIsUnknown(){ + return withContactPhone(Operator.IS_NULL); + } + + public PurchaseOrderRequest withContactPhoneIsKnown(){ + return withContactPhone(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContactPhoneCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.CONTACT_PHONE_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withContactPhoneIsNot(String contactPhone){ + return withContactPhone(Operator.NOT_EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneIn(String... contactPhone){ + return withContactPhone(Operator.IN, (Object[])contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotIn(String... contactPhone){ + return withContactPhone(Operator.NOT_IN, (Object[])contactPhone); + } + public PurchaseOrderRequest withContactPhoneGreaterThan(String contactPhone){ + return withContactPhone(Operator.GREATER_THAN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneGreaterThanOrEqualTo(String contactPhone){ + return withContactPhone(Operator.GREATER_THAN_OR_EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneLessThan(String contactPhone){ + return withContactPhone(Operator.LESS_THAN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneLessThanOrEqualTo(String contactPhone){ + return withContactPhone(Operator.LESS_THAN_OR_EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneBetween(String startOfContactPhone, String endOfContactPhone){ + return withContactPhone(Operator.BETWEEN, startOfContactPhone, endOfContactPhone); + } + public PurchaseOrderRequest withContactPhoneStartingWith(String contactPhone){ + return withContactPhone(Operator.BEGIN_WITH, contactPhone); + } + public PurchaseOrderRequest withContactPhoneContaining(String contactPhone){ + return withContactPhone(Operator.CONTAIN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotContaining(String contactPhone){ + return withContactPhone(Operator.NOT_CONTAIN, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotStartingWith(String contactPhone){ + return withContactPhone(Operator.NOT_BEGIN_WITH, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneEndingWith(String contactPhone){ + return withContactPhone(Operator.END_WITH, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneNotEndingWith(String contactPhone){ + return withContactPhone(Operator.NOT_END_WITH, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneIs(String contactPhone){ + return withContactPhone(Operator.EQUAL, contactPhone); + } + + public PurchaseOrderRequest withContactPhoneSoundingLike(String contactPhone){ + return withContactPhone(Operator.SOUNDS_LIKE, contactPhone); + } + + + + public PurchaseOrderRequest filterByInternalNote(String... internalNote){ + if (internalNote == null || internalNote.length == 0) { + throw new IllegalArgumentException("filterByInternalNote parameter internalNote cannot be empty"); + } + return appendSearchCriteria(createInternalNoteCriteria(Operator.EQUAL, (Object[])internalNote)); + } + + public PurchaseOrderRequest withInternalNote(Operator operator, Object... values){ + return appendSearchCriteria(createInternalNoteCriteria(operator, values)); + } + + public PurchaseOrderRequest withInternalNoteIsUnknown(){ + return withInternalNote(Operator.IS_NULL); + } + + public PurchaseOrderRequest withInternalNoteIsKnown(){ + return withInternalNote(Operator.IS_NOT_NULL); + } + + public SearchCriteria createInternalNoteCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.INTERNAL_NOTE_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withInternalNoteIsNot(String internalNote){ + return withInternalNote(Operator.NOT_EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteIn(String... internalNote){ + return withInternalNote(Operator.IN, (Object[])internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotIn(String... internalNote){ + return withInternalNote(Operator.NOT_IN, (Object[])internalNote); + } + public PurchaseOrderRequest withInternalNoteGreaterThan(String internalNote){ + return withInternalNote(Operator.GREATER_THAN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteGreaterThanOrEqualTo(String internalNote){ + return withInternalNote(Operator.GREATER_THAN_OR_EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteLessThan(String internalNote){ + return withInternalNote(Operator.LESS_THAN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteLessThanOrEqualTo(String internalNote){ + return withInternalNote(Operator.LESS_THAN_OR_EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteBetween(String startOfInternalNote, String endOfInternalNote){ + return withInternalNote(Operator.BETWEEN, startOfInternalNote, endOfInternalNote); + } + public PurchaseOrderRequest withInternalNoteStartingWith(String internalNote){ + return withInternalNote(Operator.BEGIN_WITH, internalNote); + } + public PurchaseOrderRequest withInternalNoteContaining(String internalNote){ + return withInternalNote(Operator.CONTAIN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotContaining(String internalNote){ + return withInternalNote(Operator.NOT_CONTAIN, internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotStartingWith(String internalNote){ + return withInternalNote(Operator.NOT_BEGIN_WITH, internalNote); + } + + public PurchaseOrderRequest withInternalNoteEndingWith(String internalNote){ + return withInternalNote(Operator.END_WITH, internalNote); + } + + public PurchaseOrderRequest withInternalNoteNotEndingWith(String internalNote){ + return withInternalNote(Operator.NOT_END_WITH, internalNote); + } + + public PurchaseOrderRequest withInternalNoteIs(String internalNote){ + return withInternalNote(Operator.EQUAL, internalNote); + } + + public PurchaseOrderRequest withInternalNoteSoundingLike(String internalNote){ + return withInternalNote(Operator.SOUNDS_LIKE, internalNote); + } + + + + public PurchaseOrderRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public PurchaseOrderRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public PurchaseOrderRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public PurchaseOrderRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.CREATE_TIME_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public PurchaseOrderRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public PurchaseOrderRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public PurchaseOrderRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public PurchaseOrderRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PurchaseOrderRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public PurchaseOrderRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public PurchaseOrderRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public PurchaseOrderRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public PurchaseOrderRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.UPDATE_TIME_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public PurchaseOrderRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public PurchaseOrderRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public PurchaseOrderRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PurchaseOrderRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public PurchaseOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PurchaseOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PurchaseOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PurchaseOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.VERSION_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PurchaseOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PurchaseOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PurchaseOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PurchaseOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PurchaseOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PurchaseOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PurchaseOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.ID_PROPERTY, orderItemRequest, OrderItem.PURCHASE_ORDER_PROPERTY)); + } + + public PurchaseOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(PurchaseOrder.ID_PROPERTY, orderItemRequest, OrderItem.PURCHASE_ORDER_PROPERTY))); + } + + public PurchaseOrderRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PurchaseOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PurchaseOrderRequest groupByTenantWithDetails(){ + return groupByTenantWithDetails(Q.tenants().unlimited()); + } + + public PurchaseOrderRequest groupByTenantWithDetails(TenantRequest subRequest){ + aggregate(PurchaseOrder.TENANT_PROPERTY, subRequest); + return this; + } + + + + + + + public PurchaseOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PurchaseOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctTenant(){ + return countDistinctTenantAs("tenant_distinct_count"); + } + + public PurchaseOrderRequest countDistinctTenantAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.TENANT_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctContactPhone(){ + return countDistinctContactPhoneAs("contact_phone_distinct_count"); + } + + public PurchaseOrderRequest countDistinctContactPhoneAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctInternalNote(){ + return countDistinctInternalNoteAs("internal_note_distinct_count"); + } + + public PurchaseOrderRequest countDistinctInternalNoteAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public PurchaseOrderRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public PurchaseOrderRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PurchaseOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.VERSION_PROPERTY); + return this; + } + public PurchaseOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public PurchaseOrderRequest groupById(){ + groupBy(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdAs(String retName){ + groupBy(retName, PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.ID_PROPERTY, function); + return this; + } + public PurchaseOrderRequest groupByTenantWith(TenantRequest subRequest){ + groupBy(PurchaseOrder.TENANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTenantWith", null, "tenant")); + return this; + } + public PurchaseOrderRequest groupByTenant(){ + groupBy(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByTenantAs(String retName){ + groupBy(retName, PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByTenantWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.TENANT_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByContactPhone(){ + groupBy(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByContactPhoneAs(String retName){ + groupBy(retName, PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByContactPhoneWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.CONTACT_PHONE_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByInternalNote(){ + groupBy(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByInternalNoteAs(String retName){ + groupBy(retName, PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByInternalNoteWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.INTERNAL_NOTE_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByCreateTime(){ + groupBy(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByCreateTimeAs(String retName){ + groupBy(retName, PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.CREATE_TIME_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByUpdateTime(){ + groupBy(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.UPDATE_TIME_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByVersion(){ + groupBy(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionAs(String retName){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY, function); + return this; + } + + + + public PurchaseOrderRequest orderByIdAscending(){ + addOrderByAscending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByIdDescending(){ + addOrderByDescending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByTenantAscending(){ + addOrderByAscending(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByTenantDescending(){ + addOrderByDescending(PurchaseOrder.TENANT_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByContactPhoneAscending(){ + addOrderByAscending(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByContactPhoneDescending(){ + addOrderByDescending(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByContactPhoneAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByContactPhoneDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.CONTACT_PHONE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByInternalNoteAscending(){ + addOrderByAscending(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByInternalNoteDescending(){ + addOrderByDescending(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByInternalNoteAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByInternalNoteDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.INTERNAL_NOTE_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByCreateTimeAscending(){ + addOrderByAscending(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByCreateTimeDescending(){ + addOrderByDescending(PurchaseOrder.CREATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByUpdateTimeAscending(){ + addOrderByAscending(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByUpdateTimeDescending(){ + addOrderByDescending(PurchaseOrder.UPDATE_TIME_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByVersionAscending(){ + addOrderByAscending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByVersionDescending(){ + addOrderByDescending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + + public PurchaseOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public PurchaseOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public TenantRequest rollUpToTenant(){ + TenantRequest tenant = Q.tenants().unlimited(); + this.internalRollUpTo("tenant", tenant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTenant", null, "tenant")); + return tenant; + } + + + + + + + public PurchaseOrderRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.PURCHASE_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.PURCHASE_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest minUnitPriceOfOrderItems(){ + addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest minUnitPriceOfOrderItemsAs(String name){ + return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest maxUnitPriceOfOrderItems(){ + addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest maxUnitPriceOfOrderItemsAs(String name){ + return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest sumUnitPriceOfOrderItems(){ + addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest sumUnitPriceOfOrderItemsAs(String name){ + return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest avgUnitPriceOfOrderItems(){ + addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest avgUnitPriceOfOrderItemsAs(String name){ + return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ + return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ + return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ + return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public PurchaseOrderRequest facetByTenantAs(String facetName, TenantRequest tenant){ + return facetByTenantAs(facetName, tenant, true); + } + + public PurchaseOrderRequest facetByTenantAs(String facetName, TenantRequest tenant, boolean includeAllFacets){ + addFacet(facetName, PurchaseOrder.TENANT_PROPERTY, tenant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTenantAs", facetName, PurchaseOrder.TENANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public PurchaseOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PurchaseOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PurchaseOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PurchaseOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PurchaseOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PurchaseOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java new file mode 100644 index 000000000..34e03207b --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java @@ -0,0 +1,152 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Tenant extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Tenant"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "85c7e7a1c8e2088fabba9ff66843736d36af1abc05a96ca7c72123129cf55183"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "purchase_order_list", "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Tenant.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String PURCHASE_ORDER_LIST_PROPERTY = "purchase_order_list"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private String name; + + private SmartList purchaseOrderList; + private SmartList orderItemList; + + public String getName(){ + return this.name; + } + + public SmartList getPurchaseOrderList(){ + return this.purchaseOrderList == null ? SmartList.unloaded() : this.purchaseOrderList; + } + public SmartList getOrderItemList(){ + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; + } + public Tenant updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Tenant addPurchaseOrder(PurchaseOrder purchaseOrder){ + if (purchaseOrder == null){ + return this; + } + + if(null == this.purchaseOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.purchaseOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.purchaseOrderList.add(purchaseOrder); + purchaseOrder.cacheRelation(PurchaseOrder.TENANT_PROPERTY, this); + return this; + } + public Tenant addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); + } + + this.orderItemList.add(orderItem); + orderItem.cacheRelation(OrderItem.TENANT_PROPERTY, this); + return this; + } + + public static Tenant refer(Long id){ + Tenant refer = new Tenant(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Tenant comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "purchase_order_list": this.purchaseOrderList = (SmartList) value; break; + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "purchase_order_list": return this.purchaseOrderList; + case "order_item_list": return this.orderItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java new file mode 100644 index 000000000..bdbdfcfdc --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java @@ -0,0 +1,59 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemChecker; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TenantChecker implements Checker{ + + public String type(){ + return Tenant.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + if(needCheck(_context, tenant)){ + markAsChecked(_context, tenant); + doCheck(_context, tenant, _parentLocation); + } + } + + public void doCheck(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ + if((tenant == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, tenant); + if(tenant.needPersist()){ + } + if(tenant.newItem()){ + }else if(tenant.updateItem()){ + if(!tenant.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, tenant.getProperty(Tenant.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; tenant.getPurchaseOrderList() != null && i < tenant.getPurchaseOrderList().size(); i++){ + PurchaseOrder purchaseOrder = tenant.getPurchaseOrderList().get(i); + new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, newLocation(_parentLocation, "purchase_order_list", i)); + } + for(int i = 0; tenant.getOrderItemList() != null && i < tenant.getOrderItemList().size(); i++){ + OrderItem orderItem = tenant.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, name); + maxStringCheck(_context, _parentLocation, 80, name); + + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java new file mode 100644 index 000000000..1f1109d3b --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java @@ -0,0 +1,59 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemListExpression; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class TenantExpression extends ExpressionAdaptor implements BaseEntityExpression { + public TenantExpression(Expression expression){ + super(expression); + } + + public TenantExpression(Expression expression, Function function){ + super(expression, function); + } + + public TenantExpression updateId(Long id){ + return new TenantExpression(this, $it -> {((Tenant)$it).__internalSet("id", id); return this;}); + } + + public TenantExpression save(UserContext userContext){ + return new TenantExpression(this, $it -> ((Tenant)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TenantExpression save(String intent, UserContext userContext){ + return new TenantExpression(this, $it -> ((Tenant)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Tenant::getName); + } + public TenantExpression updateName(String name){ + return new TenantExpression(this, $it -> ((Tenant)$it).updateName(name)); + } + + public PurchaseOrderListExpression getPurchaseOrderList(){ + return new PurchaseOrderListExpression(loaded("purchase_order_list", "getPurchaseOrderList", Tenant::getPurchaseOrderList)); + } + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", Tenant::getOrderItemList)); + } + public TenantExpression addPurchaseOrder(PurchaseOrder purchaseOrder){ + return new TenantExpression(this, $it -> ((Tenant)$it).addPurchaseOrder(purchaseOrder)); + } + public TenantExpression addOrderItem(OrderItem orderItem){ + return new TenantExpression(this, $it -> ((Tenant)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java new file mode 100644 index 000000000..e808ab0ae --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TenantListExpression extends SmartListExpression { + public TenantListExpression(Expression> expression){ + super(expression); + } + + public TenantListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TenantExpression first() { + return new TenantExpression(super.first()); + } + + public TenantExpression get(int index) { + return new TenantExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java new file mode 100644 index 000000000..4a339d57f --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java @@ -0,0 +1,835 @@ + +package com.teaql.checkerfixadvanced.tenant; + +import com.teaql.checkerfixadvanced.Q; +import com.teaql.checkerfixadvanced.orderitem.OrderItem; +import com.teaql.checkerfixadvanced.orderitem.OrderItemRequest; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; +import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class TenantRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TenantRequest(Class returnType){ + this(returnType, () -> (T) new Tenant()); + } + + protected TenantRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TenantRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TenantRequest copy(){ + return (TenantRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TenantRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TenantRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TenantRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TenantRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TenantRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public TenantRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TenantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TenantRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TenantRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TenantRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TenantRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TenantRequest)super.appendSearchCriteria(searchCriteria); + } + + public TenantRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TenantRequest matchingAnyOf(TenantRequest tenant){ + super.internalMatchAny(tenant); + return this; + } + + public TenantRequest matchingIdsOf(TenantRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Tenant.ID_PROPERTY, request, Tenant.ID_PROPERTY)); + } + + public TenantRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TenantRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TenantRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TenantRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public TenantRequest selectSelfFields(){ + return selectSelf(); + } + + public TenantRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Tenant.ID_PROPERTY); + selectProperty(Tenant.NAME_PROPERTY); + selectProperty(Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public TenantRequest selectChildren(){ + super.selectAny(); + selectPurchaseOrderList().selectOrderItemList(); + return selectId().selectName().selectVersion(); + } + + + public TenantRequest selectId(){ + selectProperty(Tenant.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TenantRequest unselectId(){ + unselectProperty(Tenant.ID_PROPERTY); + return this; + } + public TenantRequest selectName(){ + selectProperty(Tenant.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TenantRequest unselectName(){ + unselectProperty(Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest selectVersion(){ + selectProperty(Tenant.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TenantRequest unselectVersion(){ + unselectProperty(Tenant.VERSION_PROPERTY); + return this; + } + public TenantRequest selectPurchaseOrderList(){ + return selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()); + } + + public TenantRequest selectPurchaseOrderListWith(PurchaseOrderRequest purchaseOrderList){ + enhanceRelation(Tenant.PURCHASE_ORDER_LIST_PROPERTY, purchaseOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderListWith", null, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + public TenantRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public TenantRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(Tenant.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Tenant.ID_PROPERTY, operator, values); + } + + public TenantRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public TenantRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public TenantRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public TenantRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public TenantRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public TenantRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public TenantRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public TenantRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Tenant.NAME_PROPERTY, operator, values); + } + + public TenantRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public TenantRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public TenantRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public TenantRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public TenantRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public TenantRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public TenantRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public TenantRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public TenantRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public TenantRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public TenantRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public TenantRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public TenantRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public TenantRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public TenantRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public TenantRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public TenantRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public TenantRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public TenantRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public TenantRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Tenant.VERSION_PROPERTY, operator, values); + } + + public TenantRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public TenantRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public TenantRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public TenantRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public TenantRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public TenantRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public TenantRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public TenantRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public TenantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public TenantRequest withPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.TENANT_PROPERTY)); + } + + public TenantRequest withoutPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.TENANT_PROPERTY))); + } + + public TenantRequest havePurchaseOrders(){ + return withPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + + public TenantRequest haveNoPurchaseOrders(){ + return withoutPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + public TenantRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, orderItemRequest, OrderItem.TENANT_PROPERTY)); + } + + public TenantRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, orderItemRequest, OrderItem.TENANT_PROPERTY))); + } + + public TenantRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public TenantRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public TenantRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TenantRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public TenantRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TenantRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Tenant.ID_PROPERTY); + return this; + } + public TenantRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TenantRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TenantRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Tenant.VERSION_PROPERTY); + return this; + } + public TenantRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ + aggregate(Tenant.PURCHASE_ORDER_LIST_PROPERTY, subRequest); + return this; + } + public TenantRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(Tenant.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public TenantRequest groupById(){ + groupBy(Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest groupByIdAs(String retName){ + groupBy(retName, Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Tenant.ID_PROPERTY, function); + return this; + } + + public TenantRequest groupByName(){ + groupBy(Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest groupByNameAs(String retName){ + groupBy(retName, Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Tenant.NAME_PROPERTY, function); + return this; + } + + public TenantRequest groupByVersion(){ + groupBy(Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest groupByVersionAs(String retName){ + groupBy(retName, Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Tenant.VERSION_PROPERTY, function); + return this; + } + + + + public TenantRequest orderByIdAscending(){ + addOrderByAscending(Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest orderByIdDescending(){ + addOrderByDescending(Tenant.ID_PROPERTY); + return this; + } + + public TenantRequest orderByNameAscending(){ + addOrderByAscending(Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest orderByNameDescending(){ + addOrderByDescending(Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Tenant.NAME_PROPERTY); + return this; + } + + public TenantRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Tenant.NAME_PROPERTY); + return this; + } + public TenantRequest orderByVersionAscending(){ + addOrderByAscending(Tenant.VERSION_PROPERTY); + return this; + } + + public TenantRequest orderByVersionDescending(){ + addOrderByDescending(Tenant.VERSION_PROPERTY); + return this; + } + + + public TenantRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(name, subRequest, false); + } + + public TenantRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, PurchaseOrder.TENANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPurchaseOrdersAs", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public TenantRequest statsFromPurchaseOrders(PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(REFINEMENTS, subRequest); + } + public TenantRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public TenantRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public TenantRequest countPurchaseOrders(){ + addRelationCount("Count", Q.purchaseOrders().unlimited(), PurchaseOrder.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrders", null, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public TenantRequest countPurchaseOrdersAs(String name){ + addRelationCount(name, Q.purchaseOrders().unlimited(), PurchaseOrder.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersAs", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public TenantRequest countPurchaseOrdersWith(String name, PurchaseOrderRequest subRequest){ + addRelationCount(name, subRequest, PurchaseOrder.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersWith", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + public TenantRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.TENANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest minUnitPriceOfOrderItems(){ + addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest minUnitPriceOfOrderItemsAs(String name){ + return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest maxUnitPriceOfOrderItems(){ + addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest maxUnitPriceOfOrderItemsAs(String name){ + return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest sumUnitPriceOfOrderItems(){ + addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest sumUnitPriceOfOrderItemsAs(String name){ + return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest avgUnitPriceOfOrderItems(){ + addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest avgUnitPriceOfOrderItemsAs(String name){ + return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest standardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ + return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest sampleVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ + return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public TenantRequest samplePopulationVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public TenantRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ + return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public TenantRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public TenantRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TenantRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TenantRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TenantRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TenantRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public TenantRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/fix-e-alignment/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..bba37cf30 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.checkerfixadvanced.EntityMetaRegistry \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/teaql/checker-model.json b/examples/fix-e-alignment/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..12eef25eb --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:cbc03c71084d5ff17fe312ca583e790e692d2ecb065fe3a55ec2398eb9189248","entities":{"OrderItem":{"labels":{"en":"order item"},"fields":[{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"product_name","labels":{"en":"product name"},"aliases":["ProductName","productName"]},{"name":"purchase_order","targetType":"PurchaseOrder","labels":{"en":"purchase order"},"aliases":["PurchaseOrder","purchaseOrder"]},{"name":"tenant","targetType":"Tenant","labels":{"en":"tenant"},"aliases":["Tenant"]},{"name":"unit_price","labels":{"en":"unit price"},"aliases":["UnitPrice","unitPrice"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"PurchaseOrder":{"labels":{"en":"purchase order"},"fields":[{"name":"contact_phone","labels":{"en":"contact phone"},"aliases":["ContactPhone","contactPhone"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"internal_note","labels":{"en":"internal note"},"aliases":["InternalNote","internalNote"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"order item"},"aliases":["OrderItemList","orderItemList"]},{"name":"tenant","targetType":"Tenant","labels":{"en":"tenant"},"aliases":["Tenant"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Tenant":{"labels":{"en":"tenant"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"order item"},"aliases":["OrderItemList","orderItemList"]},{"name":"purchase_order_list","targetType":"PurchaseOrder","labels":{"en":"purchase order"},"aliases":["PurchaseOrderList","purchaseOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-lib-core/teaql/model-provenance.json b/examples/fix-e-alignment/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..606dee431 --- /dev/null +++ b/examples/fix-e-alignment/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:96fba0f3e785fef2792149fa1b226f4ea09863f94d4aff4b31427d4875bf612c","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/fix-e-alignment/showcase.json b/examples/fix-e-alignment/showcase.json new file mode 100644 index 000000000..3b7661ac7 --- /dev/null +++ b/examples/fix-e-alignment/showcase.json @@ -0,0 +1,57 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/fix-e-alignment", + "library": { + "generatedFilesManifestSHA256": "ea5da31929c18998e8eeec4b2abb3268a628f67935c38ac3dd141e05bf5f2f05", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "a2cf4c907cb084cb0946e993eeba586c8c0701a89fdc4a849808aa743be033b7" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/purchase-order-fix-generation/receipt.json", + "receiptSHA256": "920c683d71de38e609d2be2c3d8b7f2fb6c014e3b123edd5c4ea694fc6e91a48" + }, + "scene": "Purchase-order Fix, graph edits and precise loaded-state business outcomes", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "node", + "verify-local.cjs" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "showcase-tests/io/teaql/examples/fixe/CancelledNewGraphExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/CheckerBoundaryExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/ConcurrentQueryExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/ContextRootProbe.java", + "showcase-tests/io/teaql/examples/fixe/ContextRootSubtypeProbe.java", + "showcase-tests/io/teaql/examples/fixe/ExpressionBoundaryProbe.java", + "showcase-tests/io/teaql/examples/fixe/GeneratedFixEExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/LoadingProbe.java", + "showcase-tests/io/teaql/examples/fixe/MixedGraphExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/NewEntityIdExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/OriginalLedgerExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/OwnershipProbe.java", + "showcase-tests/io/teaql/examples/fixe/PageStreamOwnershipProbe.java", + "showcase-tests/io/teaql/examples/fixe/PartialAncestorRootExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/PostFixExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/RequestIntentExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/ReviewedPlanExampleTest.java", + "showcase-tests/io/teaql/examples/fixe/PartialAncestorExampleTest.java" + ], + "generatedFilesManifestSHA256": "392d8007c9b153e118e0615ea854f9feebf073cd17ebbdd755ac925850e4d116", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/fix-e-alignment/verify-local.cjs b/examples/fix-e-alignment/verify-local.cjs index 48aaf2141..555b9b1d7 100644 --- a/examples/fix-e-alignment/verify-local.cjs +++ b/examples/fix-e-alignment/verify-local.cjs @@ -4,6 +4,7 @@ const fs = require("node:fs"), path = require("node:path"), os = require("node:os"), cp = require("node:child_process"), crypto = require("node:crypto"), assert = require("node:assert/strict"); const example = __dirname, repo = path.resolve(example, "../.."), sha = bytes => crypto.createHash("sha256").update(bytes).digest("hex"); assert(process.argv.length===2 || process.argv.length===3 && process.argv[2]==='--original-ledger'); +const workspace=path.join(example,'java-app-console'),application=path.join(workspace,'showcase-tests/io/teaql/examples/fixe'); const originalLedgerOnly=process.argv[2]==='--original-ledger'; function fingerprint() { const m = JSON.parse(fs.readFileSync(path.join(example, "fixture-manifest.json"))); @@ -14,8 +15,8 @@ function fingerprint() { const name = path.join(prefix, e.name), file = path.join(dir, e.name); assert(!e.isSymbolicLink()); if (e.isDirectory()) walk(file, name); else { assert(e.isFile()); actual.push(name); } } } - walk(path.join(example, "generated")); assert.deepEqual(actual.sort(), Object.keys(m.files).sort()); - for (const [name, expected] of Object.entries(m.files)) assert.equal(sha(fs.readFileSync(path.join(example, "generated", name))), expected, name); + walk(path.join(example, "java-lib-core")); assert.deepEqual(actual.sort(), Object.keys(m.files).sort()); + for (const [name, expected] of Object.entries(m.files)) assert.equal(sha(fs.readFileSync(path.join(example, "java-lib-core", name))), expected, name); return m; } const requested = process.env.TEAQL_FIX_E_EVIDENCE_DIR; @@ -24,55 +25,40 @@ if (requested) { assert(path.isAbsolute(requested) && !fs.existsSync(evidence)); const scratch = fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-fix-e-build-")); const report = {schema: "teaql.java-fix-e-example/v1", passed: false, rounds: [], sameDatabase: true, localRuntime: repo, databaseRetained: true, sharedMavenInstall: false}; -report.contextRootApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ContextRootProbe.java'))); -report.contextRootSubtypeApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ContextRootSubtypeProbe.java'))); -report.partialAncestorApplicationSha256 = sha(fs.readFileSync(path.join(example, 'partial-ancestors/PartialAncestorExampleTest.java'))); -report.postFixApplicationSha256 = sha(fs.readFileSync(path.join(example, 'PostFixExampleTest.java'))); -report.partialAncestorRootApplicationSha256 = sha(fs.readFileSync(path.join(example, 'PartialAncestorRootExampleTest.java'))); -report.newEntityIdApplicationSha256 = sha(fs.readFileSync(path.join(example, 'NewEntityIdExampleTest.java'))); -report.checkerBoundaryApplicationSha256 = sha(fs.readFileSync(path.join(example, 'CheckerBoundaryExampleTest.java'))); -report.reviewedPlanApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ReviewedPlanExampleTest.java'))); -report.mixedGraphApplicationSha256 = sha(fs.readFileSync(path.join(example, 'MixedGraphExampleTest.java'))); -report.concurrentQueryApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ConcurrentQueryExampleTest.java'))); -report.requestIntentApplicationSha256 = sha(fs.readFileSync(path.join(example, 'RequestIntentExampleTest.java'))); -report.cancelledNewGraphApplicationSha256 = sha(fs.readFileSync(path.join(example, 'CancelledNewGraphExampleTest.java'))); -report.originalLedgerApplicationSha256 = sha(fs.readFileSync(path.join(example, 'OriginalLedgerExampleTest.java'))); +report.contextRootApplicationSha256 = sha(fs.readFileSync(path.join(application, 'ContextRootProbe.java'))); +report.contextRootSubtypeApplicationSha256 = sha(fs.readFileSync(path.join(application, 'ContextRootSubtypeProbe.java'))); +report.partialAncestorApplicationSha256 = sha(fs.readFileSync(path.join(application, 'PartialAncestorExampleTest.java'))); +report.postFixApplicationSha256 = sha(fs.readFileSync(path.join(application, 'PostFixExampleTest.java'))); +report.partialAncestorRootApplicationSha256 = sha(fs.readFileSync(path.join(application, 'PartialAncestorRootExampleTest.java'))); +report.newEntityIdApplicationSha256 = sha(fs.readFileSync(path.join(application, 'NewEntityIdExampleTest.java'))); +report.checkerBoundaryApplicationSha256 = sha(fs.readFileSync(path.join(application, 'CheckerBoundaryExampleTest.java'))); +report.reviewedPlanApplicationSha256 = sha(fs.readFileSync(path.join(application, 'ReviewedPlanExampleTest.java'))); +report.mixedGraphApplicationSha256 = sha(fs.readFileSync(path.join(application, 'MixedGraphExampleTest.java'))); +report.concurrentQueryApplicationSha256 = sha(fs.readFileSync(path.join(application, 'ConcurrentQueryExampleTest.java'))); +report.requestIntentApplicationSha256 = sha(fs.readFileSync(path.join(application, 'RequestIntentExampleTest.java'))); +report.cancelledNewGraphApplicationSha256 = sha(fs.readFileSync(path.join(application, 'CancelledNewGraphExampleTest.java'))); +report.originalLedgerApplicationSha256 = sha(fs.readFileSync(path.join(application, 'OriginalLedgerExampleTest.java'))); report.originalLedgerRounds=[]; const {createOwnedRunner, ownedBytes} = require('./owned-command.cjs'), runner = createOwnedRunner(); async function main() { try { const disk = fs.statfsSync(scratch); assert(disk.bavail * disk.bsize > 8 * 1024 ** 3); const m = fingerprint(); report.modelSha256 = m.modelSha256; - const runtime = path.join(scratch, "source"), generated = path.join(scratch, "generated"), consumer = path.join(scratch, "consumer"), reactor = path.join(scratch, "reactor"); + const runtime = path.join(scratch, "source"), generated = path.join(scratch, "java-lib-core/lib"), consumer = path.join(scratch, "java-app-console"), reactor = path.join(scratch, "reactor"); const sourceFiles = cp.execFileSync("git", ["-C", repo, "ls-files", "-z", "--cached", "--others", "--exclude-standard"]).toString().split("\0").filter(Boolean); for (const file of new Set(sourceFiles)) { const from = path.join(repo, file); if (!fs.existsSync(from)) continue; assert(fs.lstatSync(from).isFile(), "source copy requires regular files"); fs.mkdirSync(path.dirname(path.join(runtime, file)), {recursive: true}); fs.copyFileSync(from, path.join(runtime, file)); } - fs.cpSync(path.join(example, "generated/lib"), generated, {recursive: true}); + fs.cpSync(path.join(example, "java-lib-core/lib"), generated, {recursive: true}); report.libraryMetadata = require('../../scripts/pin-local-example-pom.cjs').pin(path.join(generated, 'pom.xml'), repo, scratch); - fs.mkdirSync(path.join(consumer, "src/test/java/io/teaql/examples/fixe"), {recursive: true}); - for (const file of fs.readdirSync(example).filter(file => file.endsWith(".java"))) - fs.copyFileSync(path.join(example, file), path.join(consumer, "src/test/java/io/teaql/examples/fixe", file)); - fs.copyFileSync(path.join(example, 'partial-ancestors/PartialAncestorExampleTest.java'), - path.join(consumer, 'src/test/java/io/teaql/examples/fixe/PartialAncestorExampleTest.java')); - const version = fs.readFileSync(path.join(repo, "pom.xml"), "utf8").match(/([^<]+)<\/version>/)[1]; - const pom = `4.0.0 - io.teaqlteaql-java-parent${version}../source/pom.xml - io.teaql.examplesteaql-fix-e-example${version} - - com.teaqlchecker-fix-advanced-core0.0.1-SNAPSHOT - io.teaqlteaql-runtime${version} - io.teaqlteaql-sqlite${version} - io.teaqlteaql-jackson${version} - io.teaqlteaql-tfp-endpoint${version} - com.fasterxml.jackson.datatypejackson-datatype-jsr310test - junitjunit4.13.2test - org.apache.maven.pluginsmaven-surefire-pluginfalse`; + fs.cpSync(workspace,consumer,{recursive:true}); + const version=fs.readFileSync(path.join(repo,'pom.xml'),'utf8').match(/([^<]+)<\/version>/)[1]; + const pom=fs.readFileSync(path.join(consumer,'pom.xml'),'utf8').replace('../../../pom.xml','../source/pom.xml'); fs.writeFileSync(path.join(consumer, "pom.xml"), pom); fs.writeFileSync(path.join(evidence, "consumer-pom.xml"), pom); fs.mkdirSync(reactor); - fs.writeFileSync(path.join(reactor, "pom.xml"), '4.0.0io.teaql.testfix-e-reactor0.0.0pom../source../generated../consumer'); + fs.writeFileSync(path.join(reactor, "pom.xml"), '4.0.0io.teaql.testfix-e-reactor0.0.0pom../source../java-lib-core/lib../java-app-console'); for (const round of [1, 2]) { const command = ['mvn', '-o', '-B', '-ntp', '-f', path.join(reactor, 'pom.xml'), '-pl', ':teaql-fix-e-example', '-am', 'test', originalLedgerOnly ? '-Dtest=OriginalLedgerExampleTest' : '-Dtest=GeneratedFixEExampleTest,PartialAncestorExampleTest,PartialAncestorRootExampleTest,PostFixExampleTest,NewEntityIdExampleTest,CheckerBoundaryExampleTest,ReviewedPlanExampleTest,MixedGraphExampleTest,ConcurrentQueryExampleTest,RequestIntentExampleTest,CancelledNewGraphExampleTest,OriginalLedgerExampleTest', '-Dsurefire.failIfNoSpecifiedTests=false', '-Dteaql.version=' + version, @@ -104,7 +90,7 @@ try { } const expected = {GeneratedFixEExampleTest: 1, PartialAncestorExampleTest: 1, PartialAncestorRootExampleTest: 1, PostFixExampleTest: 3, NewEntityIdExampleTest: 1, CheckerBoundaryExampleTest: 1, ReviewedPlanExampleTest: 6, MixedGraphExampleTest: 3, ConcurrentQueryExampleTest: 1, RequestIntentExampleTest: 1, CancelledNewGraphExampleTest: 1, OriginalLedgerExampleTest: 1}; - assert.deepEqual(fs.readdirSync(path.join(consumer, 'src/test/java/io/teaql/examples/fixe')) + assert.deepEqual(fs.readdirSync(path.join(consumer, 'showcase-tests/io/teaql/examples/fixe')) .filter(name => name.endsWith('Test.java')).map(name => name.slice(0, -5)).sort(), Object.keys(expected).sort(), 'every authored example Test must be selected and verified'); const summaries = [...bytes.toString().matchAll(/^\[INFO\] Tests run: (\d+), Failures: (\d+), Errors: (\d+), Skipped: (\d+), .* -- in io\.teaql\.examples\.fixe\.([A-Za-z]+)$/gm)]; @@ -154,10 +140,10 @@ try { report.originalLedgerDatabase={file:originalFile,sha256:sha(fs.readFileSync(path.join(evidence,originalFile)))}; if(originalLedgerOnly){report.passed=true;console.log('PASS Java original ML-01..07 generated Q/E/save boundaries twice');return;} report.databaseSha256 = sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite'))); - report.expressionBoundaryApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ExpressionBoundaryProbe.java'))); + report.expressionBoundaryApplicationSha256 = sha(fs.readFileSync(path.join(application, 'ExpressionBoundaryProbe.java'))); report.expressionBoundaryDatabase = {file: 'fixture.sqlite.expression-boundaries.sqlite', sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.expression-boundaries.sqlite')))}; - report.contextRootApplicationSha256 = sha(fs.readFileSync(path.join(example, 'ContextRootProbe.java'))); + report.contextRootApplicationSha256 = sha(fs.readFileSync(path.join(application, 'ContextRootProbe.java'))); report.contextRootDatabase = {file: 'fixture.sqlite.context-root.sqlite', sha256: sha(fs.readFileSync(path.join(evidence, 'fixture.sqlite.context-root.sqlite')))}; report.contextRootSubtypeDatabase = {file: 'fixture.sqlite.root-subtype.sqlite', From 7235c28768ac914ffd6cb1140e478e3e2207d2a0 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:41:01 +0800 Subject: [PATCH 20/71] Record focused java examples/fix-e-alignment business qualification --- examples/fix-e-alignment/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/fix-e-alignment/showcase.json b/examples/fix-e-alignment/showcase.json index 3b7661ac7..a93c5bcec 100644 --- a/examples/fix-e-alignment/showcase.json +++ b/examples/fix-e-alignment/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/purchase-order-fix-generation/receipt.json", "receiptSHA256": "920c683d71de38e609d2be2c3d8b7f2fb6c014e3b123edd5c4ea694fc6e91a48" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-purchase-order-source-reactor/runtime/fix-e/receipt.json", + "businessReceiptSHA256": "03a0be9d51e7940e87299b047968f511e4e2d3e3a8d8808e7017bb345e6775ed", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-purchase-order-source-reactor/receipt.json", + "nativeReceiptSHA256": "a06d59c4edb98b649811c783b3517968e72de9077a292fa7df825729f1c0350d", + "remainingFullRuntimeInventory": true, + "sourceCommit": "33932f31196ff8a3d00b087598975132124c6749" + }, "scene": "Purchase-order Fix, graph edits and precise loaded-state business outcomes", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "node", "verify-local.cjs" From a9a15ff657ada5c3888cbc9b9241e6109a58c375 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:42:33 +0800 Subject: [PATCH 21/71] Explain the purchase-order model, native workspace and business verification entry --- examples/fix-e-alignment/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/fix-e-alignment/README.md diff --git a/examples/fix-e-alignment/README.md b/examples/fix-e-alignment/README.md new file mode 100644 index 000000000..94798b6cb --- /dev/null +++ b/examples/fix-e-alignment/README.md @@ -0,0 +1,22 @@ +# Purchase-order Fix and loaded-state showcase + +## Model and workspace + +This showcase uses `model.xml`: Tenant owns PurchaseOrder and OrderItem. +The generated domain library is read-only in `java-lib-core/`; application code is +in `java-app-console/showcase-tests/io/teaql/examples/fixe`. The workspace hosts the original scenario checks and +trusted Context/runtime setup. + +From the SDK repository root, run: + +```bash +node examples/fix-e-alignment/verify-local.cjs +``` + +The verifier checks the model and exact generated-library hashes, builds the +native workspace with the local SDK, then runs the original business cases +twice on retained stores. Assertions cover real generated Q/E and audited +saves, precise loaded state, rejected writes and transaction outcomes. It +keeps compact receipts and result data and removes owned build output. +`showcase.json` binds this model, both generation scopes and the focused result; +the final full SDK example inventory remains a separate gate. From b6d9f0944d637462713ee029295adb0c12684e26 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:53:27 +0800 Subject: [PATCH 22/71] Host the nested Catalog validation scenario in its own generated Java workspace --- .../conformance/natural-messages/AGENTS.md | 2 +- .../automatic-fixture/evaluation.json | 7 - .../automatic-fixture/generation.json | 105 -- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 66 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 +++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 ...eckerNaturalMessageServiceUserContext.java | 0 .../Checkers.java | 0 .../Constants.java | 0 .../checkernaturalmessageservice/E.java | 0 .../EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 .../checkernaturalmessageservice/Q.java | 0 .../Repositories.java | 0 .../catalog/Catalog.java | 0 .../catalog/CatalogChecker.java | 0 .../catalog/CatalogExpression.java | 0 .../catalog/CatalogListExpression.java | 0 .../catalog/CatalogRequest.java | 0 .../entry/Entry.java | 0 .../entry/EntryChecker.java | 0 .../entry/EntryExpression.java | 0 .../entry/EntryListExpression.java | 0 .../entry/EntryRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 .../natural-messages/java-app-console/pom.xml | 1 + .../GeneratedNaturalMessagesTest.java | 0 .../checkernaturalmessageservice/App.java | 99 ++ .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 112 ++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 0 .../java-lib-core/evaluation.json | 8 + .../generated-files.json | 0 .../java-lib-core/generation.json | 121 +++ .../lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 ...eckerNaturalMessageServiceUserContext.java | 10 + .../Checkers.java | 0 .../Constants.java | 9 + .../checkernaturalmessageservice/E.java | 18 + .../EntityMetaRegistry.java | 343 +++++++ .../GeneratedRuntimeModule.java | 37 + .../checkernaturalmessageservice/Q.java | 25 + .../Repositories.java | 0 .../catalog/Catalog.java | 130 +++ .../catalog/CatalogChecker.java | 52 + .../catalog/CatalogExpression.java | 51 + .../catalog/CatalogListExpression.java | 25 + .../catalog/CatalogRequest.java | 623 ++++++++++++ .../entry/Entry.java | 169 ++++ .../entry/EntryChecker.java | 103 ++ .../entry/EntryExpression.java | 68 ++ .../entry/EntryListExpression.java | 25 + .../entry/EntryRequest.java | 957 ++++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../model.xml | 0 .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + .../natural-messages/showcase.json | 40 + .../natural-messages/verify-local.cjs | 18 +- examples/conformance/showcase.json | 3 + 73 files changed, 3664 insertions(+), 123 deletions(-) delete mode 100644 examples/conformance/natural-messages/automatic-fixture/evaluation.json delete mode 100644 examples/conformance/natural-messages/automatic-fixture/generation.json create mode 100644 examples/conformance/natural-messages/java-app-console/.gitignore create mode 100644 examples/conformance/natural-messages/java-app-console/AGENTS.md create mode 100644 examples/conformance/natural-messages/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/conformance/natural-messages/java-app-console/Makefile create mode 100644 examples/conformance/natural-messages/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/conformance/natural-messages/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/conformance/natural-messages/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/conformance/natural-messages/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/conformance/natural-messages/java-app-console/lib/pom.xml rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/E.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) create mode 100644 examples/conformance/natural-messages/java-app-console/pom.xml rename examples/conformance/natural-messages/{ => java-app-console/showcase-tests/io/teaql/examples/naturalmessages}/GeneratedNaturalMessagesTest.java (100%) create mode 100644 examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/App.java create mode 100644 examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/CustomUserContext.java create mode 100644 examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/conformance/natural-messages/java-app-console/src/main/resources/application.properties create mode 100644 examples/conformance/natural-messages/java-app-console/teaql-i18n.json rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/teaql/checker-model.json (100%) rename examples/conformance/natural-messages/{automatic-fixture => java-app-console}/teaql/model-provenance.json (100%) create mode 100644 examples/conformance/natural-messages/java-lib-core/evaluation.json rename examples/conformance/natural-messages/{automatic-fixture => java-lib-core}/generated-files.json (100%) create mode 100644 examples/conformance/natural-messages/java-lib-core/generation.json rename examples/conformance/natural-messages/{automatic-fixture => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/E.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java create mode 100644 examples/conformance/natural-messages/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename examples/conformance/natural-messages/{automatic-fixture => java-lib-core}/model.xml (100%) create mode 100644 examples/conformance/natural-messages/java-lib-core/teaql/checker-model.json create mode 100644 examples/conformance/natural-messages/java-lib-core/teaql/model-provenance.json create mode 100644 examples/conformance/natural-messages/showcase.json diff --git a/examples/conformance/natural-messages/AGENTS.md b/examples/conformance/natural-messages/AGENTS.md index 809e2ad34..bb3b3e65d 100644 --- a/examples/conformance/natural-messages/AGENTS.md +++ b/examples/conformance/natural-messages/AGENTS.md @@ -8,7 +8,7 @@ cargo teaql --input examples/conformance/natural-messages/model.xml java-assist- ``` Entities: `catalog`, `entry`. Use field-specific Query Assist when needed. -`automatic-fixture/` is the current immutable generated library and passive +`java-lib-core/` is the current immutable generated library and passive metadata; `fixture/` preserves the earlier generated input. Neither is an API-discovery source. Do not install replacement Checkers or hand-built presentation metadata in the application to make this example pass. diff --git a/examples/conformance/natural-messages/automatic-fixture/evaluation.json b/examples/conformance/natural-messages/automatic-fixture/evaluation.json deleted file mode 100644 index ba40e6686..000000000 --- a/examples/conformance/natural-messages/automatic-fixture/evaluation.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "errorCount": 0, - "errors": [], - "markdownSHA256": "898f40bd7d8475763d927f70bcca1e116abd30c898414b9fec937cf79814a69c", - "schema": "teaql.evaluation-summary-from-markdown/v1", - "warningCount": 2 -} diff --git a/examples/conformance/natural-messages/automatic-fixture/generation.json b/examples/conformance/natural-messages/automatic-fixture/generation.json deleted file mode 100644 index ea8c55b1d..000000000 --- a/examples/conformance/natural-messages/automatic-fixture/generation.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "evaluatedScope": "java-lib-core", - "evaluationErrors": 0, - "evaluationWarnings": 2, - "generatedManifestSha256": "c4c234c7fe34ac2eff76027240f192dab3362af6b6657a29ed1a233e7d74fe70", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", - "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", - "generatorRelease": "unreleased-source-021b1ed8", - "implementationHandEdited": false, - "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", - "previousGeneration": { - "evaluatedScope": "java-lib-core", - "evaluationErrors": 0, - "evaluationWarnings": 2, - "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "generatorRelease": "unreleased-source-19feda8a", - "implementationHandEdited": false, - "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", - "previousGeneration": { - "evaluatedScope": "java-lib-core", - "evaluationErrors": 0, - "evaluationWarnings": 2, - "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", - "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "generatorRelease": "unreleased-source-42275522", - "implementationHandEdited": false, - "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", - "previousGeneration": { - "evaluatedScope": "java-lib-core", - "evaluationErrors": 0, - "evaluationWarnings": 2, - "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", - "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", - "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", - "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "generatorRelease": "v4.2.0", - "implementationHandEdited": false, - "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", - "previousGeneration": { - "fixtureOutputProperty": "teaql.java.natural.fixture.output", - "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", - "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", - "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", - "implementationHandEdited": false, - "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", - "publicPublication": false, - "runtimeDependency": "local repository source", - "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core", - "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" - }, - "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", - "producerSource": { - "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", - "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", - "release": "v4.2.0" - }, - "publicPublication": false, - "runtimeDependency": "local repository source", - "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core" - }, - "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "producerSource": { - "commit": "42275522b8405f65f84a7961c66b615a427391f7", - "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", - "release": "unreleased-source-42275522" - }, - "publicPublication": false, - "runtimeDependency": "local repository source", - "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core" - }, - "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "producerSource": { - "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", - "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", - "release": "unreleased-source-19feda8a" - }, - "publicPublication": false, - "runtimeDependency": "local repository source", - "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core" - }, - "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", - "producerSource": { - "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", - "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", - "release": "unreleased-source-021b1ed8" - }, - "publicPublication": false, - "runtimeDependency": "local repository source", - "schema": "teaql.generated-example-provenance/v1", - "scope": "java-lib-core" -} diff --git a/examples/conformance/natural-messages/java-app-console/.gitignore b/examples/conformance/natural-messages/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/AGENTS.md b/examples/conformance/natural-messages/java-app-console/AGENTS.md new file mode 100644 index 000000000..8fc110bb3 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| catalog | catalog | +| entry | entry | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/conformance/natural-messages/java-app-console/DOMAIN_API_GUIDE.md b/examples/conformance/natural-messages/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..155548c76 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/checker-natural-message-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| catalog | catalog | +| entry | entry | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/Makefile b/examples/conformance/natural-messages/java-app-console/Makefile new file mode 100644 index 000000000..23a481828 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/checker-natural-message-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/checker-natural-message-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/conformance/natural-messages/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..96d286022 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/checker-natural-message-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/STANDARD_TELEMETRY.md b/examples/conformance/natural-messages/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/conformance/natural-messages/java-app-console/TOOL_API_GUIDE.md b/examples/conformance/natural-messages/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..d8e02e717 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/checker-natural-message-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/checker-natural-message-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/checker-natural-message-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/checker-natural-message-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/checker-natural-message-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/checker-natural-message-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/docs/teaql-java-crud-guide.md b/examples/conformance/natural-messages/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..69948408b --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.checkernaturalmessageservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.checkernaturalmessageservice.Q; +import com.example.checkernaturalmessageservice.CheckerNaturalMessageServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.catalogs() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.catalogs() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Catalog(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.catalogs() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.catalogs() + .selectEntryListWith(Q.entries().selectSelf()) + .comment("load with entryList") + .purpose("fetch child entryList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Catalog`: reverse relations `1`, query `Q.catalogs()`, save `new Catalog().auditAs("comment").save(userContext)`, request `com.example.checkernaturalmessageservice.catalog.CatalogRequest` \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/pom.xml b/examples/conformance/natural-messages/java-app-console/lib/pom.xml new file mode 100644 index 000000000..940a05399 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + checker-natural-message-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/E.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/E.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/E.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/E.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java rename to examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/natural-messages/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/conformance/natural-messages/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/conformance/natural-messages/java-app-console/pom.xml b/examples/conformance/natural-messages/java-app-console/pom.xml new file mode 100644 index 000000000..785993c8f --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/pom.xml @@ -0,0 +1 @@ +4.0.0io.teaqlteaql-java-parent6.3.0../../../../pom.xmlio.teaql.examplesnatural-checker-consumer6.3.0com.examplechecker-natural-message-service-core0.0.1-SNAPSHOTio.teaqlteaql-runtime6.3.0io.teaqlteaql-provider-jdbc6.3.0io.teaqlteaql-sqlite6.3.0junitjunit4.13.2testshowcase-mainshowcase-testsorg.apache.maven.pluginsmaven-surefire-pluginfalse diff --git a/examples/conformance/natural-messages/GeneratedNaturalMessagesTest.java b/examples/conformance/natural-messages/java-app-console/showcase-tests/io/teaql/examples/naturalmessages/GeneratedNaturalMessagesTest.java similarity index 100% rename from examples/conformance/natural-messages/GeneratedNaturalMessagesTest.java rename to examples/conformance/natural-messages/java-app-console/showcase-tests/io/teaql/examples/naturalmessages/GeneratedNaturalMessagesTest.java diff --git a/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/App.java b/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/App.java new file mode 100644 index 000000000..3e2faa287 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/App.java @@ -0,0 +1,99 @@ + +package com.example.checkernaturalmessageservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/CustomUserContext.java b/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/CustomUserContext.java new file mode 100644 index 000000000..38ef4fe94 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.checkernaturalmessageservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements CheckerNaturalMessageServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/WorkspaceTeaQLDatabase.java b/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..892003e6b --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/src/main/java/com/example/checkernaturalmessageservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.checkernaturalmessageservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/src/main/resources/application.properties b/examples/conformance/natural-messages/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..242ba7cc1 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:checkernaturalmessageservice.db diff --git a/examples/conformance/natural-messages/java-app-console/teaql-i18n.json b/examples/conformance/natural-messages/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..791194890 --- /dev/null +++ b/examples/conformance/natural-messages/java-app-console/teaql-i18n.json @@ -0,0 +1,112 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "entity.catalog": "Catalog", + "property.entry.name": "Name", + "property.catalog.id": "Id", + "property.entry.id": "Id", + "property.entry.updateTime": "Update Time", + "property.catalog.name": "Name", + "property.catalog.version": "Version", + "property.entry.version": "Version", + "entity.entry": "Entry", + "property.entry.createTime": "Create Time", + "property.entry.catalog": "Catalog" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + "entity.catalog": "目录", + "property.entry.name": "名称", + "property.catalog.name": "名称", + "entity.entry": "明细", + "property.entry.catalog": "目录" + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/automatic-fixture/teaql/checker-model.json b/examples/conformance/natural-messages/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/teaql/checker-model.json rename to examples/conformance/natural-messages/java-app-console/teaql/checker-model.json diff --git a/examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json b/examples/conformance/natural-messages/java-app-console/teaql/model-provenance.json similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/teaql/model-provenance.json rename to examples/conformance/natural-messages/java-app-console/teaql/model-provenance.json diff --git a/examples/conformance/natural-messages/java-lib-core/evaluation.json b/examples/conformance/natural-messages/java-lib-core/evaluation.json new file mode 100644 index 000000000..23ebc11d2 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/evaluation.json @@ -0,0 +1,8 @@ +{ + "errors": [], + "normalizedFromMarkdown": true, + "schema": "teaql.markdown-model-evaluation-reference/v1", + "source": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/catalog-natural-generation/java/catalog-natural-messages/library/evaluation.md", + "sourceSHA256": "898f40bd7d8475763d927f70bcca1e116abd30c898414b9fec937cf79814a69c", + "warningsCount": 2 +} diff --git a/examples/conformance/natural-messages/automatic-fixture/generated-files.json b/examples/conformance/natural-messages/java-lib-core/generated-files.json similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/generated-files.json rename to examples/conformance/natural-messages/java-lib-core/generated-files.json diff --git a/examples/conformance/natural-messages/java-lib-core/generation.json b/examples/conformance/natural-messages/java-lib-core/generation.json new file mode 100644 index 000000000..8bc98ab6b --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/generation.json @@ -0,0 +1,121 @@ +{ + "artifactKind": "qualified generator source build; not a public release", + "generationReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/catalog-natural-generation/java/catalog-natural-messages/library/receipt.json", + "generationReceiptSha256": "6126f2e88783014ad5fa72447db9d3f77cd5048f7c4e6bf98b8922b1af8e5515", + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "implementationHandEdited": false, + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "c4c234c7fe34ac2eff76027240f192dab3362af6b6657a29ed1a233e7d74fe70", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-intent-current-source/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "generatorCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "generatorJarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "generatorRelease": "unreleased-source-021b1ed8", + "implementationHandEdited": false, + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "9941c602ae7db08a299246001c5c7b5407dc846c55540d52411e9ad815407ccc", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-unified-current-source/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "generatorCommit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "generatorJarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "generatorRelease": "unreleased-source-19feda8a", + "implementationHandEdited": false, + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "2fa81d5b7a7b8c17a041c940b33d4ccc92da99e5b9f725cf9f611abe86577e55", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-compatibility-candidate/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "generatorCommit": "42275522b8405f65f84a7961c66b615a427391f7", + "generatorJarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "generatorRelease": "unreleased-source-42275522", + "implementationHandEdited": false, + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "evaluationWarnings": 2, + "generatedManifestSha256": "8f5030802231a084fca5ecf2b546aa611fb8c181a2d2f921fe3b0825440688eb", + "generationReceipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-catalog/java/conformance/natural-messages/model/receipt.json", + "generationReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "generatorCommit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "generatorJarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "generatorRelease": "v4.2.0", + "implementationHandEdited": false, + "modelSha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6", + "previousGeneration": { + "fixtureOutputProperty": "teaql.java.natural.fixture.output", + "generationReceipt": "teaql-conformance/evidence/2026-11-12-natural-checker-java-generation-first/receipt.json", + "generationReceiptSha256": "535a7a4bd0fb153a7bb5b3032127bbf67db43789d56bdb1535bb2fb7127af05f", + "generatorCommit": "c1304f73e0ea0eb0bdbad6fd1ebdada16e3dbe12", + "implementationHandEdited": false, + "modelSha256": "6e7bc9313817b3ebe452a0080c2e073d289362f450304b709f6bc794cd8e7f68", + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core", + "upstreamTest": "com.skynet.codegenerator.JavaNaturalMessagesGenerationTest" + }, + "producerReceiptSha256": "ce5c32a67679538f22dd34bd777ee5806497dbaf3af3cd94fed49872cce23481", + "producerSource": { + "commit": "97830096360553381a3221ad5bdbe9837c68a9b4", + "jarSHA256": "a22cfb9d9442958404cfb0d8e085af2c223c618018bbeb5e42a78765c23c4dd6", + "release": "v4.2.0" + }, + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core" + }, + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "producerSource": { + "commit": "42275522b8405f65f84a7961c66b615a427391f7", + "jarSHA256": "6a9420e4ffd686e0813ca9c0d2ad20991fa2f8ff2e365d39148c85e79acad86e", + "release": "unreleased-source-42275522" + }, + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core" + }, + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "producerSource": { + "commit": "19feda8a0608d7c7e0d64c7d9ec371c9021000fd", + "jarSHA256": "dc6e26b561f618e1f9574c5c3b4c03b7a21da9ca630cc73a78ae8ccd0d89bd7e", + "release": "unreleased-source-19feda8a" + }, + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core" + }, + "producerReceiptSha256": "b91b2ddd14ad34b91598ade1d20c06e5a3b3c680e233061b2e96b6f21c1fa445", + "producerSource": { + "commit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "release": "unreleased-source-021b1ed8" + }, + "publicPublication": false, + "runtimeDependency": "local repository source", + "schema": "teaql.generated-example-provenance/v1", + "scope": "java-lib-core" + }, + "publicPublication": false, + "schema": "teaql.native-natural-message-generation/v1" +} diff --git a/examples/conformance/natural-messages/automatic-fixture/lib/pom.xml b/examples/conformance/natural-messages/java-lib-core/lib/pom.xml similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/lib/pom.xml rename to examples/conformance/natural-messages/java-lib-core/lib/pom.xml diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java new file mode 100644 index 000000000..b8ff37b1d --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.checkernaturalmessageservice; + +import io.teaql.core.UserContext; +public interface CheckerNaturalMessageServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java new file mode 100644 index 000000000..fe730fc93 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.checkernaturalmessageservice; + +import com.example.checkernaturalmessageservice.catalog.Catalog; + +public interface Constants { + public static final long CATALOG_ID = 1l; + public static final Catalog CATALOG = Catalog.refer(CATALOG_ID); +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/E.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/E.java new file mode 100644 index 000000000..167e0960a --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/E.java @@ -0,0 +1,18 @@ + +package com.example.checkernaturalmessageservice; + +import com.example.checkernaturalmessageservice.catalog.Catalog; +import com.example.checkernaturalmessageservice.catalog.CatalogExpression; +import com.example.checkernaturalmessageservice.entry.Entry; +import com.example.checkernaturalmessageservice.entry.EntryExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static CatalogExpression catalog(Catalog catalog){ + return new CatalogExpression(new ValueExpression(catalog, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.catalog()")); + } + public static EntryExpression entry(Entry entry){ + return new EntryExpression(new ValueExpression(entry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.entry()")); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java new file mode 100644 index 000000000..c10ac24e6 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java @@ -0,0 +1,343 @@ + +package com.example.checkernaturalmessageservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerCatalog(); + registerEntry(); + } + private void registerCatalog() { + FieldLayout.installGenerated(com.example.checkernaturalmessageservice.catalog.Catalog.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.checkernaturalmessageservice.catalog.Catalog.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.checkernaturalmessageservice.catalog.Catalog.class); + entityDescriptor.setEntitySupplier(com.example.checkernaturalmessageservice.catalog.Catalog::new); + entityDescriptor.with("name", "catalog") + + .with("zh_CN", "目录") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Catalog") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("zh_CN", "名称") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerEntry() { + FieldLayout.installGenerated(com.example.checkernaturalmessageservice.entry.Entry.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.checkernaturalmessageservice.entry.Entry.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.checkernaturalmessageservice.entry.Entry.class); + entityDescriptor.setEntitySupplier(com.example.checkernaturalmessageservice.entry.Entry::new); + entityDescriptor.with("name", "entry") + + .with("zh_CN", "明细") + + .with("audit_mask_fields", "name") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY, Long.class) + ; + PropertyDescriptor catalog = + entityDescriptor.addObjectProperty($factory, com.example.checkernaturalmessageservice.entry.Entry.CATALOG_PROPERTY, com.example.checkernaturalmessageservice.catalog.Catalog.INTERNAL_TYPE, com.example.checkernaturalmessageservice.catalog.Catalog.ENTRY_LIST_PROPERTY, com.example.checkernaturalmessageservice.catalog.Catalog.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CATALOG_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("zh_CN", "名称") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..7fd451161 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.example.checkernaturalmessageservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.checkernaturalmessageservice.catalog.CatalogChecker(), new com.example.checkernaturalmessageservice.entry.EntryChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:9ea98ce6f86d4528fa8abed527685e55e825dcb5a695c61871b7aeab0eba3967\",\"entities\":{\"Catalog\":{\"labels\":{\"en\":\"catalog\",\"zh-CN\":\"目录\"},\"fields\":[{\"name\":\"entry_list\",\"targetType\":\"Entry\",\"labels\":{\"en\":\"entry\",\"zh-CN\":\"明细\"},\"aliases\":[\"EntryList\",\"entryList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\",\"zh-CN\":\"名称\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Entry\":{\"labels\":{\"en\":\"entry\",\"zh-CN\":\"明细\"},\"fields\":[{\"name\":\"catalog\",\"targetType\":\"Catalog\",\"labels\":{\"en\":\"catalog\",\"zh-CN\":\"目录\"},\"aliases\":[\"Catalog\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\",\"zh-CN\":\"名称\"},\"aliases\":[\"Name\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Catalog", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Entry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("catalog", "catalog"), java.util.Map.entry("name", "name"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.catalogs().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.checkernaturalmessageservice.catalog.Catalog domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.checkernaturalmessageservice.catalog.Catalog(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Catalog"); + domainRoot.auditAs("create generated Domain Root Catalog").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Catalog", domainRoot.getId())); + } +} diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java new file mode 100644 index 000000000..1a74d86e8 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.checkernaturalmessageservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.checkernaturalmessageservice.catalog.CatalogRequest catalogs(){ + return new com.example.checkernaturalmessageservice.catalog.CatalogRequest(com.example.checkernaturalmessageservice.catalog.Catalog.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.checkernaturalmessageservice.catalog.CatalogRequest catalogsWithMinimalFields(){ + return new com.example.checkernaturalmessageservice.catalog.CatalogRequest(com.example.checkernaturalmessageservice.catalog.Catalog.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.checkernaturalmessageservice.entry.EntryRequest entries(){ + return new com.example.checkernaturalmessageservice.entry.EntryRequest(com.example.checkernaturalmessageservice.entry.Entry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.checkernaturalmessageservice.entry.EntryRequest entriesWithMinimalFields(){ + return new com.example.checkernaturalmessageservice.entry.EntryRequest(com.example.checkernaturalmessageservice.entry.Entry.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java new file mode 100644 index 000000000..a7070458c --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java @@ -0,0 +1,130 @@ + +package com.example.checkernaturalmessageservice.catalog; + +import com.example.checkernaturalmessageservice.entry.Entry; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Catalog extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Catalog"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "17d8d23d986f660e08bbf4204a52837ff356311f48de5ad8046528786b1394bb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "entry_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Catalog.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String ENTRY_LIST_PROPERTY = "entry_list"; + private String name; + + private SmartList entryList; + + public String getName(){ + return this.name; + } + + public SmartList getEntryList(){ + return this.entryList == null ? SmartList.unloaded() : this.entryList; + } + public Catalog updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Catalog addEntry(Entry entry){ + if (entry == null){ + return this; + } + + if(null == this.entryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.entryList = teaqlUnloadedItems.map(value -> value); + } + + this.entryList.add(entry); + entry.updateCatalog(this); + return this; + } + + public static Catalog refer(Long id){ + Catalog refer = new Catalog(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Catalog comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "entry_list": this.entryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "entry_list": return this.entryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java new file mode 100644 index 000000000..760afc099 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java @@ -0,0 +1,52 @@ + +package com.example.checkernaturalmessageservice.catalog; + +import com.example.checkernaturalmessageservice.entry.Entry; +import com.example.checkernaturalmessageservice.entry.EntryChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CatalogChecker implements Checker{ + + public String type(){ + return Catalog.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + if(needCheck(_context, catalog)){ + markAsChecked(_context, catalog); + doCheck(_context, catalog, _parentLocation); + } + } + + public void doCheck(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + if((catalog == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, catalog); + if(catalog.needPersist()){ + } + if(catalog.newItem()){ + }else if(catalog.updateItem()){ + if(!catalog.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, catalog.getProperty(Catalog.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; catalog.getEntryList() != null && i < catalog.getEntryList().size(); i++){ + Entry entry = catalog.getEntryList().get(i); + new EntryChecker().checkAndFix(_context, entry, newLocation(_parentLocation, "entry_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java new file mode 100644 index 000000000..502db83b9 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java @@ -0,0 +1,51 @@ + +package com.example.checkernaturalmessageservice.catalog; + +import com.example.checkernaturalmessageservice.entry.Entry; +import com.example.checkernaturalmessageservice.entry.EntryListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CatalogExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CatalogExpression(Expression expression){ + super(expression); + } + + public CatalogExpression(Expression expression, Function function){ + super(expression, function); + } + + public CatalogExpression updateId(Long id){ + return new CatalogExpression(this, $it -> {((Catalog)$it).__internalSet("id", id); return this;}); + } + + public CatalogExpression save(UserContext userContext){ + return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CatalogExpression save(String intent, UserContext userContext){ + return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Catalog::getName); + } + public CatalogExpression updateName(String name){ + return new CatalogExpression(this, $it -> ((Catalog)$it).updateName(name)); + } + + public EntryListExpression getEntryList(){ + return new EntryListExpression(loaded("entry_list", "getEntryList", Catalog::getEntryList)); + } + public CatalogExpression addEntry(Entry entry){ + return new CatalogExpression(this, $it -> ((Catalog)$it).addEntry(entry)); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java new file mode 100644 index 000000000..e58cf190b --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java @@ -0,0 +1,25 @@ + +package com.example.checkernaturalmessageservice.catalog; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CatalogListExpression extends SmartListExpression { + public CatalogListExpression(Expression> expression){ + super(expression); + } + + public CatalogListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CatalogExpression first() { + return new CatalogExpression(super.first()); + } + + public CatalogExpression get(int index) { + return new CatalogExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java new file mode 100644 index 000000000..475feb3c0 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java @@ -0,0 +1,623 @@ + +package com.example.checkernaturalmessageservice.catalog; + +import com.example.checkernaturalmessageservice.Q; +import com.example.checkernaturalmessageservice.entry.Entry; +import com.example.checkernaturalmessageservice.entry.EntryRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CatalogRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CatalogRequest(Class returnType){ + this(returnType, () -> (T) new Catalog()); + } + + protected CatalogRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CatalogRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CatalogRequest copy(){ + return (CatalogRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CatalogRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CatalogRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CatalogRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CatalogRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CatalogRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CatalogRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CatalogRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CatalogRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CatalogRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CatalogRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CatalogRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CatalogRequest)super.appendSearchCriteria(searchCriteria); + } + + public CatalogRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CatalogRequest matchingAnyOf(CatalogRequest catalog){ + super.internalMatchAny(catalog); + return this; + } + + public CatalogRequest matchingIdsOf(CatalogRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Catalog.ID_PROPERTY, request, Catalog.ID_PROPERTY)); + } + + public CatalogRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CatalogRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CatalogRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CatalogRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public CatalogRequest selectSelfFields(){ + return selectSelf(); + } + + public CatalogRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Catalog.ID_PROPERTY); + selectProperty(Catalog.NAME_PROPERTY); + selectProperty(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public CatalogRequest selectChildren(){ + super.selectAny(); + selectEntryList(); + return selectId().selectName().selectVersion(); + } + + + public CatalogRequest selectId(){ + selectProperty(Catalog.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectId(){ + unselectProperty(Catalog.ID_PROPERTY); + return this; + } + public CatalogRequest selectName(){ + selectProperty(Catalog.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectName(){ + unselectProperty(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest selectVersion(){ + selectProperty(Catalog.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectVersion(){ + unselectProperty(Catalog.VERSION_PROPERTY); + return this; + } + public CatalogRequest selectEntryList(){ + return selectEntryListWith(Q.entries().selectSelf()); + } + + public CatalogRequest selectEntryListWith(EntryRequest entryList){ + enhanceRelation(Catalog.ENTRY_LIST_PROPERTY, entryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectEntryListWith", null, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.ID_PROPERTY, operator, values); + } + + public CatalogRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CatalogRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CatalogRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CatalogRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CatalogRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CatalogRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CatalogRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CatalogRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.NAME_PROPERTY, operator, values); + } + + public CatalogRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CatalogRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CatalogRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CatalogRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CatalogRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CatalogRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CatalogRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CatalogRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CatalogRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CatalogRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CatalogRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CatalogRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CatalogRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CatalogRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CatalogRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CatalogRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CatalogRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CatalogRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CatalogRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CatalogRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.VERSION_PROPERTY, operator, values); + } + + public CatalogRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CatalogRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CatalogRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CatalogRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CatalogRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CatalogRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CatalogRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CatalogRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CatalogRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CatalogRequest withEntryListMatching(EntryRequest entryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY)); + } + + public CatalogRequest withoutEntryListMatching(EntryRequest entryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY))); + } + + public CatalogRequest haveEntries(){ + return withEntryListMatching(Q.entries().unlimited()); + } + + public CatalogRequest haveNoEntries(){ + return withoutEntryListMatching(Q.entries().unlimited()); + } + + public CatalogRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CatalogRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CatalogRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CatalogRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Catalog.ID_PROPERTY); + return this; + } + public CatalogRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CatalogRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CatalogRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Catalog.VERSION_PROPERTY); + return this; + } + public CatalogRequest groupByEntriesWithDetails(EntryRequest subRequest){ + aggregate(Catalog.ENTRY_LIST_PROPERTY, subRequest); + return this; + } + + public CatalogRequest groupById(){ + groupBy(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest groupByIdAs(String retName){ + groupBy(retName, Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.ID_PROPERTY, function); + return this; + } + + public CatalogRequest groupByName(){ + groupBy(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest groupByNameAs(String retName){ + groupBy(retName, Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.NAME_PROPERTY, function); + return this; + } + + public CatalogRequest groupByVersion(){ + groupBy(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest groupByVersionAs(String retName){ + groupBy(retName, Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.VERSION_PROPERTY, function); + return this; + } + + + + public CatalogRequest orderByIdAscending(){ + addOrderByAscending(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest orderByIdDescending(){ + addOrderByDescending(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest orderByNameAscending(){ + addOrderByAscending(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest orderByNameDescending(){ + addOrderByDescending(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest orderByVersionAscending(){ + addOrderByAscending(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest orderByVersionDescending(){ + addOrderByDescending(Catalog.VERSION_PROPERTY); + return this; + } + + + public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest){ + return statsFromEntriesAs(name, subRequest, false); + } + + public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Entry.CATALOG_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest statsFromEntries(EntryRequest subRequest){ + return statsFromEntriesAs(REFINEMENTS, subRequest); + } + public CatalogRequest countEntries(){ + addRelationCount("Count", Q.entries().unlimited(), Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntries", null, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest countEntriesAs(String name){ + addRelationCount(name, Q.entries().unlimited(), Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest countEntriesWith(String name, EntryRequest subRequest){ + addRelationCount(name, subRequest, Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesWith", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public CatalogRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CatalogRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CatalogRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CatalogRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CatalogRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CatalogRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java new file mode 100644 index 000000000..8e6dfc21f --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java @@ -0,0 +1,169 @@ + +package com.example.checkernaturalmessageservice.entry; + +import com.example.checkernaturalmessageservice.catalog.Catalog; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Entry extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Entry"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8e34a18976365b7e707005f06d9441ba9a12b1923c7f21baf92af523ac70a9db"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("catalog", 1), java.util.Map.entry("name", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("catalog", java.util.List.of("catalog", "catalog")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Entry.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CATALOG_PROPERTY = "catalog"; + public static final String NAME_PROPERTY = "name"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private Catalog catalog; + + private String name; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public Catalog getCatalog(){ + return this.catalog; + } + + public String getName(){ + return this.name; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public Entry updateCatalog(Catalog catalog){ + if(isPropertyLoaded(CATALOG_PROPERTY) && Objects.equals(this.catalog, catalog)){ + return this; + } + handleUpdate(CATALOG_PROPERTY, getCatalog(), catalog); + this.catalog = catalog; + return this; + } + + public Entry updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Entry updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public Entry updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + + public static Entry refer(Long id){ + Entry refer = new Entry(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Entry comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "catalog": this.catalog = (Catalog) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "catalog": return this.catalog; + case "name": return this.name; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "catalog": return this.catalog; + case "name": return this.name; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java new file mode 100644 index 000000000..b173894ed --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java @@ -0,0 +1,103 @@ + +package com.example.checkernaturalmessageservice.entry; + +import com.example.checkernaturalmessageservice.catalog.Catalog; +import com.example.checkernaturalmessageservice.catalog.CatalogChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class EntryChecker implements Checker{ + + public String type(){ + return Entry.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Entry entry, ObjectLocation _parentLocation){ + if(needCheck(_context, entry)){ + markAsChecked(_context, entry); + doCheck(_context, entry, _parentLocation); + } + } + + public void doCheck(UserContext _context, Entry entry, ObjectLocation _parentLocation){ + if((entry == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, entry); + if(entry.needPersist()){ + } + if(entry.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + entry.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + entry.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(entry.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + entry.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!entry.isPropertyLoaded("catalog")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "catalog"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkCatalog(_context, entry.getProperty(Entry.CATALOG_PROPERTY), newLocation(_parentLocation, "catalog")); + checkName(_context, entry.getProperty(Entry.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCreateTime(_context, entry.getProperty(Entry.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, entry.getProperty(Entry.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkCatalog(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, catalog); + if((catalog == null)){ + return; + } + new CatalogChecker().checkAndFix(_context, catalog, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java new file mode 100644 index 000000000..671981367 --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java @@ -0,0 +1,68 @@ + +package com.example.checkernaturalmessageservice.entry; + +import com.example.checkernaturalmessageservice.catalog.Catalog; +import com.example.checkernaturalmessageservice.catalog.CatalogExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class EntryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public EntryExpression(Expression expression){ + super(expression); + } + + public EntryExpression(Expression expression, Function function){ + super(expression, function); + } + + public EntryExpression updateId(Long id){ + return new EntryExpression(this, $it -> {((Entry)$it).__internalSet("id", id); return this;}); + } + + public EntryExpression save(UserContext userContext){ + return new EntryExpression(this, $it -> ((Entry)$it).auditAs("Saved by Expression").save(userContext)); + } + + public EntryExpression save(String intent, UserContext userContext){ + return new EntryExpression(this, $it -> ((Entry)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CatalogExpression getCatalog(){ + return new CatalogExpression(loaded("catalog", "getCatalog", Entry::getCatalog)); + } + + public EntryExpression updateCatalog(Catalog catalog){ + return new EntryExpression(this, $it -> ((Entry)$it).updateCatalog(catalog)); + } + + public Expression getName(){ + return loaded("name", "getName", Entry::getName); + } + public EntryExpression updateName(String name){ + return new EntryExpression(this, $it -> ((Entry)$it).updateName(name)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", Entry::getCreateTime); + } + public EntryExpression updateCreateTime(LocalDateTime createTime){ + return new EntryExpression(this, $it -> ((Entry)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", Entry::getUpdateTime); + } + public EntryExpression updateUpdateTime(LocalDateTime updateTime){ + return new EntryExpression(this, $it -> ((Entry)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java new file mode 100644 index 000000000..5d46271ad --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.checkernaturalmessageservice.entry; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class EntryListExpression extends SmartListExpression { + public EntryListExpression(Expression> expression){ + super(expression); + } + + public EntryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public EntryExpression first() { + return new EntryExpression(super.first()); + } + + public EntryExpression get(int index) { + return new EntryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java new file mode 100644 index 000000000..8363f39bd --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java @@ -0,0 +1,957 @@ + +package com.example.checkernaturalmessageservice.entry; + +import com.example.checkernaturalmessageservice.Q; +import com.example.checkernaturalmessageservice.catalog.Catalog; +import com.example.checkernaturalmessageservice.catalog.CatalogRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class EntryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public EntryRequest(Class returnType){ + this(returnType, () -> (T) new Entry()); + } + + protected EntryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public EntryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public EntryRequest copy(){ + return (EntryRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new EntryRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public EntryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public EntryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public EntryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public EntryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public EntryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public EntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public EntryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public EntryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public EntryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public EntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (EntryRequest)super.appendSearchCriteria(searchCriteria); + } + + public EntryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public EntryRequest matchingAnyOf(EntryRequest entry){ + super.internalMatchAny(entry); + return this; + } + + public EntryRequest matchingIdsOf(EntryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Entry.ID_PROPERTY, request, Entry.ID_PROPERTY)); + } + + public EntryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public EntryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public EntryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public EntryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCatalogIdOnly().selectName().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public EntryRequest selectSelfFields(){ + return selectSelf(); + } + + public EntryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Entry.ID_PROPERTY); + selectProperty(Entry.CATALOG_PROPERTY); + selectProperty(Entry.NAME_PROPERTY); + selectProperty(Entry.CREATE_TIME_PROPERTY); + selectProperty(Entry.UPDATE_TIME_PROPERTY); + selectProperty(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest selectAll(){ + super.selectAll(); + return selectId().selectCatalog().selectName().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public EntryRequest selectChildren(){ + super.selectAny(); + return selectId().selectCatalog().selectName().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public EntryRequest selectId(){ + selectProperty(Entry.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectId(){ + unselectProperty(Entry.ID_PROPERTY); + return this; + } + public EntryRequest selectCatalogIdOnly(){ + selectProperty(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest selectCatalog(){ + return selectCatalogWith(Q.catalogs().unlimited().selectSelf()); + } + + public EntryRequest selectCatalogWith(CatalogRequest catalog){ + selectProperty(Entry.CATALOG_PROPERTY); + enhanceRelation(Entry.CATALOG_PROPERTY, catalog, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCatalogWith", null, Entry.CATALOG_PROPERTY)); + return this; + } + + public EntryRequest unselectCatalog(){ + unselectProperty(Entry.CATALOG_PROPERTY); + return this; + } + public EntryRequest selectName(){ + selectProperty(Entry.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectName(){ + unselectProperty(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest selectCreateTime(){ + selectProperty(Entry.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectCreateTime(){ + unselectProperty(Entry.CREATE_TIME_PROPERTY); + return this; + } + public EntryRequest selectUpdateTime(){ + selectProperty(Entry.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectUpdateTime(){ + unselectProperty(Entry.UPDATE_TIME_PROPERTY); + return this; + } + public EntryRequest selectVersion(){ + selectProperty(Entry.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectVersion(){ + unselectProperty(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.ID_PROPERTY, operator, values); + } + + public EntryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public EntryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public EntryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public EntryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public EntryRequest filterByCatalog(Catalog... catalog){ + if (catalog == null || catalog.length == 0) { + throw new IllegalArgumentException("filterByCatalog parameter catalog cannot be empty"); + } + return appendSearchCriteria(createCatalogCriteria(Operator.EQUAL, (Object[])catalog)); + } + + public EntryRequest withCatalog(Operator operator, Object... values){ + return appendSearchCriteria(createCatalogCriteria(operator, values)); + } + + public EntryRequest withCatalogIsUnknown(){ + return withCatalog(Operator.IS_NULL); + } + + public EntryRequest withCatalogIsKnown(){ + return withCatalog(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCatalogCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.CATALOG_PROPERTY, operator, values); + } + + public EntryRequest filterByCatalog(Long catalog){ + if(catalog == null){ + return this; + } + return withCatalog(Operator.EQUAL, catalog); + } + public EntryRequest withCatalogMatching(CatalogRequest catalog){ + return appendSearchCriteria(new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY)); + } + + public EntryRequest withoutCatalogMatching(CatalogRequest catalog){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY))); + } + + public EntryRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public EntryRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public EntryRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public EntryRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.NAME_PROPERTY, operator, values); + } + + public EntryRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public EntryRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public EntryRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public EntryRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public EntryRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public EntryRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public EntryRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public EntryRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public EntryRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public EntryRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public EntryRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public EntryRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public EntryRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public EntryRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public EntryRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public EntryRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public EntryRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public EntryRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public EntryRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public EntryRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.CREATE_TIME_PROPERTY, operator, values); + } + + public EntryRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public EntryRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public EntryRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public EntryRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public EntryRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public EntryRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public EntryRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public EntryRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public EntryRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public EntryRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public EntryRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public EntryRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public EntryRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public EntryRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public EntryRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public EntryRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public EntryRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public EntryRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.UPDATE_TIME_PROPERTY, operator, values); + } + + public EntryRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public EntryRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public EntryRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public EntryRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public EntryRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public EntryRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public EntryRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public EntryRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public EntryRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public EntryRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public EntryRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public EntryRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public EntryRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public EntryRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public EntryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public EntryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public EntryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public EntryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.VERSION_PROPERTY, operator, values); + } + + public EntryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public EntryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public EntryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public EntryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public EntryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public EntryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public EntryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public EntryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public EntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public EntryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public EntryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public EntryRequest groupByCatalogWithDetails(){ + return groupByCatalogWithDetails(Q.catalogs().unlimited()); + } + + public EntryRequest groupByCatalogWithDetails(CatalogRequest subRequest){ + aggregate(Entry.CATALOG_PROPERTY, subRequest); + return this; + } + + + + + + public EntryRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public EntryRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Entry.ID_PROPERTY); + return this; + } + public EntryRequest countDistinctCatalog(){ + return countDistinctCatalogAs("catalog_distinct_count"); + } + + public EntryRequest countDistinctCatalogAs(String alias){ + super.countDistinctProperty(alias, Entry.CATALOG_PROPERTY); + return this; + } + public EntryRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public EntryRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Entry.NAME_PROPERTY); + return this; + } + public EntryRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public EntryRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Entry.CREATE_TIME_PROPERTY); + return this; + } + public EntryRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public EntryRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Entry.UPDATE_TIME_PROPERTY); + return this; + } + public EntryRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public EntryRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupById(){ + groupBy(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest groupByIdAs(String retName){ + groupBy(retName, Entry.ID_PROPERTY); + return this; + } + + public EntryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.ID_PROPERTY, function); + return this; + } + public EntryRequest groupByCatalogWith(CatalogRequest subRequest){ + groupBy(Entry.CATALOG_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCatalogWith", null, "catalog")); + return this; + } + public EntryRequest groupByCatalog(){ + groupBy(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest groupByCatalogAs(String retName){ + groupBy(retName, Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest groupByCatalogWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.CATALOG_PROPERTY, function); + return this; + } + + public EntryRequest groupByName(){ + groupBy(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest groupByNameAs(String retName){ + groupBy(retName, Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.NAME_PROPERTY, function); + return this; + } + + public EntryRequest groupByCreateTime(){ + groupBy(Entry.CREATE_TIME_PROPERTY); + return this; + } + + public EntryRequest groupByCreateTimeAs(String retName){ + groupBy(retName, Entry.CREATE_TIME_PROPERTY); + return this; + } + + public EntryRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.CREATE_TIME_PROPERTY, function); + return this; + } + + public EntryRequest groupByUpdateTime(){ + groupBy(Entry.UPDATE_TIME_PROPERTY); + return this; + } + + public EntryRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, Entry.UPDATE_TIME_PROPERTY); + return this; + } + + public EntryRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.UPDATE_TIME_PROPERTY, function); + return this; + } + + public EntryRequest groupByVersion(){ + groupBy(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupByVersionAs(String retName){ + groupBy(retName, Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.VERSION_PROPERTY, function); + return this; + } + + + + public EntryRequest orderByIdAscending(){ + addOrderByAscending(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest orderByIdDescending(){ + addOrderByDescending(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest orderByCatalogAscending(){ + addOrderByAscending(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest orderByCatalogDescending(){ + addOrderByDescending(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest orderByNameAscending(){ + addOrderByAscending(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest orderByNameDescending(){ + addOrderByDescending(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest orderByCreateTimeAscending(){ + addOrderByAscending(Entry.CREATE_TIME_PROPERTY); + return this; + } + + public EntryRequest orderByCreateTimeDescending(){ + addOrderByDescending(Entry.CREATE_TIME_PROPERTY); + return this; + } + + public EntryRequest orderByUpdateTimeAscending(){ + addOrderByAscending(Entry.UPDATE_TIME_PROPERTY); + return this; + } + + public EntryRequest orderByUpdateTimeDescending(){ + addOrderByDescending(Entry.UPDATE_TIME_PROPERTY); + return this; + } + + public EntryRequest orderByVersionAscending(){ + addOrderByAscending(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest orderByVersionDescending(){ + addOrderByDescending(Entry.VERSION_PROPERTY); + return this; + } + + + public CatalogRequest rollUpToCatalog(){ + CatalogRequest catalog = Q.catalogs().unlimited(); + this.internalRollUpTo("catalog", catalog, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCatalog", null, "catalog")); + return catalog; + } + + + + + + + public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog){ + return facetByCatalogAs(facetName, catalog, true); + } + + public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog, boolean includeAllFacets){ + addFacet(facetName, Entry.CATALOG_PROPERTY, catalog, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCatalogAs", facetName, Entry.CATALOG_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public EntryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public EntryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public EntryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public EntryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public EntryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public EntryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java b/examples/conformance/natural-messages/java-lib-core/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/natural-messages/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/natural-messages/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..57a8cdc0e --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.checkernaturalmessageservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/natural-messages/automatic-fixture/model.xml b/examples/conformance/natural-messages/java-lib-core/model.xml similarity index 100% rename from examples/conformance/natural-messages/automatic-fixture/model.xml rename to examples/conformance/natural-messages/java-lib-core/model.xml diff --git a/examples/conformance/natural-messages/java-lib-core/teaql/checker-model.json b/examples/conformance/natural-messages/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..30dcd07eb --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:9ea98ce6f86d4528fa8abed527685e55e825dcb5a695c61871b7aeab0eba3967","entities":{"Catalog":{"labels":{"en":"catalog","zh-CN":"目录"},"fields":[{"name":"entry_list","targetType":"Entry","labels":{"en":"entry","zh-CN":"明细"},"aliases":["EntryList","entryList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name","zh-CN":"名称"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Entry":{"labels":{"en":"entry","zh-CN":"明细"},"fields":[{"name":"catalog","targetType":"Catalog","labels":{"en":"catalog","zh-CN":"目录"},"aliases":["Catalog"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name","zh-CN":"名称"},"aliases":["Name"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-lib-core/teaql/model-provenance.json b/examples/conformance/natural-messages/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..864e40a6e --- /dev/null +++ b/examples/conformance/natural-messages/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0a1b334773c70c84328c0733efa29e0d7fe5cb65d53bd33bb5cf2da3456c64ff","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/conformance/natural-messages/showcase.json b/examples/conformance/natural-messages/showcase.json new file mode 100644 index 000000000..5403545df --- /dev/null +++ b/examples/conformance/natural-messages/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/conformance", + "library": { + "generatedFilesManifestSHA256": "c4c234c7fe34ac2eff76027240f192dab3362af6b6657a29ed1a233e7d74fe70", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "4c69fcaa275d1f7d255f325305cc0c6c5071154d278f9f4af7775ae0758144a6" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/catalog-natural-generation/receipt.json", + "receiptSHA256": "c321d972c75d8f73f7f62525162f64337461996c487f3ab3abdaef25cba5e23a" + }, + "scene": "Catalog entry validation with natural messages, exact locations and private values", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "node", + "verify-local.cjs" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "showcase-tests/io/teaql/examples/naturalmessages/GeneratedNaturalMessagesTest.java" + ], + "generatedFilesManifestSHA256": "4c158e97fa019cace80ded4119dcc0fa26c4dc397ac1e6f2d78ff32389bafa6a", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/conformance/natural-messages/verify-local.cjs b/examples/conformance/natural-messages/verify-local.cjs index 738c3a86c..be8bb82c4 100644 --- a/examples/conformance/natural-messages/verify-local.cjs +++ b/examples/conformance/natural-messages/verify-local.cjs @@ -2,7 +2,7 @@ const fs = require('node:fs'), path = require('node:path'), os = require('node:os'); const cp = require('node:child_process'), crypto = require('node:crypto'), assert = require('node:assert/strict'); const {createOwnedRunner, ownedBytes} = require('../../fix-e-alignment/owned-command.cjs'); -const repo = path.resolve(__dirname, '../../..'), fixture = path.join(__dirname, 'automatic-fixture'); +const repo = path.resolve(__dirname, '../../..'), fixture = path.join(__dirname, 'java-lib-core'), workspace=path.join(__dirname,'java-app-console'); const sha = bytes => crypto.createHash('sha256').update(bytes).digest('hex'); const requested = process.env.TEAQL_NATURAL_MESSAGES_EVIDENCE_DIR; const output = requested ? path.resolve(requested) : fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-natural-evidence-')); @@ -29,8 +29,8 @@ async function main() { report.schema = 'teaql.java-natural-checker-messages/v1'; const sourceFiles = cp.execFileSync('git', ['-C', repo, 'ls-files', '-z', '--cached', '--others', '--exclude-standard']) .toString().split('\0').filter(Boolean); - const runtime = path.join(scratch, 'runtime'), bundle = path.join(scratch, 'model'), generated = path.join(bundle, 'lib'); - const consumer = path.join(scratch, 'consumer'), tests = path.join(consumer, 'src/test/java/io/teaql/examples/naturalmessages'); + const runtime = path.join(scratch, 'runtime'), bundle = path.join(scratch, 'java-lib-core'), generated = path.join(bundle, 'lib'); + const consumer = path.join(scratch, 'java-app-console'), tests = path.join(consumer, 'showcase-tests/io/teaql/examples/naturalmessages'); const sourceHash = crypto.createHash('sha256'); report.sourceHashes = {}; for (const name of [...new Set(sourceFiles)].sort()) { const file = path.join(repo, name); @@ -48,14 +48,12 @@ async function main() { } const version = fs.readFileSync(path.join(runtime, 'pom.xml'), 'utf8').match(/([^<]+)<\/version>/)[1]; report.metadataOverride = require('../../../scripts/pin-local-example-pom.cjs').pin(path.join(generated, 'pom.xml'), runtime, scratch); - fs.mkdirSync(tests, {recursive: true}); - const app = fs.readFileSync(path.join(__dirname, 'GeneratedNaturalMessagesTest.java')); - report.applicationSha256 = sha(app); fs.writeFileSync(path.join(tests, 'GeneratedNaturalMessagesTest.java'), app); - const dependencies = ['teaql-runtime', 'teaql-provider-jdbc', 'teaql-sqlite'].map(name => - `io.teaql${name}${version}`).join(''); - fs.writeFileSync(path.join(consumer, 'pom.xml'), `4.0.0io.teaqlteaql-java-parent${version}../runtime/pom.xmlio.teaql.examplesnatural-checker-consumer${version}com.examplechecker-natural-message-service-core0.0.1-SNAPSHOT${dependencies}junitjunit4.13.2testorg.apache.maven.pluginsmaven-surefire-pluginfalse`); + fs.cpSync(workspace,consumer,{recursive:true}); + const app=fs.readFileSync(path.join(tests,'GeneratedNaturalMessagesTest.java'));report.applicationSha256=sha(app); + const pom=fs.readFileSync(path.join(consumer,'pom.xml'),'utf8').replace('../../../../pom.xml','../runtime/pom.xml'); + fs.writeFileSync(path.join(consumer,'pom.xml'),pom);fs.writeFileSync(path.join(output,'consumer-pom.xml'),pom); const reactor = path.join(scratch, 'pom.xml'); - fs.writeFileSync(reactor, '4.0.0io.teaql.testnatural-checker-reactor0pomruntimemodel/libconsumer'); + fs.writeFileSync(reactor, '4.0.0io.teaql.testnatural-checker-reactor0pomruntimejava-lib-core/libjava-app-console'); if (process.env.TEAQL_NATURAL_MESSAGES_UNIT_TESTS === '1') { const command = [process.env.MAVEN || 'mvn', '-o', '-q', '-ntp', '-f', path.join(runtime, 'pom.xml'), '-pl', 'teaql-runtime', '-am', 'test']; diff --git a/examples/conformance/showcase.json b/examples/conformance/showcase.json index 0306d1a96..48c664987 100644 --- a/examples/conformance/showcase.json +++ b/examples/conformance/showcase.json @@ -29,6 +29,9 @@ "remainingFullRuntimeInventory": true, "sourceCommit": "af7e8b4ada69c18c07f08b1dcf5a3b120bfc6fc3" }, + "relatedShowcases": [ + "natural-messages/showcase.json" + ], "scene": "WorkItem governed lifecycle and workspace-owned Spring transaction business scenarios", "schema": "teaql.model-workspace-showcase/v1", "status": "focused-verified", From 8e8e88728646d54c6fd0e1b355b75cff61d47307 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:55:31 +0800 Subject: [PATCH 23/71] Record the independently qualified nested Catalog showcase --- examples/conformance/natural-messages/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/conformance/natural-messages/showcase.json b/examples/conformance/natural-messages/showcase.json index 5403545df..8de1b90a0 100644 --- a/examples/conformance/natural-messages/showcase.json +++ b/examples/conformance/natural-messages/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/catalog-natural-generation/receipt.json", "receiptSHA256": "c321d972c75d8f73f7f62525162f64337461996c487f3ab3abdaef25cba5e23a" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-natural-catalog-native-scopes/runtime/natural-messages/receipt.json", + "businessReceiptSHA256": "e1f517766eb8fc9541294313caa20e840f5bfcd7c1c28daa972f9eeb72e5c609", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-natural-catalog-native-scopes/receipt.json", + "nativeReceiptSHA256": "d9fdf291ed960529dafb63ed3da8970474353ee6a8cbfbd0ce98e8f33b539a4b", + "remainingFullRuntimeInventory": true, + "sourceCommit": "b6d9f0944d637462713ee029295adb0c12684e26" + }, "scene": "Catalog entry validation with natural messages, exact locations and private values", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "node", "verify-local.cjs" From 3032bc62b153380f8e8fc111c3a2511bc054ae57 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 13:57:50 +0800 Subject: [PATCH 24/71] Explain the Catalog model, workspace entry and located validation outcomes --- .../conformance/natural-messages/README.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/examples/conformance/natural-messages/README.md b/examples/conformance/natural-messages/README.md index aa32e05a1..248421762 100644 --- a/examples/conformance/natural-messages/README.md +++ b/examples/conformance/natural-messages/README.md @@ -68,7 +68,7 @@ metadata hashes remain unchanged. ## Fixture origin -`automatic-fixture/` is the current generated input. Its 24-file manifest, +`java-lib-core/` is the current generated input. Its 24-file manifest, raw model, evaluation output and generator origin are retained alongside `generation.json`. `JavaNaturalMessagesGenerationTest` evaluates the model and generates the library from the local generator source; the paired conformance @@ -84,3 +84,23 @@ The old Context Fix fixture remains unchanged. Its model is not reused for new generation because the current evaluator now requires an additional credential mask declaration there. This new example does not bypass evaluation or weaken the frozen old fixture's provenance guards. + +## Current model and workspace + +`model.xml` defines the Catalog and Entry business graph. The exact generated +domain library is read-only in `java-lib-core/`; its current provenance points to +the qualified generator source build, with the prior generation identity retained +separately in its metadata. The application lives in `java-app-console/showcase-tests/io/teaql/examples/naturalmessages/GeneratedNaturalMessagesTest.java`. + +Run this focused business entry from the SDK repository root: + +```bash +node examples/conformance/natural-messages/verify-local.cjs +``` + +The same graph is rejected before writes for an invalid second Entry, then +corrected and saved through generated Q/E and audited Save. Two runs check +actual stored values, precise machine locations, English/Chinese messages and +private-value redaction. Language-specific native length rules remain intact. +The verifier preserves result stores and compact receipts and removes owned +build outputs. Full runtime example qualification remains a separate gate. From 87b3225d1dc13abb5a5308b22643c501295b0b41 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 14:21:12 +0800 Subject: [PATCH 25/71] Give the Java Context Fix child an immutable current domain library and workspace --- .../context-derived/current-library.cjs | 10 + .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 66 + .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../context-derived/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 ++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../example/contextfixservice/Checkers.java | 0 .../example/contextfixservice/Constants.java | 9 + .../ContextFixServiceUserContext.java | 13 + .../java/com/example/contextfixservice/E.java | 18 + .../contextfixservice/EntityMetaRegistry.java | 501 ++++++ .../GeneratedRuntimeModule.java | 36 + .../java/com/example/contextfixservice/Q.java | 25 + .../contextfixservice/Repositories.java | 0 .../contextfixservice/catalog/Catalog.java | 130 ++ .../catalog/CatalogChecker.java | 52 + .../catalog/CatalogExpression.java | 51 + .../catalog/CatalogListExpression.java | 25 + .../catalog/CatalogRequest.java | 586 ++++++ .../contextfixservice/entry/Entry.java | 274 +++ .../contextfixservice/entry/EntryChecker.java | 170 ++ .../entry/EntryExpression.java | 103 ++ .../entry/EntryListExpression.java | 25 + .../contextfixservice/entry/EntryRequest.java | 1590 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../context-derived/java-app-console/pom.xml | 1 + .../contextfix}/GeneratedContextFixTest.java | 0 .../com/example/contextfixservice/App.java | 99 + .../contextfixservice/CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 112 ++ .../teaql/model-provenance.json | 1 + .../current-generator-fixture.json | 36 + .../context-derived/java-lib-core/lib/pom.xml | 142 ++ .../BaseServiceConfiguration.java | 0 .../example/contextfixservice/Checkers.java | 0 .../example/contextfixservice/Constants.java | 9 + .../ContextFixServiceUserContext.java | 13 + .../java/com/example/contextfixservice/E.java | 18 + .../contextfixservice/EntityMetaRegistry.java | 501 ++++++ .../GeneratedRuntimeModule.java | 36 + .../java/com/example/contextfixservice/Q.java | 25 + .../contextfixservice/Repositories.java | 0 .../contextfixservice/catalog/Catalog.java | 130 ++ .../catalog/CatalogChecker.java | 52 + .../catalog/CatalogExpression.java | 51 + .../catalog/CatalogListExpression.java | 25 + .../catalog/CatalogRequest.java | 586 ++++++ .../contextfixservice/entry/Entry.java | 274 +++ .../contextfixservice/entry/EntryChecker.java | 170 ++ .../entry/EntryExpression.java | 103 ++ .../entry/EntryListExpression.java | 25 + .../contextfixservice/entry/EntryRequest.java | 1590 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/model-provenance.json | 1 + .../conformance/context-derived/model.xml | 5 + .../conformance/context-derived/showcase.json | 40 + .../context-derived/verify-local.cjs | 26 +- examples/conformance/showcase.json | 3 +- 67 files changed, 8302 insertions(+), 16 deletions(-) create mode 100644 examples/conformance/context-derived/current-library.cjs create mode 100644 examples/conformance/context-derived/java-app-console/.gitignore create mode 100644 examples/conformance/context-derived/java-app-console/AGENTS.md create mode 100644 examples/conformance/context-derived/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/conformance/context-derived/java-app-console/Makefile create mode 100644 examples/conformance/context-derived/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/conformance/context-derived/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/conformance/context-derived/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/conformance/context-derived/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/conformance/context-derived/java-app-console/lib/pom.xml create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Checkers.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Repositories.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java create mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/conformance/context-derived/java-app-console/pom.xml rename examples/conformance/context-derived/{ => java-app-console/showcase-tests/io/teaql/examples/contextfix}/GeneratedContextFixTest.java (100%) create mode 100644 examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/App.java create mode 100644 examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/CustomUserContext.java create mode 100644 examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/conformance/context-derived/java-app-console/src/main/resources/application.properties create mode 100644 examples/conformance/context-derived/java-app-console/teaql-i18n.json create mode 100644 examples/conformance/context-derived/java-app-console/teaql/model-provenance.json create mode 100644 examples/conformance/context-derived/java-lib-core/current-generator-fixture.json create mode 100644 examples/conformance/context-derived/java-lib-core/lib/pom.xml create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Checkers.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Constants.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/E.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Q.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Repositories.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/Entry.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java create mode 100644 examples/conformance/context-derived/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/conformance/context-derived/java-lib-core/teaql/model-provenance.json create mode 100644 examples/conformance/context-derived/model.xml create mode 100644 examples/conformance/context-derived/showcase.json diff --git a/examples/conformance/context-derived/current-library.cjs b/examples/conformance/context-derived/current-library.cjs new file mode 100644 index 000000000..b9f1f2a65 --- /dev/null +++ b/examples/conformance/context-derived/current-library.cjs @@ -0,0 +1,10 @@ +'use strict'; +const fs=require('node:fs'),path=require('node:path'),crypto=require('node:crypto'),assert=require('node:assert/strict'); +const sha=b=>crypto.createHash('sha256').update(b).digest('hex'); +function currentLibraryInputs(){const root=path.join(__dirname,"java-lib-core"),meta=path.join(root,'current-generator-fixture.json'); +const m=JSON.parse(fs.readFileSync(meta));assert.equal(m.evaluationErrors,0);assert.equal(sha(fs.readFileSync(path.join(__dirname,'model.xml'))),m.modelSha256); +const actual=[];function walk(dir){for(const e of fs.readdirSync(dir,{withFileTypes:true})){assert(!e.isSymbolicLink());const p=path.join(dir,e.name);if(e.isDirectory())walk(p);else{assert(e.isFile());actual.push(path.relative(root,p));}}}walk(root); +assert.deepEqual(actual.sort(),[...Object.keys(m.files),'current-generator-fixture.json'].sort()); +for(const[n,h]of Object.entries(m.files)){assert(!path.isAbsolute(n)&&!n.split('/').includes('..'));assert.equal(sha(fs.readFileSync(path.join(root,n))),h,n);} +return{files:m.files,modelSha256:m.modelSha256,metadataSha256:sha(fs.readFileSync(meta))};} +module.exports={currentLibraryInputs}; diff --git a/examples/conformance/context-derived/java-app-console/.gitignore b/examples/conformance/context-derived/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/AGENTS.md b/examples/conformance/context-derived/java-app-console/AGENTS.md new file mode 100644 index 000000000..8fc110bb3 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| catalog | catalog | +| entry | entry | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/conformance/context-derived/java-app-console/DOMAIN_API_GUIDE.md b/examples/conformance/context-derived/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..37d5c13ec --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/context-fix-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| catalog | catalog | +| entry | entry | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/Makefile b/examples/conformance/context-derived/java-app-console/Makefile new file mode 100644 index 000000000..5a619a025 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/context-fix-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/context-fix-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/conformance/context-derived/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..0ee396747 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/context-fix-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/STANDARD_TELEMETRY.md b/examples/conformance/context-derived/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/conformance/context-derived/java-app-console/TOOL_API_GUIDE.md b/examples/conformance/context-derived/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..a0c2426ad --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/context-fix-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/context-fix-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/context-fix-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/context-fix-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/context-fix-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/context-fix-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/docs/teaql-java-crud-guide.md b/examples/conformance/context-derived/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..033e97158 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.contextfixservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.contextfixservice.Q; +import com.example.contextfixservice.ContextFixServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.catalogs() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.catalogs() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Catalog(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.catalogs() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.catalogs() + .selectEntryListWith(Q.entries().selectSelf()) + .comment("load with entryList") + .purpose("fetch child entryList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Catalog`: reverse relations `1`, query `Q.catalogs()`, save `new Catalog().auditAs("comment").save(userContext)`, request `com.example.contextfixservice.catalog.CatalogRequest` \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/pom.xml b/examples/conformance/context-derived/java-app-console/lib/pom.xml new file mode 100644 index 000000000..845a2f5f5 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + context-fix-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 1.556-RELEASE + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 1.556-RELEASE + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Checkers.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java new file mode 100644 index 000000000..f359466e1 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.contextfixservice; + +import com.example.contextfixservice.catalog.Catalog; + +public interface Constants { + public static final long CATALOG_ID = 1l; + public static final Catalog CATALOG = Catalog.refer(CATALOG_ID); +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java new file mode 100644 index 000000000..4e02f8d3f --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java @@ -0,0 +1,13 @@ + +package com.example.contextfixservice; + +import io.teaql.core.UserContext; +public interface ContextFixServiceUserContext extends UserContext{ + public default String uniStr(String prefix){ + throw new RuntimeException("not implemented yet"); + } + + + + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java new file mode 100644 index 000000000..ce74647eb --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java @@ -0,0 +1,18 @@ + +package com.example.contextfixservice; + +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogExpression; +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static CatalogExpression catalog(Catalog catalog){ + return new CatalogExpression(new ValueExpression(catalog, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.catalog()")); + } + public static EntryExpression entry(Entry entry){ + return new EntryExpression(new ValueExpression(entry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.entry()")); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java new file mode 100644 index 000000000..63dfbe7b2 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java @@ -0,0 +1,501 @@ + +package com.example.contextfixservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerCatalog(); + registerEntry(); + } + private void registerCatalog() { + FieldLayout.installGenerated(com.example.contextfixservice.catalog.Catalog.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.contextfixservice.catalog.Catalog.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.contextfixservice.catalog.Catalog.class); + entityDescriptor.setEntitySupplier(com.example.contextfixservice.catalog.Catalog::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Catalog") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerEntry() { + FieldLayout.installGenerated(com.example.contextfixservice.entry.Entry.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.contextfixservice.entry.Entry.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.contextfixservice.entry.Entry.class); + entityDescriptor.setEntitySupplier(com.example.contextfixservice.entry.Entry::new); + entityDescriptor.with("audit_mask_fields", "guarded_token") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY, Long.class) + ; + PropertyDescriptor catalog = + entityDescriptor.addObjectProperty($factory, com.example.contextfixservice.entry.Entry.CATALOG_PROPERTY, com.example.contextfixservice.catalog.Catalog.INTERNAL_TYPE, com.example.contextfixservice.catalog.Catalog.ENTRY_LIST_PROPERTY, com.example.contextfixservice.catalog.Catalog.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY, String.class) + ; + PropertyDescriptor bornAt = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor touchedAt = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor sourceIp = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY, String.class) + ; + PropertyDescriptor lastIp = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY, String.class) + ; + PropertyDescriptor openedBy = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY, String.class) + ; + PropertyDescriptor changedBy = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY, String.class) + ; + PropertyDescriptor guardedToken = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CATALOG_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("prefix", "") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("createFunction", "uniStr") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + + .with("createFunctionArgNames", "prefix") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..9ad995608 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java @@ -0,0 +1,36 @@ +package com.example.contextfixservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.contextfixservice.catalog.CatalogChecker(), new com.example.contextfixservice.entry.EntryChecker()) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Catalog", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Entry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("catalog", "catalog"), java.util.Map.entry("name", "name"), java.util.Map.entry("born_at", "bornAt"), java.util.Map.entry("touched_at", "touchedAt"), java.util.Map.entry("source_ip", "sourceIp"), java.util.Map.entry("last_ip", "lastIp"), java.util.Map.entry("opened_by", "openedBy"), java.util.Map.entry("changed_by", "changedBy"), java.util.Map.entry("guarded_token", "guardedToken"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.catalogs().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.contextfixservice.catalog.Catalog domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.contextfixservice.catalog.Catalog(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Catalog"); + domainRoot.auditAs("create generated Domain Root Catalog").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Catalog", domainRoot.getId())); + } +} diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java new file mode 100644 index 000000000..b8c9d8f3a --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.contextfixservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.contextfixservice.catalog.CatalogRequest catalogs(){ + return new com.example.contextfixservice.catalog.CatalogRequest(com.example.contextfixservice.catalog.Catalog.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.contextfixservice.catalog.CatalogRequest catalogsWithMinimalFields(){ + return new com.example.contextfixservice.catalog.CatalogRequest(com.example.contextfixservice.catalog.Catalog.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.contextfixservice.entry.EntryRequest entries(){ + return new com.example.contextfixservice.entry.EntryRequest(com.example.contextfixservice.entry.Entry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.contextfixservice.entry.EntryRequest entriesWithMinimalFields(){ + return new com.example.contextfixservice.entry.EntryRequest(com.example.contextfixservice.entry.Entry.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Repositories.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java new file mode 100644 index 000000000..7ab1bb4e6 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java @@ -0,0 +1,130 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.entry.Entry; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Catalog extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Catalog"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "0dcb16e6cbbd1798e584c9779cf0bb7037ed8624c44749752b291414d58d4dd5"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "entry_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Catalog.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String ENTRY_LIST_PROPERTY = "entry_list"; + private String name; + + private SmartList entryList; + + public String getName(){ + return this.name; + } + + public SmartList getEntryList(){ + return this.entryList == null ? SmartList.unloaded() : this.entryList; + } + public Catalog updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Catalog addEntry(Entry entry){ + if (entry == null){ + return this; + } + + if(null == this.entryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.entryList = teaqlUnloadedItems.map(value -> value); + } + + this.entryList.add(entry); + entry.updateCatalog(this); + return this; + } + + public static Catalog refer(Long id){ + Catalog refer = new Catalog(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Catalog comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "entry_list": this.entryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "entry_list": return this.entryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java new file mode 100644 index 000000000..b00ede579 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java @@ -0,0 +1,52 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CatalogChecker implements Checker{ + + public String type(){ + return Catalog.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + if(needCheck(_context, catalog)){ + markAsChecked(_context, catalog); + doCheck(_context, catalog, _parentLocation); + } + } + + public void doCheck(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + if((catalog == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, catalog); + if(catalog.needPersist()){ + } + if(catalog.newItem()){ + }else if(catalog.updateItem()){ + if(!catalog.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, catalog.getProperty(Catalog.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; catalog.getEntryList() != null && i < catalog.getEntryList().size(); i++){ + Entry entry = catalog.getEntryList().get(i); + new EntryChecker().checkAndFix(_context, entry, newLocation(_parentLocation, "entry_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java new file mode 100644 index 000000000..34e0edeb3 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java @@ -0,0 +1,51 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CatalogExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CatalogExpression(Expression expression){ + super(expression); + } + + public CatalogExpression(Expression expression, Function function){ + super(expression, function); + } + + public CatalogExpression updateId(Long id){ + return new CatalogExpression(this, $it -> {((Catalog)$it).__internalSet("id", id); return this;}); + } + + public CatalogExpression save(UserContext userContext){ + return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CatalogExpression save(String intent, UserContext userContext){ + return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Catalog::getName); + } + public CatalogExpression updateName(String name){ + return new CatalogExpression(this, $it -> ((Catalog)$it).updateName(name)); + } + + public EntryListExpression getEntryList(){ + return new EntryListExpression(loaded("entry_list", "getEntryList", Catalog::getEntryList)); + } + public CatalogExpression addEntry(Entry entry){ + return new CatalogExpression(this, $it -> ((Catalog)$it).addEntry(entry)); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java new file mode 100644 index 000000000..a10d96871 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java @@ -0,0 +1,25 @@ + +package com.example.contextfixservice.catalog; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CatalogListExpression extends SmartListExpression { + public CatalogListExpression(Expression> expression){ + super(expression); + } + + public CatalogListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CatalogExpression first() { + return new CatalogExpression(super.first()); + } + + public CatalogExpression get(int index) { + return new CatalogExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java new file mode 100644 index 000000000..c88d47e91 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java @@ -0,0 +1,586 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.Q; +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CatalogRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CatalogRequest(Class returnType){ + this(returnType, () -> (T) new Catalog()); + } + + protected CatalogRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CatalogRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CatalogRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CatalogRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CatalogRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CatalogRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CatalogRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CatalogRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CatalogRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CatalogRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CatalogRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CatalogRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CatalogRequest)super.appendSearchCriteria(searchCriteria); + } + + public CatalogRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CatalogRequest matchingAnyOf(CatalogRequest catalog){ + super.internalMatchAny(catalog); + return this; + } + + public CatalogRequest matchingIdsOf(CatalogRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Catalog.ID_PROPERTY, request, Catalog.ID_PROPERTY)); + } + + public CatalogRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CatalogRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CatalogRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CatalogRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public CatalogRequest selectSelfFields(){ + return selectSelf(); + } + + public CatalogRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Catalog.ID_PROPERTY); + selectProperty(Catalog.NAME_PROPERTY); + selectProperty(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public CatalogRequest selectChildren(){ + super.selectAny(); + selectEntryList(); + return selectId().selectName().selectVersion(); + } + + + public CatalogRequest selectId(){ + selectProperty(Catalog.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectId(){ + unselectProperty(Catalog.ID_PROPERTY); + return this; + } + public CatalogRequest selectName(){ + selectProperty(Catalog.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectName(){ + unselectProperty(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest selectVersion(){ + selectProperty(Catalog.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectVersion(){ + unselectProperty(Catalog.VERSION_PROPERTY); + return this; + } + public CatalogRequest selectEntryList(){ + return selectEntryListWith(Q.entries().selectSelf()); + } + + public CatalogRequest selectEntryListWith(EntryRequest entryList){ + enhanceRelation(Catalog.ENTRY_LIST_PROPERTY, entryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectEntryListWith", null, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.ID_PROPERTY, operator, values); + } + + public CatalogRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CatalogRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CatalogRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CatalogRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CatalogRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CatalogRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CatalogRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CatalogRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.NAME_PROPERTY, operator, values); + } + + public CatalogRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CatalogRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CatalogRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CatalogRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CatalogRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CatalogRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CatalogRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CatalogRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CatalogRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CatalogRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CatalogRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CatalogRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CatalogRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CatalogRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CatalogRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CatalogRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CatalogRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CatalogRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CatalogRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CatalogRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.VERSION_PROPERTY, operator, values); + } + + public CatalogRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CatalogRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CatalogRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CatalogRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CatalogRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CatalogRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CatalogRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CatalogRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CatalogRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CatalogRequest withEntryListMatching(EntryRequest entryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY)); + } + + public CatalogRequest withoutEntryListMatching(EntryRequest entryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY))); + } + + public CatalogRequest haveEntries(){ + return withEntryListMatching(Q.entries().unlimited()); + } + + public CatalogRequest haveNoEntries(){ + return withoutEntryListMatching(Q.entries().unlimited()); + } + + public CatalogRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CatalogRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CatalogRequest groupByEntriesWithDetails(EntryRequest subRequest){ + aggregate(Catalog.ENTRY_LIST_PROPERTY, subRequest); + return this; + } + + public CatalogRequest groupById(){ + groupBy(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest groupByIdAs(String retName){ + groupBy(retName, Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.ID_PROPERTY, function); + return this; + } + + public CatalogRequest groupByName(){ + groupBy(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest groupByNameAs(String retName){ + groupBy(retName, Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.NAME_PROPERTY, function); + return this; + } + + public CatalogRequest groupByVersion(){ + groupBy(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest groupByVersionAs(String retName){ + groupBy(retName, Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.VERSION_PROPERTY, function); + return this; + } + + + + public CatalogRequest orderByIdAscending(){ + addOrderByAscending(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest orderByIdDescending(){ + addOrderByDescending(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest orderByNameAscending(){ + addOrderByAscending(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest orderByNameDescending(){ + addOrderByDescending(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest orderByVersionAscending(){ + addOrderByAscending(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest orderByVersionDescending(){ + addOrderByDescending(Catalog.VERSION_PROPERTY); + return this; + } + + + public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest){ + return statsFromEntriesAs(name, subRequest, false); + } + + public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Entry.CATALOG_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest statsFromEntries(EntryRequest subRequest){ + return statsFromEntriesAs(REFINEMENTS, subRequest); + } + public CatalogRequest countEntries(){ + addRelationCount("Count", Q.entries().unlimited(), Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntries", null, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest countEntriesAs(String name){ + addRelationCount(name, Q.entries().unlimited(), Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest countEntriesWith(String name, EntryRequest subRequest){ + addRelationCount(name, subRequest, Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesWith", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public CatalogRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CatalogRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CatalogRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CatalogRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CatalogRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CatalogRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java new file mode 100644 index 000000000..c4f863c90 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java @@ -0,0 +1,274 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.catalog.Catalog; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Entry extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Entry"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7ae3f6f25be2681c105a55532a8c60a599eada522a7c70284e22e2172db13492"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("catalog", 1), java.util.Map.entry("name", 2), java.util.Map.entry("born_at", 3), java.util.Map.entry("touched_at", 4), java.util.Map.entry("source_ip", 5), java.util.Map.entry("last_ip", 6), java.util.Map.entry("opened_by", 7), java.util.Map.entry("changed_by", 8), java.util.Map.entry("guarded_token", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("catalog", java.util.List.of("catalog", "catalog")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("born_at", java.util.List.of("bornAt", "born_at")), java.util.Map.entry("touched_at", java.util.List.of("touchedAt", "touched_at")), java.util.Map.entry("source_ip", java.util.List.of("sourceIp", "source_ip")), java.util.Map.entry("last_ip", java.util.List.of("lastIp", "last_ip")), java.util.Map.entry("opened_by", java.util.List.of("openedBy", "opened_by")), java.util.Map.entry("changed_by", java.util.List.of("changedBy", "changed_by")), java.util.Map.entry("guarded_token", java.util.List.of("guardedToken", "guarded_token")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Entry.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CATALOG_PROPERTY = "catalog"; + public static final String NAME_PROPERTY = "name"; + public static final String BORN_AT_PROPERTY = "born_at"; + public static final String TOUCHED_AT_PROPERTY = "touched_at"; + public static final String SOURCE_IP_PROPERTY = "source_ip"; + public static final String LAST_IP_PROPERTY = "last_ip"; + public static final String OPENED_BY_PROPERTY = "opened_by"; + public static final String CHANGED_BY_PROPERTY = "changed_by"; + public static final String GUARDED_TOKEN_PROPERTY = "guarded_token"; + private Catalog catalog; + + private String name; + + private LocalDateTime bornAt; + + private LocalDateTime touchedAt; + + private String sourceIp; + + private String lastIp; + + private String openedBy; + + private String changedBy; + + private String guardedToken; + + + public Catalog getCatalog(){ + return this.catalog; + } + + public String getName(){ + return this.name; + } + + public LocalDateTime getBornAt(){ + return this.bornAt; + } + + public LocalDateTime getTouchedAt(){ + return this.touchedAt; + } + + public String getSourceIp(){ + return this.sourceIp; + } + + public String getLastIp(){ + return this.lastIp; + } + + public String getOpenedBy(){ + return this.openedBy; + } + + public String getChangedBy(){ + return this.changedBy; + } + + public String getGuardedToken(){ + return this.guardedToken; + } + + public Entry updateCatalog(Catalog catalog){ + if(isPropertyLoaded(CATALOG_PROPERTY) && Objects.equals(this.catalog, catalog)){ + return this; + } + handleUpdate(CATALOG_PROPERTY, getCatalog(), catalog); + this.catalog = catalog; + return this; + } + + public Entry updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Entry updateBornAt(LocalDateTime bornAt){ + if(isPropertyLoaded(BORN_AT_PROPERTY) && Objects.equals(this.bornAt, bornAt)){ + return this; + } + handleUpdate(BORN_AT_PROPERTY, getBornAt(), bornAt); + this.bornAt = bornAt; + return this; + } + + public Entry updateTouchedAt(LocalDateTime touchedAt){ + if(isPropertyLoaded(TOUCHED_AT_PROPERTY) && Objects.equals(this.touchedAt, touchedAt)){ + return this; + } + handleUpdate(TOUCHED_AT_PROPERTY, getTouchedAt(), touchedAt); + this.touchedAt = touchedAt; + return this; + } + + public Entry updateSourceIp(String sourceIp){ + sourceIp = (sourceIp == null ? null : sourceIp.trim()); + if(isPropertyLoaded(SOURCE_IP_PROPERTY) && Objects.equals(this.sourceIp, sourceIp)){ + return this; + } + handleUpdate(SOURCE_IP_PROPERTY, getSourceIp(), sourceIp); + this.sourceIp = sourceIp; + return this; + } + + public Entry updateLastIp(String lastIp){ + lastIp = (lastIp == null ? null : lastIp.trim()); + if(isPropertyLoaded(LAST_IP_PROPERTY) && Objects.equals(this.lastIp, lastIp)){ + return this; + } + handleUpdate(LAST_IP_PROPERTY, getLastIp(), lastIp); + this.lastIp = lastIp; + return this; + } + + public Entry updateOpenedBy(String openedBy){ + openedBy = (openedBy == null ? null : openedBy.trim()); + if(isPropertyLoaded(OPENED_BY_PROPERTY) && Objects.equals(this.openedBy, openedBy)){ + return this; + } + handleUpdate(OPENED_BY_PROPERTY, getOpenedBy(), openedBy); + this.openedBy = openedBy; + return this; + } + + public Entry updateChangedBy(String changedBy){ + changedBy = (changedBy == null ? null : changedBy.trim()); + if(isPropertyLoaded(CHANGED_BY_PROPERTY) && Objects.equals(this.changedBy, changedBy)){ + return this; + } + handleUpdate(CHANGED_BY_PROPERTY, getChangedBy(), changedBy); + this.changedBy = changedBy; + return this; + } + + public Entry updateGuardedToken(String guardedToken){ + guardedToken = (guardedToken == null ? null : guardedToken.trim()); + if(isPropertyLoaded(GUARDED_TOKEN_PROPERTY) && Objects.equals(this.guardedToken, guardedToken)){ + return this; + } + handleUpdate(GUARDED_TOKEN_PROPERTY, getGuardedToken(), guardedToken); + this.guardedToken = guardedToken; + return this; + } + + + public static Entry refer(Long id){ + Entry refer = new Entry(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Entry comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "catalog": this.catalog = (Catalog) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "born_at": this.bornAt = (LocalDateTime) value; break; + + case "touched_at": this.touchedAt = (LocalDateTime) value; break; + + case "source_ip": this.sourceIp = (value == null ? null : ((String)value).trim()); break; + + case "last_ip": this.lastIp = (value == null ? null : ((String)value).trim()); break; + + case "opened_by": this.openedBy = (value == null ? null : ((String)value).trim()); break; + + case "changed_by": this.changedBy = (value == null ? null : ((String)value).trim()); break; + + case "guarded_token": this.guardedToken = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "catalog": return this.catalog; + case "name": return this.name; + case "born_at": return this.bornAt; + case "touched_at": return this.touchedAt; + case "source_ip": return this.sourceIp; + case "last_ip": return this.lastIp; + case "opened_by": return this.openedBy; + case "changed_by": return this.changedBy; + case "guarded_token": return this.guardedToken; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "catalog": return this.catalog; + case "name": return this.name; + case "bornAt": return this.bornAt; + case "touchedAt": return this.touchedAt; + case "sourceIp": return this.sourceIp; + case "lastIp": return this.lastIp; + case "openedBy": return this.openedBy; + case "changedBy": return this.changedBy; + case "guardedToken": return this.guardedToken; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java new file mode 100644 index 000000000..46bc7e8f1 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java @@ -0,0 +1,170 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class EntryChecker implements Checker{ + + public String type(){ + return Entry.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Entry entry, ObjectLocation _parentLocation){ + if(needCheck(_context, entry)){ + markAsChecked(_context, entry); + doCheck(_context, entry, _parentLocation); + } + } + + public void doCheck(UserContext _context, Entry entry, ObjectLocation _parentLocation){ + if((entry == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, entry); + if(entry.needPersist()){ + } + if(entry.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "born_at"), () -> { + entry.updateBornAt(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "born_at", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "touched_at"), () -> { + entry.updateTouchedAt(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "touched_at", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "guarded_token"), () -> { + entry.updateGuardedToken(_context.evaluate("uniStr", "prefix")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "guarded_token", + "now".equalsIgnoreCase("uniStr") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("uniStr") ? "graphClock" : "contextFunction:uniStr")); + }); + } + }else if(entry.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "touched_at"), () -> { + entry.updateTouchedAt(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "touched_at", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!entry.isPropertyLoaded("catalog")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "catalog"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("born_at")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "born_at"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("touched_at")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "touched_at"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("source_ip")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "source_ip"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("last_ip")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "last_ip"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("opened_by")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "opened_by"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("changed_by")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "changed_by"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("guarded_token")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "guarded_token"), "Mutation requires a fully loaded entity"); + } + + } + checkCatalog(_context, entry.getProperty(Entry.CATALOG_PROPERTY), newLocation(_parentLocation, "catalog")); + checkName(_context, entry.getProperty(Entry.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkBornAt(_context, entry.getProperty(Entry.BORN_AT_PROPERTY), newLocation(_parentLocation, "born_at")); + checkTouchedAt(_context, entry.getProperty(Entry.TOUCHED_AT_PROPERTY), newLocation(_parentLocation, "touched_at")); + checkSourceIp(_context, entry.getProperty(Entry.SOURCE_IP_PROPERTY), newLocation(_parentLocation, "source_ip")); + checkLastIp(_context, entry.getProperty(Entry.LAST_IP_PROPERTY), newLocation(_parentLocation, "last_ip")); + checkOpenedBy(_context, entry.getProperty(Entry.OPENED_BY_PROPERTY), newLocation(_parentLocation, "opened_by")); + checkChangedBy(_context, entry.getProperty(Entry.CHANGED_BY_PROPERTY), newLocation(_parentLocation, "changed_by")); + checkGuardedToken(_context, entry.getProperty(Entry.GUARDED_TOKEN_PROPERTY), newLocation(_parentLocation, "guarded_token")); + } + + public void checkCatalog(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, catalog); + if((catalog == null)){ + return; + } + new CatalogChecker().checkAndFix(_context, catalog, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkBornAt(UserContext _context, LocalDateTime bornAt, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, bornAt); + if((bornAt == null)){ + return; + } + } + public void checkTouchedAt(UserContext _context, LocalDateTime touchedAt, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, touchedAt); + if((touchedAt == null)){ + return; + } + } + public void checkSourceIp(UserContext _context, String sourceIp, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sourceIp); + if((sourceIp == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, sourceIp); + + } + public void checkLastIp(UserContext _context, String lastIp, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, lastIp); + if((lastIp == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, lastIp); + + } + public void checkOpenedBy(UserContext _context, String openedBy, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, openedBy); + if((openedBy == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, openedBy); + + } + public void checkChangedBy(UserContext _context, String changedBy, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, changedBy); + if((changedBy == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, changedBy); + + } + public void checkGuardedToken(UserContext _context, String guardedToken, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, guardedToken); + if((guardedToken == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, guardedToken); + + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java new file mode 100644 index 000000000..b61497cdf --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java @@ -0,0 +1,103 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class EntryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public EntryExpression(Expression expression){ + super(expression); + } + + public EntryExpression(Expression expression, Function function){ + super(expression, function); + } + + public EntryExpression updateId(Long id){ + return new EntryExpression(this, $it -> {((Entry)$it).__internalSet("id", id); return this;}); + } + + public EntryExpression save(UserContext userContext){ + return new EntryExpression(this, $it -> ((Entry)$it).auditAs("Saved by Expression").save(userContext)); + } + + public EntryExpression save(String intent, UserContext userContext){ + return new EntryExpression(this, $it -> ((Entry)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CatalogExpression getCatalog(){ + return new CatalogExpression(loaded("catalog", "getCatalog", Entry::getCatalog)); + } + + public EntryExpression updateCatalog(Catalog catalog){ + return new EntryExpression(this, $it -> ((Entry)$it).updateCatalog(catalog)); + } + + public Expression getName(){ + return loaded("name", "getName", Entry::getName); + } + public EntryExpression updateName(String name){ + return new EntryExpression(this, $it -> ((Entry)$it).updateName(name)); + } + + public Expression getBornAt(){ + return loaded("born_at", "getBornAt", Entry::getBornAt); + } + public EntryExpression updateBornAt(LocalDateTime bornAt){ + return new EntryExpression(this, $it -> ((Entry)$it).updateBornAt(bornAt)); + } + + public Expression getTouchedAt(){ + return loaded("touched_at", "getTouchedAt", Entry::getTouchedAt); + } + public EntryExpression updateTouchedAt(LocalDateTime touchedAt){ + return new EntryExpression(this, $it -> ((Entry)$it).updateTouchedAt(touchedAt)); + } + + public Expression getSourceIp(){ + return loaded("source_ip", "getSourceIp", Entry::getSourceIp); + } + public EntryExpression updateSourceIp(String sourceIp){ + return new EntryExpression(this, $it -> ((Entry)$it).updateSourceIp(sourceIp)); + } + + public Expression getLastIp(){ + return loaded("last_ip", "getLastIp", Entry::getLastIp); + } + public EntryExpression updateLastIp(String lastIp){ + return new EntryExpression(this, $it -> ((Entry)$it).updateLastIp(lastIp)); + } + + public Expression getOpenedBy(){ + return loaded("opened_by", "getOpenedBy", Entry::getOpenedBy); + } + public EntryExpression updateOpenedBy(String openedBy){ + return new EntryExpression(this, $it -> ((Entry)$it).updateOpenedBy(openedBy)); + } + + public Expression getChangedBy(){ + return loaded("changed_by", "getChangedBy", Entry::getChangedBy); + } + public EntryExpression updateChangedBy(String changedBy){ + return new EntryExpression(this, $it -> ((Entry)$it).updateChangedBy(changedBy)); + } + + public Expression getGuardedToken(){ + return loaded("guarded_token", "getGuardedToken", Entry::getGuardedToken); + } + public EntryExpression updateGuardedToken(String guardedToken){ + return new EntryExpression(this, $it -> ((Entry)$it).updateGuardedToken(guardedToken)); + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java new file mode 100644 index 000000000..3c0ef9888 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.contextfixservice.entry; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class EntryListExpression extends SmartListExpression { + public EntryListExpression(Expression> expression){ + super(expression); + } + + public EntryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public EntryExpression first() { + return new EntryExpression(super.first()); + } + + public EntryExpression get(int index) { + return new EntryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java new file mode 100644 index 000000000..37c26d212 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java @@ -0,0 +1,1590 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.Q; +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class EntryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public EntryRequest(Class returnType){ + this(returnType, () -> (T) new Entry()); + } + + protected EntryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public EntryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public EntryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public EntryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public EntryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public EntryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public EntryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public EntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public EntryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public EntryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public EntryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public EntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (EntryRequest)super.appendSearchCriteria(searchCriteria); + } + + public EntryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public EntryRequest matchingAnyOf(EntryRequest entry){ + super.internalMatchAny(entry); + return this; + } + + public EntryRequest matchingIdsOf(EntryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Entry.ID_PROPERTY, request, Entry.ID_PROPERTY)); + } + + public EntryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public EntryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public EntryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public EntryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCatalogIdOnly().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); + } + + public EntryRequest selectSelfFields(){ + return selectSelf(); + } + + public EntryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Entry.ID_PROPERTY); + selectProperty(Entry.CATALOG_PROPERTY); + selectProperty(Entry.NAME_PROPERTY); + selectProperty(Entry.BORN_AT_PROPERTY); + selectProperty(Entry.TOUCHED_AT_PROPERTY); + selectProperty(Entry.SOURCE_IP_PROPERTY); + selectProperty(Entry.LAST_IP_PROPERTY); + selectProperty(Entry.OPENED_BY_PROPERTY); + selectProperty(Entry.CHANGED_BY_PROPERTY); + selectProperty(Entry.GUARDED_TOKEN_PROPERTY); + selectProperty(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest selectAll(){ + super.selectAll(); + return selectId().selectCatalog().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); + } + + public EntryRequest selectChildren(){ + super.selectAny(); + return selectId().selectCatalog().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); + } + + + public EntryRequest selectId(){ + selectProperty(Entry.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectId(){ + unselectProperty(Entry.ID_PROPERTY); + return this; + } + public EntryRequest selectCatalogIdOnly(){ + selectProperty(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest selectCatalog(){ + return selectCatalogWith(Q.catalogs().unlimited().selectSelf()); + } + + public EntryRequest selectCatalogWith(CatalogRequest catalog){ + selectProperty(Entry.CATALOG_PROPERTY); + enhanceRelation(Entry.CATALOG_PROPERTY, catalog, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCatalogWith", null, Entry.CATALOG_PROPERTY)); + return this; + } + + public EntryRequest unselectCatalog(){ + unselectProperty(Entry.CATALOG_PROPERTY); + return this; + } + public EntryRequest selectName(){ + selectProperty(Entry.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectName(){ + unselectProperty(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest selectBornAt(){ + selectProperty(Entry.BORN_AT_PROPERTY); + return this; + } + + /** + * fill the bornAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS bornAt) to fetch bornAt property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectBornAt(){ + unselectProperty(Entry.BORN_AT_PROPERTY); + return this; + } + public EntryRequest selectTouchedAt(){ + selectProperty(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + /** + * fill the touchedAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS touchedAt) to fetch touchedAt property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectTouchedAt(){ + unselectProperty(Entry.TOUCHED_AT_PROPERTY); + return this; + } + public EntryRequest selectSourceIp(){ + selectProperty(Entry.SOURCE_IP_PROPERTY); + return this; + } + + /** + * fill the sourceIp with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sourceIp) to fetch sourceIp property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectSourceIp(){ + unselectProperty(Entry.SOURCE_IP_PROPERTY); + return this; + } + public EntryRequest selectLastIp(){ + selectProperty(Entry.LAST_IP_PROPERTY); + return this; + } + + /** + * fill the lastIp with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS lastIp) to fetch lastIp property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectLastIp(){ + unselectProperty(Entry.LAST_IP_PROPERTY); + return this; + } + public EntryRequest selectOpenedBy(){ + selectProperty(Entry.OPENED_BY_PROPERTY); + return this; + } + + /** + * fill the openedBy with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS openedBy) to fetch openedBy property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectOpenedBy(){ + unselectProperty(Entry.OPENED_BY_PROPERTY); + return this; + } + public EntryRequest selectChangedBy(){ + selectProperty(Entry.CHANGED_BY_PROPERTY); + return this; + } + + /** + * fill the changedBy with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS changedBy) to fetch changedBy property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectChangedBy(){ + unselectProperty(Entry.CHANGED_BY_PROPERTY); + return this; + } + public EntryRequest selectGuardedToken(){ + selectProperty(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + /** + * fill the guardedToken with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS guardedToken) to fetch guardedToken property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectGuardedToken(){ + unselectProperty(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + public EntryRequest selectVersion(){ + selectProperty(Entry.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectVersion(){ + unselectProperty(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.ID_PROPERTY, operator, values); + } + + public EntryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public EntryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public EntryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public EntryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public EntryRequest filterByCatalog(Catalog... catalog){ + if (catalog == null || catalog.length == 0) { + throw new IllegalArgumentException("filterByCatalog parameter catalog cannot be empty"); + } + return appendSearchCriteria(createCatalogCriteria(Operator.EQUAL, (Object[])catalog)); + } + + public EntryRequest withCatalog(Operator operator, Object... values){ + return appendSearchCriteria(createCatalogCriteria(operator, values)); + } + + public EntryRequest withCatalogIsUnknown(){ + return withCatalog(Operator.IS_NULL); + } + + public EntryRequest withCatalogIsKnown(){ + return withCatalog(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCatalogCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.CATALOG_PROPERTY, operator, values); + } + + public EntryRequest filterByCatalog(Long catalog){ + if(catalog == null){ + return this; + } + return withCatalog(Operator.EQUAL, catalog); + } + public EntryRequest withCatalogMatching(CatalogRequest catalog){ + return appendSearchCriteria(new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY)); + } + + public EntryRequest withoutCatalogMatching(CatalogRequest catalog){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY))); + } + + public EntryRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public EntryRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public EntryRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public EntryRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.NAME_PROPERTY, operator, values); + } + + public EntryRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public EntryRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public EntryRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public EntryRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public EntryRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public EntryRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public EntryRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public EntryRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public EntryRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public EntryRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public EntryRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public EntryRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public EntryRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public EntryRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public EntryRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public EntryRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public EntryRequest filterByBornAt(LocalDateTime... bornAt){ + if (bornAt == null || bornAt.length == 0) { + throw new IllegalArgumentException("filterByBornAt parameter bornAt cannot be empty"); + } + return appendSearchCriteria(createBornAtCriteria(Operator.EQUAL, (Object[])bornAt)); + } + + public EntryRequest withBornAt(Operator operator, Object... values){ + return appendSearchCriteria(createBornAtCriteria(operator, values)); + } + + public EntryRequest withBornAtIsUnknown(){ + return withBornAt(Operator.IS_NULL); + } + + public EntryRequest withBornAtIsKnown(){ + return withBornAt(Operator.IS_NOT_NULL); + } + + public SearchCriteria createBornAtCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.BORN_AT_PROPERTY, operator, values); + } + + public EntryRequest withBornAtIs(LocalDateTime bornAt){ + return withBornAt(Operator.EQUAL, bornAt); + } + + public EntryRequest withBornAtIsNot(LocalDateTime bornAt){ + return withBornAt(Operator.NOT_EQUAL, bornAt); + } + + public EntryRequest withBornAtIn(LocalDateTime... bornAt){ + return withBornAt(Operator.IN, (Object[])bornAt); + } + + public EntryRequest withBornAtNotIn(LocalDateTime... bornAt){ + return withBornAt(Operator.NOT_IN, (Object[])bornAt); + } + public EntryRequest withBornAtGreaterThan(LocalDateTime bornAt){ + return withBornAt(Operator.GREATER_THAN, bornAt); + } + + public EntryRequest withBornAtGreaterThanOrEqualTo(LocalDateTime bornAt){ + return withBornAt(Operator.GREATER_THAN_OR_EQUAL, bornAt); + } + + public EntryRequest withBornAtLessThan(LocalDateTime bornAt){ + return withBornAt(Operator.LESS_THAN, bornAt); + } + + public EntryRequest withBornAtLessThanOrEqualTo(LocalDateTime bornAt){ + return withBornAt(Operator.LESS_THAN_OR_EQUAL, bornAt); + } + + public EntryRequest withBornAtBetween(LocalDateTime startOfBornAt, LocalDateTime endOfBornAt){ + return withBornAt(Operator.BETWEEN, startOfBornAt, endOfBornAt); + } + public EntryRequest withBornAtBefore(LocalDateTime bornAt){ + return withBornAt(Operator.LESS_THAN, bornAt); + } + + public EntryRequest withBornAtBefore(Date bornAt){ + return withBornAt(Operator.LESS_THAN, bornAt); + } + + public EntryRequest withBornAtAfter(LocalDateTime bornAt){ + return withBornAt(Operator.GREATER_THAN, bornAt); + } + + public EntryRequest withBornAtAfter(Date bornAt){ + return withBornAt(Operator.GREATER_THAN, bornAt); + } + + public EntryRequest withBornAtBetween(Date startOfBornAt, Date endOfBornAt){ + return withBornAt(Operator.BETWEEN, startOfBornAt, endOfBornAt); + } + + + + + public EntryRequest filterByTouchedAt(LocalDateTime... touchedAt){ + if (touchedAt == null || touchedAt.length == 0) { + throw new IllegalArgumentException("filterByTouchedAt parameter touchedAt cannot be empty"); + } + return appendSearchCriteria(createTouchedAtCriteria(Operator.EQUAL, (Object[])touchedAt)); + } + + public EntryRequest withTouchedAt(Operator operator, Object... values){ + return appendSearchCriteria(createTouchedAtCriteria(operator, values)); + } + + public EntryRequest withTouchedAtIsUnknown(){ + return withTouchedAt(Operator.IS_NULL); + } + + public EntryRequest withTouchedAtIsKnown(){ + return withTouchedAt(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTouchedAtCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.TOUCHED_AT_PROPERTY, operator, values); + } + + public EntryRequest withTouchedAtIs(LocalDateTime touchedAt){ + return withTouchedAt(Operator.EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtIsNot(LocalDateTime touchedAt){ + return withTouchedAt(Operator.NOT_EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtIn(LocalDateTime... touchedAt){ + return withTouchedAt(Operator.IN, (Object[])touchedAt); + } + + public EntryRequest withTouchedAtNotIn(LocalDateTime... touchedAt){ + return withTouchedAt(Operator.NOT_IN, (Object[])touchedAt); + } + public EntryRequest withTouchedAtGreaterThan(LocalDateTime touchedAt){ + return withTouchedAt(Operator.GREATER_THAN, touchedAt); + } + + public EntryRequest withTouchedAtGreaterThanOrEqualTo(LocalDateTime touchedAt){ + return withTouchedAt(Operator.GREATER_THAN_OR_EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtLessThan(LocalDateTime touchedAt){ + return withTouchedAt(Operator.LESS_THAN, touchedAt); + } + + public EntryRequest withTouchedAtLessThanOrEqualTo(LocalDateTime touchedAt){ + return withTouchedAt(Operator.LESS_THAN_OR_EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtBetween(LocalDateTime startOfTouchedAt, LocalDateTime endOfTouchedAt){ + return withTouchedAt(Operator.BETWEEN, startOfTouchedAt, endOfTouchedAt); + } + public EntryRequest withTouchedAtBefore(LocalDateTime touchedAt){ + return withTouchedAt(Operator.LESS_THAN, touchedAt); + } + + public EntryRequest withTouchedAtBefore(Date touchedAt){ + return withTouchedAt(Operator.LESS_THAN, touchedAt); + } + + public EntryRequest withTouchedAtAfter(LocalDateTime touchedAt){ + return withTouchedAt(Operator.GREATER_THAN, touchedAt); + } + + public EntryRequest withTouchedAtAfter(Date touchedAt){ + return withTouchedAt(Operator.GREATER_THAN, touchedAt); + } + + public EntryRequest withTouchedAtBetween(Date startOfTouchedAt, Date endOfTouchedAt){ + return withTouchedAt(Operator.BETWEEN, startOfTouchedAt, endOfTouchedAt); + } + + + + + public EntryRequest filterBySourceIp(String... sourceIp){ + if (sourceIp == null || sourceIp.length == 0) { + throw new IllegalArgumentException("filterBySourceIp parameter sourceIp cannot be empty"); + } + return appendSearchCriteria(createSourceIpCriteria(Operator.EQUAL, (Object[])sourceIp)); + } + + public EntryRequest withSourceIp(Operator operator, Object... values){ + return appendSearchCriteria(createSourceIpCriteria(operator, values)); + } + + public EntryRequest withSourceIpIsUnknown(){ + return withSourceIp(Operator.IS_NULL); + } + + public EntryRequest withSourceIpIsKnown(){ + return withSourceIp(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSourceIpCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.SOURCE_IP_PROPERTY, operator, values); + } + + public EntryRequest withSourceIpIsNot(String sourceIp){ + return withSourceIp(Operator.NOT_EQUAL, sourceIp); + } + + public EntryRequest withSourceIpIn(String... sourceIp){ + return withSourceIp(Operator.IN, (Object[])sourceIp); + } + + public EntryRequest withSourceIpNotIn(String... sourceIp){ + return withSourceIp(Operator.NOT_IN, (Object[])sourceIp); + } + public EntryRequest withSourceIpGreaterThan(String sourceIp){ + return withSourceIp(Operator.GREATER_THAN, sourceIp); + } + + public EntryRequest withSourceIpGreaterThanOrEqualTo(String sourceIp){ + return withSourceIp(Operator.GREATER_THAN_OR_EQUAL, sourceIp); + } + + public EntryRequest withSourceIpLessThan(String sourceIp){ + return withSourceIp(Operator.LESS_THAN, sourceIp); + } + + public EntryRequest withSourceIpLessThanOrEqualTo(String sourceIp){ + return withSourceIp(Operator.LESS_THAN_OR_EQUAL, sourceIp); + } + + public EntryRequest withSourceIpBetween(String startOfSourceIp, String endOfSourceIp){ + return withSourceIp(Operator.BETWEEN, startOfSourceIp, endOfSourceIp); + } + public EntryRequest withSourceIpStartingWith(String sourceIp){ + return withSourceIp(Operator.BEGIN_WITH, sourceIp); + } + public EntryRequest withSourceIpContaining(String sourceIp){ + return withSourceIp(Operator.CONTAIN, sourceIp); + } + + public EntryRequest withSourceIpNotContaining(String sourceIp){ + return withSourceIp(Operator.NOT_CONTAIN, sourceIp); + } + + public EntryRequest withSourceIpNotStartingWith(String sourceIp){ + return withSourceIp(Operator.NOT_BEGIN_WITH, sourceIp); + } + + public EntryRequest withSourceIpEndingWith(String sourceIp){ + return withSourceIp(Operator.END_WITH, sourceIp); + } + + public EntryRequest withSourceIpNotEndingWith(String sourceIp){ + return withSourceIp(Operator.NOT_END_WITH, sourceIp); + } + + public EntryRequest withSourceIpIs(String sourceIp){ + return withSourceIp(Operator.EQUAL, sourceIp); + } + + public EntryRequest withSourceIpSoundingLike(String sourceIp){ + return withSourceIp(Operator.SOUNDS_LIKE, sourceIp); + } + + + + public EntryRequest filterByLastIp(String... lastIp){ + if (lastIp == null || lastIp.length == 0) { + throw new IllegalArgumentException("filterByLastIp parameter lastIp cannot be empty"); + } + return appendSearchCriteria(createLastIpCriteria(Operator.EQUAL, (Object[])lastIp)); + } + + public EntryRequest withLastIp(Operator operator, Object... values){ + return appendSearchCriteria(createLastIpCriteria(operator, values)); + } + + public EntryRequest withLastIpIsUnknown(){ + return withLastIp(Operator.IS_NULL); + } + + public EntryRequest withLastIpIsKnown(){ + return withLastIp(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLastIpCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.LAST_IP_PROPERTY, operator, values); + } + + public EntryRequest withLastIpIsNot(String lastIp){ + return withLastIp(Operator.NOT_EQUAL, lastIp); + } + + public EntryRequest withLastIpIn(String... lastIp){ + return withLastIp(Operator.IN, (Object[])lastIp); + } + + public EntryRequest withLastIpNotIn(String... lastIp){ + return withLastIp(Operator.NOT_IN, (Object[])lastIp); + } + public EntryRequest withLastIpGreaterThan(String lastIp){ + return withLastIp(Operator.GREATER_THAN, lastIp); + } + + public EntryRequest withLastIpGreaterThanOrEqualTo(String lastIp){ + return withLastIp(Operator.GREATER_THAN_OR_EQUAL, lastIp); + } + + public EntryRequest withLastIpLessThan(String lastIp){ + return withLastIp(Operator.LESS_THAN, lastIp); + } + + public EntryRequest withLastIpLessThanOrEqualTo(String lastIp){ + return withLastIp(Operator.LESS_THAN_OR_EQUAL, lastIp); + } + + public EntryRequest withLastIpBetween(String startOfLastIp, String endOfLastIp){ + return withLastIp(Operator.BETWEEN, startOfLastIp, endOfLastIp); + } + public EntryRequest withLastIpStartingWith(String lastIp){ + return withLastIp(Operator.BEGIN_WITH, lastIp); + } + public EntryRequest withLastIpContaining(String lastIp){ + return withLastIp(Operator.CONTAIN, lastIp); + } + + public EntryRequest withLastIpNotContaining(String lastIp){ + return withLastIp(Operator.NOT_CONTAIN, lastIp); + } + + public EntryRequest withLastIpNotStartingWith(String lastIp){ + return withLastIp(Operator.NOT_BEGIN_WITH, lastIp); + } + + public EntryRequest withLastIpEndingWith(String lastIp){ + return withLastIp(Operator.END_WITH, lastIp); + } + + public EntryRequest withLastIpNotEndingWith(String lastIp){ + return withLastIp(Operator.NOT_END_WITH, lastIp); + } + + public EntryRequest withLastIpIs(String lastIp){ + return withLastIp(Operator.EQUAL, lastIp); + } + + public EntryRequest withLastIpSoundingLike(String lastIp){ + return withLastIp(Operator.SOUNDS_LIKE, lastIp); + } + + + + public EntryRequest filterByOpenedBy(String... openedBy){ + if (openedBy == null || openedBy.length == 0) { + throw new IllegalArgumentException("filterByOpenedBy parameter openedBy cannot be empty"); + } + return appendSearchCriteria(createOpenedByCriteria(Operator.EQUAL, (Object[])openedBy)); + } + + public EntryRequest withOpenedBy(Operator operator, Object... values){ + return appendSearchCriteria(createOpenedByCriteria(operator, values)); + } + + public EntryRequest withOpenedByIsUnknown(){ + return withOpenedBy(Operator.IS_NULL); + } + + public EntryRequest withOpenedByIsKnown(){ + return withOpenedBy(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOpenedByCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.OPENED_BY_PROPERTY, operator, values); + } + + public EntryRequest withOpenedByIsNot(String openedBy){ + return withOpenedBy(Operator.NOT_EQUAL, openedBy); + } + + public EntryRequest withOpenedByIn(String... openedBy){ + return withOpenedBy(Operator.IN, (Object[])openedBy); + } + + public EntryRequest withOpenedByNotIn(String... openedBy){ + return withOpenedBy(Operator.NOT_IN, (Object[])openedBy); + } + public EntryRequest withOpenedByGreaterThan(String openedBy){ + return withOpenedBy(Operator.GREATER_THAN, openedBy); + } + + public EntryRequest withOpenedByGreaterThanOrEqualTo(String openedBy){ + return withOpenedBy(Operator.GREATER_THAN_OR_EQUAL, openedBy); + } + + public EntryRequest withOpenedByLessThan(String openedBy){ + return withOpenedBy(Operator.LESS_THAN, openedBy); + } + + public EntryRequest withOpenedByLessThanOrEqualTo(String openedBy){ + return withOpenedBy(Operator.LESS_THAN_OR_EQUAL, openedBy); + } + + public EntryRequest withOpenedByBetween(String startOfOpenedBy, String endOfOpenedBy){ + return withOpenedBy(Operator.BETWEEN, startOfOpenedBy, endOfOpenedBy); + } + public EntryRequest withOpenedByStartingWith(String openedBy){ + return withOpenedBy(Operator.BEGIN_WITH, openedBy); + } + public EntryRequest withOpenedByContaining(String openedBy){ + return withOpenedBy(Operator.CONTAIN, openedBy); + } + + public EntryRequest withOpenedByNotContaining(String openedBy){ + return withOpenedBy(Operator.NOT_CONTAIN, openedBy); + } + + public EntryRequest withOpenedByNotStartingWith(String openedBy){ + return withOpenedBy(Operator.NOT_BEGIN_WITH, openedBy); + } + + public EntryRequest withOpenedByEndingWith(String openedBy){ + return withOpenedBy(Operator.END_WITH, openedBy); + } + + public EntryRequest withOpenedByNotEndingWith(String openedBy){ + return withOpenedBy(Operator.NOT_END_WITH, openedBy); + } + + public EntryRequest withOpenedByIs(String openedBy){ + return withOpenedBy(Operator.EQUAL, openedBy); + } + + public EntryRequest withOpenedBySoundingLike(String openedBy){ + return withOpenedBy(Operator.SOUNDS_LIKE, openedBy); + } + + + + public EntryRequest filterByChangedBy(String... changedBy){ + if (changedBy == null || changedBy.length == 0) { + throw new IllegalArgumentException("filterByChangedBy parameter changedBy cannot be empty"); + } + return appendSearchCriteria(createChangedByCriteria(Operator.EQUAL, (Object[])changedBy)); + } + + public EntryRequest withChangedBy(Operator operator, Object... values){ + return appendSearchCriteria(createChangedByCriteria(operator, values)); + } + + public EntryRequest withChangedByIsUnknown(){ + return withChangedBy(Operator.IS_NULL); + } + + public EntryRequest withChangedByIsKnown(){ + return withChangedBy(Operator.IS_NOT_NULL); + } + + public SearchCriteria createChangedByCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.CHANGED_BY_PROPERTY, operator, values); + } + + public EntryRequest withChangedByIsNot(String changedBy){ + return withChangedBy(Operator.NOT_EQUAL, changedBy); + } + + public EntryRequest withChangedByIn(String... changedBy){ + return withChangedBy(Operator.IN, (Object[])changedBy); + } + + public EntryRequest withChangedByNotIn(String... changedBy){ + return withChangedBy(Operator.NOT_IN, (Object[])changedBy); + } + public EntryRequest withChangedByGreaterThan(String changedBy){ + return withChangedBy(Operator.GREATER_THAN, changedBy); + } + + public EntryRequest withChangedByGreaterThanOrEqualTo(String changedBy){ + return withChangedBy(Operator.GREATER_THAN_OR_EQUAL, changedBy); + } + + public EntryRequest withChangedByLessThan(String changedBy){ + return withChangedBy(Operator.LESS_THAN, changedBy); + } + + public EntryRequest withChangedByLessThanOrEqualTo(String changedBy){ + return withChangedBy(Operator.LESS_THAN_OR_EQUAL, changedBy); + } + + public EntryRequest withChangedByBetween(String startOfChangedBy, String endOfChangedBy){ + return withChangedBy(Operator.BETWEEN, startOfChangedBy, endOfChangedBy); + } + public EntryRequest withChangedByStartingWith(String changedBy){ + return withChangedBy(Operator.BEGIN_WITH, changedBy); + } + public EntryRequest withChangedByContaining(String changedBy){ + return withChangedBy(Operator.CONTAIN, changedBy); + } + + public EntryRequest withChangedByNotContaining(String changedBy){ + return withChangedBy(Operator.NOT_CONTAIN, changedBy); + } + + public EntryRequest withChangedByNotStartingWith(String changedBy){ + return withChangedBy(Operator.NOT_BEGIN_WITH, changedBy); + } + + public EntryRequest withChangedByEndingWith(String changedBy){ + return withChangedBy(Operator.END_WITH, changedBy); + } + + public EntryRequest withChangedByNotEndingWith(String changedBy){ + return withChangedBy(Operator.NOT_END_WITH, changedBy); + } + + public EntryRequest withChangedByIs(String changedBy){ + return withChangedBy(Operator.EQUAL, changedBy); + } + + public EntryRequest withChangedBySoundingLike(String changedBy){ + return withChangedBy(Operator.SOUNDS_LIKE, changedBy); + } + + + + public EntryRequest filterByGuardedToken(String... guardedToken){ + if (guardedToken == null || guardedToken.length == 0) { + throw new IllegalArgumentException("filterByGuardedToken parameter guardedToken cannot be empty"); + } + return appendSearchCriteria(createGuardedTokenCriteria(Operator.EQUAL, (Object[])guardedToken)); + } + + public EntryRequest withGuardedToken(Operator operator, Object... values){ + return appendSearchCriteria(createGuardedTokenCriteria(operator, values)); + } + + public EntryRequest withGuardedTokenIsUnknown(){ + return withGuardedToken(Operator.IS_NULL); + } + + public EntryRequest withGuardedTokenIsKnown(){ + return withGuardedToken(Operator.IS_NOT_NULL); + } + + public SearchCriteria createGuardedTokenCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.GUARDED_TOKEN_PROPERTY, operator, values); + } + + public EntryRequest withGuardedTokenIsNot(String guardedToken){ + return withGuardedToken(Operator.NOT_EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenIn(String... guardedToken){ + return withGuardedToken(Operator.IN, (Object[])guardedToken); + } + + public EntryRequest withGuardedTokenNotIn(String... guardedToken){ + return withGuardedToken(Operator.NOT_IN, (Object[])guardedToken); + } + public EntryRequest withGuardedTokenGreaterThan(String guardedToken){ + return withGuardedToken(Operator.GREATER_THAN, guardedToken); + } + + public EntryRequest withGuardedTokenGreaterThanOrEqualTo(String guardedToken){ + return withGuardedToken(Operator.GREATER_THAN_OR_EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenLessThan(String guardedToken){ + return withGuardedToken(Operator.LESS_THAN, guardedToken); + } + + public EntryRequest withGuardedTokenLessThanOrEqualTo(String guardedToken){ + return withGuardedToken(Operator.LESS_THAN_OR_EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenBetween(String startOfGuardedToken, String endOfGuardedToken){ + return withGuardedToken(Operator.BETWEEN, startOfGuardedToken, endOfGuardedToken); + } + public EntryRequest withGuardedTokenStartingWith(String guardedToken){ + return withGuardedToken(Operator.BEGIN_WITH, guardedToken); + } + public EntryRequest withGuardedTokenContaining(String guardedToken){ + return withGuardedToken(Operator.CONTAIN, guardedToken); + } + + public EntryRequest withGuardedTokenNotContaining(String guardedToken){ + return withGuardedToken(Operator.NOT_CONTAIN, guardedToken); + } + + public EntryRequest withGuardedTokenNotStartingWith(String guardedToken){ + return withGuardedToken(Operator.NOT_BEGIN_WITH, guardedToken); + } + + public EntryRequest withGuardedTokenEndingWith(String guardedToken){ + return withGuardedToken(Operator.END_WITH, guardedToken); + } + + public EntryRequest withGuardedTokenNotEndingWith(String guardedToken){ + return withGuardedToken(Operator.NOT_END_WITH, guardedToken); + } + + public EntryRequest withGuardedTokenIs(String guardedToken){ + return withGuardedToken(Operator.EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenSoundingLike(String guardedToken){ + return withGuardedToken(Operator.SOUNDS_LIKE, guardedToken); + } + + + + public EntryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public EntryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public EntryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public EntryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.VERSION_PROPERTY, operator, values); + } + + public EntryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public EntryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public EntryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public EntryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public EntryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public EntryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public EntryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public EntryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public EntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public EntryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public EntryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public EntryRequest groupByCatalogWithDetails(){ + return groupByCatalogWithDetails(Q.catalogs().unlimited()); + } + + public EntryRequest groupByCatalogWithDetails(CatalogRequest subRequest){ + aggregate(Entry.CATALOG_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + + public EntryRequest groupById(){ + groupBy(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest groupByIdAs(String retName){ + groupBy(retName, Entry.ID_PROPERTY); + return this; + } + + public EntryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.ID_PROPERTY, function); + return this; + } + public EntryRequest groupByCatalogWith(CatalogRequest subRequest){ + groupBy(Entry.CATALOG_PROPERTY, subRequest); + return this; + } + public EntryRequest groupByCatalog(){ + groupBy(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest groupByCatalogAs(String retName){ + groupBy(retName, Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest groupByCatalogWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.CATALOG_PROPERTY, function); + return this; + } + + public EntryRequest groupByName(){ + groupBy(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest groupByNameAs(String retName){ + groupBy(retName, Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.NAME_PROPERTY, function); + return this; + } + + public EntryRequest groupByBornAt(){ + groupBy(Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest groupByBornAtAs(String retName){ + groupBy(retName, Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest groupByBornAtWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.BORN_AT_PROPERTY, function); + return this; + } + + public EntryRequest groupByTouchedAt(){ + groupBy(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest groupByTouchedAtAs(String retName){ + groupBy(retName, Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest groupByTouchedAtWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.TOUCHED_AT_PROPERTY, function); + return this; + } + + public EntryRequest groupBySourceIp(){ + groupBy(Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest groupBySourceIpAs(String retName){ + groupBy(retName, Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest groupBySourceIpWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.SOURCE_IP_PROPERTY, function); + return this; + } + + public EntryRequest groupByLastIp(){ + groupBy(Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest groupByLastIpAs(String retName){ + groupBy(retName, Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest groupByLastIpWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.LAST_IP_PROPERTY, function); + return this; + } + + public EntryRequest groupByOpenedBy(){ + groupBy(Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByOpenedByAs(String retName){ + groupBy(retName, Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByOpenedByWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.OPENED_BY_PROPERTY, function); + return this; + } + + public EntryRequest groupByChangedBy(){ + groupBy(Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByChangedByAs(String retName){ + groupBy(retName, Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByChangedByWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.CHANGED_BY_PROPERTY, function); + return this; + } + + public EntryRequest groupByGuardedToken(){ + groupBy(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest groupByGuardedTokenAs(String retName){ + groupBy(retName, Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest groupByGuardedTokenWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.GUARDED_TOKEN_PROPERTY, function); + return this; + } + + public EntryRequest groupByVersion(){ + groupBy(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupByVersionAs(String retName){ + groupBy(retName, Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.VERSION_PROPERTY, function); + return this; + } + + + + public EntryRequest orderByIdAscending(){ + addOrderByAscending(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest orderByIdDescending(){ + addOrderByDescending(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest orderByCatalogAscending(){ + addOrderByAscending(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest orderByCatalogDescending(){ + addOrderByDescending(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest orderByNameAscending(){ + addOrderByAscending(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest orderByNameDescending(){ + addOrderByDescending(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest orderByBornAtAscending(){ + addOrderByAscending(Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest orderByBornAtDescending(){ + addOrderByDescending(Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest orderByTouchedAtAscending(){ + addOrderByAscending(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest orderByTouchedAtDescending(){ + addOrderByDescending(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest orderBySourceIpAscending(){ + addOrderByAscending(Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest orderBySourceIpDescending(){ + addOrderByDescending(Entry.SOURCE_IP_PROPERTY); + return this; + } + public EntryRequest orderBySourceIpAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest orderBySourceIpDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.SOURCE_IP_PROPERTY); + return this; + } + public EntryRequest orderByLastIpAscending(){ + addOrderByAscending(Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest orderByLastIpDescending(){ + addOrderByDescending(Entry.LAST_IP_PROPERTY); + return this; + } + public EntryRequest orderByLastIpAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest orderByLastIpDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.LAST_IP_PROPERTY); + return this; + } + public EntryRequest orderByOpenedByAscending(){ + addOrderByAscending(Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByOpenedByDescending(){ + addOrderByDescending(Entry.OPENED_BY_PROPERTY); + return this; + } + public EntryRequest orderByOpenedByAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByOpenedByDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.OPENED_BY_PROPERTY); + return this; + } + public EntryRequest orderByChangedByAscending(){ + addOrderByAscending(Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByChangedByDescending(){ + addOrderByDescending(Entry.CHANGED_BY_PROPERTY); + return this; + } + public EntryRequest orderByChangedByAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByChangedByDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.CHANGED_BY_PROPERTY); + return this; + } + public EntryRequest orderByGuardedTokenAscending(){ + addOrderByAscending(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest orderByGuardedTokenDescending(){ + addOrderByDescending(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + public EntryRequest orderByGuardedTokenAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest orderByGuardedTokenDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + public EntryRequest orderByVersionAscending(){ + addOrderByAscending(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest orderByVersionDescending(){ + addOrderByDescending(Entry.VERSION_PROPERTY); + return this; + } + + + public CatalogRequest rollUpToCatalog(){ + CatalogRequest catalog = Q.catalogs().unlimited(); + this.withCatalogMatching(catalog) + .groupByCatalogWith(catalog); + return catalog; + } + + + + + + + + + + + + public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog){ + return facetByCatalogAs(facetName, catalog, true); + } + + public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog, boolean includeAllFacets){ + addFacet(facetName, Entry.CATALOG_PROPERTY, catalog, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCatalogAs", facetName, Entry.CATALOG_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public EntryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public EntryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public EntryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public EntryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public EntryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public EntryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..5da6f9001 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.contextfixservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/pom.xml b/examples/conformance/context-derived/java-app-console/pom.xml new file mode 100644 index 000000000..92999c158 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/pom.xml @@ -0,0 +1 @@ +4.0.0io.teaqlteaql-java-parent6.3.0../../../../pom.xmlio.teaql.examplescontext-fix-consumer6.3.0com.examplecontext-fix-service-core0.0.1-SNAPSHOTio.teaqlteaql-runtime6.3.0io.teaqlteaql-provider-jdbc6.3.0io.teaqlteaql-sqlite6.3.0io.teaqlteaql-dynamic-fields-jdbc6.3.0junitjunit4.13.2testshowcase-mainshowcase-testsorg.apache.maven.pluginsmaven-surefire-pluginfalse diff --git a/examples/conformance/context-derived/GeneratedContextFixTest.java b/examples/conformance/context-derived/java-app-console/showcase-tests/io/teaql/examples/contextfix/GeneratedContextFixTest.java similarity index 100% rename from examples/conformance/context-derived/GeneratedContextFixTest.java rename to examples/conformance/context-derived/java-app-console/showcase-tests/io/teaql/examples/contextfix/GeneratedContextFixTest.java diff --git a/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/App.java b/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/App.java new file mode 100644 index 000000000..d8f657c40 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/App.java @@ -0,0 +1,99 @@ + +package com.example.contextfixservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/CustomUserContext.java b/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/CustomUserContext.java new file mode 100644 index 000000000..fa5ec6490 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.contextfixservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements ContextFixServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/WorkspaceTeaQLDatabase.java b/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..e5e84e2a7 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/src/main/java/com/example/contextfixservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.contextfixservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/src/main/resources/application.properties b/examples/conformance/context-derived/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..4c4df3a6b --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:contextfixservice.db diff --git a/examples/conformance/context-derived/java-app-console/teaql-i18n.json b/examples/conformance/context-derived/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..c64cb98a2 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/teaql-i18n.json @@ -0,0 +1,112 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "entity.catalog": "Catalog", + "property.entry.name": "Name", + "property.catalog.id": "Id", + "property.entry.touchedAt": "Touched At", + "property.entry.lastIp": "Last Ip", + "property.entry.id": "Id", + "property.entry.changedBy": "Changed By", + "property.catalog.name": "Name", + "property.catalog.version": "Version", + "property.entry.sourceIp": "Source Ip", + "property.entry.version": "Version", + "property.entry.openedBy": "Opened By", + "entity.entry": "Entry", + "property.entry.guardedToken": "Guarded Token", + "property.entry.bornAt": "Born At", + "property.entry.catalog": "Catalog" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/teaql/model-provenance.json b/examples/conformance/context-derived/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..12882c218 --- /dev/null +++ b/examples/conformance/context-derived/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:7b6c0098ed7adda7c9ba6d7969972b9a13b677e930e1b70d98b8aca4ca8e05e2","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/current-generator-fixture.json b/examples/conformance/context-derived/java-lib-core/current-generator-fixture.json new file mode 100644 index 000000000..dceb8cb7a --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/current-generator-fixture.json @@ -0,0 +1,36 @@ +{ + "applicationManifestsPreserved": false, + "evaluatedScope": "java-lib-core", + "evaluationErrors": 0, + "files": { + "lib/pom.xml": "35af082fc6aab70f3cdc87f8d3d41be2686297a51ffb220105322ead67cfdedf", + "lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/contextfixservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/contextfixservice/Constants.java": "3c0502eaaa2a2aaea2503fe1c700c4902e1766caf2b3db5ce7631268846715df", + "lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java": "86503139320fff959fe7e647781e51acb35ebf1b9c11aa53bbe79a508a14f4b5", + "lib/src/main/java/com/example/contextfixservice/E.java": "655904f161dfb15713f58aac7cca1ac4db0a76ea67ef11575e37f9965d2b2aaf", + "lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java": "60a47ccacb1f2f9581067b38a9d2639e46a52299778e5bd0f92c8ad612cceac4", + "lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java": "641c1efd2cf75f5b73a75a0e59b7d47eb67fe2b5dde8abf706db5cc686c6f96a", + "lib/src/main/java/com/example/contextfixservice/Q.java": "71ee43beda34f940ec0815aea9312f2d29d4fb218e1d50a419fec84d90591000", + "lib/src/main/java/com/example/contextfixservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java": "0de7cc1b4adb23bd8dd01b5e88de83de858c1a48d31af01cdfb3b676ab1cf55e", + "lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java": "ab950dbd72ef028423238bb148b60cd805ceb513b7c967e6795577063a1b247e", + "lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java": "4201917d77ee847298abff38c2e8e6d821e68bba60e2e6e6b610bc59851e9553", + "lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java": "cddfca7d41e8112294ff0bf34ee59270177d7480249d130dc61a63a539f42c49", + "lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java": "1106f2157a96335bb6ff4e0d8d88aa59a21ea544a4d648e4fe12a00b0d05783c", + "lib/src/main/java/com/example/contextfixservice/entry/Entry.java": "657f36230a7f6da7bac4d5e95acc9a1d65962fc67ef58e5536ba2311055c972f", + "lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java": "7b02cc075dc39f296d9c4126c66b7a85e5bb3ebdb0c0154026309d37b255ccc2", + "lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java": "5cda4d60429e76b29cc176a3f412add939bc3140bc152c5e2eeb5a90ac74db87", + "lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java": "a3df8cb675fc122c15b116f5d7f609c45b24addd8c3c1bac137c44bf19572221", + "lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java": "f0c9abe89a3173fef147f4664e18ecf4eead559aa5444852fee98aaf7960f5a8", + "lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "a559507aefd933185ba6026a0d6fd55bfee397855be3ab248aa7f6c911477846", + "teaql/model-provenance.json": "945e773b93ef9fbc28eaeeef3f2783fc15941ba6fbc32084fc23184c0ae31cce" + }, + "generatedManifestSha256": "2dee65cb3eb73e6f4db0750a281bcc44913dcdc7e4ee98445163f9c468bebbce", + "generationReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/context-field-qualified-generation/java/context-field-showcase/library/receipt.json", + "language": "java", + "modelSha256": "ad6f3616d5bc004471e31a97000cc79b90c28ef1300b9dfe0aeca6e53e52b634", + "producerReceiptSha256": "c660638b8ed31cbada7ac4b37c7dfc08e78a4bb04ab2f3eeed60c32fd50e8bd5", + "schema": "teaql.current-model-scope-fixture/v1" +} diff --git a/examples/conformance/context-derived/java-lib-core/lib/pom.xml b/examples/conformance/context-derived/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..d0211c3bd --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + context-fix-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 1.556-RELEASE + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Checkers.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Constants.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Constants.java new file mode 100644 index 000000000..f359466e1 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.contextfixservice; + +import com.example.contextfixservice.catalog.Catalog; + +public interface Constants { + public static final long CATALOG_ID = 1l; + public static final Catalog CATALOG = Catalog.refer(CATALOG_ID); +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java new file mode 100644 index 000000000..4e02f8d3f --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java @@ -0,0 +1,13 @@ + +package com.example.contextfixservice; + +import io.teaql.core.UserContext; +public interface ContextFixServiceUserContext extends UserContext{ + public default String uniStr(String prefix){ + throw new RuntimeException("not implemented yet"); + } + + + + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/E.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/E.java new file mode 100644 index 000000000..ce74647eb --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/E.java @@ -0,0 +1,18 @@ + +package com.example.contextfixservice; + +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogExpression; +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static CatalogExpression catalog(Catalog catalog){ + return new CatalogExpression(new ValueExpression(catalog, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.catalog()")); + } + public static EntryExpression entry(Entry entry){ + return new EntryExpression(new ValueExpression(entry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.entry()")); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java new file mode 100644 index 000000000..63dfbe7b2 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java @@ -0,0 +1,501 @@ + +package com.example.contextfixservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerCatalog(); + registerEntry(); + } + private void registerCatalog() { + FieldLayout.installGenerated(com.example.contextfixservice.catalog.Catalog.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.contextfixservice.catalog.Catalog.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.contextfixservice.catalog.Catalog.class); + entityDescriptor.setEntitySupplier(com.example.contextfixservice.catalog.Catalog::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Catalog") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerEntry() { + FieldLayout.installGenerated(com.example.contextfixservice.entry.Entry.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.contextfixservice.entry.Entry.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.contextfixservice.entry.Entry.class); + entityDescriptor.setEntitySupplier(com.example.contextfixservice.entry.Entry::new); + entityDescriptor.with("audit_mask_fields", "guarded_token") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY, Long.class) + ; + PropertyDescriptor catalog = + entityDescriptor.addObjectProperty($factory, com.example.contextfixservice.entry.Entry.CATALOG_PROPERTY, com.example.contextfixservice.catalog.Catalog.INTERNAL_TYPE, com.example.contextfixservice.catalog.Catalog.ENTRY_LIST_PROPERTY, com.example.contextfixservice.catalog.Catalog.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY, String.class) + ; + PropertyDescriptor bornAt = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor touchedAt = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor sourceIp = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY, String.class) + ; + PropertyDescriptor lastIp = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY, String.class) + ; + PropertyDescriptor openedBy = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY, String.class) + ; + PropertyDescriptor changedBy = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY, String.class) + ; + PropertyDescriptor guardedToken = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CATALOG_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("prefix", "") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("createFunction", "uniStr") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + + .with("createFunctionArgNames", "prefix") + ; + + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..9ad995608 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java @@ -0,0 +1,36 @@ +package com.example.contextfixservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.contextfixservice.catalog.CatalogChecker(), new com.example.contextfixservice.entry.EntryChecker()) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Catalog", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Entry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("catalog", "catalog"), java.util.Map.entry("name", "name"), java.util.Map.entry("born_at", "bornAt"), java.util.Map.entry("touched_at", "touchedAt"), java.util.Map.entry("source_ip", "sourceIp"), java.util.Map.entry("last_ip", "lastIp"), java.util.Map.entry("opened_by", "openedBy"), java.util.Map.entry("changed_by", "changedBy"), java.util.Map.entry("guarded_token", "guardedToken"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.catalogs().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.contextfixservice.catalog.Catalog domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.contextfixservice.catalog.Catalog(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Catalog"); + domainRoot.auditAs("create generated Domain Root Catalog").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Catalog", domainRoot.getId())); + } +} diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Q.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Q.java new file mode 100644 index 000000000..b8c9d8f3a --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.contextfixservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.contextfixservice.catalog.CatalogRequest catalogs(){ + return new com.example.contextfixservice.catalog.CatalogRequest(com.example.contextfixservice.catalog.Catalog.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.contextfixservice.catalog.CatalogRequest catalogsWithMinimalFields(){ + return new com.example.contextfixservice.catalog.CatalogRequest(com.example.contextfixservice.catalog.Catalog.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.contextfixservice.entry.EntryRequest entries(){ + return new com.example.contextfixservice.entry.EntryRequest(com.example.contextfixservice.entry.Entry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.contextfixservice.entry.EntryRequest entriesWithMinimalFields(){ + return new com.example.contextfixservice.entry.EntryRequest(com.example.contextfixservice.entry.Entry.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Repositories.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java new file mode 100644 index 000000000..7ab1bb4e6 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java @@ -0,0 +1,130 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.entry.Entry; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Catalog extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Catalog"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "0dcb16e6cbbd1798e584c9779cf0bb7037ed8624c44749752b291414d58d4dd5"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "entry_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Catalog.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String ENTRY_LIST_PROPERTY = "entry_list"; + private String name; + + private SmartList entryList; + + public String getName(){ + return this.name; + } + + public SmartList getEntryList(){ + return this.entryList == null ? SmartList.unloaded() : this.entryList; + } + public Catalog updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Catalog addEntry(Entry entry){ + if (entry == null){ + return this; + } + + if(null == this.entryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.entryList = teaqlUnloadedItems.map(value -> value); + } + + this.entryList.add(entry); + entry.updateCatalog(this); + return this; + } + + public static Catalog refer(Long id){ + Catalog refer = new Catalog(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Catalog comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "entry_list": this.entryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "entry_list": return this.entryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java new file mode 100644 index 000000000..b00ede579 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java @@ -0,0 +1,52 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CatalogChecker implements Checker{ + + public String type(){ + return Catalog.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + if(needCheck(_context, catalog)){ + markAsChecked(_context, catalog); + doCheck(_context, catalog, _parentLocation); + } + } + + public void doCheck(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + if((catalog == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, catalog); + if(catalog.needPersist()){ + } + if(catalog.newItem()){ + }else if(catalog.updateItem()){ + if(!catalog.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, catalog.getProperty(Catalog.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; catalog.getEntryList() != null && i < catalog.getEntryList().size(); i++){ + Entry entry = catalog.getEntryList().get(i); + new EntryChecker().checkAndFix(_context, entry, newLocation(_parentLocation, "entry_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java new file mode 100644 index 000000000..34e0edeb3 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java @@ -0,0 +1,51 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CatalogExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CatalogExpression(Expression expression){ + super(expression); + } + + public CatalogExpression(Expression expression, Function function){ + super(expression, function); + } + + public CatalogExpression updateId(Long id){ + return new CatalogExpression(this, $it -> {((Catalog)$it).__internalSet("id", id); return this;}); + } + + public CatalogExpression save(UserContext userContext){ + return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CatalogExpression save(String intent, UserContext userContext){ + return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Catalog::getName); + } + public CatalogExpression updateName(String name){ + return new CatalogExpression(this, $it -> ((Catalog)$it).updateName(name)); + } + + public EntryListExpression getEntryList(){ + return new EntryListExpression(loaded("entry_list", "getEntryList", Catalog::getEntryList)); + } + public CatalogExpression addEntry(Entry entry){ + return new CatalogExpression(this, $it -> ((Catalog)$it).addEntry(entry)); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java new file mode 100644 index 000000000..a10d96871 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java @@ -0,0 +1,25 @@ + +package com.example.contextfixservice.catalog; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CatalogListExpression extends SmartListExpression { + public CatalogListExpression(Expression> expression){ + super(expression); + } + + public CatalogListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CatalogExpression first() { + return new CatalogExpression(super.first()); + } + + public CatalogExpression get(int index) { + return new CatalogExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java new file mode 100644 index 000000000..c88d47e91 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java @@ -0,0 +1,586 @@ + +package com.example.contextfixservice.catalog; + +import com.example.contextfixservice.Q; +import com.example.contextfixservice.entry.Entry; +import com.example.contextfixservice.entry.EntryRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CatalogRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CatalogRequest(Class returnType){ + this(returnType, () -> (T) new Catalog()); + } + + protected CatalogRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CatalogRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CatalogRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CatalogRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CatalogRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CatalogRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CatalogRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CatalogRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CatalogRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CatalogRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CatalogRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CatalogRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CatalogRequest)super.appendSearchCriteria(searchCriteria); + } + + public CatalogRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CatalogRequest matchingAnyOf(CatalogRequest catalog){ + super.internalMatchAny(catalog); + return this; + } + + public CatalogRequest matchingIdsOf(CatalogRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Catalog.ID_PROPERTY, request, Catalog.ID_PROPERTY)); + } + + public CatalogRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CatalogRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CatalogRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CatalogRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public CatalogRequest selectSelfFields(){ + return selectSelf(); + } + + public CatalogRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Catalog.ID_PROPERTY); + selectProperty(Catalog.NAME_PROPERTY); + selectProperty(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public CatalogRequest selectChildren(){ + super.selectAny(); + selectEntryList(); + return selectId().selectName().selectVersion(); + } + + + public CatalogRequest selectId(){ + selectProperty(Catalog.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectId(){ + unselectProperty(Catalog.ID_PROPERTY); + return this; + } + public CatalogRequest selectName(){ + selectProperty(Catalog.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectName(){ + unselectProperty(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest selectVersion(){ + selectProperty(Catalog.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CatalogRequest unselectVersion(){ + unselectProperty(Catalog.VERSION_PROPERTY); + return this; + } + public CatalogRequest selectEntryList(){ + return selectEntryListWith(Q.entries().selectSelf()); + } + + public CatalogRequest selectEntryListWith(EntryRequest entryList){ + enhanceRelation(Catalog.ENTRY_LIST_PROPERTY, entryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectEntryListWith", null, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.ID_PROPERTY, operator, values); + } + + public CatalogRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CatalogRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CatalogRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CatalogRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CatalogRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CatalogRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CatalogRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CatalogRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.NAME_PROPERTY, operator, values); + } + + public CatalogRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CatalogRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CatalogRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CatalogRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CatalogRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CatalogRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CatalogRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CatalogRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CatalogRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CatalogRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CatalogRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CatalogRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CatalogRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CatalogRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CatalogRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CatalogRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CatalogRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CatalogRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CatalogRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CatalogRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Catalog.VERSION_PROPERTY, operator, values); + } + + public CatalogRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CatalogRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CatalogRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CatalogRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CatalogRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CatalogRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CatalogRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CatalogRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CatalogRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CatalogRequest withEntryListMatching(EntryRequest entryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY)); + } + + public CatalogRequest withoutEntryListMatching(EntryRequest entryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY))); + } + + public CatalogRequest haveEntries(){ + return withEntryListMatching(Q.entries().unlimited()); + } + + public CatalogRequest haveNoEntries(){ + return withoutEntryListMatching(Q.entries().unlimited()); + } + + public CatalogRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CatalogRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CatalogRequest groupByEntriesWithDetails(EntryRequest subRequest){ + aggregate(Catalog.ENTRY_LIST_PROPERTY, subRequest); + return this; + } + + public CatalogRequest groupById(){ + groupBy(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest groupByIdAs(String retName){ + groupBy(retName, Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.ID_PROPERTY, function); + return this; + } + + public CatalogRequest groupByName(){ + groupBy(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest groupByNameAs(String retName){ + groupBy(retName, Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.NAME_PROPERTY, function); + return this; + } + + public CatalogRequest groupByVersion(){ + groupBy(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest groupByVersionAs(String retName){ + groupBy(retName, Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Catalog.VERSION_PROPERTY, function); + return this; + } + + + + public CatalogRequest orderByIdAscending(){ + addOrderByAscending(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest orderByIdDescending(){ + addOrderByDescending(Catalog.ID_PROPERTY); + return this; + } + + public CatalogRequest orderByNameAscending(){ + addOrderByAscending(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest orderByNameDescending(){ + addOrderByDescending(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Catalog.NAME_PROPERTY); + return this; + } + + public CatalogRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Catalog.NAME_PROPERTY); + return this; + } + public CatalogRequest orderByVersionAscending(){ + addOrderByAscending(Catalog.VERSION_PROPERTY); + return this; + } + + public CatalogRequest orderByVersionDescending(){ + addOrderByDescending(Catalog.VERSION_PROPERTY); + return this; + } + + + public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest){ + return statsFromEntriesAs(name, subRequest, false); + } + + public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Entry.CATALOG_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest statsFromEntries(EntryRequest subRequest){ + return statsFromEntriesAs(REFINEMENTS, subRequest); + } + public CatalogRequest countEntries(){ + addRelationCount("Count", Q.entries().unlimited(), Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntries", null, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest countEntriesAs(String name){ + addRelationCount(name, Q.entries().unlimited(), Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + public CatalogRequest countEntriesWith(String name, EntryRequest subRequest){ + addRelationCount(name, subRequest, Entry.CATALOG_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesWith", name, Catalog.ENTRY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public CatalogRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CatalogRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CatalogRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CatalogRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CatalogRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CatalogRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/Entry.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/Entry.java new file mode 100644 index 000000000..c4f863c90 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/Entry.java @@ -0,0 +1,274 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.catalog.Catalog; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Entry extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Entry"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7ae3f6f25be2681c105a55532a8c60a599eada522a7c70284e22e2172db13492"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("catalog", 1), java.util.Map.entry("name", 2), java.util.Map.entry("born_at", 3), java.util.Map.entry("touched_at", 4), java.util.Map.entry("source_ip", 5), java.util.Map.entry("last_ip", 6), java.util.Map.entry("opened_by", 7), java.util.Map.entry("changed_by", 8), java.util.Map.entry("guarded_token", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("catalog", java.util.List.of("catalog", "catalog")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("born_at", java.util.List.of("bornAt", "born_at")), java.util.Map.entry("touched_at", java.util.List.of("touchedAt", "touched_at")), java.util.Map.entry("source_ip", java.util.List.of("sourceIp", "source_ip")), java.util.Map.entry("last_ip", java.util.List.of("lastIp", "last_ip")), java.util.Map.entry("opened_by", java.util.List.of("openedBy", "opened_by")), java.util.Map.entry("changed_by", java.util.List.of("changedBy", "changed_by")), java.util.Map.entry("guarded_token", java.util.List.of("guardedToken", "guarded_token")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Entry.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CATALOG_PROPERTY = "catalog"; + public static final String NAME_PROPERTY = "name"; + public static final String BORN_AT_PROPERTY = "born_at"; + public static final String TOUCHED_AT_PROPERTY = "touched_at"; + public static final String SOURCE_IP_PROPERTY = "source_ip"; + public static final String LAST_IP_PROPERTY = "last_ip"; + public static final String OPENED_BY_PROPERTY = "opened_by"; + public static final String CHANGED_BY_PROPERTY = "changed_by"; + public static final String GUARDED_TOKEN_PROPERTY = "guarded_token"; + private Catalog catalog; + + private String name; + + private LocalDateTime bornAt; + + private LocalDateTime touchedAt; + + private String sourceIp; + + private String lastIp; + + private String openedBy; + + private String changedBy; + + private String guardedToken; + + + public Catalog getCatalog(){ + return this.catalog; + } + + public String getName(){ + return this.name; + } + + public LocalDateTime getBornAt(){ + return this.bornAt; + } + + public LocalDateTime getTouchedAt(){ + return this.touchedAt; + } + + public String getSourceIp(){ + return this.sourceIp; + } + + public String getLastIp(){ + return this.lastIp; + } + + public String getOpenedBy(){ + return this.openedBy; + } + + public String getChangedBy(){ + return this.changedBy; + } + + public String getGuardedToken(){ + return this.guardedToken; + } + + public Entry updateCatalog(Catalog catalog){ + if(isPropertyLoaded(CATALOG_PROPERTY) && Objects.equals(this.catalog, catalog)){ + return this; + } + handleUpdate(CATALOG_PROPERTY, getCatalog(), catalog); + this.catalog = catalog; + return this; + } + + public Entry updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Entry updateBornAt(LocalDateTime bornAt){ + if(isPropertyLoaded(BORN_AT_PROPERTY) && Objects.equals(this.bornAt, bornAt)){ + return this; + } + handleUpdate(BORN_AT_PROPERTY, getBornAt(), bornAt); + this.bornAt = bornAt; + return this; + } + + public Entry updateTouchedAt(LocalDateTime touchedAt){ + if(isPropertyLoaded(TOUCHED_AT_PROPERTY) && Objects.equals(this.touchedAt, touchedAt)){ + return this; + } + handleUpdate(TOUCHED_AT_PROPERTY, getTouchedAt(), touchedAt); + this.touchedAt = touchedAt; + return this; + } + + public Entry updateSourceIp(String sourceIp){ + sourceIp = (sourceIp == null ? null : sourceIp.trim()); + if(isPropertyLoaded(SOURCE_IP_PROPERTY) && Objects.equals(this.sourceIp, sourceIp)){ + return this; + } + handleUpdate(SOURCE_IP_PROPERTY, getSourceIp(), sourceIp); + this.sourceIp = sourceIp; + return this; + } + + public Entry updateLastIp(String lastIp){ + lastIp = (lastIp == null ? null : lastIp.trim()); + if(isPropertyLoaded(LAST_IP_PROPERTY) && Objects.equals(this.lastIp, lastIp)){ + return this; + } + handleUpdate(LAST_IP_PROPERTY, getLastIp(), lastIp); + this.lastIp = lastIp; + return this; + } + + public Entry updateOpenedBy(String openedBy){ + openedBy = (openedBy == null ? null : openedBy.trim()); + if(isPropertyLoaded(OPENED_BY_PROPERTY) && Objects.equals(this.openedBy, openedBy)){ + return this; + } + handleUpdate(OPENED_BY_PROPERTY, getOpenedBy(), openedBy); + this.openedBy = openedBy; + return this; + } + + public Entry updateChangedBy(String changedBy){ + changedBy = (changedBy == null ? null : changedBy.trim()); + if(isPropertyLoaded(CHANGED_BY_PROPERTY) && Objects.equals(this.changedBy, changedBy)){ + return this; + } + handleUpdate(CHANGED_BY_PROPERTY, getChangedBy(), changedBy); + this.changedBy = changedBy; + return this; + } + + public Entry updateGuardedToken(String guardedToken){ + guardedToken = (guardedToken == null ? null : guardedToken.trim()); + if(isPropertyLoaded(GUARDED_TOKEN_PROPERTY) && Objects.equals(this.guardedToken, guardedToken)){ + return this; + } + handleUpdate(GUARDED_TOKEN_PROPERTY, getGuardedToken(), guardedToken); + this.guardedToken = guardedToken; + return this; + } + + + public static Entry refer(Long id){ + Entry refer = new Entry(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Entry comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "catalog": this.catalog = (Catalog) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "born_at": this.bornAt = (LocalDateTime) value; break; + + case "touched_at": this.touchedAt = (LocalDateTime) value; break; + + case "source_ip": this.sourceIp = (value == null ? null : ((String)value).trim()); break; + + case "last_ip": this.lastIp = (value == null ? null : ((String)value).trim()); break; + + case "opened_by": this.openedBy = (value == null ? null : ((String)value).trim()); break; + + case "changed_by": this.changedBy = (value == null ? null : ((String)value).trim()); break; + + case "guarded_token": this.guardedToken = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "catalog": return this.catalog; + case "name": return this.name; + case "born_at": return this.bornAt; + case "touched_at": return this.touchedAt; + case "source_ip": return this.sourceIp; + case "last_ip": return this.lastIp; + case "opened_by": return this.openedBy; + case "changed_by": return this.changedBy; + case "guarded_token": return this.guardedToken; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "catalog": return this.catalog; + case "name": return this.name; + case "bornAt": return this.bornAt; + case "touchedAt": return this.touchedAt; + case "sourceIp": return this.sourceIp; + case "lastIp": return this.lastIp; + case "openedBy": return this.openedBy; + case "changedBy": return this.changedBy; + case "guardedToken": return this.guardedToken; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java new file mode 100644 index 000000000..46bc7e8f1 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java @@ -0,0 +1,170 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class EntryChecker implements Checker{ + + public String type(){ + return Entry.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Entry entry, ObjectLocation _parentLocation){ + if(needCheck(_context, entry)){ + markAsChecked(_context, entry); + doCheck(_context, entry, _parentLocation); + } + } + + public void doCheck(UserContext _context, Entry entry, ObjectLocation _parentLocation){ + if((entry == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, entry); + if(entry.needPersist()){ + } + if(entry.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "born_at"), () -> { + entry.updateBornAt(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "born_at", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "touched_at"), () -> { + entry.updateTouchedAt(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "touched_at", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "guarded_token"), () -> { + entry.updateGuardedToken(_context.evaluate("uniStr", "prefix")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "guarded_token", + "now".equalsIgnoreCase("uniStr") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("uniStr") ? "graphClock" : "contextFunction:uniStr")); + }); + } + }else if(entry.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "touched_at"), () -> { + entry.updateTouchedAt(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "touched_at", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!entry.isPropertyLoaded("catalog")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "catalog"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("born_at")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "born_at"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("touched_at")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "touched_at"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("source_ip")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "source_ip"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("last_ip")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "last_ip"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("opened_by")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "opened_by"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("changed_by")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "changed_by"), "Mutation requires a fully loaded entity"); + } + if(!entry.isPropertyLoaded("guarded_token")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "guarded_token"), "Mutation requires a fully loaded entity"); + } + + } + checkCatalog(_context, entry.getProperty(Entry.CATALOG_PROPERTY), newLocation(_parentLocation, "catalog")); + checkName(_context, entry.getProperty(Entry.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkBornAt(_context, entry.getProperty(Entry.BORN_AT_PROPERTY), newLocation(_parentLocation, "born_at")); + checkTouchedAt(_context, entry.getProperty(Entry.TOUCHED_AT_PROPERTY), newLocation(_parentLocation, "touched_at")); + checkSourceIp(_context, entry.getProperty(Entry.SOURCE_IP_PROPERTY), newLocation(_parentLocation, "source_ip")); + checkLastIp(_context, entry.getProperty(Entry.LAST_IP_PROPERTY), newLocation(_parentLocation, "last_ip")); + checkOpenedBy(_context, entry.getProperty(Entry.OPENED_BY_PROPERTY), newLocation(_parentLocation, "opened_by")); + checkChangedBy(_context, entry.getProperty(Entry.CHANGED_BY_PROPERTY), newLocation(_parentLocation, "changed_by")); + checkGuardedToken(_context, entry.getProperty(Entry.GUARDED_TOKEN_PROPERTY), newLocation(_parentLocation, "guarded_token")); + } + + public void checkCatalog(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, catalog); + if((catalog == null)){ + return; + } + new CatalogChecker().checkAndFix(_context, catalog, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkBornAt(UserContext _context, LocalDateTime bornAt, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, bornAt); + if((bornAt == null)){ + return; + } + } + public void checkTouchedAt(UserContext _context, LocalDateTime touchedAt, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, touchedAt); + if((touchedAt == null)){ + return; + } + } + public void checkSourceIp(UserContext _context, String sourceIp, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sourceIp); + if((sourceIp == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, sourceIp); + + } + public void checkLastIp(UserContext _context, String lastIp, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, lastIp); + if((lastIp == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, lastIp); + + } + public void checkOpenedBy(UserContext _context, String openedBy, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, openedBy); + if((openedBy == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, openedBy); + + } + public void checkChangedBy(UserContext _context, String changedBy, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, changedBy); + if((changedBy == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, changedBy); + + } + public void checkGuardedToken(UserContext _context, String guardedToken, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, guardedToken); + if((guardedToken == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, guardedToken); + + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java new file mode 100644 index 000000000..b61497cdf --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java @@ -0,0 +1,103 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class EntryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public EntryExpression(Expression expression){ + super(expression); + } + + public EntryExpression(Expression expression, Function function){ + super(expression, function); + } + + public EntryExpression updateId(Long id){ + return new EntryExpression(this, $it -> {((Entry)$it).__internalSet("id", id); return this;}); + } + + public EntryExpression save(UserContext userContext){ + return new EntryExpression(this, $it -> ((Entry)$it).auditAs("Saved by Expression").save(userContext)); + } + + public EntryExpression save(String intent, UserContext userContext){ + return new EntryExpression(this, $it -> ((Entry)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CatalogExpression getCatalog(){ + return new CatalogExpression(loaded("catalog", "getCatalog", Entry::getCatalog)); + } + + public EntryExpression updateCatalog(Catalog catalog){ + return new EntryExpression(this, $it -> ((Entry)$it).updateCatalog(catalog)); + } + + public Expression getName(){ + return loaded("name", "getName", Entry::getName); + } + public EntryExpression updateName(String name){ + return new EntryExpression(this, $it -> ((Entry)$it).updateName(name)); + } + + public Expression getBornAt(){ + return loaded("born_at", "getBornAt", Entry::getBornAt); + } + public EntryExpression updateBornAt(LocalDateTime bornAt){ + return new EntryExpression(this, $it -> ((Entry)$it).updateBornAt(bornAt)); + } + + public Expression getTouchedAt(){ + return loaded("touched_at", "getTouchedAt", Entry::getTouchedAt); + } + public EntryExpression updateTouchedAt(LocalDateTime touchedAt){ + return new EntryExpression(this, $it -> ((Entry)$it).updateTouchedAt(touchedAt)); + } + + public Expression getSourceIp(){ + return loaded("source_ip", "getSourceIp", Entry::getSourceIp); + } + public EntryExpression updateSourceIp(String sourceIp){ + return new EntryExpression(this, $it -> ((Entry)$it).updateSourceIp(sourceIp)); + } + + public Expression getLastIp(){ + return loaded("last_ip", "getLastIp", Entry::getLastIp); + } + public EntryExpression updateLastIp(String lastIp){ + return new EntryExpression(this, $it -> ((Entry)$it).updateLastIp(lastIp)); + } + + public Expression getOpenedBy(){ + return loaded("opened_by", "getOpenedBy", Entry::getOpenedBy); + } + public EntryExpression updateOpenedBy(String openedBy){ + return new EntryExpression(this, $it -> ((Entry)$it).updateOpenedBy(openedBy)); + } + + public Expression getChangedBy(){ + return loaded("changed_by", "getChangedBy", Entry::getChangedBy); + } + public EntryExpression updateChangedBy(String changedBy){ + return new EntryExpression(this, $it -> ((Entry)$it).updateChangedBy(changedBy)); + } + + public Expression getGuardedToken(){ + return loaded("guarded_token", "getGuardedToken", Entry::getGuardedToken); + } + public EntryExpression updateGuardedToken(String guardedToken){ + return new EntryExpression(this, $it -> ((Entry)$it).updateGuardedToken(guardedToken)); + } + +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java new file mode 100644 index 000000000..3c0ef9888 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.contextfixservice.entry; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class EntryListExpression extends SmartListExpression { + public EntryListExpression(Expression> expression){ + super(expression); + } + + public EntryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public EntryExpression first() { + return new EntryExpression(super.first()); + } + + public EntryExpression get(int index) { + return new EntryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java new file mode 100644 index 000000000..37c26d212 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java @@ -0,0 +1,1590 @@ + +package com.example.contextfixservice.entry; + +import com.example.contextfixservice.Q; +import com.example.contextfixservice.catalog.Catalog; +import com.example.contextfixservice.catalog.CatalogRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class EntryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public EntryRequest(Class returnType){ + this(returnType, () -> (T) new Entry()); + } + + protected EntryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public EntryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public EntryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public EntryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public EntryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public EntryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public EntryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public EntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public EntryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public EntryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public EntryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public EntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (EntryRequest)super.appendSearchCriteria(searchCriteria); + } + + public EntryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public EntryRequest matchingAnyOf(EntryRequest entry){ + super.internalMatchAny(entry); + return this; + } + + public EntryRequest matchingIdsOf(EntryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Entry.ID_PROPERTY, request, Entry.ID_PROPERTY)); + } + + public EntryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public EntryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public EntryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public EntryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCatalogIdOnly().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); + } + + public EntryRequest selectSelfFields(){ + return selectSelf(); + } + + public EntryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Entry.ID_PROPERTY); + selectProperty(Entry.CATALOG_PROPERTY); + selectProperty(Entry.NAME_PROPERTY); + selectProperty(Entry.BORN_AT_PROPERTY); + selectProperty(Entry.TOUCHED_AT_PROPERTY); + selectProperty(Entry.SOURCE_IP_PROPERTY); + selectProperty(Entry.LAST_IP_PROPERTY); + selectProperty(Entry.OPENED_BY_PROPERTY); + selectProperty(Entry.CHANGED_BY_PROPERTY); + selectProperty(Entry.GUARDED_TOKEN_PROPERTY); + selectProperty(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest selectAll(){ + super.selectAll(); + return selectId().selectCatalog().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); + } + + public EntryRequest selectChildren(){ + super.selectAny(); + return selectId().selectCatalog().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); + } + + + public EntryRequest selectId(){ + selectProperty(Entry.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectId(){ + unselectProperty(Entry.ID_PROPERTY); + return this; + } + public EntryRequest selectCatalogIdOnly(){ + selectProperty(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest selectCatalog(){ + return selectCatalogWith(Q.catalogs().unlimited().selectSelf()); + } + + public EntryRequest selectCatalogWith(CatalogRequest catalog){ + selectProperty(Entry.CATALOG_PROPERTY); + enhanceRelation(Entry.CATALOG_PROPERTY, catalog, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCatalogWith", null, Entry.CATALOG_PROPERTY)); + return this; + } + + public EntryRequest unselectCatalog(){ + unselectProperty(Entry.CATALOG_PROPERTY); + return this; + } + public EntryRequest selectName(){ + selectProperty(Entry.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectName(){ + unselectProperty(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest selectBornAt(){ + selectProperty(Entry.BORN_AT_PROPERTY); + return this; + } + + /** + * fill the bornAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS bornAt) to fetch bornAt property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectBornAt(){ + unselectProperty(Entry.BORN_AT_PROPERTY); + return this; + } + public EntryRequest selectTouchedAt(){ + selectProperty(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + /** + * fill the touchedAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS touchedAt) to fetch touchedAt property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectTouchedAt(){ + unselectProperty(Entry.TOUCHED_AT_PROPERTY); + return this; + } + public EntryRequest selectSourceIp(){ + selectProperty(Entry.SOURCE_IP_PROPERTY); + return this; + } + + /** + * fill the sourceIp with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sourceIp) to fetch sourceIp property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectSourceIp(){ + unselectProperty(Entry.SOURCE_IP_PROPERTY); + return this; + } + public EntryRequest selectLastIp(){ + selectProperty(Entry.LAST_IP_PROPERTY); + return this; + } + + /** + * fill the lastIp with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS lastIp) to fetch lastIp property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectLastIp(){ + unselectProperty(Entry.LAST_IP_PROPERTY); + return this; + } + public EntryRequest selectOpenedBy(){ + selectProperty(Entry.OPENED_BY_PROPERTY); + return this; + } + + /** + * fill the openedBy with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS openedBy) to fetch openedBy property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectOpenedBy(){ + unselectProperty(Entry.OPENED_BY_PROPERTY); + return this; + } + public EntryRequest selectChangedBy(){ + selectProperty(Entry.CHANGED_BY_PROPERTY); + return this; + } + + /** + * fill the changedBy with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS changedBy) to fetch changedBy property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectChangedBy(){ + unselectProperty(Entry.CHANGED_BY_PROPERTY); + return this; + } + public EntryRequest selectGuardedToken(){ + selectProperty(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + /** + * fill the guardedToken with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS guardedToken) to fetch guardedToken property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectGuardedToken(){ + unselectProperty(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + public EntryRequest selectVersion(){ + selectProperty(Entry.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public EntryRequest unselectVersion(){ + unselectProperty(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.ID_PROPERTY, operator, values); + } + + public EntryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public EntryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public EntryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public EntryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public EntryRequest filterByCatalog(Catalog... catalog){ + if (catalog == null || catalog.length == 0) { + throw new IllegalArgumentException("filterByCatalog parameter catalog cannot be empty"); + } + return appendSearchCriteria(createCatalogCriteria(Operator.EQUAL, (Object[])catalog)); + } + + public EntryRequest withCatalog(Operator operator, Object... values){ + return appendSearchCriteria(createCatalogCriteria(operator, values)); + } + + public EntryRequest withCatalogIsUnknown(){ + return withCatalog(Operator.IS_NULL); + } + + public EntryRequest withCatalogIsKnown(){ + return withCatalog(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCatalogCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.CATALOG_PROPERTY, operator, values); + } + + public EntryRequest filterByCatalog(Long catalog){ + if(catalog == null){ + return this; + } + return withCatalog(Operator.EQUAL, catalog); + } + public EntryRequest withCatalogMatching(CatalogRequest catalog){ + return appendSearchCriteria(new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY)); + } + + public EntryRequest withoutCatalogMatching(CatalogRequest catalog){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY))); + } + + public EntryRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public EntryRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public EntryRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public EntryRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.NAME_PROPERTY, operator, values); + } + + public EntryRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public EntryRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public EntryRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public EntryRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public EntryRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public EntryRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public EntryRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public EntryRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public EntryRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public EntryRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public EntryRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public EntryRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public EntryRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public EntryRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public EntryRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public EntryRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public EntryRequest filterByBornAt(LocalDateTime... bornAt){ + if (bornAt == null || bornAt.length == 0) { + throw new IllegalArgumentException("filterByBornAt parameter bornAt cannot be empty"); + } + return appendSearchCriteria(createBornAtCriteria(Operator.EQUAL, (Object[])bornAt)); + } + + public EntryRequest withBornAt(Operator operator, Object... values){ + return appendSearchCriteria(createBornAtCriteria(operator, values)); + } + + public EntryRequest withBornAtIsUnknown(){ + return withBornAt(Operator.IS_NULL); + } + + public EntryRequest withBornAtIsKnown(){ + return withBornAt(Operator.IS_NOT_NULL); + } + + public SearchCriteria createBornAtCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.BORN_AT_PROPERTY, operator, values); + } + + public EntryRequest withBornAtIs(LocalDateTime bornAt){ + return withBornAt(Operator.EQUAL, bornAt); + } + + public EntryRequest withBornAtIsNot(LocalDateTime bornAt){ + return withBornAt(Operator.NOT_EQUAL, bornAt); + } + + public EntryRequest withBornAtIn(LocalDateTime... bornAt){ + return withBornAt(Operator.IN, (Object[])bornAt); + } + + public EntryRequest withBornAtNotIn(LocalDateTime... bornAt){ + return withBornAt(Operator.NOT_IN, (Object[])bornAt); + } + public EntryRequest withBornAtGreaterThan(LocalDateTime bornAt){ + return withBornAt(Operator.GREATER_THAN, bornAt); + } + + public EntryRequest withBornAtGreaterThanOrEqualTo(LocalDateTime bornAt){ + return withBornAt(Operator.GREATER_THAN_OR_EQUAL, bornAt); + } + + public EntryRequest withBornAtLessThan(LocalDateTime bornAt){ + return withBornAt(Operator.LESS_THAN, bornAt); + } + + public EntryRequest withBornAtLessThanOrEqualTo(LocalDateTime bornAt){ + return withBornAt(Operator.LESS_THAN_OR_EQUAL, bornAt); + } + + public EntryRequest withBornAtBetween(LocalDateTime startOfBornAt, LocalDateTime endOfBornAt){ + return withBornAt(Operator.BETWEEN, startOfBornAt, endOfBornAt); + } + public EntryRequest withBornAtBefore(LocalDateTime bornAt){ + return withBornAt(Operator.LESS_THAN, bornAt); + } + + public EntryRequest withBornAtBefore(Date bornAt){ + return withBornAt(Operator.LESS_THAN, bornAt); + } + + public EntryRequest withBornAtAfter(LocalDateTime bornAt){ + return withBornAt(Operator.GREATER_THAN, bornAt); + } + + public EntryRequest withBornAtAfter(Date bornAt){ + return withBornAt(Operator.GREATER_THAN, bornAt); + } + + public EntryRequest withBornAtBetween(Date startOfBornAt, Date endOfBornAt){ + return withBornAt(Operator.BETWEEN, startOfBornAt, endOfBornAt); + } + + + + + public EntryRequest filterByTouchedAt(LocalDateTime... touchedAt){ + if (touchedAt == null || touchedAt.length == 0) { + throw new IllegalArgumentException("filterByTouchedAt parameter touchedAt cannot be empty"); + } + return appendSearchCriteria(createTouchedAtCriteria(Operator.EQUAL, (Object[])touchedAt)); + } + + public EntryRequest withTouchedAt(Operator operator, Object... values){ + return appendSearchCriteria(createTouchedAtCriteria(operator, values)); + } + + public EntryRequest withTouchedAtIsUnknown(){ + return withTouchedAt(Operator.IS_NULL); + } + + public EntryRequest withTouchedAtIsKnown(){ + return withTouchedAt(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTouchedAtCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.TOUCHED_AT_PROPERTY, operator, values); + } + + public EntryRequest withTouchedAtIs(LocalDateTime touchedAt){ + return withTouchedAt(Operator.EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtIsNot(LocalDateTime touchedAt){ + return withTouchedAt(Operator.NOT_EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtIn(LocalDateTime... touchedAt){ + return withTouchedAt(Operator.IN, (Object[])touchedAt); + } + + public EntryRequest withTouchedAtNotIn(LocalDateTime... touchedAt){ + return withTouchedAt(Operator.NOT_IN, (Object[])touchedAt); + } + public EntryRequest withTouchedAtGreaterThan(LocalDateTime touchedAt){ + return withTouchedAt(Operator.GREATER_THAN, touchedAt); + } + + public EntryRequest withTouchedAtGreaterThanOrEqualTo(LocalDateTime touchedAt){ + return withTouchedAt(Operator.GREATER_THAN_OR_EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtLessThan(LocalDateTime touchedAt){ + return withTouchedAt(Operator.LESS_THAN, touchedAt); + } + + public EntryRequest withTouchedAtLessThanOrEqualTo(LocalDateTime touchedAt){ + return withTouchedAt(Operator.LESS_THAN_OR_EQUAL, touchedAt); + } + + public EntryRequest withTouchedAtBetween(LocalDateTime startOfTouchedAt, LocalDateTime endOfTouchedAt){ + return withTouchedAt(Operator.BETWEEN, startOfTouchedAt, endOfTouchedAt); + } + public EntryRequest withTouchedAtBefore(LocalDateTime touchedAt){ + return withTouchedAt(Operator.LESS_THAN, touchedAt); + } + + public EntryRequest withTouchedAtBefore(Date touchedAt){ + return withTouchedAt(Operator.LESS_THAN, touchedAt); + } + + public EntryRequest withTouchedAtAfter(LocalDateTime touchedAt){ + return withTouchedAt(Operator.GREATER_THAN, touchedAt); + } + + public EntryRequest withTouchedAtAfter(Date touchedAt){ + return withTouchedAt(Operator.GREATER_THAN, touchedAt); + } + + public EntryRequest withTouchedAtBetween(Date startOfTouchedAt, Date endOfTouchedAt){ + return withTouchedAt(Operator.BETWEEN, startOfTouchedAt, endOfTouchedAt); + } + + + + + public EntryRequest filterBySourceIp(String... sourceIp){ + if (sourceIp == null || sourceIp.length == 0) { + throw new IllegalArgumentException("filterBySourceIp parameter sourceIp cannot be empty"); + } + return appendSearchCriteria(createSourceIpCriteria(Operator.EQUAL, (Object[])sourceIp)); + } + + public EntryRequest withSourceIp(Operator operator, Object... values){ + return appendSearchCriteria(createSourceIpCriteria(operator, values)); + } + + public EntryRequest withSourceIpIsUnknown(){ + return withSourceIp(Operator.IS_NULL); + } + + public EntryRequest withSourceIpIsKnown(){ + return withSourceIp(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSourceIpCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.SOURCE_IP_PROPERTY, operator, values); + } + + public EntryRequest withSourceIpIsNot(String sourceIp){ + return withSourceIp(Operator.NOT_EQUAL, sourceIp); + } + + public EntryRequest withSourceIpIn(String... sourceIp){ + return withSourceIp(Operator.IN, (Object[])sourceIp); + } + + public EntryRequest withSourceIpNotIn(String... sourceIp){ + return withSourceIp(Operator.NOT_IN, (Object[])sourceIp); + } + public EntryRequest withSourceIpGreaterThan(String sourceIp){ + return withSourceIp(Operator.GREATER_THAN, sourceIp); + } + + public EntryRequest withSourceIpGreaterThanOrEqualTo(String sourceIp){ + return withSourceIp(Operator.GREATER_THAN_OR_EQUAL, sourceIp); + } + + public EntryRequest withSourceIpLessThan(String sourceIp){ + return withSourceIp(Operator.LESS_THAN, sourceIp); + } + + public EntryRequest withSourceIpLessThanOrEqualTo(String sourceIp){ + return withSourceIp(Operator.LESS_THAN_OR_EQUAL, sourceIp); + } + + public EntryRequest withSourceIpBetween(String startOfSourceIp, String endOfSourceIp){ + return withSourceIp(Operator.BETWEEN, startOfSourceIp, endOfSourceIp); + } + public EntryRequest withSourceIpStartingWith(String sourceIp){ + return withSourceIp(Operator.BEGIN_WITH, sourceIp); + } + public EntryRequest withSourceIpContaining(String sourceIp){ + return withSourceIp(Operator.CONTAIN, sourceIp); + } + + public EntryRequest withSourceIpNotContaining(String sourceIp){ + return withSourceIp(Operator.NOT_CONTAIN, sourceIp); + } + + public EntryRequest withSourceIpNotStartingWith(String sourceIp){ + return withSourceIp(Operator.NOT_BEGIN_WITH, sourceIp); + } + + public EntryRequest withSourceIpEndingWith(String sourceIp){ + return withSourceIp(Operator.END_WITH, sourceIp); + } + + public EntryRequest withSourceIpNotEndingWith(String sourceIp){ + return withSourceIp(Operator.NOT_END_WITH, sourceIp); + } + + public EntryRequest withSourceIpIs(String sourceIp){ + return withSourceIp(Operator.EQUAL, sourceIp); + } + + public EntryRequest withSourceIpSoundingLike(String sourceIp){ + return withSourceIp(Operator.SOUNDS_LIKE, sourceIp); + } + + + + public EntryRequest filterByLastIp(String... lastIp){ + if (lastIp == null || lastIp.length == 0) { + throw new IllegalArgumentException("filterByLastIp parameter lastIp cannot be empty"); + } + return appendSearchCriteria(createLastIpCriteria(Operator.EQUAL, (Object[])lastIp)); + } + + public EntryRequest withLastIp(Operator operator, Object... values){ + return appendSearchCriteria(createLastIpCriteria(operator, values)); + } + + public EntryRequest withLastIpIsUnknown(){ + return withLastIp(Operator.IS_NULL); + } + + public EntryRequest withLastIpIsKnown(){ + return withLastIp(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLastIpCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.LAST_IP_PROPERTY, operator, values); + } + + public EntryRequest withLastIpIsNot(String lastIp){ + return withLastIp(Operator.NOT_EQUAL, lastIp); + } + + public EntryRequest withLastIpIn(String... lastIp){ + return withLastIp(Operator.IN, (Object[])lastIp); + } + + public EntryRequest withLastIpNotIn(String... lastIp){ + return withLastIp(Operator.NOT_IN, (Object[])lastIp); + } + public EntryRequest withLastIpGreaterThan(String lastIp){ + return withLastIp(Operator.GREATER_THAN, lastIp); + } + + public EntryRequest withLastIpGreaterThanOrEqualTo(String lastIp){ + return withLastIp(Operator.GREATER_THAN_OR_EQUAL, lastIp); + } + + public EntryRequest withLastIpLessThan(String lastIp){ + return withLastIp(Operator.LESS_THAN, lastIp); + } + + public EntryRequest withLastIpLessThanOrEqualTo(String lastIp){ + return withLastIp(Operator.LESS_THAN_OR_EQUAL, lastIp); + } + + public EntryRequest withLastIpBetween(String startOfLastIp, String endOfLastIp){ + return withLastIp(Operator.BETWEEN, startOfLastIp, endOfLastIp); + } + public EntryRequest withLastIpStartingWith(String lastIp){ + return withLastIp(Operator.BEGIN_WITH, lastIp); + } + public EntryRequest withLastIpContaining(String lastIp){ + return withLastIp(Operator.CONTAIN, lastIp); + } + + public EntryRequest withLastIpNotContaining(String lastIp){ + return withLastIp(Operator.NOT_CONTAIN, lastIp); + } + + public EntryRequest withLastIpNotStartingWith(String lastIp){ + return withLastIp(Operator.NOT_BEGIN_WITH, lastIp); + } + + public EntryRequest withLastIpEndingWith(String lastIp){ + return withLastIp(Operator.END_WITH, lastIp); + } + + public EntryRequest withLastIpNotEndingWith(String lastIp){ + return withLastIp(Operator.NOT_END_WITH, lastIp); + } + + public EntryRequest withLastIpIs(String lastIp){ + return withLastIp(Operator.EQUAL, lastIp); + } + + public EntryRequest withLastIpSoundingLike(String lastIp){ + return withLastIp(Operator.SOUNDS_LIKE, lastIp); + } + + + + public EntryRequest filterByOpenedBy(String... openedBy){ + if (openedBy == null || openedBy.length == 0) { + throw new IllegalArgumentException("filterByOpenedBy parameter openedBy cannot be empty"); + } + return appendSearchCriteria(createOpenedByCriteria(Operator.EQUAL, (Object[])openedBy)); + } + + public EntryRequest withOpenedBy(Operator operator, Object... values){ + return appendSearchCriteria(createOpenedByCriteria(operator, values)); + } + + public EntryRequest withOpenedByIsUnknown(){ + return withOpenedBy(Operator.IS_NULL); + } + + public EntryRequest withOpenedByIsKnown(){ + return withOpenedBy(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOpenedByCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.OPENED_BY_PROPERTY, operator, values); + } + + public EntryRequest withOpenedByIsNot(String openedBy){ + return withOpenedBy(Operator.NOT_EQUAL, openedBy); + } + + public EntryRequest withOpenedByIn(String... openedBy){ + return withOpenedBy(Operator.IN, (Object[])openedBy); + } + + public EntryRequest withOpenedByNotIn(String... openedBy){ + return withOpenedBy(Operator.NOT_IN, (Object[])openedBy); + } + public EntryRequest withOpenedByGreaterThan(String openedBy){ + return withOpenedBy(Operator.GREATER_THAN, openedBy); + } + + public EntryRequest withOpenedByGreaterThanOrEqualTo(String openedBy){ + return withOpenedBy(Operator.GREATER_THAN_OR_EQUAL, openedBy); + } + + public EntryRequest withOpenedByLessThan(String openedBy){ + return withOpenedBy(Operator.LESS_THAN, openedBy); + } + + public EntryRequest withOpenedByLessThanOrEqualTo(String openedBy){ + return withOpenedBy(Operator.LESS_THAN_OR_EQUAL, openedBy); + } + + public EntryRequest withOpenedByBetween(String startOfOpenedBy, String endOfOpenedBy){ + return withOpenedBy(Operator.BETWEEN, startOfOpenedBy, endOfOpenedBy); + } + public EntryRequest withOpenedByStartingWith(String openedBy){ + return withOpenedBy(Operator.BEGIN_WITH, openedBy); + } + public EntryRequest withOpenedByContaining(String openedBy){ + return withOpenedBy(Operator.CONTAIN, openedBy); + } + + public EntryRequest withOpenedByNotContaining(String openedBy){ + return withOpenedBy(Operator.NOT_CONTAIN, openedBy); + } + + public EntryRequest withOpenedByNotStartingWith(String openedBy){ + return withOpenedBy(Operator.NOT_BEGIN_WITH, openedBy); + } + + public EntryRequest withOpenedByEndingWith(String openedBy){ + return withOpenedBy(Operator.END_WITH, openedBy); + } + + public EntryRequest withOpenedByNotEndingWith(String openedBy){ + return withOpenedBy(Operator.NOT_END_WITH, openedBy); + } + + public EntryRequest withOpenedByIs(String openedBy){ + return withOpenedBy(Operator.EQUAL, openedBy); + } + + public EntryRequest withOpenedBySoundingLike(String openedBy){ + return withOpenedBy(Operator.SOUNDS_LIKE, openedBy); + } + + + + public EntryRequest filterByChangedBy(String... changedBy){ + if (changedBy == null || changedBy.length == 0) { + throw new IllegalArgumentException("filterByChangedBy parameter changedBy cannot be empty"); + } + return appendSearchCriteria(createChangedByCriteria(Operator.EQUAL, (Object[])changedBy)); + } + + public EntryRequest withChangedBy(Operator operator, Object... values){ + return appendSearchCriteria(createChangedByCriteria(operator, values)); + } + + public EntryRequest withChangedByIsUnknown(){ + return withChangedBy(Operator.IS_NULL); + } + + public EntryRequest withChangedByIsKnown(){ + return withChangedBy(Operator.IS_NOT_NULL); + } + + public SearchCriteria createChangedByCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.CHANGED_BY_PROPERTY, operator, values); + } + + public EntryRequest withChangedByIsNot(String changedBy){ + return withChangedBy(Operator.NOT_EQUAL, changedBy); + } + + public EntryRequest withChangedByIn(String... changedBy){ + return withChangedBy(Operator.IN, (Object[])changedBy); + } + + public EntryRequest withChangedByNotIn(String... changedBy){ + return withChangedBy(Operator.NOT_IN, (Object[])changedBy); + } + public EntryRequest withChangedByGreaterThan(String changedBy){ + return withChangedBy(Operator.GREATER_THAN, changedBy); + } + + public EntryRequest withChangedByGreaterThanOrEqualTo(String changedBy){ + return withChangedBy(Operator.GREATER_THAN_OR_EQUAL, changedBy); + } + + public EntryRequest withChangedByLessThan(String changedBy){ + return withChangedBy(Operator.LESS_THAN, changedBy); + } + + public EntryRequest withChangedByLessThanOrEqualTo(String changedBy){ + return withChangedBy(Operator.LESS_THAN_OR_EQUAL, changedBy); + } + + public EntryRequest withChangedByBetween(String startOfChangedBy, String endOfChangedBy){ + return withChangedBy(Operator.BETWEEN, startOfChangedBy, endOfChangedBy); + } + public EntryRequest withChangedByStartingWith(String changedBy){ + return withChangedBy(Operator.BEGIN_WITH, changedBy); + } + public EntryRequest withChangedByContaining(String changedBy){ + return withChangedBy(Operator.CONTAIN, changedBy); + } + + public EntryRequest withChangedByNotContaining(String changedBy){ + return withChangedBy(Operator.NOT_CONTAIN, changedBy); + } + + public EntryRequest withChangedByNotStartingWith(String changedBy){ + return withChangedBy(Operator.NOT_BEGIN_WITH, changedBy); + } + + public EntryRequest withChangedByEndingWith(String changedBy){ + return withChangedBy(Operator.END_WITH, changedBy); + } + + public EntryRequest withChangedByNotEndingWith(String changedBy){ + return withChangedBy(Operator.NOT_END_WITH, changedBy); + } + + public EntryRequest withChangedByIs(String changedBy){ + return withChangedBy(Operator.EQUAL, changedBy); + } + + public EntryRequest withChangedBySoundingLike(String changedBy){ + return withChangedBy(Operator.SOUNDS_LIKE, changedBy); + } + + + + public EntryRequest filterByGuardedToken(String... guardedToken){ + if (guardedToken == null || guardedToken.length == 0) { + throw new IllegalArgumentException("filterByGuardedToken parameter guardedToken cannot be empty"); + } + return appendSearchCriteria(createGuardedTokenCriteria(Operator.EQUAL, (Object[])guardedToken)); + } + + public EntryRequest withGuardedToken(Operator operator, Object... values){ + return appendSearchCriteria(createGuardedTokenCriteria(operator, values)); + } + + public EntryRequest withGuardedTokenIsUnknown(){ + return withGuardedToken(Operator.IS_NULL); + } + + public EntryRequest withGuardedTokenIsKnown(){ + return withGuardedToken(Operator.IS_NOT_NULL); + } + + public SearchCriteria createGuardedTokenCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.GUARDED_TOKEN_PROPERTY, operator, values); + } + + public EntryRequest withGuardedTokenIsNot(String guardedToken){ + return withGuardedToken(Operator.NOT_EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenIn(String... guardedToken){ + return withGuardedToken(Operator.IN, (Object[])guardedToken); + } + + public EntryRequest withGuardedTokenNotIn(String... guardedToken){ + return withGuardedToken(Operator.NOT_IN, (Object[])guardedToken); + } + public EntryRequest withGuardedTokenGreaterThan(String guardedToken){ + return withGuardedToken(Operator.GREATER_THAN, guardedToken); + } + + public EntryRequest withGuardedTokenGreaterThanOrEqualTo(String guardedToken){ + return withGuardedToken(Operator.GREATER_THAN_OR_EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenLessThan(String guardedToken){ + return withGuardedToken(Operator.LESS_THAN, guardedToken); + } + + public EntryRequest withGuardedTokenLessThanOrEqualTo(String guardedToken){ + return withGuardedToken(Operator.LESS_THAN_OR_EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenBetween(String startOfGuardedToken, String endOfGuardedToken){ + return withGuardedToken(Operator.BETWEEN, startOfGuardedToken, endOfGuardedToken); + } + public EntryRequest withGuardedTokenStartingWith(String guardedToken){ + return withGuardedToken(Operator.BEGIN_WITH, guardedToken); + } + public EntryRequest withGuardedTokenContaining(String guardedToken){ + return withGuardedToken(Operator.CONTAIN, guardedToken); + } + + public EntryRequest withGuardedTokenNotContaining(String guardedToken){ + return withGuardedToken(Operator.NOT_CONTAIN, guardedToken); + } + + public EntryRequest withGuardedTokenNotStartingWith(String guardedToken){ + return withGuardedToken(Operator.NOT_BEGIN_WITH, guardedToken); + } + + public EntryRequest withGuardedTokenEndingWith(String guardedToken){ + return withGuardedToken(Operator.END_WITH, guardedToken); + } + + public EntryRequest withGuardedTokenNotEndingWith(String guardedToken){ + return withGuardedToken(Operator.NOT_END_WITH, guardedToken); + } + + public EntryRequest withGuardedTokenIs(String guardedToken){ + return withGuardedToken(Operator.EQUAL, guardedToken); + } + + public EntryRequest withGuardedTokenSoundingLike(String guardedToken){ + return withGuardedToken(Operator.SOUNDS_LIKE, guardedToken); + } + + + + public EntryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public EntryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public EntryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public EntryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Entry.VERSION_PROPERTY, operator, values); + } + + public EntryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public EntryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public EntryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public EntryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public EntryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public EntryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public EntryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public EntryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public EntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public EntryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public EntryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public EntryRequest groupByCatalogWithDetails(){ + return groupByCatalogWithDetails(Q.catalogs().unlimited()); + } + + public EntryRequest groupByCatalogWithDetails(CatalogRequest subRequest){ + aggregate(Entry.CATALOG_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + + public EntryRequest groupById(){ + groupBy(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest groupByIdAs(String retName){ + groupBy(retName, Entry.ID_PROPERTY); + return this; + } + + public EntryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.ID_PROPERTY, function); + return this; + } + public EntryRequest groupByCatalogWith(CatalogRequest subRequest){ + groupBy(Entry.CATALOG_PROPERTY, subRequest); + return this; + } + public EntryRequest groupByCatalog(){ + groupBy(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest groupByCatalogAs(String retName){ + groupBy(retName, Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest groupByCatalogWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.CATALOG_PROPERTY, function); + return this; + } + + public EntryRequest groupByName(){ + groupBy(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest groupByNameAs(String retName){ + groupBy(retName, Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.NAME_PROPERTY, function); + return this; + } + + public EntryRequest groupByBornAt(){ + groupBy(Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest groupByBornAtAs(String retName){ + groupBy(retName, Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest groupByBornAtWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.BORN_AT_PROPERTY, function); + return this; + } + + public EntryRequest groupByTouchedAt(){ + groupBy(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest groupByTouchedAtAs(String retName){ + groupBy(retName, Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest groupByTouchedAtWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.TOUCHED_AT_PROPERTY, function); + return this; + } + + public EntryRequest groupBySourceIp(){ + groupBy(Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest groupBySourceIpAs(String retName){ + groupBy(retName, Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest groupBySourceIpWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.SOURCE_IP_PROPERTY, function); + return this; + } + + public EntryRequest groupByLastIp(){ + groupBy(Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest groupByLastIpAs(String retName){ + groupBy(retName, Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest groupByLastIpWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.LAST_IP_PROPERTY, function); + return this; + } + + public EntryRequest groupByOpenedBy(){ + groupBy(Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByOpenedByAs(String retName){ + groupBy(retName, Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByOpenedByWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.OPENED_BY_PROPERTY, function); + return this; + } + + public EntryRequest groupByChangedBy(){ + groupBy(Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByChangedByAs(String retName){ + groupBy(retName, Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest groupByChangedByWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.CHANGED_BY_PROPERTY, function); + return this; + } + + public EntryRequest groupByGuardedToken(){ + groupBy(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest groupByGuardedTokenAs(String retName){ + groupBy(retName, Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest groupByGuardedTokenWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.GUARDED_TOKEN_PROPERTY, function); + return this; + } + + public EntryRequest groupByVersion(){ + groupBy(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupByVersionAs(String retName){ + groupBy(retName, Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Entry.VERSION_PROPERTY, function); + return this; + } + + + + public EntryRequest orderByIdAscending(){ + addOrderByAscending(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest orderByIdDescending(){ + addOrderByDescending(Entry.ID_PROPERTY); + return this; + } + + public EntryRequest orderByCatalogAscending(){ + addOrderByAscending(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest orderByCatalogDescending(){ + addOrderByDescending(Entry.CATALOG_PROPERTY); + return this; + } + + public EntryRequest orderByNameAscending(){ + addOrderByAscending(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest orderByNameDescending(){ + addOrderByDescending(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.NAME_PROPERTY); + return this; + } + + public EntryRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.NAME_PROPERTY); + return this; + } + public EntryRequest orderByBornAtAscending(){ + addOrderByAscending(Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest orderByBornAtDescending(){ + addOrderByDescending(Entry.BORN_AT_PROPERTY); + return this; + } + + public EntryRequest orderByTouchedAtAscending(){ + addOrderByAscending(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest orderByTouchedAtDescending(){ + addOrderByDescending(Entry.TOUCHED_AT_PROPERTY); + return this; + } + + public EntryRequest orderBySourceIpAscending(){ + addOrderByAscending(Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest orderBySourceIpDescending(){ + addOrderByDescending(Entry.SOURCE_IP_PROPERTY); + return this; + } + public EntryRequest orderBySourceIpAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.SOURCE_IP_PROPERTY); + return this; + } + + public EntryRequest orderBySourceIpDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.SOURCE_IP_PROPERTY); + return this; + } + public EntryRequest orderByLastIpAscending(){ + addOrderByAscending(Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest orderByLastIpDescending(){ + addOrderByDescending(Entry.LAST_IP_PROPERTY); + return this; + } + public EntryRequest orderByLastIpAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.LAST_IP_PROPERTY); + return this; + } + + public EntryRequest orderByLastIpDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.LAST_IP_PROPERTY); + return this; + } + public EntryRequest orderByOpenedByAscending(){ + addOrderByAscending(Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByOpenedByDescending(){ + addOrderByDescending(Entry.OPENED_BY_PROPERTY); + return this; + } + public EntryRequest orderByOpenedByAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.OPENED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByOpenedByDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.OPENED_BY_PROPERTY); + return this; + } + public EntryRequest orderByChangedByAscending(){ + addOrderByAscending(Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByChangedByDescending(){ + addOrderByDescending(Entry.CHANGED_BY_PROPERTY); + return this; + } + public EntryRequest orderByChangedByAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.CHANGED_BY_PROPERTY); + return this; + } + + public EntryRequest orderByChangedByDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.CHANGED_BY_PROPERTY); + return this; + } + public EntryRequest orderByGuardedTokenAscending(){ + addOrderByAscending(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest orderByGuardedTokenDescending(){ + addOrderByDescending(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + public EntryRequest orderByGuardedTokenAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + + public EntryRequest orderByGuardedTokenDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Entry.GUARDED_TOKEN_PROPERTY); + return this; + } + public EntryRequest orderByVersionAscending(){ + addOrderByAscending(Entry.VERSION_PROPERTY); + return this; + } + + public EntryRequest orderByVersionDescending(){ + addOrderByDescending(Entry.VERSION_PROPERTY); + return this; + } + + + public CatalogRequest rollUpToCatalog(){ + CatalogRequest catalog = Q.catalogs().unlimited(); + this.withCatalogMatching(catalog) + .groupByCatalogWith(catalog); + return catalog; + } + + + + + + + + + + + + public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog){ + return facetByCatalogAs(facetName, catalog, true); + } + + public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog, boolean includeAllFacets){ + addFacet(facetName, Entry.CATALOG_PROPERTY, catalog, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCatalogAs", facetName, Entry.CATALOG_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public EntryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public EntryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public EntryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public EntryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public EntryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public EntryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java b/examples/conformance/context-derived/java-lib-core/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/conformance/context-derived/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/context-derived/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..5da6f9001 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.contextfixservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/context-derived/java-lib-core/teaql/model-provenance.json b/examples/conformance/context-derived/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..12882c218 --- /dev/null +++ b/examples/conformance/context-derived/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:7b6c0098ed7adda7c9ba6d7969972b9a13b677e930e1b70d98b8aca4ca8e05e2","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/conformance/context-derived/model.xml b/examples/conformance/context-derived/model.xml new file mode 100644 index 000000000..997b84bba --- /dev/null +++ b/examples/conformance/context-derived/model.xml @@ -0,0 +1,5 @@ + + + + diff --git a/examples/conformance/context-derived/showcase.json b/examples/conformance/context-derived/showcase.json new file mode 100644 index 000000000..5af030823 --- /dev/null +++ b/examples/conformance/context-derived/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/conformance", + "library": { + "generatedFilesManifestSHA256": "2dee65cb3eb73e6f4db0750a281bcc44913dcdc7e4ee98445163f9c468bebbce", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "ad6f3616d5bc004471e31a97000cc79b90c28ef1300b9dfe0aeca6e53e52b634" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/context-field-qualified-generation/receipt.json", + "receiptSHA256": "fd8c37aeb5622a41a2dd8768724e432d5f97b58bf720f39217a8f31a8f4c1d90" + }, + "scene": "Catalog entry edits with trusted Context defaults, no-op saves and rollback", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "node", + "verify-local.cjs" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "showcase-tests/io/teaql/examples/contextfix/GeneratedContextFixTest.java" + ], + "generatedFilesManifestSHA256": "eb0ca431c33d68437fa9acf909d95825b07f9788f1b60597b1e7242dfe934383", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/conformance/context-derived/verify-local.cjs b/examples/conformance/context-derived/verify-local.cjs index 6a72add9b..638356a02 100644 --- a/examples/conformance/context-derived/verify-local.cjs +++ b/examples/conformance/context-derived/verify-local.cjs @@ -1,4 +1,5 @@ 'use strict'; +const {currentLibraryInputs}=require('./current-library.cjs'); const fs = require('node:fs'), path = require('node:path'), os = require('node:os'); const cp = require('node:child_process'), crypto = require('node:crypto'), assert = require('node:assert/strict'); const {createOwnedRunner, ownedBytes} = require('../../fix-e-alignment/owned-command.cjs'); @@ -23,11 +24,11 @@ function inputs() { async function main() { try { const disk = fs.statfsSync(scratch); assert(disk.bavail * disk.bsize > 2 * 1024 ** 3); - const fixtureInputs = inputs(); report.fixture = fixtureInputs; + const fixtureInputs = inputs(); report.currentLibrary=currentLibraryInputs(); report.fixture = fixtureInputs; const sourceFiles = cp.execFileSync('git', ['-C', repo, 'ls-files', '-z', '--cached', '--others', '--exclude-standard']) .toString().split('\0').filter(Boolean); - const runtime = path.join(scratch, 'runtime'), bundle = path.join(scratch, 'model'), generated = path.join(bundle, 'lib'); - const consumer = path.join(scratch, 'consumer'), tests = path.join(consumer, 'src/test/java/io/teaql/examples/contextfix'); + const runtime = path.join(scratch, 'runtime'), bundle = path.join(scratch, 'java-lib-core'), generated = path.join(bundle, 'lib'); + const consumer = path.join(scratch, 'java-app-console'), tests = path.join(consumer, 'showcase-tests/io/teaql/examples/contextfix'); const sourceHash = crypto.createHash('sha256'); for (const name of [...new Set(sourceFiles)].sort()) { const file = path.join(repo, name); if (!fs.existsSync(file)) continue; @@ -37,20 +38,15 @@ async function main() { } report.sourceCommit = cp.execFileSync('git', ['-C', repo, 'rev-parse', 'HEAD']).toString().trim(); report.sourceSha256 = sourceHash.digest('hex'); - for (const name of Object.keys(fixtureInputs.files)) { - const target = path.join(bundle, name); fs.mkdirSync(path.dirname(target), {recursive: true}); - fs.copyFileSync(path.join(fixture, name), target); - } + fs.cpSync(path.join(__dirname,'java-lib-core'),bundle,{recursive:true}); const version = fs.readFileSync(path.join(runtime, 'pom.xml'), 'utf8').match(/([^<]+)<\/version>/)[1]; report.metadataOverride = require('../../../scripts/pin-local-example-pom.cjs').pin(path.join(generated, 'pom.xml'), runtime, scratch); - fs.mkdirSync(tests, {recursive: true}); - const app = fs.readFileSync(path.join(__dirname, 'GeneratedContextFixTest.java')); - report.applicationSha256 = sha(app); fs.writeFileSync(path.join(tests, 'GeneratedContextFixTest.java'), app); - const dependencies = ['teaql-runtime', 'teaql-provider-jdbc', 'teaql-sqlite', 'teaql-dynamic-fields-jdbc'].map(name => - `io.teaql${name}${version}`).join(''); - fs.writeFileSync(path.join(consumer, 'pom.xml'), `4.0.0io.teaqlteaql-java-parent${version}../runtime/pom.xmlio.teaql.examplescontext-fix-consumer${version}com.examplecontext-fix-service-core0.0.1-SNAPSHOT${dependencies}junitjunit4.13.2testorg.apache.maven.pluginsmaven-surefire-pluginfalse`); + fs.cpSync(path.join(__dirname,'java-app-console'),consumer,{recursive:true}); + report.applicationSha256=sha(fs.readFileSync(path.join(tests,'GeneratedContextFixTest.java'))); + const pom=fs.readFileSync(path.join(consumer,'pom.xml'),'utf8').replace('../../../../pom.xml','../runtime/pom.xml'); + fs.writeFileSync(path.join(consumer,'pom.xml'),pom);fs.writeFileSync(path.join(output,'consumer-pom.xml'),pom); const reactor = path.join(scratch, 'pom.xml'); - fs.writeFileSync(reactor, '4.0.0io.teaql.testcontext-reactor0pomruntimemodel/libconsumer'); + fs.writeFileSync(reactor, '4.0.0io.teaql.testcontext-reactor0pomruntimejava-lib-core/libjava-app-console'); if (process.env.TEAQL_CONTEXT_FIX_UNIT_TESTS === '1') { const command = [process.env.MAVEN || 'mvn', '-o', '-q', '-ntp', '-f', path.join(runtime, 'pom.xml'), '-pl', 'teaql-runtime', '-am', 'test']; @@ -82,7 +78,7 @@ async function main() { assert.match(bytes.toString(), /JAVA_CONTEXT_FIX_SQLITE=passed typedQ=true typedE=true noOpProviderCalls=0 failedCheckProviderCalls=0 updateAudits=1 objectLocation=true/); assert.match(bytes.toString(), /JAVA_CONTEXT_FIX_EXTENSIONS=passed dynamicOnly=true readonlyNoop=true equalDynamicNoop=true/); assert.match(bytes.toString(), /JAVA_CONTEXT_FIX_GRAPH=passed indexedLocation=true automaticUndo=true childOnly=true/); - assert.deepEqual(inputs(), fixtureInputs, 'generated fixture changed'); + assert.deepEqual(currentLibraryInputs(),report.currentLibrary); assert.deepEqual(inputs(), fixtureInputs, 'generated fixture changed'); } report.sameDatabase = true; report.databaseSha256 = sha(fs.readFileSync(path.join(output, 'fixture.sqlite'))); report.passed = true; console.log('PASS generated Java Context Fix SQLite example twice with local runtime'); diff --git a/examples/conformance/showcase.json b/examples/conformance/showcase.json index 48c664987..25622d2de 100644 --- a/examples/conformance/showcase.json +++ b/examples/conformance/showcase.json @@ -30,7 +30,8 @@ "sourceCommit": "af7e8b4ada69c18c07f08b1dcf5a3b120bfc6fc3" }, "relatedShowcases": [ - "natural-messages/showcase.json" + "natural-messages/showcase.json", + "context-derived/showcase.json" ], "scene": "WorkItem governed lifecycle and workspace-owned Spring transaction business scenarios", "schema": "teaql.model-workspace-showcase/v1", From 852bca58a93cdd96d9f728b7b24b8f4cdb324e89 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 14:22:43 +0800 Subject: [PATCH 26/71] Record the independently qualified nested Catalog showcase --- examples/conformance/context-derived/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/conformance/context-derived/showcase.json b/examples/conformance/context-derived/showcase.json index 5af030823..8e21a00b5 100644 --- a/examples/conformance/context-derived/showcase.json +++ b/examples/conformance/context-derived/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/context-field-qualified-generation/receipt.json", "receiptSHA256": "fd8c37aeb5622a41a2dd8768724e432d5f97b58bf720f39217a8f31a8f4c1d90" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-context-field-native-scopes/runtime/context-derived/receipt.json", + "businessReceiptSHA256": "8766ddceb40a1d185d57163914ea457cf327951f1af4460a50171d4441ccb7c5", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-context-field-native-scopes/receipt.json", + "nativeReceiptSHA256": "046c9511369908719f6640d002c9d14d3ffa76e168b4ebc70adbe66e4ad60c31", + "remainingFullRuntimeInventory": true, + "sourceCommit": "87b3225d1dc13abb5a5308b22643c501295b0b41" + }, "scene": "Catalog entry edits with trusted Context defaults, no-op saves and rollback", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "node", "verify-local.cjs" From 07b1782313ab445502803d77f9720df4941f406f Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 14:34:44 +0800 Subject: [PATCH 27/71] Explain the Context-derived Catalog scene and preserved historical calibration --- .../conformance/context-derived/README.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/conformance/context-derived/README.md diff --git a/examples/conformance/context-derived/README.md b/examples/conformance/context-derived/README.md new file mode 100644 index 000000000..db9d628d6 --- /dev/null +++ b/examples/conformance/context-derived/README.md @@ -0,0 +1,27 @@ +# Trusted Context fields on Catalog entries + +## Current business model and workspace + +`model.xml` defines Catalog and Entry. Trusted Context supplies collection/edit +times, IP and actor fields; the example shows why saving an unchanged entry +must leave those business values untouched. `java-lib-core/` is the exact, read-only +current generated domain library. The application is in `java-app-console/showcase-tests/io/teaql/examples/contextfix/GeneratedContextFixTest.java`. +The historical `fixture/` remains byte-identical and retains all of its original +fingerprint checks; a separate guard verifies the current library before and +after business execution. + +Run the focused source qualifier entry from the SDK repository root: + +```bash +node examples/conformance/context-derived/verify-local.cjs +``` + +The original assertions run twice on retained stores: no-op saves produce no +updates, genuine edits consume the trusted Context, failed validation/provider +work preserves edits, and a later invalid child rolls back staged graph fields. +Current managed creation results are explicitly awaited or checked. No generated +implementation is hand-edited. Compact receipts and result stores are retained; +owned build output is removed. Full runtime inventories remain separate gates. + +The current model adds only `_audit_mask_fields="guarded_token"` to satisfy the +current evaluator. Business fields/defaults and the frozen model are unchanged. From 4c46bb90f04ef55b32b414a8692745d71ee60ba6 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 14:47:49 +0800 Subject: [PATCH 28/71] Show generated Java procurement order numbering alongside existing calibration --- examples/business-id-runtime/README.md | 10 +- .../java-app-console/.gitignore | 53 ++ .../java-app-console/AGENTS.md | 66 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 ++++ .../java-app-console/lib/pom.xml | 102 +++ .../BaseServiceConfiguration.java | 0 .../purchaseordernumbering/Checkers.java | 0 .../purchaseordernumbering/Constants.java | 9 + .../com/teaql/purchaseordernumbering/E.java | 18 + .../EntityMetaRegistry.java | 305 +++++++ .../GeneratedRuntimeModule.java | 37 + .../PurchaseOrderNumberingUserContext.java | 10 + .../com/teaql/purchaseordernumbering/Q.java | 31 + .../purchaseordernumbering/Repositories.java | 0 .../platform/Platform.java | 130 +++ .../platform/PlatformChecker.java | 52 ++ .../platform/PlatformExpression.java | 51 ++ .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 623 ++++++++++++++ .../purchaseorder/PurchaseOrder.java | 170 ++++ .../purchaseorder/PurchaseOrderChecker.java | 98 +++ .../PurchaseOrderExpression.java | 61 ++ .../PurchaseOrderListExpression.java | 25 + .../purchaseorder/PurchaseOrderRequest.java | 767 ++++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-app-console/pom.xml | 103 +++ .../com/teaql/purchaseordernumbering/App.java | 120 +++ .../CustomUserContext.java | 26 + .../PurchaseOrderNumbering.java | 83 ++ .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 106 +++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../java-lib-core/generated-files.json | 26 + .../java-lib-core/lib/pom.xml | 142 ++++ .../BaseServiceConfiguration.java | 0 .../purchaseordernumbering/Checkers.java | 0 .../purchaseordernumbering/Constants.java | 9 + .../com/teaql/purchaseordernumbering/E.java | 18 + .../EntityMetaRegistry.java | 305 +++++++ .../GeneratedRuntimeModule.java | 37 + .../PurchaseOrderNumberingUserContext.java | 10 + .../com/teaql/purchaseordernumbering/Q.java | 31 + .../purchaseordernumbering/Repositories.java | 0 .../platform/Platform.java | 130 +++ .../platform/PlatformChecker.java | 52 ++ .../platform/PlatformExpression.java | 51 ++ .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 623 ++++++++++++++ .../purchaseorder/PurchaseOrder.java | 170 ++++ .../purchaseorder/PurchaseOrderChecker.java | 98 +++ .../PurchaseOrderExpression.java | 61 ++ .../PurchaseOrderListExpression.java | 25 + .../purchaseorder/PurchaseOrderRequest.java | 767 ++++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/business-id-runtime/model.xml | 6 + examples/business-id-runtime/showcase.json | 39 + scripts/verify-examples.sh | 6 + 68 files changed, 6094 insertions(+), 1 deletion(-) create mode 100644 examples/business-id-runtime/java-app-console/.gitignore create mode 100644 examples/business-id-runtime/java-app-console/AGENTS.md create mode 100644 examples/business-id-runtime/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/business-id-runtime/java-app-console/Makefile create mode 100644 examples/business-id-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/business-id-runtime/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/business-id-runtime/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/business-id-runtime/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/business-id-runtime/java-app-console/lib/pom.xml create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java create mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/business-id-runtime/java-app-console/pom.xml create mode 100644 examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java create mode 100644 examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/CustomUserContext.java create mode 100644 examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java create mode 100644 examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/WorkspaceTeaQLDatabase.java create mode 100644 examples/business-id-runtime/java-app-console/src/main/resources/application.properties create mode 100644 examples/business-id-runtime/java-app-console/teaql-i18n.json create mode 100644 examples/business-id-runtime/java-app-console/teaql/checker-model.json create mode 100644 examples/business-id-runtime/java-app-console/teaql/model-provenance.json create mode 100644 examples/business-id-runtime/java-lib-core/generated-files.json create mode 100644 examples/business-id-runtime/java-lib-core/lib/pom.xml create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/E.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java create mode 100644 examples/business-id-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/business-id-runtime/java-lib-core/teaql/checker-model.json create mode 100644 examples/business-id-runtime/java-lib-core/teaql/model-provenance.json create mode 100644 examples/business-id-runtime/model.xml create mode 100644 examples/business-id-runtime/showcase.json diff --git a/examples/business-id-runtime/README.md b/examples/business-id-runtime/README.md index 3b959c99a..a4ab27cee 100644 --- a/examples/business-id-runtime/README.md +++ b/examples/business-id-runtime/README.md @@ -1,4 +1,12 @@ -# Business ID focused runtime example +# Number two procurement orders + +`model.xml` defines the purchase order and its `ORD` Business ID. +`java-lib-core/` contains the generated domain library. The console at +`java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java` installs the trusted business clock and SQLite allocator, +records two orders, retries the first, and reads both back by number. +It rejects a blank audit reason and verifies the denied order is absent. + +## Allocator and live-dialect calibration This example verifies the Java runtime Business ID boundary without running the full multi-module regression suite. It covers the default six-character diff --git a/examples/business-id-runtime/java-app-console/.gitignore b/examples/business-id-runtime/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/AGENTS.md b/examples/business-id-runtime/java-app-console/AGENTS.md new file mode 100644 index 000000000..60b120b36 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | platform | +| purchase_order | purchase_order | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/business-id-runtime/java-app-console/DOMAIN_API_GUIDE.md b/examples/business-id-runtime/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..b1c6d4a93 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/purchase-order-numbering.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | platform | +| purchase_order | purchase_order | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/Makefile b/examples/business-id-runtime/java-app-console/Makefile new file mode 100644 index 000000000..3165e8179 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/purchase-order-numbering-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/purchase-order-numbering-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/business-id-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..664ead2a8 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/purchase-order-numbering.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/STANDARD_TELEMETRY.md b/examples/business-id-runtime/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/business-id-runtime/java-app-console/TOOL_API_GUIDE.md b/examples/business-id-runtime/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..87ef3ecd1 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/purchase-order-numbering.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/purchase-order-numbering.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/purchase-order-numbering.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/purchase-order-numbering.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/purchase-order-numbering.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/purchase-order-numbering.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/docs/teaql-java-crud-guide.md b/examples/business-id-runtime/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..fdab6a8e6 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.purchaseordernumbering`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.purchaseordernumbering.Q; +import com.teaql.purchaseordernumbering.PurchaseOrderNumberingUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()) + .comment("load with purchaseOrderList") + .purpose("fetch child purchaseOrderList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `1`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.teaql.purchaseordernumbering.platform.PlatformRequest` \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/pom.xml b/examples/business-id-runtime/java-app-console/lib/pom.xml new file mode 100644 index 000000000..e6e38ff8b --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + purchase-order-numbering-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java new file mode 100644 index 000000000..21f3171bf --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java new file mode 100644 index 000000000..253c026cf --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java @@ -0,0 +1,18 @@ + +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformExpression; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static PurchaseOrderExpression purchaseOrder(PurchaseOrder purchaseOrder){ + return new PurchaseOrderExpression(new ValueExpression(purchaseOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.purchaseOrder()")); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java new file mode 100644 index 000000000..ceda8f0ba --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java @@ -0,0 +1,305 @@ + +package com.teaql.purchaseordernumbering; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerPurchaseOrder(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.teaql.purchaseordernumbering.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.purchaseordernumbering.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.purchaseordernumbering.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.teaql.purchaseordernumbering.platform.Platform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Procurement") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerPurchaseOrder() { + FieldLayout.installGenerated(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.PLATFORM_PROPERTY, com.teaql.purchaseordernumbering.platform.Platform.INTERNAL_TYPE, com.teaql.purchaseordernumbering.platform.Platform.PURCHASE_ORDER_LIST_PROPERTY, com.teaql.purchaseordernumbering.platform.Platform.class) + ; + PropertyDescriptor supplier = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY, String.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY).with("isPassword", "false") + + .with("max", "80") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("min", "1") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY).with("policyVersion", "1") + + .with("splitbydate", "true") + + .with("isPassword", "false") + + .with("dateFormat", "yyyyMMdd") + + .with("max", "100") + + .with("prefix", "ORD") + + .with("profile", "daily-permuted-v1") + + .with("preserve_digits", "6") + + .with("isVersion", "false") + + .with("separator", "-") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("namespace", "order_number") + + .with("reset", "daily") + + .with("isString", "true") + + .with("isDate", "false") + + .with("isBusinessId", "true") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java new file mode 100644 index 000000000..9e1b662fa --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.teaql.purchaseordernumbering; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.purchaseordernumbering.platform.PlatformChecker(), new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:304c22e5b2a924d8fc32148174ef6d249857e8080ea8459c2cb4d8a6fd75ae60\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"purchase_order_list\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrderList\",\"purchaseOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PurchaseOrder\":{\"labels\":{\"en\":\"purchase order\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"supplier\",\"labels\":{\"en\":\"supplier\"},\"aliases\":[\"Supplier\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("PurchaseOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("supplier", "supplier"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.purchaseordernumbering.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.purchaseordernumbering.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Procurement"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java new file mode 100644 index 000000000..4657ad0f1 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.purchaseordernumbering; + +import io.teaql.core.UserContext; +public interface PurchaseOrderNumberingUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java new file mode 100644 index 000000000..9e36986b3 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java @@ -0,0 +1,31 @@ + +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.purchaseordernumbering.platform.PlatformRequest platforms(){ + return new com.teaql.purchaseordernumbering.platform.PlatformRequest(com.teaql.purchaseordernumbering.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.purchaseordernumbering.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.teaql.purchaseordernumbering.platform.PlatformRequest(com.teaql.purchaseordernumbering.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrders(){ + return new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrdersWithMinimalFields(){ + return new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrderByOrderNumber(OrderNumber value){ + return purchaseOrders() + .withOrderNumberIs(value) + .limit(2); + } + + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java new file mode 100644 index 000000000..7a10bad15 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "d902d21d4ba3eb14abdffc72b05a2e8008839fa2694a0e0978a2b236da59b3b6"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "purchase_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String PURCHASE_ORDER_LIST_PROPERTY = "purchase_order_list"; + private String name; + + private SmartList purchaseOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getPurchaseOrderList(){ + return this.purchaseOrderList == null ? SmartList.unloaded() : this.purchaseOrderList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addPurchaseOrder(PurchaseOrder purchaseOrder){ + if (purchaseOrder == null){ + return this; + } + + if(null == this.purchaseOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.purchaseOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.purchaseOrderList.add(purchaseOrder); + purchaseOrder.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "purchase_order_list": this.purchaseOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "purchase_order_list": return this.purchaseOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java new file mode 100644 index 000000000..1acced04e --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getPurchaseOrderList() != null && i < platform.getPurchaseOrderList().size(); i++){ + PurchaseOrder purchaseOrder = platform.getPurchaseOrderList().get(i); + new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, newLocation(_parentLocation, "purchase_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java new file mode 100644 index 000000000..bf49a9f08 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public PurchaseOrderListExpression getPurchaseOrderList(){ + return new PurchaseOrderListExpression(loaded("purchase_order_list", "getPurchaseOrderList", Platform::getPurchaseOrderList)); + } + public PlatformExpression addPurchaseOrder(PurchaseOrder purchaseOrder){ + return new PlatformExpression(this, $it -> ((Platform)$it).addPurchaseOrder(purchaseOrder)); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java new file mode 100644 index 000000000..741d23e61 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.purchaseordernumbering.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java new file mode 100644 index 000000000..f68efd9c8 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.Q; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectPurchaseOrderList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectPurchaseOrderList(){ + return selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()); + } + + public PlatformRequest selectPurchaseOrderListWith(PurchaseOrderRequest purchaseOrderList){ + enhanceRelation(Platform.PURCHASE_ORDER_LIST_PROPERTY, purchaseOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderListWith", null, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.PLATFORM_PROPERTY))); + } + + public PlatformRequest havePurchaseOrders(){ + return withPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + + public PlatformRequest haveNoPurchaseOrders(){ + return withoutPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ + aggregate(Platform.PURCHASE_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(name, subRequest, false); + } + + public PlatformRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, PurchaseOrder.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPurchaseOrdersAs", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromPurchaseOrders(PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(REFINEMENTS, subRequest); + } + public PlatformRequest countPurchaseOrders(){ + addRelationCount("Count", Q.purchaseOrders().unlimited(), PurchaseOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrders", null, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countPurchaseOrdersAs(String name){ + addRelationCount(name, Q.purchaseOrders().unlimited(), PurchaseOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersAs", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countPurchaseOrdersWith(String name, PurchaseOrderRequest subRequest){ + addRelationCount(name, subRequest, PurchaseOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersWith", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java new file mode 100644 index 000000000..874e77a05 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java @@ -0,0 +1,170 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.businessid.BusinessIdDefinition; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class PurchaseOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "PurchaseOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5270760d55c941f82fc30cf0457d609378a6398d6229c0bb5ba44c7dea546787"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("supplier", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("supplier", java.util.List.of("supplier", "supplier")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + PurchaseOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public record OrderNumber(String value) { + public OrderNumber { + value = value == null ? null : value.trim(); + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("order_number must not be blank"); + } + } + + public static OrderNumber of(String value) { + return new OrderNumber(value); + } + + public static BusinessIdDefinition definition() { + return new BusinessIdDefinition( + "order_number", "daily-permuted-v1", "ORD", + "yyyyMMdd", "daily", 6, + "-", "order_number", 1); + } + + @Override + public String toString() { return value; } + } + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String SUPPLIER_PROPERTY = "supplier"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + private Platform platform; + + private String supplier; + + private String orderNumber; + + public Platform getPlatform(){ + return this.platform; + } + + public String getSupplier(){ + return this.supplier; + } + + public OrderNumber getOrderNumber(){ + return this.orderNumber == null ? null : new OrderNumber(this.orderNumber); + } + public PurchaseOrder updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public PurchaseOrder updateSupplier(String supplier){ + supplier = (supplier == null ? null : supplier.trim()); + if(isPropertyLoaded(SUPPLIER_PROPERTY) && Objects.equals(this.supplier, supplier)){ + return this; + } + handleUpdate(SUPPLIER_PROPERTY, getSupplier(), supplier); + this.supplier = supplier; + return this; + } + + public PurchaseOrder updateOrderNumber(OrderNumber orderNumber){ + String canonical = orderNumber == null ? null : orderNumber.value(); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, canonical)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, this.orderNumber, canonical); + this.orderNumber = canonical; + return this; + } + + + public static PurchaseOrder refer(Long id){ + PurchaseOrder refer = new PurchaseOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public PurchaseOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "supplier": this.supplier = (value == null ? null : ((String)value).trim()); break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "supplier": return this.supplier; + case "order_number": return this.orderNumber; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "supplier": return this.supplier; + case "orderNumber": return this.orderNumber; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java new file mode 100644 index 000000000..ef68e96c3 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java @@ -0,0 +1,98 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformChecker; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.UserContext; +import io.teaql.core.businessid.BusinessIdSlot; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PurchaseOrderChecker implements Checker{ + + public String type(){ + return PurchaseOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, purchaseOrder)){ + markAsChecked(_context, purchaseOrder); + doCheck(_context, purchaseOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if((purchaseOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, purchaseOrder); + if(purchaseOrder.needPersist()){ + } + if(purchaseOrder.newItem()){ + boolean orderNumberWasMissing = purchaseOrder.getOrderNumber() == null; + try { + _context.businessIds().ensure( + _context, + OrderNumber.definition(), + String.valueOf(_context.requireActiveRoot("Platform").id()), + type(), + new BusinessIdSlot() { + public String currentValue() { + OrderNumber current = purchaseOrder.getOrderNumber(); + return current == null ? null : current.value(); + } + public boolean newAggregate() { return true; } + public void assignCanonicalValue(String value) { + purchaseOrder.updateOrderNumber(OrderNumber.of(value)); + } + }); + if (orderNumberWasMissing) { + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "order_number", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "businessIdAllocator")); + } + } catch (io.teaql.core.businessid.BusinessIdException error) { + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), error.getCode() + ": " + error.getMessage()); + } + + }else if(purchaseOrder.updateItem()){ + if(!purchaseOrder.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("supplier")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "supplier"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(purchaseOrder.getUpdatedProperties().contains(PurchaseOrder.ORDER_NUMBER_PROPERTY)){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Business ID is immutable after create"); + } + } + checkPlatform(_context, purchaseOrder.getProperty(PurchaseOrder.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkSupplier(_context, purchaseOrder.getProperty(PurchaseOrder.SUPPLIER_PROPERTY), newLocation(_parentLocation, "supplier")); + checkOrderNumber(_context, purchaseOrder.getOrderNumber(), newLocation(_parentLocation, "order_number")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkSupplier(UserContext _context, String supplier, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, supplier); + if((supplier == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, supplier); + maxStringCheck(_context, _parentLocation, 80, supplier); + + } + public void checkOrderNumber(UserContext _context, OrderNumber orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java new file mode 100644 index 000000000..0594527d8 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformExpression; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PurchaseOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PurchaseOrderExpression(Expression expression){ + super(expression); + } + + public PurchaseOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public PurchaseOrderExpression updateId(Long id){ + return new PurchaseOrderExpression(this, $it -> {((PurchaseOrder)$it).__internalSet("id", id); return this;}); + } + + public PurchaseOrderExpression save(UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PurchaseOrderExpression save(String intent, UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", PurchaseOrder::getPlatform)); + } + + public PurchaseOrderExpression updatePlatform(Platform platform){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updatePlatform(platform)); + } + + public Expression getSupplier(){ + return loaded("supplier", "getSupplier", PurchaseOrder::getSupplier); + } + public PurchaseOrderExpression updateSupplier(String supplier){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateSupplier(supplier)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", PurchaseOrder::getOrderNumber); + } + public PurchaseOrderExpression updateOrderNumber(OrderNumber orderNumber){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateOrderNumber(orderNumber)); + } + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java new file mode 100644 index 000000000..17920adce --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PurchaseOrderListExpression extends SmartListExpression { + public PurchaseOrderListExpression(Expression> expression){ + super(expression); + } + + public PurchaseOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PurchaseOrderExpression first() { + return new PurchaseOrderExpression(super.first()); + } + + public PurchaseOrderExpression get(int index) { + return new PurchaseOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java new file mode 100644 index 000000000..aa96df543 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java @@ -0,0 +1,767 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.Q; +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformRequest; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PurchaseOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PurchaseOrderRequest(Class returnType){ + this(returnType, () -> (T) new PurchaseOrder()); + } + + protected PurchaseOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PurchaseOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PurchaseOrderRequest copy(){ + return (PurchaseOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PurchaseOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PurchaseOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PurchaseOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PurchaseOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PurchaseOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PurchaseOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PurchaseOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PurchaseOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public PurchaseOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder){ + super.internalMatchAny(purchaseOrder); + return this; + } + + public PurchaseOrderRequest matchingIdsOf(PurchaseOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + PurchaseOrder.ID_PROPERTY, request, PurchaseOrder.ID_PROPERTY)); + } + + public PurchaseOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PurchaseOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PurchaseOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PurchaseOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectSupplier().selectOrderNumber().selectVersion(); + } + + public PurchaseOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public PurchaseOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(PurchaseOrder.ID_PROPERTY); + selectProperty(PurchaseOrder.PLATFORM_PROPERTY); + selectProperty(PurchaseOrder.SUPPLIER_PROPERTY); + selectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectSupplier().selectOrderNumber().selectVersion(); + } + + public PurchaseOrderRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectSupplier().selectOrderNumber().selectVersion(); + } + + + public PurchaseOrderRequest selectId(){ + selectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectId(){ + unselectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest selectPlatformIdOnly(){ + selectProperty(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public PurchaseOrderRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(PurchaseOrder.PLATFORM_PROPERTY); + enhanceRelation(PurchaseOrder.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, PurchaseOrder.PLATFORM_PROPERTY)); + return this; + } + + public PurchaseOrderRequest unselectPlatform(){ + unselectProperty(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + public PurchaseOrderRequest selectSupplier(){ + selectProperty(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + /** + * fill the supplier with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS supplier) to fetch supplier property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectSupplier(){ + unselectProperty(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest selectOrderNumber(){ + selectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectOrderNumber(){ + unselectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest selectVersion(){ + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectVersion(){ + unselectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.ID_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PurchaseOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PurchaseOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PurchaseOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PurchaseOrderRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public PurchaseOrderRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public PurchaseOrderRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public PurchaseOrderRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, operator, values); + } + + public PurchaseOrderRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public PurchaseOrderRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public PurchaseOrderRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public PurchaseOrderRequest filterBySupplier(String... supplier){ + if (supplier == null || supplier.length == 0) { + throw new IllegalArgumentException("filterBySupplier parameter supplier cannot be empty"); + } + return appendSearchCriteria(createSupplierCriteria(Operator.EQUAL, (Object[])supplier)); + } + + public PurchaseOrderRequest withSupplier(Operator operator, Object... values){ + return appendSearchCriteria(createSupplierCriteria(operator, values)); + } + + public PurchaseOrderRequest withSupplierIsUnknown(){ + return withSupplier(Operator.IS_NULL); + } + + public PurchaseOrderRequest withSupplierIsKnown(){ + return withSupplier(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSupplierCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.SUPPLIER_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withSupplierIsNot(String supplier){ + return withSupplier(Operator.NOT_EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierIn(String... supplier){ + return withSupplier(Operator.IN, (Object[])supplier); + } + + public PurchaseOrderRequest withSupplierNotIn(String... supplier){ + return withSupplier(Operator.NOT_IN, (Object[])supplier); + } + public PurchaseOrderRequest withSupplierGreaterThan(String supplier){ + return withSupplier(Operator.GREATER_THAN, supplier); + } + + public PurchaseOrderRequest withSupplierGreaterThanOrEqualTo(String supplier){ + return withSupplier(Operator.GREATER_THAN_OR_EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierLessThan(String supplier){ + return withSupplier(Operator.LESS_THAN, supplier); + } + + public PurchaseOrderRequest withSupplierLessThanOrEqualTo(String supplier){ + return withSupplier(Operator.LESS_THAN_OR_EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierBetween(String startOfSupplier, String endOfSupplier){ + return withSupplier(Operator.BETWEEN, startOfSupplier, endOfSupplier); + } + public PurchaseOrderRequest withSupplierStartingWith(String supplier){ + return withSupplier(Operator.BEGIN_WITH, supplier); + } + public PurchaseOrderRequest withSupplierContaining(String supplier){ + return withSupplier(Operator.CONTAIN, supplier); + } + + public PurchaseOrderRequest withSupplierNotContaining(String supplier){ + return withSupplier(Operator.NOT_CONTAIN, supplier); + } + + public PurchaseOrderRequest withSupplierNotStartingWith(String supplier){ + return withSupplier(Operator.NOT_BEGIN_WITH, supplier); + } + + public PurchaseOrderRequest withSupplierEndingWith(String supplier){ + return withSupplier(Operator.END_WITH, supplier); + } + + public PurchaseOrderRequest withSupplierNotEndingWith(String supplier){ + return withSupplier(Operator.NOT_END_WITH, supplier); + } + + public PurchaseOrderRequest withSupplierIs(String supplier){ + return withSupplier(Operator.EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierSoundingLike(String supplier){ + return withSupplier(Operator.SOUNDS_LIKE, supplier); + } + + + + public PurchaseOrderRequest withOrderNumberIs(OrderNumber value){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.EQUAL, value.value())); + } + + public PurchaseOrderRequest withOrderNumberIsNot(OrderNumber value){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.NOT_EQUAL, value.value())); + } + + public PurchaseOrderRequest withOrderNumberIsUnknown(){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.IS_NULL)); + } + + public PurchaseOrderRequest withOrderNumberIsKnown(){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.IS_NOT_NULL)); + } + + public PurchaseOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PurchaseOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PurchaseOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PurchaseOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.VERSION_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PurchaseOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PurchaseOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PurchaseOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PurchaseOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PurchaseOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PurchaseOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public PurchaseOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PurchaseOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PurchaseOrderRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public PurchaseOrderRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(PurchaseOrder.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public PurchaseOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PurchaseOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public PurchaseOrderRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctSupplier(){ + return countDistinctSupplierAs("supplier_distinct_count"); + } + + public PurchaseOrderRequest countDistinctSupplierAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public PurchaseOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PurchaseOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupById(){ + groupBy(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdAs(String retName){ + groupBy(retName, PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.ID_PROPERTY, function); + return this; + } + public PurchaseOrderRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(PurchaseOrder.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public PurchaseOrderRequest groupByPlatform(){ + groupBy(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByPlatformAs(String retName){ + groupBy(retName, PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.PLATFORM_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupBySupplier(){ + groupBy(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupBySupplierAs(String retName){ + groupBy(retName, PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupBySupplierWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.SUPPLIER_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByOrderNumber(){ + groupBy(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByVersion(){ + groupBy(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionAs(String retName){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY, function); + return this; + } + + + + public PurchaseOrderRequest orderByIdAscending(){ + addOrderByAscending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByIdDescending(){ + addOrderByDescending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByPlatformAscending(){ + addOrderByAscending(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByPlatformDescending(){ + addOrderByDescending(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderBySupplierAscending(){ + addOrderByAscending(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderBySupplierDescending(){ + addOrderByDescending(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderBySupplierAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderBySupplierDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByVersionAscending(){ + addOrderByAscending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByVersionDescending(){ + addOrderByDescending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + public PurchaseOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public PurchaseOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, PurchaseOrder.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, PurchaseOrder.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public PurchaseOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PurchaseOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PurchaseOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PurchaseOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PurchaseOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PurchaseOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..ebd1eefdf --- /dev/null +++ b/examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.purchaseordernumbering.EntityMetaRegistry \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/pom.xml b/examples/business-id-runtime/java-app-console/pom.xml new file mode 100644 index 000000000..a85853740 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + com.teaql + purchase-order-numbering + 0.0.1-SNAPSHOT + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + io.teaql + teaql-business-id-jdbc + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.teaql + purchase-order-numbering-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.teaql.purchaseordernumbering.App + + + + + + + + \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java new file mode 100644 index 000000000..4e03dea0a --- /dev/null +++ b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java @@ -0,0 +1,120 @@ + +package com.teaql.purchaseordernumbering; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.businessid.jdbc.JdbcBusinessIdAllocator; +import io.teaql.core.businessid.BusinessIdEncodingKey; +import io.teaql.runtime.businessid.StaticBusinessIdKeyProvider; +import java.util.HexFormat; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + PurchaseOrderNumbering.verify(context, System.getenv("TEAQL_PURCHASE_NUMBERING_ROUND")); + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .businessClock(context -> java.time.LocalDate.of(2026, 10, 1)) + .businessIdInfrastructure(new JdbcBusinessIdAllocator(database)) + .businessIdKeyProvider(businessIdKeyProvider()) + .build() + .install(GeneratedRuntimeModule.module()); + } + + private static StaticBusinessIdKeyProvider businessIdKeyProvider() { + String encoded = System.getenv("TEAQL_BUSINESS_ID_KEY_V1_HEX"); + if (encoded == null || encoded.isBlank()) { + throw new IllegalStateException( + "TEAQL_BUSINESS_ID_KEY_V1_HEX must contain exactly 64 hexadecimal characters"); + } + try { + int version = Integer.parseInt( + System.getenv().getOrDefault("TEAQL_BUSINESS_ID_KEY_VERSION", "1")); + return new StaticBusinessIdKeyProvider( + new BusinessIdEncodingKey(version, HexFormat.of().parseHex(encoded))); + } catch (RuntimeException error) { + throw new IllegalStateException( + "Invalid TeaQL Business ID key configuration", error); + } + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/CustomUserContext.java b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/CustomUserContext.java new file mode 100644 index 000000000..034a5998e --- /dev/null +++ b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.purchaseordernumbering; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements PurchaseOrderNumberingUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java new file mode 100644 index 000000000..76e913e64 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java @@ -0,0 +1,83 @@ +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import io.teaql.core.RequestIntentException; +import io.teaql.core.UserContext; + +final class PurchaseOrderNumbering { + private static final String REJECTED_SUPPLIER = "Unaudited Supplier"; + + private PurchaseOrderNumbering() {} + + static void verify(UserContext context, String round) { + require(round != null && round.matches("[a-z]+"), "Supply the example round label"); + Platform platform = Q.platformsWithMinimalFields().withIdIs(1L).limit(1) + .comment("Read the bootstrapped procurement platform") + .purpose("Associate purchase orders with the procurement platform") + .executeForOne(context); + require(platform != null, "Procurement platform was not bootstrapped"); + + PurchaseOrder first = create(context, platform, "Northwind-" + round); + PurchaseOrder second = create(context, platform, "Contoso-" + round); + Long firstId = first.getId(); + var firstNumber = first.getOrderNumber(); + var secondNumber = second.getOrderNumber(); + String format = "ORD-20261001-[A-Z0-9]{6}"; + require(firstNumber != null && secondNumber != null + && !firstId.equals(second.getId()) && !firstNumber.equals(secondNumber) + && firstNumber.value().matches(format) && secondNumber.value().matches(format), + "Expected distinct numbers from the Context business day"); + first.auditAs("Retry recording Northwind's purchase order").save(context); + require(firstId.equals(first.getId()) && firstNumber.equals(first.getOrderNumber()), + "Retry changed the purchase order identity"); + + for (PurchaseOrder order : new PurchaseOrder[] { first, second }) { + var read = Q.purchaseOrders().withOrderNumberIs(order.getOrderNumber()).limit(2) + .comment("Read a purchase order by its assigned number") + .purpose("Verify the procurement record and allocation").executeForOne(context); + require(read != null && read.getId().equals(order.getId()) + && read.getOrderNumber().equals(order.getOrderNumber()) + && read.getSupplier().equals(order.getSupplier()), + "Typed order-number query returned a different purchase order"); + } + + var rejected = prepare(context, platform, REJECTED_SUPPLIER); + String rejection; + try { + rejected.auditAs(" ").save(context); + throw new IllegalStateException("Unaudited purchase order was accepted"); + } catch (RequestIntentException error) { + require(error.getCode().equals("REQUEST_COMMENT_REQUIRED") + && error.getRequestKind().equals("mutation"), "Unexpected intent failure"); + rejection = error.getCode(); + } + var absent = Q.purchaseOrders().withSupplierIs(REJECTED_SUPPLIER).limit(2) + .comment("Look for the unaudited purchase order") + .purpose("Prove the rejected operation stored no order").executeForOne(context); + require(absent == null, "Unaudited purchase order persisted"); + System.out.printf("PURCHASE_ORDER_NUMBERING={\"round\":\"%s\",\"firstId\":%d,\"firstNumber\":\"%s\"," + + "\"secondId\":%d,\"secondNumber\":\"%s\",\"retryNumber\":\"%s\"," + + "\"rejection\":\"%s\",\"typedReadback\":true}%n", + round, firstId, firstNumber.value(), second.getId(), secondNumber.value(), + first.getOrderNumber().value(), rejection); + } + + private static PurchaseOrder prepare(UserContext context, Platform platform, String supplier) { + var order = Q.purchaseOrders().comment("Initialize the purchase order") + .purpose("Record a procurement commitment").newEntity(context); + order.updatePlatform(platform); + order.updateSupplier(supplier); + return order; + } + + private static PurchaseOrder create(UserContext context, Platform platform, String supplier) { + var order = prepare(context, platform, supplier); + order.auditAs("Record the approved purchase order").save(context); + return order; + } + + private static void require(boolean condition, String message) { + if (!condition) throw new IllegalStateException(message); + } +} diff --git a/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/WorkspaceTeaQLDatabase.java b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..579fe1990 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/src/main/java/com/teaql/purchaseordernumbering/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.purchaseordernumbering; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/src/main/resources/application.properties b/examples/business-id-runtime/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..a70cbce6a --- /dev/null +++ b/examples/business-id-runtime/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:purchaseordernumbering.db diff --git a/examples/business-id-runtime/java-app-console/teaql-i18n.json b/examples/business-id-runtime/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..732e1a66f --- /dev/null +++ b/examples/business-id-runtime/java-app-console/teaql-i18n.json @@ -0,0 +1,106 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.purchaseOrder.id": "Id", + "property.purchaseOrder.platform": "Platform", + "entity.purchaseOrder": "Purchase Order", + "property.purchaseOrder.version": "Version", + "property.purchaseOrder.supplier": "Supplier", + "property.platform.version": "Version", + "property.purchaseOrder.orderNumber": "Order Number" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/teaql/checker-model.json b/examples/business-id-runtime/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..d8402c672 --- /dev/null +++ b/examples/business-id-runtime/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:304c22e5b2a924d8fc32148174ef6d249857e8080ea8459c2cb4d8a6fd75ae60","entities":{"Platform":{"labels":{"en":"platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"purchase_order_list","targetType":"PurchaseOrder","labels":{"en":"purchase order"},"aliases":["PurchaseOrderList","purchaseOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"PurchaseOrder":{"labels":{"en":"purchase order"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"supplier","labels":{"en":"supplier"},"aliases":["Supplier"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/teaql/model-provenance.json b/examples/business-id-runtime/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..8ed79824d --- /dev/null +++ b/examples/business-id-runtime/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:ae5ea6f908693b88007259e6347336dc7d1a5469b4c3db8e554eec0c27e4e30f","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/generated-files.json b/examples/business-id-runtime/java-lib-core/generated-files.json new file mode 100644 index 000000000..60564536a --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/generated-files.json @@ -0,0 +1,26 @@ +{ + "lib/pom.xml": "93bca565c3ea5aa87589ad27172cfbe1ad3419b02788ad0cb4b9f680b84ecbf9", + "lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java": "14160295a83d6751ddf5d30d0c7b451d265c09a1913742f89cc56fe4cf43b9de", + "lib/src/main/java/com/teaql/purchaseordernumbering/E.java": "36d2d164bb2c3350860d2feaa8fba8767379184adca4b88491340ca1f37573fb", + "lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java": "37ff313bd9e034fb5876a0422cd06b9ff39460f6b8b6f1c3a07ea256deba9abf", + "lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java": "05153601754224fe39522d1691f0e338e4c735c4178b809cd02377b5f2936a20", + "lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java": "71d60360b70b6e1862633afd91b4cb8d47e88f7d471a873d86410412cec57904", + "lib/src/main/java/com/teaql/purchaseordernumbering/Q.java": "af2748f74c1ef199bc3eb6043d57608ae2c524cf932924827efbc0b23a0fa461", + "lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java": "bfe737b02fcd85824aa68653988cac43e95e1513b9b3547037a390b5d7145cb0", + "lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java": "ef939e5a2b45f1a82adcc41964e12d5652d72e76d8b4c07f976c0446440a3a69", + "lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java": "65d7f96555f2014594427a2b266ec6d06b9c66c8e0abff2cd940f5f4e59346b7", + "lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java": "612024956219d3bdb6b0b391f8d65b14bcc0ea4350e1fb1c716cd56d6d25b2c4", + "lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java": "85a5413326d4e75495c585e0fffd73f75bb4830fd8680dbc6b481939c806e82f", + "lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java": "504f43740594fb2ab44a6f6630c160a3d4424566fd1d0eca968e45e1792ab831", + "lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java": "3c7be6d975eced5f6dc6a43c3a3e885010cf4dd17be7397cdcfefa2d5e7f92b4", + "lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java": "2393794e787e2afb97cf47c18da20823a8cff1877c5791a9b8d46429a07efb41", + "lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java": "4eae88602c6e320d829ea1139aa4aa2ef5f08b4a87a289085c4bf6cdd846ccf7", + "lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java": "3882cf602b89dea80d11703f97cb9936737971c40b5c2c3f2b5a213875309865", + "lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "80c609e830e1972ffd62ce75cac998d3179baffbe8054a64c86129791b934c5e", + "teaql/checker-model.json": "9df3b08c07b9a38e5e0950e53c7a36835566ecf687bd87b66c67bb78abe63fdc", + "teaql/model-provenance.json": "866f95b2e3da7709501c25b00a177cd36e29120d13e78b2e1142f03299614a21" +} diff --git a/examples/business-id-runtime/java-lib-core/lib/pom.xml b/examples/business-id-runtime/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..65dddd700 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.teaql + purchase-order-numbering-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java new file mode 100644 index 000000000..21f3171bf --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/E.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/E.java new file mode 100644 index 000000000..253c026cf --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/E.java @@ -0,0 +1,18 @@ + +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformExpression; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static PurchaseOrderExpression purchaseOrder(PurchaseOrder purchaseOrder){ + return new PurchaseOrderExpression(new ValueExpression(purchaseOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.purchaseOrder()")); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java new file mode 100644 index 000000000..ceda8f0ba --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java @@ -0,0 +1,305 @@ + +package com.teaql.purchaseordernumbering; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerPurchaseOrder(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.teaql.purchaseordernumbering.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.purchaseordernumbering.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.purchaseordernumbering.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.teaql.purchaseordernumbering.platform.Platform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Procurement") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerPurchaseOrder() { + FieldLayout.installGenerated(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.PLATFORM_PROPERTY, com.teaql.purchaseordernumbering.platform.Platform.INTERNAL_TYPE, com.teaql.purchaseordernumbering.platform.Platform.PURCHASE_ORDER_LIST_PROPERTY, com.teaql.purchaseordernumbering.platform.Platform.class) + ; + PropertyDescriptor supplier = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY, String.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY).with("isPassword", "false") + + .with("max", "80") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("min", "1") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY).with("policyVersion", "1") + + .with("splitbydate", "true") + + .with("isPassword", "false") + + .with("dateFormat", "yyyyMMdd") + + .with("max", "100") + + .with("prefix", "ORD") + + .with("profile", "daily-permuted-v1") + + .with("preserve_digits", "6") + + .with("isVersion", "false") + + .with("separator", "-") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("namespace", "order_number") + + .with("reset", "daily") + + .with("isString", "true") + + .with("isDate", "false") + + .with("isBusinessId", "true") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java new file mode 100644 index 000000000..9e1b662fa --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.teaql.purchaseordernumbering; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.purchaseordernumbering.platform.PlatformChecker(), new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:304c22e5b2a924d8fc32148174ef6d249857e8080ea8459c2cb4d8a6fd75ae60\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"purchase_order_list\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrderList\",\"purchaseOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PurchaseOrder\":{\"labels\":{\"en\":\"purchase order\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"supplier\",\"labels\":{\"en\":\"supplier\"},\"aliases\":[\"Supplier\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("PurchaseOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("supplier", "supplier"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.purchaseordernumbering.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.purchaseordernumbering.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Procurement"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java new file mode 100644 index 000000000..4657ad0f1 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.purchaseordernumbering; + +import io.teaql.core.UserContext; +public interface PurchaseOrderNumberingUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java new file mode 100644 index 000000000..9e36986b3 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java @@ -0,0 +1,31 @@ + +package com.teaql.purchaseordernumbering; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.purchaseordernumbering.platform.PlatformRequest platforms(){ + return new com.teaql.purchaseordernumbering.platform.PlatformRequest(com.teaql.purchaseordernumbering.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.purchaseordernumbering.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.teaql.purchaseordernumbering.platform.PlatformRequest(com.teaql.purchaseordernumbering.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrders(){ + return new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrdersWithMinimalFields(){ + return new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrderByOrderNumber(OrderNumber value){ + return purchaseOrders() + .withOrderNumberIs(value) + .limit(2); + } + + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java new file mode 100644 index 000000000..7a10bad15 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "d902d21d4ba3eb14abdffc72b05a2e8008839fa2694a0e0978a2b236da59b3b6"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "purchase_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String PURCHASE_ORDER_LIST_PROPERTY = "purchase_order_list"; + private String name; + + private SmartList purchaseOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getPurchaseOrderList(){ + return this.purchaseOrderList == null ? SmartList.unloaded() : this.purchaseOrderList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addPurchaseOrder(PurchaseOrder purchaseOrder){ + if (purchaseOrder == null){ + return this; + } + + if(null == this.purchaseOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.purchaseOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.purchaseOrderList.add(purchaseOrder); + purchaseOrder.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "purchase_order_list": this.purchaseOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "purchase_order_list": return this.purchaseOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java new file mode 100644 index 000000000..1acced04e --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getPurchaseOrderList() != null && i < platform.getPurchaseOrderList().size(); i++){ + PurchaseOrder purchaseOrder = platform.getPurchaseOrderList().get(i); + new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, newLocation(_parentLocation, "purchase_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java new file mode 100644 index 000000000..bf49a9f08 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public PurchaseOrderListExpression getPurchaseOrderList(){ + return new PurchaseOrderListExpression(loaded("purchase_order_list", "getPurchaseOrderList", Platform::getPurchaseOrderList)); + } + public PlatformExpression addPurchaseOrder(PurchaseOrder purchaseOrder){ + return new PlatformExpression(this, $it -> ((Platform)$it).addPurchaseOrder(purchaseOrder)); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java new file mode 100644 index 000000000..741d23e61 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.purchaseordernumbering.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java new file mode 100644 index 000000000..f68efd9c8 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.purchaseordernumbering.platform; + +import com.teaql.purchaseordernumbering.Q; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectPurchaseOrderList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectPurchaseOrderList(){ + return selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()); + } + + public PlatformRequest selectPurchaseOrderListWith(PurchaseOrderRequest purchaseOrderList){ + enhanceRelation(Platform.PURCHASE_ORDER_LIST_PROPERTY, purchaseOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderListWith", null, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.PLATFORM_PROPERTY))); + } + + public PlatformRequest havePurchaseOrders(){ + return withPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + + public PlatformRequest haveNoPurchaseOrders(){ + return withoutPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ + aggregate(Platform.PURCHASE_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(name, subRequest, false); + } + + public PlatformRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, PurchaseOrder.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPurchaseOrdersAs", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromPurchaseOrders(PurchaseOrderRequest subRequest){ + return statsFromPurchaseOrdersAs(REFINEMENTS, subRequest); + } + public PlatformRequest countPurchaseOrders(){ + addRelationCount("Count", Q.purchaseOrders().unlimited(), PurchaseOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrders", null, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countPurchaseOrdersAs(String name){ + addRelationCount(name, Q.purchaseOrders().unlimited(), PurchaseOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersAs", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countPurchaseOrdersWith(String name, PurchaseOrderRequest subRequest){ + addRelationCount(name, subRequest, PurchaseOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersWith", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java new file mode 100644 index 000000000..874e77a05 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java @@ -0,0 +1,170 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.businessid.BusinessIdDefinition; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class PurchaseOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "PurchaseOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5270760d55c941f82fc30cf0457d609378a6398d6229c0bb5ba44c7dea546787"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("supplier", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("supplier", java.util.List.of("supplier", "supplier")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + PurchaseOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + public record OrderNumber(String value) { + public OrderNumber { + value = value == null ? null : value.trim(); + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("order_number must not be blank"); + } + } + + public static OrderNumber of(String value) { + return new OrderNumber(value); + } + + public static BusinessIdDefinition definition() { + return new BusinessIdDefinition( + "order_number", "daily-permuted-v1", "ORD", + "yyyyMMdd", "daily", 6, + "-", "order_number", 1); + } + + @Override + public String toString() { return value; } + } + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String SUPPLIER_PROPERTY = "supplier"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + private Platform platform; + + private String supplier; + + private String orderNumber; + + public Platform getPlatform(){ + return this.platform; + } + + public String getSupplier(){ + return this.supplier; + } + + public OrderNumber getOrderNumber(){ + return this.orderNumber == null ? null : new OrderNumber(this.orderNumber); + } + public PurchaseOrder updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public PurchaseOrder updateSupplier(String supplier){ + supplier = (supplier == null ? null : supplier.trim()); + if(isPropertyLoaded(SUPPLIER_PROPERTY) && Objects.equals(this.supplier, supplier)){ + return this; + } + handleUpdate(SUPPLIER_PROPERTY, getSupplier(), supplier); + this.supplier = supplier; + return this; + } + + public PurchaseOrder updateOrderNumber(OrderNumber orderNumber){ + String canonical = orderNumber == null ? null : orderNumber.value(); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, canonical)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, this.orderNumber, canonical); + this.orderNumber = canonical; + return this; + } + + + public static PurchaseOrder refer(Long id){ + PurchaseOrder refer = new PurchaseOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public PurchaseOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "supplier": this.supplier = (value == null ? null : ((String)value).trim()); break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "supplier": return this.supplier; + case "order_number": return this.orderNumber; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "supplier": return this.supplier; + case "orderNumber": return this.orderNumber; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java new file mode 100644 index 000000000..ef68e96c3 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java @@ -0,0 +1,98 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformChecker; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.UserContext; +import io.teaql.core.businessid.BusinessIdSlot; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PurchaseOrderChecker implements Checker{ + + public String type(){ + return PurchaseOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, purchaseOrder)){ + markAsChecked(_context, purchaseOrder); + doCheck(_context, purchaseOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ + if((purchaseOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, purchaseOrder); + if(purchaseOrder.needPersist()){ + } + if(purchaseOrder.newItem()){ + boolean orderNumberWasMissing = purchaseOrder.getOrderNumber() == null; + try { + _context.businessIds().ensure( + _context, + OrderNumber.definition(), + String.valueOf(_context.requireActiveRoot("Platform").id()), + type(), + new BusinessIdSlot() { + public String currentValue() { + OrderNumber current = purchaseOrder.getOrderNumber(); + return current == null ? null : current.value(); + } + public boolean newAggregate() { return true; } + public void assignCanonicalValue(String value) { + purchaseOrder.updateOrderNumber(OrderNumber.of(value)); + } + }); + if (orderNumberWasMissing) { + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "order_number", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "businessIdAllocator")); + } + } catch (io.teaql.core.businessid.BusinessIdException error) { + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), error.getCode() + ": " + error.getMessage()); + } + + }else if(purchaseOrder.updateItem()){ + if(!purchaseOrder.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("supplier")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "supplier"), "Mutation requires a fully loaded entity"); + } + if(!purchaseOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(purchaseOrder.getUpdatedProperties().contains(PurchaseOrder.ORDER_NUMBER_PROPERTY)){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Business ID is immutable after create"); + } + } + checkPlatform(_context, purchaseOrder.getProperty(PurchaseOrder.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkSupplier(_context, purchaseOrder.getProperty(PurchaseOrder.SUPPLIER_PROPERTY), newLocation(_parentLocation, "supplier")); + checkOrderNumber(_context, purchaseOrder.getOrderNumber(), newLocation(_parentLocation, "order_number")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkSupplier(UserContext _context, String supplier, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, supplier); + if((supplier == null)){ + return; + } + minStringCheck(_context, _parentLocation, 1, supplier); + maxStringCheck(_context, _parentLocation, 80, supplier); + + } + public void checkOrderNumber(UserContext _context, OrderNumber orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java new file mode 100644 index 000000000..0594527d8 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformExpression; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PurchaseOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PurchaseOrderExpression(Expression expression){ + super(expression); + } + + public PurchaseOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public PurchaseOrderExpression updateId(Long id){ + return new PurchaseOrderExpression(this, $it -> {((PurchaseOrder)$it).__internalSet("id", id); return this;}); + } + + public PurchaseOrderExpression save(UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PurchaseOrderExpression save(String intent, UserContext userContext){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", PurchaseOrder::getPlatform)); + } + + public PurchaseOrderExpression updatePlatform(Platform platform){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updatePlatform(platform)); + } + + public Expression getSupplier(){ + return loaded("supplier", "getSupplier", PurchaseOrder::getSupplier); + } + public PurchaseOrderExpression updateSupplier(String supplier){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateSupplier(supplier)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", PurchaseOrder::getOrderNumber); + } + public PurchaseOrderExpression updateOrderNumber(OrderNumber orderNumber){ + return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateOrderNumber(orderNumber)); + } + +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java new file mode 100644 index 000000000..17920adce --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PurchaseOrderListExpression extends SmartListExpression { + public PurchaseOrderListExpression(Expression> expression){ + super(expression); + } + + public PurchaseOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PurchaseOrderExpression first() { + return new PurchaseOrderExpression(super.first()); + } + + public PurchaseOrderExpression get(int index) { + return new PurchaseOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java new file mode 100644 index 000000000..aa96df543 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java @@ -0,0 +1,767 @@ + +package com.teaql.purchaseordernumbering.purchaseorder; + +import com.teaql.purchaseordernumbering.Q; +import com.teaql.purchaseordernumbering.platform.Platform; +import com.teaql.purchaseordernumbering.platform.PlatformRequest; +import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PurchaseOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PurchaseOrderRequest(Class returnType){ + this(returnType, () -> (T) new PurchaseOrder()); + } + + protected PurchaseOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PurchaseOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PurchaseOrderRequest copy(){ + return (PurchaseOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PurchaseOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PurchaseOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PurchaseOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PurchaseOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PurchaseOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PurchaseOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PurchaseOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PurchaseOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PurchaseOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PurchaseOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public PurchaseOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder){ + super.internalMatchAny(purchaseOrder); + return this; + } + + public PurchaseOrderRequest matchingIdsOf(PurchaseOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + PurchaseOrder.ID_PROPERTY, request, PurchaseOrder.ID_PROPERTY)); + } + + public PurchaseOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PurchaseOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PurchaseOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PurchaseOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectSupplier().selectOrderNumber().selectVersion(); + } + + public PurchaseOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public PurchaseOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(PurchaseOrder.ID_PROPERTY); + selectProperty(PurchaseOrder.PLATFORM_PROPERTY); + selectProperty(PurchaseOrder.SUPPLIER_PROPERTY); + selectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectSupplier().selectOrderNumber().selectVersion(); + } + + public PurchaseOrderRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectSupplier().selectOrderNumber().selectVersion(); + } + + + public PurchaseOrderRequest selectId(){ + selectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectId(){ + unselectProperty(PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest selectPlatformIdOnly(){ + selectProperty(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public PurchaseOrderRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(PurchaseOrder.PLATFORM_PROPERTY); + enhanceRelation(PurchaseOrder.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, PurchaseOrder.PLATFORM_PROPERTY)); + return this; + } + + public PurchaseOrderRequest unselectPlatform(){ + unselectProperty(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + public PurchaseOrderRequest selectSupplier(){ + selectProperty(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + /** + * fill the supplier with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS supplier) to fetch supplier property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectSupplier(){ + unselectProperty(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest selectOrderNumber(){ + selectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectOrderNumber(){ + unselectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest selectVersion(){ + selectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PurchaseOrderRequest unselectVersion(){ + unselectProperty(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.ID_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PurchaseOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PurchaseOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PurchaseOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PurchaseOrderRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public PurchaseOrderRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public PurchaseOrderRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public PurchaseOrderRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, operator, values); + } + + public PurchaseOrderRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public PurchaseOrderRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public PurchaseOrderRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public PurchaseOrderRequest filterBySupplier(String... supplier){ + if (supplier == null || supplier.length == 0) { + throw new IllegalArgumentException("filterBySupplier parameter supplier cannot be empty"); + } + return appendSearchCriteria(createSupplierCriteria(Operator.EQUAL, (Object[])supplier)); + } + + public PurchaseOrderRequest withSupplier(Operator operator, Object... values){ + return appendSearchCriteria(createSupplierCriteria(operator, values)); + } + + public PurchaseOrderRequest withSupplierIsUnknown(){ + return withSupplier(Operator.IS_NULL); + } + + public PurchaseOrderRequest withSupplierIsKnown(){ + return withSupplier(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSupplierCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.SUPPLIER_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withSupplierIsNot(String supplier){ + return withSupplier(Operator.NOT_EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierIn(String... supplier){ + return withSupplier(Operator.IN, (Object[])supplier); + } + + public PurchaseOrderRequest withSupplierNotIn(String... supplier){ + return withSupplier(Operator.NOT_IN, (Object[])supplier); + } + public PurchaseOrderRequest withSupplierGreaterThan(String supplier){ + return withSupplier(Operator.GREATER_THAN, supplier); + } + + public PurchaseOrderRequest withSupplierGreaterThanOrEqualTo(String supplier){ + return withSupplier(Operator.GREATER_THAN_OR_EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierLessThan(String supplier){ + return withSupplier(Operator.LESS_THAN, supplier); + } + + public PurchaseOrderRequest withSupplierLessThanOrEqualTo(String supplier){ + return withSupplier(Operator.LESS_THAN_OR_EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierBetween(String startOfSupplier, String endOfSupplier){ + return withSupplier(Operator.BETWEEN, startOfSupplier, endOfSupplier); + } + public PurchaseOrderRequest withSupplierStartingWith(String supplier){ + return withSupplier(Operator.BEGIN_WITH, supplier); + } + public PurchaseOrderRequest withSupplierContaining(String supplier){ + return withSupplier(Operator.CONTAIN, supplier); + } + + public PurchaseOrderRequest withSupplierNotContaining(String supplier){ + return withSupplier(Operator.NOT_CONTAIN, supplier); + } + + public PurchaseOrderRequest withSupplierNotStartingWith(String supplier){ + return withSupplier(Operator.NOT_BEGIN_WITH, supplier); + } + + public PurchaseOrderRequest withSupplierEndingWith(String supplier){ + return withSupplier(Operator.END_WITH, supplier); + } + + public PurchaseOrderRequest withSupplierNotEndingWith(String supplier){ + return withSupplier(Operator.NOT_END_WITH, supplier); + } + + public PurchaseOrderRequest withSupplierIs(String supplier){ + return withSupplier(Operator.EQUAL, supplier); + } + + public PurchaseOrderRequest withSupplierSoundingLike(String supplier){ + return withSupplier(Operator.SOUNDS_LIKE, supplier); + } + + + + public PurchaseOrderRequest withOrderNumberIs(OrderNumber value){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.EQUAL, value.value())); + } + + public PurchaseOrderRequest withOrderNumberIsNot(OrderNumber value){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.NOT_EQUAL, value.value())); + } + + public PurchaseOrderRequest withOrderNumberIsUnknown(){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.IS_NULL)); + } + + public PurchaseOrderRequest withOrderNumberIsKnown(){ + return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.IS_NOT_NULL)); + } + + public PurchaseOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PurchaseOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PurchaseOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PurchaseOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PurchaseOrder.VERSION_PROPERTY, operator, values); + } + + public PurchaseOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PurchaseOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PurchaseOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PurchaseOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PurchaseOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PurchaseOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PurchaseOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PurchaseOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public PurchaseOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PurchaseOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PurchaseOrderRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public PurchaseOrderRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(PurchaseOrder.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public PurchaseOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PurchaseOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.ID_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public PurchaseOrderRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctSupplier(){ + return countDistinctSupplierAs("supplier_distinct_count"); + } + + public PurchaseOrderRequest countDistinctSupplierAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public PurchaseOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PurchaseOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupById(){ + groupBy(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdAs(String retName){ + groupBy(retName, PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.ID_PROPERTY, function); + return this; + } + public PurchaseOrderRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(PurchaseOrder.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public PurchaseOrderRequest groupByPlatform(){ + groupBy(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByPlatformAs(String retName){ + groupBy(retName, PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.PLATFORM_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupBySupplier(){ + groupBy(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupBySupplierAs(String retName){ + groupBy(retName, PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupBySupplierWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.SUPPLIER_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByOrderNumber(){ + groupBy(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public PurchaseOrderRequest groupByVersion(){ + groupBy(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionAs(String retName){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, PurchaseOrder.VERSION_PROPERTY, function); + return this; + } + + + + public PurchaseOrderRequest orderByIdAscending(){ + addOrderByAscending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByIdDescending(){ + addOrderByDescending(PurchaseOrder.ID_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByPlatformAscending(){ + addOrderByAscending(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByPlatformDescending(){ + addOrderByDescending(PurchaseOrder.PLATFORM_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderBySupplierAscending(){ + addOrderByAscending(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderBySupplierDescending(){ + addOrderByDescending(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderBySupplierAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderBySupplierDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.SUPPLIER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PurchaseOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public PurchaseOrderRequest orderByVersionAscending(){ + addOrderByAscending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + public PurchaseOrderRequest orderByVersionDescending(){ + addOrderByDescending(PurchaseOrder.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + public PurchaseOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public PurchaseOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, PurchaseOrder.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, PurchaseOrder.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public PurchaseOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PurchaseOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PurchaseOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PurchaseOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PurchaseOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PurchaseOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java b/examples/business-id-runtime/java-lib-core/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/business-id-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/business-id-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..ebd1eefdf --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.purchaseordernumbering.EntityMetaRegistry \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/teaql/checker-model.json b/examples/business-id-runtime/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..d8402c672 --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:304c22e5b2a924d8fc32148174ef6d249857e8080ea8459c2cb4d8a6fd75ae60","entities":{"Platform":{"labels":{"en":"platform"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"purchase_order_list","targetType":"PurchaseOrder","labels":{"en":"purchase order"},"aliases":["PurchaseOrderList","purchaseOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"PurchaseOrder":{"labels":{"en":"purchase order"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"supplier","labels":{"en":"supplier"},"aliases":["Supplier"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/business-id-runtime/java-lib-core/teaql/model-provenance.json b/examples/business-id-runtime/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..8ed79824d --- /dev/null +++ b/examples/business-id-runtime/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:ae5ea6f908693b88007259e6347336dc7d1a5469b4c3db8e554eec0c27e4e30f","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/business-id-runtime/model.xml b/examples/business-id-runtime/model.xml new file mode 100644 index 000000000..c2908cd1a --- /dev/null +++ b/examples/business-id-runtime/model.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/examples/business-id-runtime/showcase.json b/examples/business-id-runtime/showcase.json new file mode 100644 index 000000000..e1c685f8f --- /dev/null +++ b/examples/business-id-runtime/showcase.json @@ -0,0 +1,39 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/business-id-runtime", + "library": { + "generatedFilesManifestSHA256": "0c37c55f0a0a4b0af42955480f8b296878075a6c3b4811378be5ba59c11e1d2e", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "04eb9dcc3062ceae19a3de676d89d9ad8647fb0d691f3ad653b6ba4462904c71" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build; not a public release", + "jarSHA256": "34dd804dccf05470dad46d086d58412e4a9dfcd0a1c6ed34f8f90c55ff478220", + "qualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "tag": "unreleased-source-021b1ed8" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/purchase-order-numbering-generation/receipt.json", + "receiptSHA256": "e65136b27d5640fa4cdd62b13413148a267ea25ae0c7947adbea2ad9121c84b4" + }, + "scene": "Number and re-read two purchase orders with a trusted business date", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java" + ], + "workspace": { + "applicationOwnedFiles": [ + "src/main/java/com/teaql/purchaseordernumbering/App.java", + "src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java" + ], + "generatedFilesManifestSHA256": "9ab05c103dd98dc0d7fc51f06cb2f7f8a4cef03524711b74101853c1dbbba719", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 58d27da41..1b3258f92 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -33,6 +33,12 @@ mvn -q -pl teaql-sqlite \ -Dtest=DerivedQueryTraceSqliteTest,LikeIntentPrivacySqliteTest,TypedIntentPrivacySqliteTest test mvn -q -pl examples/business-id-runtime \ -Dtest=BusinessIdRuntimeExampleTest test +mvn -q -o -f examples/business-id-runtime/java-lib-core/lib/pom.xml -DskipTests install +TEAQL_BUSINESS_ID_KEY_V1_HEX=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \ +TEAQL_PURCHASE_NUMBERING_ROUND=inventory \ +mvn -q -o -f examples/business-id-runtime/java-app-console/pom.xml compile \ + org.codehaus.mojo:exec-maven-plugin:3.5.0:java -Dexec.mainClass=com.teaql.purchaseordernumbering.App \ + "-Dexec.args=--teaql.datasource.url=jdbc:sqlite:$evidence_dir/business-id.sqlite" mvn -q -pl examples/security-foundations \ -Dtest=SecurityFoundationsExampleTest,SqlRelationMaskingTest test mvn -q -pl examples/round-trip-reference-runtime \ From 9aae31adbebd380b82b702baeffd26f5d898ad40 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 14:49:31 +0800 Subject: [PATCH 29/71] Record focused java examples/business-id-runtime business qualification --- examples/business-id-runtime/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/business-id-runtime/showcase.json b/examples/business-id-runtime/showcase.json index e1c685f8f..3dd26874e 100644 --- a/examples/business-id-runtime/showcase.json +++ b/examples/business-id-runtime/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/purchase-order-numbering-generation/receipt.json", "receiptSHA256": "e65136b27d5640fa4cdd62b13413148a267ea25ae0c7947adbea2ad9121c84b4" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-purchase-order-numbering-native/runtime/business-id/receipt.json", + "businessReceiptSHA256": "908f916123792fd276890752c23b5afaf8e985259349d949706fb09d12688b61", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-purchase-order-numbering-native/receipt.json", + "nativeReceiptSHA256": "17a50662e35a181faeefd766c6d7cf8fb9c48683367d9f1c0e1e5967c41f7cd1", + "remainingFullRuntimeInventory": true, + "sourceCommit": "4c46bb90f04ef55b32b414a8692745d71ee60ba6" + }, "scene": "Number and re-read two purchase orders with a trusted business date", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "java-app-console/src/main/java/com/teaql/purchaseordernumbering/App.java" ], From 6cc8596c55b956d64eed107948fd46f24c17b770 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 15:48:12 +0800 Subject: [PATCH 30/71] Run the standard order operations queue in its generated Java workspace --- examples/standard-order/AGENTS.md | 2 +- examples/standard-order/README.md | 10 +- .../java-app-console/.gitignore | 53 + .../standard-order/java-app-console/AGENTS.md | 69 + .../java-app-console/DOMAIN_API_GUIDE.md | 32 + .../standard-order/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 189 ++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../requesttreeorderservice/Checkers.java | 0 .../requesttreeorderservice/Constants.java | 0 .../example/requesttreeorderservice/E.java | 0 .../EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 .../example/requesttreeorderservice/Q.java | 0 .../requesttreeorderservice/Repositories.java | 0 .../RequestTreeOrderServiceUserContext.java | 0 .../customer/Customer.java | 0 .../customer/CustomerChecker.java | 0 .../customer/CustomerExpression.java | 0 .../customer/CustomerListExpression.java | 0 .../customer/CustomerRequest.java | 0 .../customerorder/CustomerOrder.java | 0 .../customerorder/CustomerOrderChecker.java | 0 .../CustomerOrderExpression.java | 0 .../CustomerOrderListExpression.java | 0 .../customerorder/CustomerOrderRequest.java | 0 .../orderitem/OrderItem.java | 0 .../orderitem/OrderItemChecker.java | 0 .../orderitem/OrderItemExpression.java | 0 .../orderitem/OrderItemListExpression.java | 0 .../orderitem/OrderItemRequest.java | 0 .../orderstatus/OrderStatus.java | 0 .../orderstatus/OrderStatusChecker.java | 0 .../orderstatus/OrderStatusExpression.java | 0 .../OrderStatusListExpression.java | 0 .../orderstatus/OrderStatusRequest.java | 0 .../platform/Platform.java | 0 .../platform/PlatformChecker.java | 0 .../platform/PlatformExpression.java | 0 .../platform/PlatformListExpression.java | 0 .../platform/PlatformRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 .../standard-order/java-app-console/pom.xml | 125 ++ .../example/requesttreeorderservice/App.java | 99 ++ .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../ExampleDatabase.java | 19 + ...StandardOrderGraphStreamTelemetryTest.java | 11 +- .../StandardOrderTelemetryTest.java | 5 +- .../java-app-console/teaql-i18n.json | 128 ++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 2 +- .../{generated => java-lib-core}/lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 .../requesttreeorderservice/Checkers.java | 0 .../requesttreeorderservice/Constants.java | 14 + .../example/requesttreeorderservice/E.java | 33 + .../EntityMetaRegistry.java | 907 ++++++++++ .../GeneratedRuntimeModule.java | 100 ++ .../example/requesttreeorderservice/Q.java | 52 + .../requesttreeorderservice/Repositories.java | 0 .../RequestTreeOrderServiceUserContext.java | 10 + .../customer/Customer.java | 151 ++ .../customer/CustomerChecker.java | 65 + .../customer/CustomerExpression.java | 61 + .../customer/CustomerListExpression.java | 25 + .../customer/CustomerRequest.java | 902 ++++++++++ .../customerorder/CustomerOrder.java | 236 +++ .../customerorder/CustomerOrderChecker.java | 100 ++ .../CustomerOrderExpression.java | 93 + .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 1516 +++++++++++++++++ .../orderitem/OrderItem.java | 169 ++ .../orderitem/OrderItemChecker.java | 80 + .../orderitem/OrderItemExpression.java | 68 + .../orderitem/OrderItemListExpression.java | 25 + .../orderitem/OrderItemRequest.java | 1060 ++++++++++++ .../orderstatus/OrderStatus.java | 214 +++ .../orderstatus/OrderStatusChecker.java | 100 ++ .../orderstatus/OrderStatusExpression.java | 83 + .../OrderStatusListExpression.java | 25 + .../orderstatus/OrderStatusRequest.java | 1385 +++++++++++++++ .../platform/Platform.java | 152 ++ .../platform/PlatformChecker.java | 58 + .../platform/PlatformExpression.java | 59 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 835 +++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/standard-order/pom.xml | 19 - examples/standard-order/showcase.json | 41 + examples/standard-order/verify.sh | 35 +- pom.xml | 4 +- 101 files changed, 9773 insertions(+), 40 deletions(-) create mode 100644 examples/standard-order/java-app-console/.gitignore create mode 100644 examples/standard-order/java-app-console/AGENTS.md create mode 100644 examples/standard-order/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/standard-order/java-app-console/Makefile create mode 100644 examples/standard-order/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/standard-order/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/standard-order/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/standard-order/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/standard-order/java-app-console/lib/pom.xml rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/Constants.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/E.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/Q.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java (100%) rename examples/standard-order/{generated => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) create mode 100644 examples/standard-order/java-app-console/pom.xml create mode 100644 examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/App.java create mode 100644 examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/CustomUserContext.java create mode 100644 examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/standard-order/java-app-console/src/main/resources/application.properties create mode 100644 examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/ExampleDatabase.java rename examples/standard-order/{ => java-app-console}/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java (96%) rename examples/standard-order/{ => java-app-console}/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java (98%) create mode 100644 examples/standard-order/java-app-console/teaql-i18n.json rename examples/standard-order/{generated => java-app-console}/teaql/checker-model.json (100%) rename examples/standard-order/{generated => java-app-console}/teaql/model-provenance.json (82%) rename examples/standard-order/{generated => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Constants.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/E.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Q.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java create mode 100644 examples/standard-order/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/standard-order/java-lib-core/teaql/checker-model.json create mode 100644 examples/standard-order/java-lib-core/teaql/model-provenance.json delete mode 100644 examples/standard-order/pom.xml create mode 100644 examples/standard-order/showcase.json diff --git a/examples/standard-order/AGENTS.md b/examples/standard-order/AGENTS.md index 3ff1537c5..150d444e9 100644 --- a/examples/standard-order/AGENTS.md +++ b/examples/standard-order/AGENTS.md @@ -1,6 +1,6 @@ # Java Standard Order Example Rules -Implement only application-owned code. The files under `generated/lib` are +Implement only application-owned code. The files under `java-lib-core` and `java-app-console/lib` are read-only. Discover generated APIs using progressive model-aware Assist with `models/model.xml`; never read generated source to discover methods. diff --git a/examples/standard-order/README.md b/examples/standard-order/README.md index 57bb9e861..4ee2052c1 100644 --- a/examples/standard-order/README.md +++ b/examples/standard-order/README.md @@ -1,4 +1,4 @@ -# Java Standard Telemetry Order Example +# Operations queue and order telemetry This example uses generated Q/E and the ordinary `executeForList(context)` entry point to load a filtered order list with bounded pagination, status @@ -10,10 +10,12 @@ generated audited mutations. Repeated ensureSchema does not produce duplicate writes or audits. Four orders and twenty items are created through the same mutation API. The filtered result contains three orders; the selected one-row slice has three item previews and an independent count of five items. Status -facets have counts `1, 2, 0` and amount totals `100, 500, 0`. The deliberately +facets have counts `1, 2, 0` and amount totals `100, 500, null`. The deliberately omitted order amount remains NotLoaded. -The local runtime handles a declared ungrouped count alongside rows under one +The model is `models/model.xml`. Maven compiles the immutable `java-lib-core/lib` +and runs the application checks in the generated `java-app-console`. The local +runtime handles a declared ungrouped count alongside rows under one logical list invocation. Grouped and mixed aggregate requests keep their existing aggregate semantics. All generated library files are produced from the checked model; do not patch them to change query behavior. @@ -32,7 +34,7 @@ process settings: TEAQL_TELEMETRY_ENABLED=true \ TEAQL_TELEMETRY_SERVICE_NAME=order-example \ TEAQL_TELEMETRY_OTLP_ENDPOINT=http://127.0.0.1:4318 \ - mvn -q -Pruntime-examples -pl examples/standard-order -am \ + mvn -q -Pruntime-examples -pl examples/standard-order/java-app-console -am \ -Dtest=StandardOrderTelemetryTest -Dsurefire.failIfNoSpecifiedTests=false test ``` diff --git a/examples/standard-order/java-app-console/.gitignore b/examples/standard-order/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/standard-order/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/standard-order/java-app-console/AGENTS.md b/examples/standard-order/java-app-console/AGENTS.md new file mode 100644 index 000000000..29f3dbab2 --- /dev/null +++ b/examples/standard-order/java-app-console/AGENTS.md @@ -0,0 +1,69 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Commerce Platform | +| order_status | Order Status | +| customer | Customer | +| customer_order | Customer Order | +| order_item | Order Item | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/standard-order/java-app-console/DOMAIN_API_GUIDE.md b/examples/standard-order/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..335a94eb5 --- /dev/null +++ b/examples/standard-order/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,32 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/request-tree-order-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Commerce Platform | +| order_status | Order Status | +| customer | Customer | +| customer_order | Customer Order | +| order_item | Order Item | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/standard-order/java-app-console/Makefile b/examples/standard-order/java-app-console/Makefile new file mode 100644 index 000000000..88045ce8b --- /dev/null +++ b/examples/standard-order/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/request-tree-order-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/request-tree-order-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/standard-order/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/standard-order/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..5da026b64 --- /dev/null +++ b/examples/standard-order/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/request-tree-order-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/standard-order/java-app-console/STANDARD_TELEMETRY.md b/examples/standard-order/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/standard-order/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/standard-order/java-app-console/TOOL_API_GUIDE.md b/examples/standard-order/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..8cc61eb0a --- /dev/null +++ b/examples/standard-order/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/request-tree-order-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/request-tree-order-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/request-tree-order-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/request-tree-order-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/request-tree-order-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/request-tree-order-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/standard-order/java-app-console/docs/teaql-java-crud-guide.md b/examples/standard-order/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..8acaddf0c --- /dev/null +++ b/examples/standard-order/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,189 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.requesttreeorderservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.requesttreeorderservice.Q; +import com.example.requesttreeorderservice.RequestTreeOrderServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectOrderStatusListWith(Q.orderStatuses().selectSelf()) + .comment("load with orderStatusList") + .purpose("fetch child orderStatusList") + .executeForList(userContext); +``` + +```java +var list = Q.platforms() + .selectCustomerListWith(Q.customers().selectSelf()) + .comment("load with customerList") + .purpose("fetch child customerList") + .executeForList(userContext); +``` + +```java +var list = Q.customers() + .selectPlatformWith(Q.platforms().selectSelf()) + .comment("load with platform") + .purpose("fetch associated platform") + .executeForList(userContext); +``` + + +```java +var list = Q.customers() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.customerOrders() + .selectCustomerWith(Q.customers().selectSelf()) + .comment("load with customer") + .purpose("fetch associated customer") + .executeForList(userContext); +``` +```java +var list = Q.customerOrders() + .selectStatusWith(Q.orderStatuses().selectSelf()) + .comment("load with status") + .purpose("fetch associated status") + .executeForList(userContext); +``` + + + + +```java +var list = Q.customerOrders() + .selectOrderItemListWith(Q.orderItems().selectSelf()) + .comment("load with orderItemList") + .purpose("fetch child orderItemList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `2`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.example.requesttreeorderservice.platform.PlatformRequest` +- `Customer`: reverse relations `1`, query `Q.customers()`, save `new Customer().auditAs("comment").save(userContext)`, request `com.example.requesttreeorderservice.customer.CustomerRequest` +- `CustomerOrder`: reverse relations `1`, query `Q.customerOrders()`, save `new CustomerOrder().auditAs("comment").save(userContext)`, request `com.example.requesttreeorderservice.customerorder.CustomerOrderRequest` \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/pom.xml b/examples/standard-order/java-app-console/lib/pom.xml new file mode 100644 index 000000000..066245b26 --- /dev/null +++ b/examples/standard-order/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + request-tree-order-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Constants.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Constants.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Constants.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Constants.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/E.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/E.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/E.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Q.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Q.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Q.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Q.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java diff --git a/examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java similarity index 100% rename from examples/standard-order/generated/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java rename to examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java diff --git a/examples/standard-order/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/standard-order/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/standard-order/generated/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/standard-order/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/standard-order/java-app-console/pom.xml b/examples/standard-order/java-app-console/pom.xml new file mode 100644 index 000000000..b32a6173c --- /dev/null +++ b/examples/standard-order/java-app-console/pom.xml @@ -0,0 +1,125 @@ + + + + 4.0.0 + + io.teaql + teaql-java-parent + 6.3.0 + ../../../pom.xml + + + com.example + request-tree-order-service + 0.0.1-SNAPSHOT + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.example + request-tree-order-service-core + ${libversion} + + + io.teaql + teaql-query-json + ${teaql.version} + + + io.teaql + teaql-opentelemetry + ${teaql.version} + test + + + junit + junit + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.example.requesttreeorderservice.App + + + + + + + + diff --git a/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/App.java b/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/App.java new file mode 100644 index 000000000..e4f6d4a94 --- /dev/null +++ b/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/App.java @@ -0,0 +1,99 @@ + +package com.example.requesttreeorderservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/CustomUserContext.java b/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/CustomUserContext.java new file mode 100644 index 000000000..6d1bef320 --- /dev/null +++ b/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.requesttreeorderservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements RequestTreeOrderServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/WorkspaceTeaQLDatabase.java b/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..cf7c5846f --- /dev/null +++ b/examples/standard-order/java-app-console/src/main/java/com/example/requesttreeorderservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.requesttreeorderservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/src/main/resources/application.properties b/examples/standard-order/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..fc3ec14f5 --- /dev/null +++ b/examples/standard-order/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:requesttreeorderservice.db diff --git a/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/ExampleDatabase.java b/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/ExampleDatabase.java new file mode 100644 index 000000000..9621c29b0 --- /dev/null +++ b/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/ExampleDatabase.java @@ -0,0 +1,19 @@ +package com.example.requesttreeorderservice; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import org.junit.rules.TemporaryFolder; + +public final class ExampleDatabase extends TemporaryFolder { + String url(String scenario) throws IOException { + String retained = System.getenv("TEAQL_JAVA_STANDARD_ORDER_DATABASE_DIR"); + Path directory = retained == null ? getRoot().toPath() : Path.of(retained); + if (!Files.isDirectory(directory)) { + throw new IOException("Order example requires a fresh existing evidence directory"); + } + Path database = directory.resolve(scenario + ".sqlite"); + Files.createFile(database); + return "jdbc:sqlite:" + database.toAbsolutePath(); + } +} diff --git a/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java b/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java similarity index 96% rename from examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java rename to examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java index 97e5e2227..7cc81edd4 100644 --- a/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java +++ b/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java @@ -11,12 +11,12 @@ import io.teaql.runtime.SafeAuditEvent; import io.teaql.runtime.TeaQLRuntime; import java.math.BigDecimal; -import java.nio.file.Files; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import org.junit.Rule; import org.junit.Test; import org.sqlite.SQLiteDataSource; import static org.junit.Assert.*; @@ -24,9 +24,10 @@ /** Generated Q/E and audited graph save; no SDK imports or handwritten application SQL. */ public class StandardOrderGraphStreamTelemetryTest { static final String PRIVATE = "STANDARD_GRAPH_STREAM_PRIVATE_7a3120c8"; + @Rule public final ExampleDatabase database = new ExampleDatabase(); @Test public void graphSaveKeepsInheritedAndExplicitEntityCommentsAndIndependentAudit() throws Exception { - try (var fixture = new Fixture()) { + try (var fixture = new Fixture(database.url("graph"))) { var context = fixture.context; var platform = Q.platforms().limit(1).comment("load graph root seed") .purpose("prepare bounded graph fixture").executeForOne(context); @@ -67,7 +68,7 @@ public class StandardOrderGraphStreamTelemetryTest { } @Test public void streamsRetainRootAndCloseResourcesOnExhaustionAndEarlyClose() throws Exception { - try (var fixture = new Fixture()) { + try (var fixture = new Fixture(database.url("stream"))) { var context = fixture.context; var platform = Q.platforms().limit(1).comment("load stream root seed").purpose("prepare bounded stream fixture").executeForOne(context); var customer = Q.customers().comment("prepare stream customer").purpose("prepare bounded stream fixture").newEntity(context); @@ -109,8 +110,8 @@ private static final class Fixture implements AutoCloseable { final AtomicInteger ordinaryLogs = new AtomicInteger(); final TeaQLRuntime runtime; final DefaultUserContext context; - Fixture() throws Exception { - source.setUrl("jdbc:sqlite:" + Files.createTempDirectory("teaql-java-standard-graph-stream-").resolve("orders.sqlite")); + Fixture(String databaseUrl) throws Exception { + source.setUrl(databaseUrl); var service = new SqliteDataServiceExecutor("sqlite", new JdbcSqlExecutor(source), source); var ids = new AtomicLong(4000); runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) diff --git a/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java b/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java similarity index 98% rename from examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java rename to examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java index 841df0b82..d2ff2f982 100644 --- a/examples/standard-order/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java +++ b/examples/standard-order/java-app-console/src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java @@ -14,12 +14,12 @@ import io.teaql.runtime.SafeAuditEvent; import io.teaql.runtime.TeaQLRuntime; import java.math.BigDecimal; -import java.nio.file.Files; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import org.junit.Rule; import org.junit.Test; import org.sqlite.SQLiteDataSource; import static org.junit.Assert.*; @@ -27,10 +27,11 @@ /** Ordinary generated business code: no SDK setup, manual span or application SQL. */ public class StandardOrderTelemetryTest { private static final String PRIVATE = "STANDARD_PRIVATE_ORDER_79463A12"; + @Rule public final ExampleDatabase database = new ExampleDatabase(); @Test public void completeOrderPagesKeepCountsFacetsRelationsAndAutomaticDiagnostics() throws Exception { var source = new SQLiteDataSource(); - source.setUrl("jdbc:sqlite:" + Files.createTempDirectory("teaql-java-standard-order-").resolve("orders.sqlite")); + source.setUrl(database.url("list")); var service = new SqliteDataServiceExecutor("sqlite", new JdbcSqlExecutor(source), source); var ids = new AtomicLong(2000); var ordinaryLogs = new AtomicInteger(); diff --git a/examples/standard-order/java-app-console/teaql-i18n.json b/examples/standard-order/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..c69942a7a --- /dev/null +++ b/examples/standard-order/java-app-console/teaql-i18n.json @@ -0,0 +1,128 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.customerOrder.orderNumber": "Order Number", + "property.orderItem.id": "Id", + "entity.orderItem": "Order Item", + "property.orderItem.customerOrder": "Customer Order", + "property.orderStatus.version": "Version", + "property.orderItem.unitPrice": "Unit Price", + "property.orderItem.productName": "Product Name", + "property.orderStatus.code": "Code", + "property.customerOrder.orderDate": "Order Date", + "entity.customerOrder": "Customer Order", + "property.orderStatus.displayOrder": "Display Order", + "entity.customer": "Customer", + "property.customerOrder.id": "Id", + "property.orderStatus.color": "Color", + "property.customerOrder.totalAmount": "Total Amount", + "property.customerOrder.version": "Version", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.customer.version": "Version", + "property.orderStatus.id": "Id", + "property.customer.id": "Id", + "property.customer.platform": "Platform", + "entity.orderStatus": "Order Status", + "property.customerOrder.customer": "Customer", + "property.customer.name": "Name", + "property.orderItem.version": "Version", + "property.orderStatus.platform": "Platform", + "property.orderStatus.name": "Name", + "property.platform.version": "Version", + "property.customerOrder.status": "Status", + "property.orderItem.quantity": "Quantity" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/standard-order/generated/teaql/checker-model.json b/examples/standard-order/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/standard-order/generated/teaql/checker-model.json rename to examples/standard-order/java-app-console/teaql/checker-model.json diff --git a/examples/standard-order/generated/teaql/model-provenance.json b/examples/standard-order/java-app-console/teaql/model-provenance.json similarity index 82% rename from examples/standard-order/generated/teaql/model-provenance.json rename to examples/standard-order/java-app-console/teaql/model-provenance.json index 56b0d0bb3..1588569fb 100644 --- a/examples/standard-order/generated/teaql/model-provenance.json +++ b/examples/standard-order/java-app-console/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"021b1ed8"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/standard-order/generated/lib/pom.xml b/examples/standard-order/java-lib-core/lib/pom.xml similarity index 100% rename from examples/standard-order/generated/lib/pom.xml rename to examples/standard-order/java-lib-core/lib/pom.xml diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Constants.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Constants.java new file mode 100644 index 000000000..bdd12b2ef --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Constants.java @@ -0,0 +1,14 @@ + +package com.example.requesttreeorderservice; + +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); + public static final long ORDER_STATUS_NEW_ID = 1001l ; + public static final OrderStatus ORDER_STATUS_NEW = OrderStatus.refer(ORDER_STATUS_NEW_ID);public static final long ORDER_STATUS_PAID_ID = 1002l ; + public static final OrderStatus ORDER_STATUS_PAID = OrderStatus.refer(ORDER_STATUS_PAID_ID);public static final long ORDER_STATUS_CANCELLED_ID = 1003l ; + public static final OrderStatus ORDER_STATUS_CANCELLED = OrderStatus.refer(ORDER_STATUS_CANCELLED_ID); +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/E.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/E.java new file mode 100644 index 000000000..b7f4b2984 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/E.java @@ -0,0 +1,33 @@ + +package com.example.requesttreeorderservice; + +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerExpression; +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderExpression; +import com.example.requesttreeorderservice.orderitem.OrderItem; +import com.example.requesttreeorderservice.orderitem.OrderItemExpression; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusExpression; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static OrderStatusExpression orderStatus(OrderStatus orderStatus){ + return new OrderStatusExpression(new ValueExpression(orderStatus, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderStatus()")); + } + public static CustomerExpression customer(Customer customer){ + return new CustomerExpression(new ValueExpression(customer, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customer()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } + public static OrderItemExpression orderItem(OrderItem orderItem){ + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java new file mode 100644 index 000000000..f263ba221 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java @@ -0,0 +1,907 @@ + +package com.example.requesttreeorderservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerOrderStatus(); + registerCustomer(); + registerCustomerOrder(); + registerOrderItem(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.requesttreeorderservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.requesttreeorderservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.requesttreeorderservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.platform.Platform::new); + entityDescriptor.with("name", "Commerce Platform") + + .with("module", "Commerce") + + .with("module_key", "commerce") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Commerce Test Platform") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderStatus() { + FieldLayout.installGenerated(com.example.requesttreeorderservice.orderstatus.OrderStatus.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.requesttreeorderservice.orderstatus.OrderStatus.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.requesttreeorderservice.orderstatus.OrderStatus.class); + entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.orderstatus.OrderStatus::new); + entityDescriptor.with("name", "Order Status") + + .with("module", "Commerce") + + .with("module_key", "commerce") + + .with("constant", "true") + + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY, com.example.requesttreeorderservice.platform.Platform.INTERNAL_TYPE, com.example.requesttreeorderservice.platform.Platform.ORDER_STATUS_LIST_PROPERTY, com.example.requesttreeorderservice.platform.Platform.class) + ; + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY, String.class) + ; + PropertyDescriptor code = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY, String.class) + ; + PropertyDescriptor color = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY, String.class) + ; + PropertyDescriptor displayOrder = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("candidates", "platform()") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("candidates", "1001,1002,1003") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "New,Paid,Cancelled") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY).with("identifier", "true") + + .with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "NEW,PAID,CANCELLED") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "#94A3B8,#22C55E,#EF4444") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("candidates", "1,2,3") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomer() { + FieldLayout.installGenerated(com.example.requesttreeorderservice.customer.Customer.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.requesttreeorderservice.customer.Customer.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.requesttreeorderservice.customer.Customer.class); + entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.customer.Customer::new); + entityDescriptor.with("name", "Customer") + + .with("module", "Commerce") + + .with("module_key", "commerce") + + .with("audit_mask_fields", "name") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.customer.Customer.PLATFORM_PROPERTY, com.example.requesttreeorderservice.platform.Platform.INTERNAL_TYPE, com.example.requesttreeorderservice.platform.Platform.CUSTOMER_LIST_PROPERTY, com.example.requesttreeorderservice.platform.Platform.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.example.requesttreeorderservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.requesttreeorderservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.requesttreeorderservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.customerorder.CustomerOrder::new); + entityDescriptor.with("name", "Customer Order") + + .with("module", "Commerce") + + .with("module_key", "commerce") + + .with("audit_mask_fields", "order_number") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customer = + entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY, com.example.requesttreeorderservice.customer.Customer.INTERNAL_TYPE, com.example.requesttreeorderservice.customer.Customer.CUSTOMER_ORDER_LIST_PROPERTY, com.example.requesttreeorderservice.customer.Customer.class) + ; + PropertyDescriptor status = + entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.customerorder.CustomerOrder.STATUS_PROPERTY, com.example.requesttreeorderservice.orderstatus.OrderStatus.INTERNAL_TYPE, com.example.requesttreeorderservice.orderstatus.OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, com.example.requesttreeorderservice.orderstatus.OrderStatus.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor orderDate = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor totalAmount = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.STATUS_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderItem() { + FieldLayout.installGenerated(com.example.requesttreeorderservice.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.requesttreeorderservice.orderitem.OrderItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.requesttreeorderservice.orderitem.OrderItem.class); + entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.orderitem.OrderItem::new); + entityDescriptor.with("name", "Order Item") + + .with("module", "Commerce") + + .with("module_key", "commerce") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY, com.example.requesttreeorderservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_ITEM_LIST_PROPERTY, com.example.requesttreeorderservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor productName = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY, String.class) + ; + PropertyDescriptor quantity = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY, Integer.class) + ; + PropertyDescriptor unitPrice = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..50e4a262d --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java @@ -0,0 +1,100 @@ +package com.example.requesttreeorderservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.requesttreeorderservice.platform.PlatformChecker(), new com.example.requesttreeorderservice.orderstatus.OrderStatusChecker(), new com.example.requesttreeorderservice.customer.CustomerChecker(), new com.example.requesttreeorderservice.customerorder.CustomerOrderChecker(), new com.example.requesttreeorderservice.orderitem.OrderItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:dd69b1927859f89b828bf1e7fb802e68157655ac0eca216e5aee11f0e8667aa8\",\"entities\":{\"Customer\":{\"labels\":{\"en\":\"Customer\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Commerce Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"customer\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"Customer\"},\"aliases\":[\"Customer\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_date\",\"labels\":{\"en\":\"order date\"},\"aliases\":[\"OrderDate\",\"orderDate\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"Order Item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"status\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"Order Status\"},\"aliases\":[\"Status\"]},{\"name\":\"total_amount\",\"labels\":{\"en\":\"total amount\"},\"aliases\":[\"TotalAmount\",\"totalAmount\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"Order Item\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"unit_price\",\"labels\":{\"en\":\"unit price\"},\"aliases\":[\"UnitPrice\",\"unitPrice\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderStatus\":{\"labels\":{\"en\":\"Order Status\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"color\",\"labels\":{\"en\":\"color\"},\"aliases\":[\"Color\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Commerce Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Commerce Platform\"},\"fields\":[{\"name\":\"customer_list\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"Customer\"},\"aliases\":[\"CustomerList\",\"customerList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_status_list\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"Order Status\"},\"aliases\":[\"OrderStatusList\",\"orderStatusList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderStatus", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("color", "color"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Customer", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer", "customer"), java.util.Map.entry("status", "status"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("order_date", "orderDate"), java.util.Map.entry("total_amount", "totalAmount"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("unit_price", "unitPrice"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.requesttreeorderservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.requesttreeorderservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Commerce Test Platform"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + var constantOrderStatus1001Rows = Q.orderStatuses().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1001Rows.isEmpty()) { + com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1001 = new com.example.requesttreeorderservice.orderstatus.OrderStatus(); + constantOrderStatus1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1001, 1001L); + constantOrderStatus1001.updatePlatform(domainRoot); + constantOrderStatus1001.updateName("New"); + constantOrderStatus1001.updateCode("NEW"); + constantOrderStatus1001.updateColor("#94A3B8"); + constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); + constantOrderStatus1001.auditAs("create model constant OrderStatus(1001)").save(context); + } else { + com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1001 = constantOrderStatus1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1001.getPlatform().getId(), domainRoot.getId()))) { constantOrderStatus1001.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getName(), "New"))) { constantOrderStatus1001.updateName("New"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getCode(), "NEW"))) { constantOrderStatus1001.updateCode("NEW"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1001.getColor(), "#94A3B8"))) { constantOrderStatus1001.updateColor("#94A3B8"); changed = true; } + if (!((constantOrderStatus1001.getDisplayOrder() != null && constantOrderStatus1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } + if (changed) constantOrderStatus1001.auditAs("reconcile model constant OrderStatus(1001)").save(context); + } + var constantOrderStatus1002Rows = Q.orderStatuses().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1002Rows.isEmpty()) { + com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1002 = new com.example.requesttreeorderservice.orderstatus.OrderStatus(); + constantOrderStatus1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1002, 1002L); + constantOrderStatus1002.updatePlatform(domainRoot); + constantOrderStatus1002.updateName("Paid"); + constantOrderStatus1002.updateCode("PAID"); + constantOrderStatus1002.updateColor("#22C55E"); + constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); + constantOrderStatus1002.auditAs("create model constant OrderStatus(1002)").save(context); + } else { + com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1002 = constantOrderStatus1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1002.getPlatform().getId(), domainRoot.getId()))) { constantOrderStatus1002.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getName(), "Paid"))) { constantOrderStatus1002.updateName("Paid"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getCode(), "PAID"))) { constantOrderStatus1002.updateCode("PAID"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1002.getColor(), "#22C55E"))) { constantOrderStatus1002.updateColor("#22C55E"); changed = true; } + if (!((constantOrderStatus1002.getDisplayOrder() != null && constantOrderStatus1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } + if (changed) constantOrderStatus1002.auditAs("reconcile model constant OrderStatus(1002)").save(context); + } + var constantOrderStatus1003Rows = Q.orderStatuses().withIdIs(1003L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantOrderStatus1003Rows.isEmpty()) { + com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1003 = new com.example.requesttreeorderservice.orderstatus.OrderStatus(); + constantOrderStatus1003 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1003, 1003L); + constantOrderStatus1003.updatePlatform(domainRoot); + constantOrderStatus1003.updateName("Cancelled"); + constantOrderStatus1003.updateCode("CANCELLED"); + constantOrderStatus1003.updateColor("#EF4444"); + constantOrderStatus1003.updateDisplayOrder(new java.math.BigDecimal("3")); + constantOrderStatus1003.auditAs("create model constant OrderStatus(1003)").save(context); + } else { + com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1003 = constantOrderStatus1003Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantOrderStatus1003.getPlatform().getId(), domainRoot.getId()))) { constantOrderStatus1003.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1003.getName(), "Cancelled"))) { constantOrderStatus1003.updateName("Cancelled"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1003.getCode(), "CANCELLED"))) { constantOrderStatus1003.updateCode("CANCELLED"); changed = true; } + if (!(java.util.Objects.equals(constantOrderStatus1003.getColor(), "#EF4444"))) { constantOrderStatus1003.updateColor("#EF4444"); changed = true; } + if (!((constantOrderStatus1003.getDisplayOrder() != null && constantOrderStatus1003.getDisplayOrder().compareTo(new java.math.BigDecimal("3")) == 0))) { constantOrderStatus1003.updateDisplayOrder(new java.math.BigDecimal("3")); changed = true; } + if (changed) constantOrderStatus1003.auditAs("reconcile model constant OrderStatus(1003)").save(context); + } + } +} diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Q.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Q.java new file mode 100644 index 000000000..d170581a1 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Q.java @@ -0,0 +1,52 @@ + +package com.example.requesttreeorderservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.requesttreeorderservice.platform.PlatformRequest platforms(){ + return new com.example.requesttreeorderservice.platform.PlatformRequest(com.example.requesttreeorderservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.requesttreeorderservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.requesttreeorderservice.platform.PlatformRequest(com.example.requesttreeorderservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.requesttreeorderservice.orderstatus.OrderStatusRequest orderStatuses(){ + return new com.example.requesttreeorderservice.orderstatus.OrderStatusRequest(com.example.requesttreeorderservice.orderstatus.OrderStatus.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.requesttreeorderservice.orderstatus.OrderStatusRequest orderStatusesWithMinimalFields(){ + return new com.example.requesttreeorderservice.orderstatus.OrderStatusRequest(com.example.requesttreeorderservice.orderstatus.OrderStatus.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.requesttreeorderservice.customer.CustomerRequest customers(){ + return new com.example.requesttreeorderservice.customer.CustomerRequest(com.example.requesttreeorderservice.customer.Customer.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.requesttreeorderservice.customer.CustomerRequest customersWithMinimalFields(){ + return new com.example.requesttreeorderservice.customer.CustomerRequest(com.example.requesttreeorderservice.customer.Customer.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.requesttreeorderservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.example.requesttreeorderservice.customerorder.CustomerOrderRequest(com.example.requesttreeorderservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.requesttreeorderservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.example.requesttreeorderservice.customerorder.CustomerOrderRequest(com.example.requesttreeorderservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.requesttreeorderservice.orderitem.OrderItemRequest orderItems(){ + return new com.example.requesttreeorderservice.orderitem.OrderItemRequest(com.example.requesttreeorderservice.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.requesttreeorderservice.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ + return new com.example.requesttreeorderservice.orderitem.OrderItemRequest(com.example.requesttreeorderservice.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java new file mode 100644 index 000000000..673d21a57 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.requesttreeorderservice; + +import io.teaql.core.UserContext; +public interface RequestTreeOrderServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java new file mode 100644 index 000000000..4499d623c --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java @@ -0,0 +1,151 @@ + +package com.example.requesttreeorderservice.customer; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Customer extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Customer"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "52190974dcef386c9676cd86cd564677c6cb5bb058e7e13bfea8b26db14f86a2"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("name", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Customer.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private Platform platform; + + private String name; + + private SmartList customerOrderList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public Customer updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public Customer updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Customer addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCustomer(this); + return this; + } + + public static Customer refer(Long id){ + Customer refer = new Customer(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Customer comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java new file mode 100644 index 000000000..81246067f --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java @@ -0,0 +1,65 @@ + +package com.example.requesttreeorderservice.customer; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderChecker; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerChecker implements Checker{ + + public String type(){ + return Customer.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + if(needCheck(_context, customer)){ + markAsChecked(_context, customer); + doCheck(_context, customer, _parentLocation); + } + } + + public void doCheck(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + if((customer == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customer); + if(customer.needPersist()){ + } + if(customer.newItem()){ + }else if(customer.updateItem()){ + if(!customer.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!customer.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, customer.getProperty(Customer.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, customer.getProperty(Customer.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; customer.getCustomerOrderList() != null && i < customer.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = customer.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java new file mode 100644 index 000000000..c0e0888d4 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java @@ -0,0 +1,61 @@ + +package com.example.requesttreeorderservice.customer; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderListExpression; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerExpression(Expression expression){ + super(expression); + } + + public CustomerExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerExpression updateId(Long id){ + return new CustomerExpression(this, $it -> {((Customer)$it).__internalSet("id", id); return this;}); + } + + public CustomerExpression save(UserContext userContext){ + return new CustomerExpression(this, $it -> ((Customer)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerExpression save(String intent, UserContext userContext){ + return new CustomerExpression(this, $it -> ((Customer)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", Customer::getPlatform)); + } + + public CustomerExpression updatePlatform(Platform platform){ + return new CustomerExpression(this, $it -> ((Customer)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", Customer::getName); + } + public CustomerExpression updateName(String name){ + return new CustomerExpression(this, $it -> ((Customer)$it).updateName(name)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Customer::getCustomerOrderList)); + } + public CustomerExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CustomerExpression(this, $it -> ((Customer)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java new file mode 100644 index 000000000..7c856e198 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java @@ -0,0 +1,25 @@ + +package com.example.requesttreeorderservice.customer; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerListExpression extends SmartListExpression { + public CustomerListExpression(Expression> expression){ + super(expression); + } + + public CustomerListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerExpression first() { + return new CustomerExpression(super.first()); + } + + public CustomerExpression get(int index) { + return new CustomerExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java new file mode 100644 index 000000000..b6752cacc --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java @@ -0,0 +1,902 @@ + +package com.example.requesttreeorderservice.customer; + +import com.example.requesttreeorderservice.Q; +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderRequest; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerRequest(Class returnType){ + this(returnType, () -> (T) new Customer()); + } + + protected CustomerRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerRequest copy(){ + return (CustomerRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerRequest matchingAnyOf(CustomerRequest customer){ + super.internalMatchAny(customer); + return this; + } + + public CustomerRequest matchingIdsOf(CustomerRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Customer.ID_PROPERTY, request, Customer.ID_PROPERTY)); + } + + public CustomerRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectName().selectVersion(); + } + + public CustomerRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Customer.ID_PROPERTY); + selectProperty(Customer.PLATFORM_PROPERTY); + selectProperty(Customer.NAME_PROPERTY); + selectProperty(Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectName().selectVersion(); + } + + public CustomerRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectPlatform().selectName().selectVersion(); + } + + + public CustomerRequest selectId(){ + selectProperty(Customer.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectId(){ + unselectProperty(Customer.ID_PROPERTY); + return this; + } + public CustomerRequest selectPlatformIdOnly(){ + selectProperty(Customer.PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public CustomerRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(Customer.PLATFORM_PROPERTY); + enhanceRelation(Customer.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, Customer.PLATFORM_PROPERTY)); + return this; + } + + public CustomerRequest unselectPlatform(){ + unselectProperty(Customer.PLATFORM_PROPERTY); + return this; + } + public CustomerRequest selectName(){ + selectProperty(Customer.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectName(){ + unselectProperty(Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest selectVersion(){ + selectProperty(Customer.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerRequest unselectVersion(){ + unselectProperty(Customer.VERSION_PROPERTY); + return this; + } + public CustomerRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CustomerRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(Customer.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.ID_PROPERTY, operator, values); + } + + public CustomerRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public CustomerRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public CustomerRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public CustomerRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.PLATFORM_PROPERTY, operator, values); + } + + public CustomerRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public CustomerRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(Customer.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public CustomerRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Customer.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public CustomerRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CustomerRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CustomerRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CustomerRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.NAME_PROPERTY, operator, values); + } + + public CustomerRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CustomerRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CustomerRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CustomerRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CustomerRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CustomerRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CustomerRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CustomerRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CustomerRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CustomerRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CustomerRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CustomerRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CustomerRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CustomerRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CustomerRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CustomerRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CustomerRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Customer.VERSION_PROPERTY, operator, values); + } + + public CustomerRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY)); + } + + public CustomerRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY))); + } + + public CustomerRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public CustomerRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(Customer.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + public CustomerRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Customer.ID_PROPERTY); + return this; + } + public CustomerRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public CustomerRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, Customer.PLATFORM_PROPERTY); + return this; + } + public CustomerRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CustomerRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Customer.VERSION_PROPERTY); + return this; + } + public CustomerRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(Customer.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerRequest groupById(){ + groupBy(Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest groupByIdAs(String retName){ + groupBy(retName, Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.ID_PROPERTY, function); + return this; + } + public CustomerRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(Customer.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public CustomerRequest groupByPlatform(){ + groupBy(Customer.PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest groupByPlatformAs(String retName){ + groupBy(retName, Customer.PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.PLATFORM_PROPERTY, function); + return this; + } + + public CustomerRequest groupByName(){ + groupBy(Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest groupByNameAs(String retName){ + groupBy(retName, Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.NAME_PROPERTY, function); + return this; + } + + public CustomerRequest groupByVersion(){ + groupBy(Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest groupByVersionAs(String retName){ + groupBy(retName, Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Customer.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerRequest orderByIdAscending(){ + addOrderByAscending(Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest orderByIdDescending(){ + addOrderByDescending(Customer.ID_PROPERTY); + return this; + } + + public CustomerRequest orderByPlatformAscending(){ + addOrderByAscending(Customer.PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest orderByPlatformDescending(){ + addOrderByDescending(Customer.PLATFORM_PROPERTY); + return this; + } + + public CustomerRequest orderByNameAscending(){ + addOrderByAscending(Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest orderByNameDescending(){ + addOrderByDescending(Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Customer.NAME_PROPERTY); + return this; + } + + public CustomerRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Customer.NAME_PROPERTY); + return this; + } + public CustomerRequest orderByVersionAscending(){ + addOrderByAscending(Customer.VERSION_PROPERTY); + return this; + } + + public CustomerRequest orderByVersionDescending(){ + addOrderByDescending(Customer.VERSION_PROPERTY); + return this; + } + + + public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + public CustomerRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest minTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name){ + return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest maxTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name){ + return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest sumTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name){ + return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest avgTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name){ + return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest standardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest sampleVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ + return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ + return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public CustomerRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, Customer.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, Customer.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..686cdce0a --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java @@ -0,0 +1,236 @@ + +package com.example.requesttreeorderservice.customerorder; + +import com.example.requesttreeorderservice.Constants; +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.orderitem.OrderItem; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "835b87e26813b0d288c20fbcd3ab52649d0d32277d4f1740fac610ad0b9432bb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer", 1), java.util.Map.entry("status", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("order_date", 4), java.util.Map.entry("total_amount", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer", java.util.List.of("customer", "customer")), java.util.Map.entry("status", java.util.List.of("status", "status")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("order_date", java.util.List.of("orderDate", "order_date")), java.util.Map.entry("total_amount", java.util.List.of("totalAmount", "total_amount")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_PROPERTY = "customer"; + public static final String STATUS_PROPERTY = "status"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String ORDER_DATE_PROPERTY = "order_date"; + public static final String TOTAL_AMOUNT_PROPERTY = "total_amount"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private Customer customer; + + private OrderStatus status; + + private String orderNumber; + + private LocalDate orderDate; + + private BigDecimal totalAmount; + + private SmartList orderItemList; + + public Customer getCustomer(){ + return this.customer; + } + + public OrderStatus getStatus(){ + return this.status; + } + + public String getOrderNumber(){ + return this.orderNumber; + } + + public LocalDate getOrderDate(){ + return this.orderDate; + } + + public BigDecimal getTotalAmount(){ + return this.totalAmount; + } + + public SmartList getOrderItemList(){ + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; + } + public CustomerOrder updateCustomer(Customer customer){ + if(isPropertyLoaded(CUSTOMER_PROPERTY) && Objects.equals(this.customer, customer)){ + return this; + } + handleUpdate(CUSTOMER_PROPERTY, getCustomer(), customer); + this.customer = customer; + return this; + } + + protected CustomerOrder updateStatus(OrderStatus status){ + if(isPropertyLoaded(STATUS_PROPERTY) && Objects.equals(this.status, status)){ + return this; + } + handleUpdate(STATUS_PROPERTY, getStatus(), status); + this.status = status; + return this; + } + + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateOrderDate(LocalDate orderDate){ + if(isPropertyLoaded(ORDER_DATE_PROPERTY) && Objects.equals(this.orderDate, orderDate)){ + return this; + } + handleUpdate(ORDER_DATE_PROPERTY, getOrderDate(), orderDate); + this.orderDate = orderDate; + return this; + } + + public CustomerOrder updateTotalAmount(BigDecimal totalAmount){ + if(isPropertyLoaded(TOTAL_AMOUNT_PROPERTY) && Objects.equals(this.totalAmount, totalAmount)){ + return this; + } + handleUpdate(TOTAL_AMOUNT_PROPERTY, getTotalAmount(), totalAmount); + this.totalAmount = totalAmount; + return this; + } + + public CustomerOrder addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); + } + + this.orderItemList.add(orderItem); + orderItem.updateCustomerOrder(this); + return this; + } + public boolean isStatusNew(){ + return Objects.equals(getStatus(), Constants.ORDER_STATUS_NEW); + } + + public CustomerOrder updateStatusToNew(){ + return updateStatus(Constants.ORDER_STATUS_NEW); + } + public boolean isStatusPaid(){ + return Objects.equals(getStatus(), Constants.ORDER_STATUS_PAID); + } + + public CustomerOrder updateStatusToPaid(){ + return updateStatus(Constants.ORDER_STATUS_PAID); + } + public boolean isStatusCancelled(){ + return Objects.equals(getStatus(), Constants.ORDER_STATUS_CANCELLED); + } + + public CustomerOrder updateStatusToCancelled(){ + return updateStatus(Constants.ORDER_STATUS_CANCELLED); + } + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer": this.customer = (Customer) value; break; + + case "status": this.status = (OrderStatus) value; break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "order_date": this.orderDate = (LocalDate) value; break; + + case "total_amount": this.totalAmount = (BigDecimal) value; break; + + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer": return this.customer; + case "status": return this.status; + case "order_number": return this.orderNumber; + case "order_date": return this.orderDate; + case "total_amount": return this.totalAmount; + case "order_item_list": return this.orderItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customer": return this.customer; + case "status": return this.status; + case "orderNumber": return this.orderNumber; + case "orderDate": return this.orderDate; + case "totalAmount": return this.totalAmount; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..e18674ef8 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,100 @@ + +package com.example.requesttreeorderservice.customerorder; + +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerChecker; +import com.example.requesttreeorderservice.orderitem.OrderItem; +import com.example.requesttreeorderservice.orderitem.OrderItemChecker; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + }else if(customerOrder.updateItem()){ + if(!customerOrder.isPropertyLoaded("customer")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "status"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_date"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("total_amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "total_amount"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomer(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROPERTY), newLocation(_parentLocation, "customer")); + checkStatus(_context, customerOrder.getProperty(CustomerOrder.STATUS_PROPERTY), newLocation(_parentLocation, "status")); + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkOrderDate(_context, customerOrder.getProperty(CustomerOrder.ORDER_DATE_PROPERTY), newLocation(_parentLocation, "order_date")); + checkTotalAmount(_context, customerOrder.getProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY), newLocation(_parentLocation, "total_amount")); + for(int i = 0; customerOrder.getOrderItemList() != null && i < customerOrder.getOrderItemList().size(); i++){ + OrderItem orderItem = customerOrder.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkCustomer(UserContext _context, Customer customer, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customer); + if((customer == null)){ + return; + } + new CustomerChecker().checkAndFix(_context, customer, _parentLocation); + } + public void checkStatus(UserContext _context, OrderStatus status, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, status); + if((status == null)){ + return; + } + new OrderStatusChecker().checkAndFix(_context, status, _parentLocation); + } + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkOrderDate(UserContext _context, LocalDate orderDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderDate); + if((orderDate == null)){ + return; + } + } + public void checkTotalAmount(UserContext _context, BigDecimal totalAmount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, totalAmount); + if((totalAmount == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..470e8b5bf --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,93 @@ + +package com.example.requesttreeorderservice.customerorder; + +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerExpression; +import com.example.requesttreeorderservice.orderitem.OrderItem; +import com.example.requesttreeorderservice.orderitem.OrderItemListExpression; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerExpression getCustomer(){ + return new CustomerExpression(loaded("customer", "getCustomer", CustomerOrder::getCustomer)); + } + + public CustomerOrderExpression updateCustomer(Customer customer){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomer(customer)); + } + + public OrderStatusExpression getStatus(){ + return new OrderStatusExpression(loaded("status", "getStatus", CustomerOrder::getStatus)); + } + + public CustomerOrderExpression updateStatusToNew(){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToNew()); + } + public CustomerOrderExpression updateStatusToPaid(){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToPaid()); + } + public CustomerOrderExpression updateStatusToCancelled(){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToCancelled()); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public Expression getOrderDate(){ + return loaded("order_date", "getOrderDate", CustomerOrder::getOrderDate); + } + public CustomerOrderExpression updateOrderDate(LocalDate orderDate){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderDate(orderDate)); + } + + public Expression getTotalAmount(){ + return loaded("total_amount", "getTotalAmount", CustomerOrder::getTotalAmount); + } + public CustomerOrderExpression updateTotalAmount(BigDecimal totalAmount){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateTotalAmount(totalAmount)); + } + + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", CustomerOrder::getOrderItemList)); + } + public CustomerOrderExpression addOrderItem(OrderItem orderItem){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..959f52594 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.example.requesttreeorderservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..baeab4690 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,1516 @@ + +package com.example.requesttreeorderservice.customerorder; + +import com.example.requesttreeorderservice.Q; +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerRequest; +import com.example.requesttreeorderservice.orderitem.OrderItem; +import com.example.requesttreeorderservice.orderitem.OrderItemRequest; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Date; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerIdOnly().selectStatusIdOnly().selectOrderNumber().selectOrderDate().selectTotalAmount().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + selectProperty(CustomerOrder.STATUS_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomer().selectStatus().selectOrderNumber().selectOrderDate().selectTotalAmount().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + selectOrderItemList(); + return selectId().selectCustomer().selectStatus().selectOrderNumber().selectOrderDate().selectTotalAmount().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectCustomerIdOnly(){ + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCustomer(){ + return selectCustomerWith(Q.customers().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCustomerWith(CustomerRequest customer){ + selectProperty(CustomerOrder.CUSTOMER_PROPERTY); + enhanceRelation(CustomerOrder.CUSTOMER_PROPERTY, customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerWith", null, CustomerOrder.CUSTOMER_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCustomer(){ + unselectProperty(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + public CustomerOrderRequest selectStatusIdOnly(){ + selectProperty(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest selectStatus(){ + return selectStatusWith(Q.orderStatuses().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectStatusWith(OrderStatusRequest status){ + selectProperty(CustomerOrder.STATUS_PROPERTY); + enhanceRelation(CustomerOrder.STATUS_PROPERTY, status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectStatusWith", null, CustomerOrder.STATUS_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectStatus(){ + unselectProperty(CustomerOrder.STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderDate(){ + selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + /** + * fill the orderDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderDate) to fetch orderDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderDate(){ + unselectProperty(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + public CustomerOrderRequest selectTotalAmount(){ + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + /** + * fill the totalAmount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalAmount) to fetch totalAmount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the totalAmount with customized aggrFunction, TEAQL uses ({aggrFunction}(totalAmount) AS totalAmount to fetch totalAmount property. + * @param aggrFunction aggrFunction + */ + public CustomerOrderRequest selectTotalAmount(AggrFunction aggrFunction){ + selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY, aggrFunction); + return this; + } + + + public CustomerOrderRequest unselectTotalAmount(){ + unselectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public CustomerOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByCustomer(Customer... customer){ + if (customer == null || customer.length == 0) { + throw new IllegalArgumentException("filterByCustomer parameter customer cannot be empty"); + } + return appendSearchCriteria(createCustomerCriteria(Operator.EQUAL, (Object[])customer)); + } + + public CustomerOrderRequest withCustomer(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerCriteria(operator, values)); + } + + public CustomerOrderRequest withCustomerIsUnknown(){ + return withCustomer(Operator.IS_NULL); + } + + public CustomerOrderRequest withCustomerIsKnown(){ + return withCustomer(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCustomer(Long customer){ + if(customer == null){ + return this; + } + return withCustomer(Operator.EQUAL, customer); + } + public CustomerOrderRequest withCustomerMatching(CustomerRequest customer){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCustomerMatching(CustomerRequest customer){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByStatus(OrderStatus... status){ + if (status == null || status.length == 0) { + throw new IllegalArgumentException("filterByStatus parameter status cannot be empty"); + } + return appendSearchCriteria(createStatusCriteria(Operator.EQUAL, (Object[])status)); + } + + public CustomerOrderRequest withStatus(Operator operator, Object... values){ + return appendSearchCriteria(createStatusCriteria(operator, values)); + } + + public CustomerOrderRequest withStatusIsUnknown(){ + return withStatus(Operator.IS_NULL); + } + + public CustomerOrderRequest withStatusIsKnown(){ + return withStatus(Operator.IS_NOT_NULL); + } + + public SearchCriteria createStatusCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.STATUS_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByStatus(Long status){ + if(status == null){ + return this; + } + return withStatus(Operator.EQUAL, status); + } + public CustomerOrderRequest withStatusMatching(OrderStatusRequest status){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutStatusMatching(OrderStatusRequest status){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByOrderDate(LocalDate... orderDate){ + if (orderDate == null || orderDate.length == 0) { + throw new IllegalArgumentException("filterByOrderDate parameter orderDate cannot be empty"); + } + return appendSearchCriteria(createOrderDateCriteria(Operator.EQUAL, (Object[])orderDate)); + } + + public CustomerOrderRequest withOrderDate(Operator operator, Object... values){ + return appendSearchCriteria(createOrderDateCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderDateIsUnknown(){ + return withOrderDate(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderDateIsKnown(){ + return withOrderDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_DATE_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderDateIs(LocalDate orderDate){ + return withOrderDate(Operator.EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateIsNot(LocalDate orderDate){ + return withOrderDate(Operator.NOT_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateIn(LocalDate... orderDate){ + return withOrderDate(Operator.IN, (Object[])orderDate); + } + + public CustomerOrderRequest withOrderDateNotIn(LocalDate... orderDate){ + return withOrderDate(Operator.NOT_IN, (Object[])orderDate); + } + public CustomerOrderRequest withOrderDateGreaterThan(LocalDate orderDate){ + return withOrderDate(Operator.GREATER_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateGreaterThanOrEqualTo(LocalDate orderDate){ + return withOrderDate(Operator.GREATER_THAN_OR_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateLessThan(LocalDate orderDate){ + return withOrderDate(Operator.LESS_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateLessThanOrEqualTo(LocalDate orderDate){ + return withOrderDate(Operator.LESS_THAN_OR_EQUAL, orderDate); + } + + public CustomerOrderRequest withOrderDateBetween(LocalDate startOfOrderDate, LocalDate endOfOrderDate){ + return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); + } + public CustomerOrderRequest withOrderDateBefore(LocalDate orderDate){ + return withOrderDate(Operator.LESS_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateBefore(Date orderDate){ + return withOrderDate(Operator.LESS_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateAfter(LocalDate orderDate){ + return withOrderDate(Operator.GREATER_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateAfter(Date orderDate){ + return withOrderDate(Operator.GREATER_THAN, orderDate); + } + + public CustomerOrderRequest withOrderDateBetween(Date startOfOrderDate, Date endOfOrderDate){ + return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); + } + + + + + public CustomerOrderRequest filterByTotalAmount(BigDecimal... totalAmount){ + if (totalAmount == null || totalAmount.length == 0) { + throw new IllegalArgumentException("filterByTotalAmount parameter totalAmount cannot be empty"); + } + return appendSearchCriteria(createTotalAmountCriteria(Operator.EQUAL, (Object[])totalAmount)); + } + + public CustomerOrderRequest withTotalAmount(Operator operator, Object... values){ + return appendSearchCriteria(createTotalAmountCriteria(operator, values)); + } + + public CustomerOrderRequest withTotalAmountIsUnknown(){ + return withTotalAmount(Operator.IS_NULL); + } + + public CustomerOrderRequest withTotalAmountIsKnown(){ + return withTotalAmount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTotalAmountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.TOTAL_AMOUNT_PROPERTY, operator, values); + } + + public CustomerOrderRequest withTotalAmountIs(BigDecimal totalAmount){ + return withTotalAmount(Operator.EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountIsNot(BigDecimal totalAmount){ + return withTotalAmount(Operator.NOT_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountIn(BigDecimal... totalAmount){ + return withTotalAmount(Operator.IN, (Object[])totalAmount); + } + + public CustomerOrderRequest withTotalAmountNotIn(BigDecimal... totalAmount){ + return withTotalAmount(Operator.NOT_IN, (Object[])totalAmount); + } + public CustomerOrderRequest withTotalAmountGreaterThan(BigDecimal totalAmount){ + return withTotalAmount(Operator.GREATER_THAN, totalAmount); + } + + public CustomerOrderRequest withTotalAmountGreaterThanOrEqualTo(BigDecimal totalAmount){ + return withTotalAmount(Operator.GREATER_THAN_OR_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountLessThan(BigDecimal totalAmount){ + return withTotalAmount(Operator.LESS_THAN, totalAmount); + } + + public CustomerOrderRequest withTotalAmountLessThanOrEqualTo(BigDecimal totalAmount){ + return withTotalAmount(Operator.LESS_THAN_OR_EQUAL, totalAmount); + } + + public CustomerOrderRequest withTotalAmountBetween(BigDecimal startOfTotalAmount, BigDecimal endOfTotalAmount){ + return withTotalAmount(Operator.BETWEEN, startOfTotalAmount, endOfTotalAmount); + } + + + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public CustomerOrderRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest minTotalAmount(){ + return minTotalAmountAs(prefix("minOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest minTotalAmountAs(String retName){ + super.min(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest maxTotalAmount(){ + return maxTotalAmountAs(prefix("maxOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest maxTotalAmountAs(String retName){ + super.max(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest sumTotalAmount(){ + return sumTotalAmountAs(prefix("sumOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest sumTotalAmountAs(String retName){ + super.sum(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest avgTotalAmount(){ + return avgTotalAmountAs(prefix("avgOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest avgTotalAmountAs(String retName){ + super.avg(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest standardDeviationTotalAmount(){ + return standardDeviationTotalAmountAs(prefix("standardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest standardDeviationTotalAmountAs(String retName){ + super.standardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmount(){ + return squareRootOfPopulationStandardDeviationTotalAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest sampleVarianceTotalAmount(){ + return sampleVarianceTotalAmountAs(prefix("sampleVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest sampleVarianceTotalAmountAs(String retName){ + super.sampleVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest samplePopulationVarianceTotalAmount(){ + return samplePopulationVarianceTotalAmountAs(prefix("samplePopulationVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); + } + + public CustomerOrderRequest samplePopulationVarianceTotalAmountAs(String retName){ + super.samplePopulationVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest groupByCustomerWithDetails(){ + return groupByCustomerWithDetails(Q.customers().unlimited()); + } + + public CustomerOrderRequest groupByCustomerWithDetails(CustomerRequest subRequest){ + aggregate(CustomerOrder.CUSTOMER_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupByStatusWithDetails(){ + return groupByStatusWithDetails(Q.orderStatuses().unlimited()); + } + + public CustomerOrderRequest groupByStatusWithDetails(OrderStatusRequest subRequest){ + aggregate(CustomerOrder.STATUS_PROPERTY, subRequest); + return this; + } + + + + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCustomer(){ + return countDistinctCustomerAs("customer_distinct_count"); + } + + public CustomerOrderRequest countDistinctCustomerAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctStatus(){ + return countDistinctStatusAs("status_distinct_count"); + } + + public CustomerOrderRequest countDistinctStatusAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderDate(){ + return countDistinctOrderDateAs("order_date_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderDateAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctTotalAmount(){ + return countDistinctTotalAmountAs("total_amount_distinct_count"); + } + + public CustomerOrderRequest countDistinctTotalAmountAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCustomerWith(CustomerRequest subRequest){ + groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerWith", null, "customer")); + return this; + } + public CustomerOrderRequest groupByCustomer(){ + groupBy(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerAs(String retName){ + groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByStatusWith(OrderStatusRequest subRequest){ + groupBy(CustomerOrder.STATUS_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByStatusWith", null, "status")); + return this; + } + public CustomerOrderRequest groupByStatus(){ + groupBy(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByStatusAs(String retName){ + groupBy(retName, CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByStatusWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.STATUS_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderDate(){ + groupBy(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderDateAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByTotalAmount(){ + groupBy(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByTotalAmountAs(String retName){ + groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByTotalAmountWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + public CustomerOrderRequest withStatusIsNew(){ + filterByStatus(com.example.requesttreeorderservice.Constants.ORDER_STATUS_NEW); + return this; + } + + + public CustomerOrderRequest withStatusIsPaid(){ + filterByStatus(com.example.requesttreeorderservice.Constants.ORDER_STATUS_PAID); + return this; + } + + + public CustomerOrderRequest withStatusIsCancelled(){ + filterByStatus(com.example.requesttreeorderservice.Constants.ORDER_STATUS_CANCELLED); + return this; + } + + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerAscending(){ + addOrderByAscending(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerDescending(){ + addOrderByDescending(CustomerOrder.CUSTOMER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByStatusAscending(){ + addOrderByAscending(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByStatusDescending(){ + addOrderByDescending(CustomerOrder.STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderDateAscending(){ + addOrderByAscending(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderDateDescending(){ + addOrderByDescending(CustomerOrder.ORDER_DATE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByTotalAmountAscending(){ + addOrderByAscending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByTotalAmountDescending(){ + addOrderByDescending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public CustomerRequest rollUpToCustomer(){ + CustomerRequest customer = Q.customers().unlimited(); + this.internalRollUpTo("customer", customer, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomer", null, "customer")); + return customer; + } + + public OrderStatusRequest rollUpToStatus(){ + OrderStatusRequest status = Q.orderStatuses().unlimited(); + this.internalRollUpTo("status", status, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToStatus", null, "status")); + return status; + } + + + + + + public CustomerOrderRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest minQuantityOfOrderItems(){ + addRelationScalarAggregate("minQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest minQuantityOfOrderItemsAs(String name){ + return minQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest minQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest maxQuantityOfOrderItems(){ + addRelationScalarAggregate("maxQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest maxQuantityOfOrderItemsAs(String name){ + return maxQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest maxQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sumQuantityOfOrderItems(){ + addRelationScalarAggregate("sumQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sumQuantityOfOrderItemsAs(String name){ + return sumQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest sumQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest avgQuantityOfOrderItems(){ + addRelationScalarAggregate("avgQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest avgQuantityOfOrderItemsAs(String name){ + return avgQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest avgQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest standardDeviationQuantityOfOrderItems(){ + addRelationScalarAggregate("stdDevQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest standardDeviationQuantityOfOrderItemsAs(String name){ + return standardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest standardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItems(){ + addRelationScalarAggregate("stdDevPopQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sampleVarianceQuantityOfOrderItems(){ + addRelationScalarAggregate("varSampQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name){ + return sampleVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderItems(){ + addRelationScalarAggregate("varPopQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name){ + return samplePopulationVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest minUnitPriceOfOrderItems(){ + addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest minUnitPriceOfOrderItemsAs(String name){ + return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest maxUnitPriceOfOrderItems(){ + addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest maxUnitPriceOfOrderItemsAs(String name){ + return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sumUnitPriceOfOrderItems(){ + addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sumUnitPriceOfOrderItemsAs(String name){ + return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest avgUnitPriceOfOrderItems(){ + addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest avgUnitPriceOfOrderItemsAs(String name){ + return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest standardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ + return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ + addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sampleVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ + return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest samplePopulationVarianceUnitPriceOfOrderItems(){ + addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), + OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ + return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public CustomerOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + OrderItem.UNIT_PRICE_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer){ + return facetByCustomerAs(facetName, customer, true); + } + + public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.CUSTOMER_PROPERTY, customer, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerAs", facetName, CustomerOrder.CUSTOMER_PROPERTY)); + return this; + } + public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status){ + return facetByStatusAs(facetName, status, true); + } + + public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.STATUS_PROPERTY, status, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByStatusAs", facetName, CustomerOrder.STATUS_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java new file mode 100644 index 000000000..c601b176d --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java @@ -0,0 +1,169 @@ + +package com.example.requesttreeorderservice.orderitem; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c42b4bc2252ab616b0b006ad2560900a40e2ca87d71ad860bab689f0b16b1795"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("product_name", 2), java.util.Map.entry("quantity", 3), java.util.Map.entry("unit_price", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("unit_price", java.util.List.of("unitPrice", "unit_price")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String PRODUCT_NAME_PROPERTY = "product_name"; + public static final String QUANTITY_PROPERTY = "quantity"; + public static final String UNIT_PRICE_PROPERTY = "unit_price"; + private CustomerOrder customerOrder; + + private String productName; + + private Integer quantity; + + private BigDecimal unitPrice; + + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public String getProductName(){ + return this.productName; + } + + public Integer getQuantity(){ + return this.quantity; + } + + public BigDecimal getUnitPrice(){ + return this.unitPrice; + } + + public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public OrderItem updateProductName(String productName){ + productName = (productName == null ? null : productName.trim()); + if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ + return this; + } + handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); + this.productName = productName; + return this; + } + + public OrderItem updateQuantity(Integer quantity){ + if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ + return this; + } + handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); + this.quantity = quantity; + return this; + } + + public OrderItem updateUnitPrice(BigDecimal unitPrice){ + if(isPropertyLoaded(UNIT_PRICE_PROPERTY) && Objects.equals(this.unitPrice, unitPrice)){ + return this; + } + handleUpdate(UNIT_PRICE_PROPERTY, getUnitPrice(), unitPrice); + this.unitPrice = unitPrice; + return this; + } + + + public static OrderItem refer(Long id){ + OrderItem refer = new OrderItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; + + case "quantity": this.quantity = (Integer) value; break; + + case "unit_price": this.unitPrice = (BigDecimal) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "product_name": return this.productName; + case "quantity": return this.quantity; + case "unit_price": return this.unitPrice; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "productName": return this.productName; + case "quantity": return this.quantity; + case "unitPrice": return this.unitPrice; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java new file mode 100644 index 000000000..31528fa21 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java @@ -0,0 +1,80 @@ + +package com.example.requesttreeorderservice.orderitem; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class OrderItemChecker implements Checker{ + + public String type(){ + return OrderItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if(needCheck(_context, orderItem)){ + markAsChecked(_context, orderItem); + doCheck(_context, orderItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if((orderItem == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + } + if(orderItem.newItem()){ + }else if(orderItem.updateItem()){ + if(!orderItem.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("product_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("quantity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("unit_price")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "unit_price"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, orderItem.getProperty(OrderItem.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkProductName(_context, orderItem.getProperty(OrderItem.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); + checkQuantity(_context, orderItem.getProperty(OrderItem.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); + checkUnitPrice(_context, orderItem.getProperty(OrderItem.UNIT_PRICE_PROPERTY), newLocation(_parentLocation, "unit_price")); + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, productName); + if((productName == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, productName); + + } + public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quantity); + if((quantity == null)){ + return; + } + } + public void checkUnitPrice(UserContext _context, BigDecimal unitPrice, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, unitPrice); + if((unitPrice == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java new file mode 100644 index 000000000..f8b30f5e6 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java @@ -0,0 +1,68 @@ + +package com.example.requesttreeorderservice.orderitem; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderItemExpression(Expression expression){ + super(expression); + } + + public OrderItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderItemExpression updateId(Long id){ + return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); + } + + public OrderItemExpression save(UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderItemExpression save(String intent, UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderItem::getCustomerOrder)); + } + + public OrderItemExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCustomerOrder(customerOrder)); + } + + public Expression getProductName(){ + return loaded("product_name", "getProductName", OrderItem::getProductName); + } + public OrderItemExpression updateProductName(String productName){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateProductName(productName)); + } + + public Expression getQuantity(){ + return loaded("quantity", "getQuantity", OrderItem::getQuantity); + } + public OrderItemExpression updateQuantity(Integer quantity){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateQuantity(quantity)); + } + + public Expression getUnitPrice(){ + return loaded("unit_price", "getUnitPrice", OrderItem::getUnitPrice); + } + public OrderItemExpression updateUnitPrice(BigDecimal unitPrice){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUnitPrice(unitPrice)); + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java new file mode 100644 index 000000000..da7c16f15 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java @@ -0,0 +1,25 @@ + +package com.example.requesttreeorderservice.orderitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderItemListExpression extends SmartListExpression { + public OrderItemListExpression(Expression> expression){ + super(expression); + } + + public OrderItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderItemExpression first() { + return new OrderItemExpression(super.first()); + } + + public OrderItemExpression get(int index) { + return new OrderItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java new file mode 100644 index 000000000..158c0afe9 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java @@ -0,0 +1,1060 @@ + +package com.example.requesttreeorderservice.orderitem; + +import com.example.requesttreeorderservice.Q; +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class OrderItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderItemRequest(Class returnType){ + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ + super.internalMatchAny(orderItem); + return this; + } + + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + + public OrderItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectProductName().selectQuantity().selectUnitPrice().selectVersion(); + } + + public OrderItemRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + selectProperty(OrderItem.QUANTITY_PROPERTY); + selectProperty(OrderItem.UNIT_PRICE_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectProductName().selectQuantity().selectUnitPrice().selectVersion(); + } + + public OrderItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectCustomerOrder().selectProductName().selectQuantity().selectUnitPrice().selectVersion(); + } + + + public OrderItemRequest selectId(){ + selectProperty(OrderItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectId(){ + unselectProperty(OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest selectCustomerOrderIdOnly(){ + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public OrderItemRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderItem.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public OrderItemRequest unselectCustomerOrder(){ + unselectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderItemRequest selectProductName(){ + selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + /** + * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectProductName(){ + unselectProperty(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest selectQuantity(){ + selectProperty(OrderItem.QUANTITY_PROPERTY); + return this; + } + + /** + * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. + * @param aggrFunction aggrFunction + */ + public OrderItemRequest selectQuantity(AggrFunction aggrFunction){ + selectProperty(OrderItem.QUANTITY_PROPERTY, aggrFunction); + return this; + } + + + public OrderItemRequest unselectQuantity(){ + unselectProperty(OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest selectUnitPrice(){ + selectProperty(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + /** + * fill the unitPrice with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS unitPrice) to fetch unitPrice property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the unitPrice with customized aggrFunction, TEAQL uses ({aggrFunction}(unitPrice) AS unitPrice to fetch unitPrice property. + * @param aggrFunction aggrFunction + */ + public OrderItemRequest selectUnitPrice(AggrFunction aggrFunction){ + selectProperty(OrderItem.UNIT_PRICE_PROPERTY, aggrFunction); + return this; + } + + + public OrderItemRequest unselectUnitPrice(){ + unselectProperty(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest selectVersion(){ + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectVersion(){ + unselectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); + } + + public OrderItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderItemRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public OrderItemRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public OrderItemRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public OrderItemRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public OrderItemRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public OrderItemRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public OrderItemRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public OrderItemRequest filterByProductName(String... productName){ + if (productName == null || productName.length == 0) { + throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); + } + return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); + } + + public OrderItemRequest withProductName(Operator operator, Object... values){ + return appendSearchCriteria(createProductNameCriteria(operator, values)); + } + + public OrderItemRequest withProductNameIsUnknown(){ + return withProductName(Operator.IS_NULL); + } + + public OrderItemRequest withProductNameIsKnown(){ + return withProductName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.PRODUCT_NAME_PROPERTY, operator, values); + } + + public OrderItemRequest withProductNameIsNot(String productName){ + return withProductName(Operator.NOT_EQUAL, productName); + } + + public OrderItemRequest withProductNameIn(String... productName){ + return withProductName(Operator.IN, (Object[])productName); + } + + public OrderItemRequest withProductNameNotIn(String... productName){ + return withProductName(Operator.NOT_IN, (Object[])productName); + } + public OrderItemRequest withProductNameGreaterThan(String productName){ + return withProductName(Operator.GREATER_THAN, productName); + } + + public OrderItemRequest withProductNameGreaterThanOrEqualTo(String productName){ + return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); + } + + public OrderItemRequest withProductNameLessThan(String productName){ + return withProductName(Operator.LESS_THAN, productName); + } + + public OrderItemRequest withProductNameLessThanOrEqualTo(String productName){ + return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); + } + + public OrderItemRequest withProductNameBetween(String startOfProductName, String endOfProductName){ + return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); + } + public OrderItemRequest withProductNameStartingWith(String productName){ + return withProductName(Operator.BEGIN_WITH, productName); + } + public OrderItemRequest withProductNameContaining(String productName){ + return withProductName(Operator.CONTAIN, productName); + } + + public OrderItemRequest withProductNameNotContaining(String productName){ + return withProductName(Operator.NOT_CONTAIN, productName); + } + + public OrderItemRequest withProductNameNotStartingWith(String productName){ + return withProductName(Operator.NOT_BEGIN_WITH, productName); + } + + public OrderItemRequest withProductNameEndingWith(String productName){ + return withProductName(Operator.END_WITH, productName); + } + + public OrderItemRequest withProductNameNotEndingWith(String productName){ + return withProductName(Operator.NOT_END_WITH, productName); + } + + public OrderItemRequest withProductNameIs(String productName){ + return withProductName(Operator.EQUAL, productName); + } + + public OrderItemRequest withProductNameSoundingLike(String productName){ + return withProductName(Operator.SOUNDS_LIKE, productName); + } + + + + public OrderItemRequest filterByQuantity(Integer... quantity){ + if (quantity == null || quantity.length == 0) { + throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); + } + return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); + } + + public OrderItemRequest withQuantity(Operator operator, Object... values){ + return appendSearchCriteria(createQuantityCriteria(operator, values)); + } + + public OrderItemRequest withQuantityIsUnknown(){ + return withQuantity(Operator.IS_NULL); + } + + public OrderItemRequest withQuantityIsKnown(){ + return withQuantity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.QUANTITY_PROPERTY, operator, values); + } + + public OrderItemRequest withQuantityIs(Integer quantity){ + return withQuantity(Operator.EQUAL, quantity); + } + + public OrderItemRequest withQuantityIsNot(Integer quantity){ + return withQuantity(Operator.NOT_EQUAL, quantity); + } + + public OrderItemRequest withQuantityIn(Integer... quantity){ + return withQuantity(Operator.IN, (Object[])quantity); + } + + public OrderItemRequest withQuantityNotIn(Integer... quantity){ + return withQuantity(Operator.NOT_IN, (Object[])quantity); + } + public OrderItemRequest withQuantityGreaterThan(Integer quantity){ + return withQuantity(Operator.GREATER_THAN, quantity); + } + + public OrderItemRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); + } + + public OrderItemRequest withQuantityLessThan(Integer quantity){ + return withQuantity(Operator.LESS_THAN, quantity); + } + + public OrderItemRequest withQuantityLessThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); + } + + public OrderItemRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ + return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); + } + + + + public OrderItemRequest filterByUnitPrice(BigDecimal... unitPrice){ + if (unitPrice == null || unitPrice.length == 0) { + throw new IllegalArgumentException("filterByUnitPrice parameter unitPrice cannot be empty"); + } + return appendSearchCriteria(createUnitPriceCriteria(Operator.EQUAL, (Object[])unitPrice)); + } + + public OrderItemRequest withUnitPrice(Operator operator, Object... values){ + return appendSearchCriteria(createUnitPriceCriteria(operator, values)); + } + + public OrderItemRequest withUnitPriceIsUnknown(){ + return withUnitPrice(Operator.IS_NULL); + } + + public OrderItemRequest withUnitPriceIsKnown(){ + return withUnitPrice(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUnitPriceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.UNIT_PRICE_PROPERTY, operator, values); + } + + public OrderItemRequest withUnitPriceIs(BigDecimal unitPrice){ + return withUnitPrice(Operator.EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceIsNot(BigDecimal unitPrice){ + return withUnitPrice(Operator.NOT_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceIn(BigDecimal... unitPrice){ + return withUnitPrice(Operator.IN, (Object[])unitPrice); + } + + public OrderItemRequest withUnitPriceNotIn(BigDecimal... unitPrice){ + return withUnitPrice(Operator.NOT_IN, (Object[])unitPrice); + } + public OrderItemRequest withUnitPriceGreaterThan(BigDecimal unitPrice){ + return withUnitPrice(Operator.GREATER_THAN, unitPrice); + } + + public OrderItemRequest withUnitPriceGreaterThanOrEqualTo(BigDecimal unitPrice){ + return withUnitPrice(Operator.GREATER_THAN_OR_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceLessThan(BigDecimal unitPrice){ + return withUnitPrice(Operator.LESS_THAN, unitPrice); + } + + public OrderItemRequest withUnitPriceLessThanOrEqualTo(BigDecimal unitPrice){ + return withUnitPrice(Operator.LESS_THAN_OR_EQUAL, unitPrice); + } + + public OrderItemRequest withUnitPriceBetween(BigDecimal startOfUnitPrice, BigDecimal endOfUnitPrice){ + return withUnitPrice(Operator.BETWEEN, startOfUnitPrice, endOfUnitPrice); + } + + + + public OrderItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); + } + + public OrderItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderItemRequest minQuantity(){ + return minQuantityAs(prefix("minOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest minQuantityAs(String retName){ + super.min(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest maxQuantity(){ + return maxQuantityAs(prefix("maxOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest maxQuantityAs(String retName){ + super.max(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest sumQuantity(){ + return sumQuantityAs(prefix("sumOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest sumQuantityAs(String retName){ + super.sum(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest avgQuantity(){ + return avgQuantityAs(prefix("avgOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest avgQuantityAs(String retName){ + super.avg(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest standardDeviationQuantity(){ + return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest standardDeviationQuantityAs(String retName){ + super.standardDeviation(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest squareRootOfPopulationStandardDeviationQuantity(){ + return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest sampleVarianceQuantity(){ + return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest sampleVarianceQuantityAs(String retName){ + super.sampleVariance(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest samplePopulationVarianceQuantity(){ + return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest samplePopulationVarianceQuantityAs(String retName){ + super.samplePopulationVariance(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest minUnitPrice(){ + return minUnitPriceAs(prefix("minOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest minUnitPriceAs(String retName){ + super.min(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest maxUnitPrice(){ + return maxUnitPriceAs(prefix("maxOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest maxUnitPriceAs(String retName){ + super.max(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest sumUnitPrice(){ + return sumUnitPriceAs(prefix("sumOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest sumUnitPriceAs(String retName){ + super.sum(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest avgUnitPrice(){ + return avgUnitPriceAs(prefix("avgOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest avgUnitPriceAs(String retName){ + super.avg(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest standardDeviationUnitPrice(){ + return standardDeviationUnitPriceAs(prefix("standardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest standardDeviationUnitPriceAs(String retName){ + super.standardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPrice(){ + return squareRootOfPopulationStandardDeviationUnitPriceAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPriceAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest sampleVarianceUnitPrice(){ + return sampleVarianceUnitPriceAs(prefix("sampleVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest sampleVarianceUnitPriceAs(String retName){ + super.sampleVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest samplePopulationVarianceUnitPrice(){ + return samplePopulationVarianceUnitPriceAs(prefix("samplePopulationVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); + } + + public OrderItemRequest samplePopulationVarianceUnitPriceAs(String retName){ + super.samplePopulationVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public OrderItemRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + + + + + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderItemRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctProductName(){ + return countDistinctProductNameAs("product_name_distinct_count"); + } + + public OrderItemRequest countDistinctProductNameAs(String alias){ + super.countDistinctProperty(alias, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctQuantity(){ + return countDistinctQuantityAs("quantity_distinct_count"); + } + + public OrderItemRequest countDistinctQuantityAs(String alias){ + super.countDistinctProperty(alias, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest countDistinctUnitPrice(){ + return countDistinctUnitPriceAs("unit_price_distinct_count"); + } + + public OrderItemRequest countDistinctUnitPriceAs(String alias){ + super.countDistinctProperty(alias, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupById(){ + groupBy(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdAs(String retName){ + groupBy(retName, OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.ID_PROPERTY, function); + return this; + } + public OrderItemRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public OrderItemRequest groupByCustomerOrder(){ + groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByProductName(){ + groupBy(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByProductNameAs(String retName){ + groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByProductNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByQuantity(){ + groupBy(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest groupByQuantityAs(String retName){ + groupBy(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest groupByQuantityWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.QUANTITY_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByUnitPrice(){ + groupBy(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest groupByUnitPriceAs(String retName){ + groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest groupByUnitPriceWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByVersion(){ + groupBy(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionAs(String retName){ + groupBy(retName, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.VERSION_PROPERTY, function); + return this; + } + + + + public OrderItemRequest orderByIdAscending(){ + addOrderByAscending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByIdDescending(){ + addOrderByDescending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByCustomerOrderAscending(){ + addOrderByAscending(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByCustomerOrderDescending(){ + addOrderByDescending(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameAscending(){ + addOrderByAscending(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameDescending(){ + addOrderByDescending(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByProductNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByProductNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByQuantityAscending(){ + addOrderByAscending(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest orderByQuantityDescending(){ + addOrderByDescending(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest orderByUnitPriceAscending(){ + addOrderByAscending(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest orderByUnitPriceDescending(){ + addOrderByDescending(OrderItem.UNIT_PRICE_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionAscending(){ + addOrderByAscending(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionDescending(){ + addOrderByDescending(OrderItem.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + + + + + + public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderItem.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java new file mode 100644 index 000000000..83fbdfb38 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java @@ -0,0 +1,214 @@ + +package com.example.requesttreeorderservice.orderstatus; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderStatus extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderStatus"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "81304ab2e3fd61964bc163a850a2a321e1c0bfe204f85f36aedc4e1b5d8cebcd"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("color", 4), java.util.Map.entry("display_order", 5), java.util.Map.entry("version", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("color", java.util.List.of("color", "color")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderStatus.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String CODE_PROPERTY = "code"; + public static final String COLOR_PROPERTY = "color"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private Platform platform; + + private String name; + + private String code; + + private String color; + + private BigDecimal displayOrder; + + private SmartList customerOrderList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public String getCode(){ + return this.code; + } + + public String getColor(){ + return this.color; + } + + public BigDecimal getDisplayOrder(){ + return this.displayOrder; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public OrderStatus updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public OrderStatus updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public OrderStatus updateCode(String code){ + code = (code == null ? null : code.trim()); + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ + return this; + } + handleUpdate(CODE_PROPERTY, getCode(), code); + this.code = code; + return this; + } + + public OrderStatus updateColor(String color){ + color = (color == null ? null : color.trim()); + if(isPropertyLoaded(COLOR_PROPERTY) && Objects.equals(this.color, color)){ + return this; + } + handleUpdate(COLOR_PROPERTY, getColor(), color); + this.color = color; + return this; + } + + public OrderStatus updateDisplayOrder(BigDecimal displayOrder){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ + return this; + } + handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); + this.displayOrder = displayOrder; + return this; + } + + public OrderStatus addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateProperty(CustomerOrder.STATUS_PROPERTY, this); + return this; + } + + public static OrderStatus refer(Long id){ + OrderStatus refer = new OrderStatus(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderStatus comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "code": this.code = (value == null ? null : ((String)value).trim()); break; + + case "color": this.color = (value == null ? null : ((String)value).trim()); break; + + case "display_order": this.displayOrder = (BigDecimal) value; break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "color": return this.color; + case "display_order": return this.displayOrder; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "color": return this.color; + case "displayOrder": return this.displayOrder; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java new file mode 100644 index 000000000..0f2645a76 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java @@ -0,0 +1,100 @@ + +package com.example.requesttreeorderservice.orderstatus; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderChecker; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class OrderStatusChecker implements Checker{ + + public String type(){ + return OrderStatus.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ + if(needCheck(_context, orderStatus)){ + markAsChecked(_context, orderStatus); + doCheck(_context, orderStatus, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ + if((orderStatus == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderStatus); + if(orderStatus.needPersist()){ + } + if(orderStatus.newItem()){ + }else if(orderStatus.updateItem()){ + if(!orderStatus.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("color")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "color"), "Mutation requires a fully loaded entity"); + } + if(!orderStatus.isPropertyLoaded("display_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, orderStatus.getProperty(OrderStatus.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, orderStatus.getProperty(OrderStatus.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, orderStatus.getProperty(OrderStatus.CODE_PROPERTY), newLocation(_parentLocation, "code")); + checkColor(_context, orderStatus.getProperty(OrderStatus.COLOR_PROPERTY), newLocation(_parentLocation, "color")); + checkDisplayOrder(_context, orderStatus.getProperty(OrderStatus.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); + for(int i = 0; orderStatus.getCustomerOrderList() != null && i < orderStatus.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = orderStatus.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); + if((code == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, code); + + } + public void checkColor(UserContext _context, String color, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, color); + if((color == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, color); + + } + public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, displayOrder); + if((displayOrder == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java new file mode 100644 index 000000000..b251f692b --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java @@ -0,0 +1,83 @@ + +package com.example.requesttreeorderservice.orderstatus; + +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderListExpression; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class OrderStatusExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderStatusExpression(Expression expression){ + super(expression); + } + + public OrderStatusExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderStatusExpression updateId(Long id){ + return new OrderStatusExpression(this, $it -> {((OrderStatus)$it).__internalSet("id", id); return this;}); + } + + public OrderStatusExpression save(UserContext userContext){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderStatusExpression save(String intent, UserContext userContext){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", OrderStatus::getPlatform)); + } + + public OrderStatusExpression updatePlatform(Platform platform){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", OrderStatus::getName); + } + public OrderStatusExpression updateName(String name){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateName(name)); + } + + public Expression getCode(){ + return loaded("code", "getCode", OrderStatus::getCode); + } + public OrderStatusExpression updateCode(String code){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCode(code)); + } + + public Expression getColor(){ + return loaded("color", "getColor", OrderStatus::getColor); + } + public OrderStatusExpression updateColor(String color){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateColor(color)); + } + + public Expression getDisplayOrder(){ + return loaded("display_order", "getDisplayOrder", OrderStatus::getDisplayOrder); + } + public OrderStatusExpression updateDisplayOrder(BigDecimal displayOrder){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateDisplayOrder(displayOrder)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", OrderStatus::getCustomerOrderList)); + } + public OrderStatusExpression addCustomerOrder(CustomerOrder customerOrder){ + return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java new file mode 100644 index 000000000..483767e21 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java @@ -0,0 +1,25 @@ + +package com.example.requesttreeorderservice.orderstatus; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderStatusListExpression extends SmartListExpression { + public OrderStatusListExpression(Expression> expression){ + super(expression); + } + + public OrderStatusListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderStatusExpression first() { + return new OrderStatusExpression(super.first()); + } + + public OrderStatusExpression get(int index) { + return new OrderStatusExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java new file mode 100644 index 000000000..05a90f705 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java @@ -0,0 +1,1385 @@ + +package com.example.requesttreeorderservice.orderstatus; + +import com.example.requesttreeorderservice.Q; +import com.example.requesttreeorderservice.customerorder.CustomerOrder; +import com.example.requesttreeorderservice.customerorder.CustomerOrderRequest; +import com.example.requesttreeorderservice.platform.Platform; +import com.example.requesttreeorderservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class OrderStatusRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderStatusRequest(Class returnType){ + this(returnType, () -> (T) new OrderStatus()); + } + + protected OrderStatusRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderStatusRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderStatusRequest copy(){ + return (OrderStatusRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderStatusRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderStatusRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderStatusRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderStatusRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderStatusRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderStatusRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderStatusRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderStatusRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderStatusRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderStatusRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderStatusRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderStatusRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderStatusRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderStatusRequest matchingAnyOf(OrderStatusRequest orderStatus){ + super.internalMatchAny(orderStatus); + return this; + } + + public OrderStatusRequest matchingIdsOf(OrderStatusRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderStatus.ID_PROPERTY, request, OrderStatus.ID_PROPERTY)); + } + + public OrderStatusRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderStatusRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderStatusRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderStatusRequest selectSelf(){ + super.selectSelf(); + return selectPlatformIdOnly().selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectVersion(); + } + + public OrderStatusRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderStatusRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderStatus.PLATFORM_PROPERTY); + selectProperty(OrderStatus.ID_PROPERTY); + selectProperty(OrderStatus.NAME_PROPERTY); + selectProperty(OrderStatus.CODE_PROPERTY); + selectProperty(OrderStatus.COLOR_PROPERTY); + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + selectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest selectAll(){ + super.selectAll(); + return selectPlatform().selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectVersion(); + } + + public OrderStatusRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectPlatform().selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectVersion(); + } + + + public OrderStatusRequest selectPlatformIdOnly(){ + selectProperty(OrderStatus.PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public OrderStatusRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(OrderStatus.PLATFORM_PROPERTY); + enhanceRelation(OrderStatus.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, OrderStatus.PLATFORM_PROPERTY)); + return this; + } + + public OrderStatusRequest unselectPlatform(){ + unselectProperty(OrderStatus.PLATFORM_PROPERTY); + return this; + } + public OrderStatusRequest selectId(){ + selectProperty(OrderStatus.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectId(){ + unselectProperty(OrderStatus.ID_PROPERTY); + return this; + } + public OrderStatusRequest selectName(){ + selectProperty(OrderStatus.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectName(){ + unselectProperty(OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest selectCode(){ + selectProperty(OrderStatus.CODE_PROPERTY); + return this; + } + + /** + * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectCode(){ + unselectProperty(OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest selectColor(){ + selectProperty(OrderStatus.COLOR_PROPERTY); + return this; + } + + /** + * fill the color with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS color) to fetch color property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectColor(){ + unselectProperty(OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest selectDisplayOrder(){ + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + /** + * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. + * @param aggrFunction aggrFunction + */ + public OrderStatusRequest selectDisplayOrder(AggrFunction aggrFunction){ + selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY, aggrFunction); + return this; + } + + + public OrderStatusRequest unselectDisplayOrder(){ + unselectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest selectVersion(){ + selectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderStatusRequest unselectVersion(){ + unselectProperty(OrderStatus.VERSION_PROPERTY); + return this; + } + public OrderStatusRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public OrderStatusRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public OrderStatusRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public OrderStatusRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public OrderStatusRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.PLATFORM_PROPERTY, operator, values); + } + + public OrderStatusRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public OrderStatusRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public OrderStatusRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderStatus.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public OrderStatusRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.ID_PROPERTY, operator, values); + } + + public OrderStatusRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderStatusRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderStatusRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderStatusRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderStatusRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public OrderStatusRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public OrderStatusRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public OrderStatusRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.NAME_PROPERTY, operator, values); + } + + public OrderStatusRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public OrderStatusRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public OrderStatusRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public OrderStatusRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public OrderStatusRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public OrderStatusRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public OrderStatusRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public OrderStatusRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public OrderStatusRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public OrderStatusRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public OrderStatusRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public OrderStatusRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public OrderStatusRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public OrderStatusRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public OrderStatusRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public OrderStatusRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public OrderStatusRequest filterByCode(String... code){ + if (code == null || code.length == 0) { + throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); + } + return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); + } + + public OrderStatusRequest withCode(Operator operator, Object... values){ + return appendSearchCriteria(createCodeCriteria(operator, values)); + } + + public OrderStatusRequest withCodeIsUnknown(){ + return withCode(Operator.IS_NULL); + } + + public OrderStatusRequest withCodeIsKnown(){ + return withCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.CODE_PROPERTY, operator, values); + } + + public OrderStatusRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public OrderStatusRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public OrderStatusRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } + public OrderStatusRequest withCodeGreaterThan(String code){ + return withCode(Operator.GREATER_THAN, code); + } + + public OrderStatusRequest withCodeGreaterThanOrEqualTo(String code){ + return withCode(Operator.GREATER_THAN_OR_EQUAL, code); + } + + public OrderStatusRequest withCodeLessThan(String code){ + return withCode(Operator.LESS_THAN, code); + } + + public OrderStatusRequest withCodeLessThanOrEqualTo(String code){ + return withCode(Operator.LESS_THAN_OR_EQUAL, code); + } + + public OrderStatusRequest withCodeBetween(String startOfCode, String endOfCode){ + return withCode(Operator.BETWEEN, startOfCode, endOfCode); + } + public OrderStatusRequest withCodeStartingWith(String code){ + return withCode(Operator.BEGIN_WITH, code); + } + public OrderStatusRequest withCodeContaining(String code){ + return withCode(Operator.CONTAIN, code); + } + + public OrderStatusRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public OrderStatusRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + + public OrderStatusRequest withCodeEndingWith(String code){ + return withCode(Operator.END_WITH, code); + } + + public OrderStatusRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + + public OrderStatusRequest withCodeIs(String code){ + return withCode(Operator.EQUAL, code); + } + + public OrderStatusRequest withCodeSoundingLike(String code){ + return withCode(Operator.SOUNDS_LIKE, code); + } + + + + public OrderStatusRequest filterByColor(String... color){ + if (color == null || color.length == 0) { + throw new IllegalArgumentException("filterByColor parameter color cannot be empty"); + } + return appendSearchCriteria(createColorCriteria(Operator.EQUAL, (Object[])color)); + } + + public OrderStatusRequest withColor(Operator operator, Object... values){ + return appendSearchCriteria(createColorCriteria(operator, values)); + } + + public OrderStatusRequest withColorIsUnknown(){ + return withColor(Operator.IS_NULL); + } + + public OrderStatusRequest withColorIsKnown(){ + return withColor(Operator.IS_NOT_NULL); + } + + public SearchCriteria createColorCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.COLOR_PROPERTY, operator, values); + } + + public OrderStatusRequest withColorIsNot(String color){ + return withColor(Operator.NOT_EQUAL, color); + } + + public OrderStatusRequest withColorIn(String... color){ + return withColor(Operator.IN, (Object[])color); + } + + public OrderStatusRequest withColorNotIn(String... color){ + return withColor(Operator.NOT_IN, (Object[])color); + } + public OrderStatusRequest withColorGreaterThan(String color){ + return withColor(Operator.GREATER_THAN, color); + } + + public OrderStatusRequest withColorGreaterThanOrEqualTo(String color){ + return withColor(Operator.GREATER_THAN_OR_EQUAL, color); + } + + public OrderStatusRequest withColorLessThan(String color){ + return withColor(Operator.LESS_THAN, color); + } + + public OrderStatusRequest withColorLessThanOrEqualTo(String color){ + return withColor(Operator.LESS_THAN_OR_EQUAL, color); + } + + public OrderStatusRequest withColorBetween(String startOfColor, String endOfColor){ + return withColor(Operator.BETWEEN, startOfColor, endOfColor); + } + public OrderStatusRequest withColorStartingWith(String color){ + return withColor(Operator.BEGIN_WITH, color); + } + public OrderStatusRequest withColorContaining(String color){ + return withColor(Operator.CONTAIN, color); + } + + public OrderStatusRequest withColorNotContaining(String color){ + return withColor(Operator.NOT_CONTAIN, color); + } + + public OrderStatusRequest withColorNotStartingWith(String color){ + return withColor(Operator.NOT_BEGIN_WITH, color); + } + + public OrderStatusRequest withColorEndingWith(String color){ + return withColor(Operator.END_WITH, color); + } + + public OrderStatusRequest withColorNotEndingWith(String color){ + return withColor(Operator.NOT_END_WITH, color); + } + + public OrderStatusRequest withColorIs(String color){ + return withColor(Operator.EQUAL, color); + } + + public OrderStatusRequest withColorSoundingLike(String color){ + return withColor(Operator.SOUNDS_LIKE, color); + } + + + + public OrderStatusRequest filterByDisplayOrder(BigDecimal... displayOrder){ + if (displayOrder == null || displayOrder.length == 0) { + throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); + } + return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); + } + + public OrderStatusRequest withDisplayOrder(Operator operator, Object... values){ + return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); + } + + public OrderStatusRequest withDisplayOrderIsUnknown(){ + return withDisplayOrder(Operator.IS_NULL); + } + + public OrderStatusRequest withDisplayOrderIsKnown(){ + return withDisplayOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.DISPLAY_ORDER_PROPERTY, operator, values); + } + + public OrderStatusRequest withDisplayOrderIs(BigDecimal displayOrder){ + return withDisplayOrder(Operator.EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderIsNot(BigDecimal displayOrder){ + return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.IN, (Object[])displayOrder); + } + + public OrderStatusRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); + } + public OrderStatusRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN, displayOrder); + } + + public OrderStatusRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderLessThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN, displayOrder); + } + + public OrderStatusRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); + } + + public OrderStatusRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ + return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); + } + + + + public OrderStatusRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderStatusRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderStatusRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderStatusRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderStatus.VERSION_PROPERTY, operator, values); + } + + public OrderStatusRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderStatusRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderStatusRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderStatusRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderStatusRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderStatusRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderStatusRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderStatusRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderStatusRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public OrderStatusRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY)); + } + + public OrderStatusRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY))); + } + + public OrderStatusRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public OrderStatusRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public OrderStatusRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderStatusRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderStatusRequest minDisplayOrder(){ + return minDisplayOrderAs(prefix("minOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest minDisplayOrderAs(String retName){ + super.min(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest maxDisplayOrder(){ + return maxDisplayOrderAs(prefix("maxOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest maxDisplayOrderAs(String retName){ + super.max(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest sumDisplayOrder(){ + return sumDisplayOrderAs(prefix("sumOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest sumDisplayOrderAs(String retName){ + super.sum(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest avgDisplayOrder(){ + return avgDisplayOrderAs(prefix("avgOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest avgDisplayOrderAs(String retName){ + super.avg(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest standardDeviationDisplayOrder(){ + return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest standardDeviationDisplayOrderAs(String retName){ + super.standardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ + return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest sampleVarianceDisplayOrder(){ + return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest sampleVarianceDisplayOrderAs(String retName){ + super.sampleVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest samplePopulationVarianceDisplayOrder(){ + return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); + } + + public OrderStatusRequest samplePopulationVarianceDisplayOrderAs(String retName){ + super.samplePopulationVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public OrderStatusRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(OrderStatus.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + public OrderStatusRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public OrderStatusRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.PLATFORM_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderStatusRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.ID_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderStatusRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public OrderStatusRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctColor(){ + return countDistinctColorAs("color_distinct_count"); + } + + public OrderStatusRequest countDistinctColorAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public OrderStatusRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + public OrderStatusRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderStatusRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderStatus.VERSION_PROPERTY); + return this; + } + public OrderStatusRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public OrderStatusRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(OrderStatus.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public OrderStatusRequest groupByPlatform(){ + groupBy(OrderStatus.PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest groupByPlatformAs(String retName){ + groupBy(retName, OrderStatus.PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.PLATFORM_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupById(){ + groupBy(OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest groupByIdAs(String retName){ + groupBy(retName, OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.ID_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByName(){ + groupBy(OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest groupByNameAs(String retName){ + groupBy(retName, OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.NAME_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByCode(){ + groupBy(OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest groupByCodeAs(String retName){ + groupBy(retName, OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest groupByCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.CODE_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByColor(){ + groupBy(OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest groupByColorAs(String retName){ + groupBy(retName, OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest groupByColorWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.COLOR_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByDisplayOrder(){ + groupBy(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest groupByDisplayOrderAs(String retName){ + groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY, function); + return this; + } + + public OrderStatusRequest groupByVersion(){ + groupBy(OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest groupByVersionAs(String retName){ + groupBy(retName, OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderStatus.VERSION_PROPERTY, function); + return this; + } + + + + public OrderStatusRequest orderByPlatformAscending(){ + addOrderByAscending(OrderStatus.PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest orderByPlatformDescending(){ + addOrderByDescending(OrderStatus.PLATFORM_PROPERTY); + return this; + } + + public OrderStatusRequest orderByIdAscending(){ + addOrderByAscending(OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest orderByIdDescending(){ + addOrderByDescending(OrderStatus.ID_PROPERTY); + return this; + } + + public OrderStatusRequest orderByNameAscending(){ + addOrderByAscending(OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest orderByNameDescending(){ + addOrderByDescending(OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderStatus.NAME_PROPERTY); + return this; + } + + public OrderStatusRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderStatus.NAME_PROPERTY); + return this; + } + public OrderStatusRequest orderByCodeAscending(){ + addOrderByAscending(OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest orderByCodeDescending(){ + addOrderByDescending(OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest orderByCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderStatus.CODE_PROPERTY); + return this; + } + + public OrderStatusRequest orderByCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderStatus.CODE_PROPERTY); + return this; + } + public OrderStatusRequest orderByColorAscending(){ + addOrderByAscending(OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest orderByColorDescending(){ + addOrderByDescending(OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest orderByColorAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderStatus.COLOR_PROPERTY); + return this; + } + + public OrderStatusRequest orderByColorDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderStatus.COLOR_PROPERTY); + return this; + } + public OrderStatusRequest orderByDisplayOrderAscending(){ + addOrderByAscending(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest orderByDisplayOrderDescending(){ + addOrderByDescending(OrderStatus.DISPLAY_ORDER_PROPERTY); + return this; + } + + public OrderStatusRequest orderByVersionAscending(){ + addOrderByAscending(OrderStatus.VERSION_PROPERTY); + return this; + } + + public OrderStatusRequest orderByVersionDescending(){ + addOrderByDescending(OrderStatus.VERSION_PROPERTY); + return this; + } + + + public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + + public OrderStatusRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.STATUS_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest minTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name){ + return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest maxTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name){ + return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest sumTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name){ + return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest avgTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name){ + return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ + return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ + return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ + addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), + CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ + return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); + } + + public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, + CustomerOrder.TOTAL_AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public OrderStatusRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public OrderStatusRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, OrderStatus.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, OrderStatus.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderStatusRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderStatusRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderStatusRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderStatusRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderStatusRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderStatusRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java new file mode 100644 index 000000000..41af7d99f --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java @@ -0,0 +1,152 @@ + +package com.example.requesttreeorderservice.platform; + +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5fc644cb1f2eea3001a51825735535d27d0cefa47fe9e256c92d24309fc93c0f"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_status_list", "customer_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String ORDER_STATUS_LIST_PROPERTY = "order_status_list"; + public static final String CUSTOMER_LIST_PROPERTY = "customer_list"; + private String name; + + private SmartList orderStatusList; + private SmartList customerList; + + public String getName(){ + return this.name; + } + + public SmartList getOrderStatusList(){ + return this.orderStatusList == null ? SmartList.unloaded() : this.orderStatusList; + } + public SmartList getCustomerList(){ + return this.customerList == null ? SmartList.unloaded() : this.customerList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addOrderStatus(OrderStatus orderStatus){ + if (orderStatus == null){ + return this; + } + + if(null == this.orderStatusList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderStatusList = teaqlUnloadedItems.map(value -> value); + } + + this.orderStatusList.add(orderStatus); + orderStatus.updatePlatform(this); + return this; + } + public Platform addCustomer(Customer customer){ + if (customer == null){ + return this; + } + + if(null == this.customerList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerList = teaqlUnloadedItems.map(value -> value); + } + + this.customerList.add(customer); + customer.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "order_status_list": this.orderStatusList = (SmartList) value; break; + case "customer_list": this.customerList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "order_status_list": return this.orderStatusList; + case "customer_list": return this.customerList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java new file mode 100644 index 000000000..21ff31db5 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java @@ -0,0 +1,58 @@ + +package com.example.requesttreeorderservice.platform; + +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerChecker; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getOrderStatusList() != null && i < platform.getOrderStatusList().size(); i++){ + OrderStatus orderStatus = platform.getOrderStatusList().get(i); + new OrderStatusChecker().checkAndFix(_context, orderStatus, newLocation(_parentLocation, "order_status_list", i)); + } + for(int i = 0; platform.getCustomerList() != null && i < platform.getCustomerList().size(); i++){ + Customer customer = platform.getCustomerList().get(i); + new CustomerChecker().checkAndFix(_context, customer, newLocation(_parentLocation, "customer_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java new file mode 100644 index 000000000..7f1880f43 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java @@ -0,0 +1,59 @@ + +package com.example.requesttreeorderservice.platform; + +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerListExpression; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public OrderStatusListExpression getOrderStatusList(){ + return new OrderStatusListExpression(loaded("order_status_list", "getOrderStatusList", Platform::getOrderStatusList)); + } + public CustomerListExpression getCustomerList(){ + return new CustomerListExpression(loaded("customer_list", "getCustomerList", Platform::getCustomerList)); + } + public PlatformExpression addOrderStatus(OrderStatus orderStatus){ + return new PlatformExpression(this, $it -> ((Platform)$it).addOrderStatus(orderStatus)); + } + public PlatformExpression addCustomer(Customer customer){ + return new PlatformExpression(this, $it -> ((Platform)$it).addCustomer(customer)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..67a967af2 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.requesttreeorderservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java new file mode 100644 index 000000000..e2b4cae1f --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java @@ -0,0 +1,835 @@ + +package com.example.requesttreeorderservice.platform; + +import com.example.requesttreeorderservice.Q; +import com.example.requesttreeorderservice.customer.Customer; +import com.example.requesttreeorderservice.customer.CustomerRequest; +import com.example.requesttreeorderservice.orderstatus.OrderStatus; +import com.example.requesttreeorderservice.orderstatus.OrderStatusRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectOrderStatusList().selectCustomerList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectOrderStatusList(){ + return selectOrderStatusListWith(Q.orderStatuses().selectSelf()); + } + + public PlatformRequest selectOrderStatusListWith(OrderStatusRequest orderStatusList){ + enhanceRelation(Platform.ORDER_STATUS_LIST_PROPERTY, orderStatusList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderStatusListWith", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectCustomerList(){ + return selectCustomerListWith(Q.customers().selectSelf()); + } + + public PlatformRequest selectCustomerListWith(CustomerRequest customerList){ + enhanceRelation(Platform.CUSTOMER_LIST_PROPERTY, customerList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerListWith", null, Platform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, orderStatusRequest, OrderStatus.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, orderStatusRequest, OrderStatus.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveOrderStatuses(){ + return withOrderStatusListMatching(Q.orderStatuses().unlimited()); + } + + public PlatformRequest haveNoOrderStatuses(){ + return withoutOrderStatusListMatching(Q.orderStatuses().unlimited()); + } + public PlatformRequest withCustomerListMatching(CustomerRequest customerRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerRequest, Customer.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutCustomerListMatching(CustomerRequest customerRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerRequest, Customer.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveCustomers(){ + return withCustomerListMatching(Q.customers().unlimited()); + } + + public PlatformRequest haveNoCustomers(){ + return withoutCustomerListMatching(Q.customers().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByOrderStatusesWithDetails(OrderStatusRequest subRequest){ + aggregate(Platform.ORDER_STATUS_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupByCustomersWithDetails(CustomerRequest subRequest){ + aggregate(Platform.CUSTOMER_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest){ + return statsFromOrderStatusesAs(name, subRequest, false); + } + + public PlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromOrderStatuses(OrderStatusRequest subRequest){ + return statsFromOrderStatusesAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest){ + return statsFromCustomersAs(name, subRequest, false); + } + + public PlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Customer.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomersAs", name, Platform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromCustomers(CustomerRequest subRequest){ + return statsFromCustomersAs(REFINEMENTS, subRequest); + } + public PlatformRequest countOrderStatuses(){ + addRelationCount("Count", Q.orderStatuses().unlimited(), OrderStatus.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countOrderStatusesAs(String name){ + addRelationCount(name, Q.orderStatuses().unlimited(), OrderStatus.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countOrderStatusesWith(String name, OrderStatusRequest subRequest){ + addRelationCount(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesWith", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest countCustomers(){ + addRelationCount("Count", Q.customers().unlimited(), Customer.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomers", null, Platform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countCustomersAs(String name){ + addRelationCount(name, Q.customers().unlimited(), Customer.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersAs", name, Platform.CUSTOMER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countCustomersWith(String name, CustomerRequest subRequest){ + addRelationCount(name, subRequest, Customer.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersWith", name, Platform.CUSTOMER_LIST_PROPERTY)); + return this; + } + public PlatformRequest minDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("minDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minDisplayOrderOfOrderStatusesAs(String name){ + return minDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest minDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("maxDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxDisplayOrderOfOrderStatusesAs(String name){ + return maxDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest maxDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("sumDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumDisplayOrderOfOrderStatusesAs(String name){ + return sumDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest sumDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("avgDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgDisplayOrderOfOrderStatusesAs(String name){ + return avgDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest avgDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("stdDevDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name){ + return standardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("stdDevPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name){ + return squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("varSampDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name){ + return sampleVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatuses(){ + addRelationScalarAggregate("varPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), + OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name){ + return samplePopulationVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, + OrderStatus.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java b/examples/standard-order/java-lib-core/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/standard-order/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/standard-order/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..492cc4412 --- /dev/null +++ b/examples/standard-order/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.requesttreeorderservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/teaql/checker-model.json b/examples/standard-order/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..471ca90fe --- /dev/null +++ b/examples/standard-order/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:dd69b1927859f89b828bf1e7fb802e68157655ac0eca216e5aee11f0e8667aa8","entities":{"Customer":{"labels":{"en":"Customer"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Commerce Platform"},"aliases":["Platform"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerOrder":{"labels":{"en":"Customer Order"},"fields":[{"name":"customer","targetType":"Customer","labels":{"en":"Customer"},"aliases":["Customer"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_date","labels":{"en":"order date"},"aliases":["OrderDate","orderDate"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"Order Item"},"aliases":["OrderItemList","orderItemList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"status","targetType":"OrderStatus","labels":{"en":"Order Status"},"aliases":["Status"]},{"name":"total_amount","labels":{"en":"total amount"},"aliases":["TotalAmount","totalAmount"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderItem":{"labels":{"en":"Order Item"},"fields":[{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"product_name","labels":{"en":"product name"},"aliases":["ProductName","productName"]},{"name":"quantity","labels":{"en":"quantity"},"aliases":["Quantity"]},{"name":"unit_price","labels":{"en":"unit price"},"aliases":["UnitPrice","unitPrice"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderStatus":{"labels":{"en":"Order Status"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"color","labels":{"en":"color"},"aliases":["Color"]},{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Commerce Platform"},"aliases":["Platform"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Commerce Platform"},"fields":[{"name":"customer_list","targetType":"Customer","labels":{"en":"Customer"},"aliases":["CustomerList","customerList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"order_status_list","targetType":"OrderStatus","labels":{"en":"Order Status"},"aliases":["OrderStatusList","orderStatusList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/standard-order/java-lib-core/teaql/model-provenance.json b/examples/standard-order/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..1588569fb --- /dev/null +++ b/examples/standard-order/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:025b6a6041897fcd0b70148e2cfb0bb5b472ea343ce9402306d3920ad3d02eb2","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/standard-order/pom.xml b/examples/standard-order/pom.xml deleted file mode 100644 index ef492e2df..000000000 --- a/examples/standard-order/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - io.teaqlteaql-java-parent - 6.3.0../../pom.xml - teaql-standard-order-example - 21 - - com.examplerequest-tree-order-service-core0.0.1-SNAPSHOT - io.teaqlteaql-runtime - io.teaqlteaql-sqlite - io.teaqlteaql-provider-jdbc - io.teaqlteaql-query-json - io.teaqlteaql-opentelemetry${project.version}test - junitjunittest - - org.apache.maven.pluginsmaven-surefire-plugin3.2.5 - diff --git a/examples/standard-order/showcase.json b/examples/standard-order/showcase.json new file mode 100644 index 000000000..9a67222a5 --- /dev/null +++ b/examples/standard-order/showcase.json @@ -0,0 +1,41 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/standard-order", + "library": { + "generatedFilesManifestSHA256": "1a5ac81b038fda6a19d5fa2d325a316728a6a82cc8bc4de779401baf01b8b64d", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "models/model.xml", + "sha256": "455a5b60e571859a68586678da4bd8c9f13120132dc7ecf95f0554d98af6d674" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/standard-order-query-grouping-generation/receipt.json", + "receiptSHA256": "665a03b7607ee266dfec9115b89316cb808a336d997171590b061362497fcce3" + }, + "scene": "Operations queue: order list, item preview, status facet, audited save and streaming", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/standard-order/verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java", + "src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java" + ], + "generatedFilesManifestSHA256": "0f6b10bd4045061b0caf8f1434c305b3bac40e34cfb7a93463242c99a85b87cd", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/standard-order/verify.sh b/examples/standard-order/verify.sh index 20f985693..b1469c49c 100644 --- a/examples/standard-order/verify.sh +++ b/examples/standard-order/verify.sh @@ -2,15 +2,32 @@ set -euo pipefail example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" repo="$(cd "$example/../.." && pwd)" -evidence="$(mktemp -d /tmp/teaql-java-standard-order-evidence-XXXXXX)" +evidence="${TEAQL_JAVA_STANDARD_ORDER_EVIDENCE_DIR:-}" +if [[ -n "$evidence" ]]; then + mkdir "$evidence" +else + evidence="$(mktemp -d -t teaql-java-standard-order-evidence.XXXXXXXX)" +fi +mode="${1:-}" +rounds=(first second) +if [[ "$mode" == --capture ]]; then + [[ "${TEAQL_TELEMETRY_ENABLED:-}" == true ]] + [[ "${TEAQL_TELEMETRY_OTLP_ENDPOINT:-}" =~ ^http://127\.0\.0\.1:[0-9]+$ ]] + rounds=(enabled) +else + [[ -z "$mode" ]] + unset TEAQL_TELEMETRY_ENABLED TEAQL_TELEMETRY_SERVICE_NAME TEAQL_TELEMETRY_OTLP_ENDPOINT +fi hash_library() { - (cd "$example" && find generated/lib -type f ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) + (cd "$example" && find java-lib-core java-app-console/lib -type f \ + ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) } hash_library > "$evidence/generated-before.sha256" -for round in first second; do - timeout --kill-after=10s 180s env -u TEAQL_TELEMETRY_ENABLED -u TEAQL_TELEMETRY_SERVICE_NAME \ - -u TEAQL_TELEMETRY_OTLP_ENDPOINT mvn -q -f "$repo/pom.xml" -Pruntime-examples \ - -pl examples/standard-order -am -Dtest=StandardOrderTelemetryTest,StandardOrderGraphStreamTelemetryTest \ +for round in "${rounds[@]}"; do + mkdir "$evidence/$round" + TEAQL_JAVA_STANDARD_ORDER_DATABASE_DIR="$evidence/$round" \ + timeout --kill-after=10s 180s mvn -q -f "$repo/pom.xml" -Pruntime-examples \ + -pl examples/standard-order/java-app-console -am -Dtest=StandardOrderTelemetryTest,StandardOrderGraphStreamTelemetryTest \ -Dsurefire.failIfNoSpecifiedTests=false test 2>&1 | tee "$evidence/$round.log" rg -Fq 'JAVA_STANDARD_ORDER PASSED' "$evidence/$round.log" rg -Fq 'JAVA_STANDARD_GRAPH PASSED' "$evidence/$round.log" @@ -18,6 +35,12 @@ for round in first second; do for name in TEAQL_TELEMETRY_ENABLED TEAQL_TELEMETRY_SERVICE_NAME TEAQL_TELEMETRY_OTLP_ENDPOINT; do rg -Fq "$name" "$evidence/$round.log" done + if [[ "$round" == enabled ]]; then + rg -Fq 'TeaQL telemetry: enabled; full recording' "$evidence/$round.log" + else + rg -Fq 'TeaQL telemetry: supported, disabled' "$evidence/$round.log" + fi + cp "$example/java-app-console/target/surefire-reports"/TEST-*StandardOrder*Test.xml "$evidence/$round" done hash_library > "$evidence/generated-after.sha256" cmp "$evidence/generated-before.sha256" "$evidence/generated-after.sha256" diff --git a/pom.xml b/pom.xml index fb1cf9be4..d78805f3d 100644 --- a/pom.xml +++ b/pom.xml @@ -377,8 +377,8 @@ examples/school-management/java-app-console examples/trace-chain/lib examples/trace-chain - examples/standard-order/generated/lib - examples/standard-order + examples/standard-order/java-lib-core/lib + examples/standard-order/java-app-console From 8499d407ef88c0f3040fc61aa49dc83a2e26de5d Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 15:50:40 +0800 Subject: [PATCH 31/71] Keep the standard order workspace aligned with the local Maven reactor version --- examples/standard-order/java-app-console/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/standard-order/java-app-console/pom.xml b/examples/standard-order/java-app-console/pom.xml index b32a6173c..1a628fa14 100644 --- a/examples/standard-order/java-app-console/pom.xml +++ b/examples/standard-order/java-app-console/pom.xml @@ -11,9 +11,7 @@ ../../../pom.xml - com.example - request-tree-order-service - 0.0.1-SNAPSHOT + teaql-standard-order-example jar From 51c554c81bf1d66d2133e90bb2c53de2e6ac36cf Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 15:51:47 +0800 Subject: [PATCH 32/71] Record focused java examples/standard-order business qualification --- examples/standard-order/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/standard-order/showcase.json b/examples/standard-order/showcase.json index 9a67222a5..e8ef87f95 100644 --- a/examples/standard-order/showcase.json +++ b/examples/standard-order/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/standard-order-query-grouping-generation/receipt.json", "receiptSHA256": "665a03b7607ee266dfec9115b89316cb808a336d997171590b061362497fcce3" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-standard-order-reactor-version/runtime/standard-order/receipt.json", + "businessReceiptSHA256": "8af45716110d4f2c933283e2beb385102639bd6975fec8c9b9f0ba8ec9903ed8", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-standard-order-reactor-version/receipt.json", + "nativeReceiptSHA256": "34a5cb4e5f91fc6678637dcb0cfb25ec9037224fc6d2f8b26e692e25c2b2e424", + "remainingFullRuntimeInventory": true, + "sourceCommit": "8499d407ef88c0f3040fc61aa49dc83a2e26de5d" + }, "scene": "Operations queue: order list, item preview, status facet, audited save and streaming", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/standard-order/verify.sh" From b23be96f9170a22b874be81762b5f53165019080 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 15:58:09 +0800 Subject: [PATCH 33/71] Document the current local wire and business verification for the order workspace --- examples/standard-order/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/standard-order/README.md b/examples/standard-order/README.md index 4ee2052c1..1408c50b5 100644 --- a/examples/standard-order/README.md +++ b/examples/standard-order/README.md @@ -38,8 +38,8 @@ TEAQL_TELEMETRY_OTLP_ENDPOINT=http://127.0.0.1:4318 \ -Dtest=StandardOrderTelemetryTest -Dsurefire.failIfNoSpecifiedTests=false test ``` -Ordinary SQL logs are disabled in the example. The checked model marks order -numbers and customer names for masking; telemetry must still export safe -expanded SQL. Conformance's `telemetry/capture-java-standard-order.cjs` checks -actual backend delivery and parentage. A successful application run alone does -not establish that all SQL diagnostics reached the collector. +Ordinary SQL logs are disabled. The model marks order numbers and customer +names for masking. The conformance `standard-order` gate runs this workspace +against a task-owned loopback OTLP receiver and checks the exported SQL, +parentage and metrics. It also compares all three business cases with the +SQLite data retained from each run. From 578582e2d917c26a5894cbb4675962caf35641f5 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 16:00:20 +0800 Subject: [PATCH 34/71] Retain standard order receipts with the canonical Java example inventory --- scripts/verify-examples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 1b3258f92..2c0b35af6 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -50,7 +50,7 @@ mvn -q -f examples/school-management/java-app-console/pom.xml spring-boot:run \ TEAQL_ORDER_EVIDENCE_DIR="$evidence_dir/order-management" bash examples/order-management/verify.sh bash examples/trace-chain/verify.sh bash examples/trace-chain/verify-standard-telemetry.sh -bash examples/standard-order/verify.sh +TEAQL_JAVA_STANDARD_ORDER_EVIDENCE_DIR="$verification_dir/standard-order" bash examples/standard-order/verify.sh TEAQL_CODEGEN_DIR="$build_dir/generator" bash examples/shared-load-state/verify.sh --generate TEAQL_JAVA_EXACT_EVIDENCE_DIR="$evidence_dir/exact-decimal" \ bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/exact-decimal/verify.sh" From 26f81f6f66c19ad0772dd3c65d5cc1f861239fc5 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 16:15:17 +0800 Subject: [PATCH 35/71] Run precise settlement quotes in the generated Java workspace --- examples/exact-decimal/README.md | 25 +- .../exact-decimal/generated-scope-hashes.json | 68 ++ .../exact-decimal/java-app-console/.gitignore | 53 ++ .../exact-decimal/java-app-console/AGENTS.md | 66 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../exact-decimal/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 +++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../example/exactdecimalservice/Checkers.java | 0 .../exactdecimalservice/Constants.java | 9 + .../com/example/exactdecimalservice/E.java | 18 + .../EntityMetaRegistry.java | 300 ++++++ .../ExactDecimalServiceUserContext.java | 10 + .../GeneratedRuntimeModule.java | 37 + .../com/example/exactdecimalservice/Q.java | 25 + .../exactdecimalservice/Repositories.java | 0 .../decimalentry/DecimalEntry.java | 149 +++ .../decimalentry/DecimalEntryChecker.java | 70 ++ .../decimalentry/DecimalEntryExpression.java | 61 ++ .../DecimalEntryListExpression.java | 25 + .../decimalentry/DecimalEntryRequest.java | 875 ++++++++++++++++++ .../platform/Platform.java | 130 +++ .../platform/PlatformChecker.java | 52 ++ .../platform/PlatformExpression.java | 51 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 775 ++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../exact-decimal/java-app-console/pom.xml | 98 ++ .../com/example/exactdecimalservice/App.java | 99 ++ .../CustomUserContext.java | 26 + .../GeneratedExactDecimalProbe.java | 10 +- .../GeneratedMemoryAggregateProbe.java | 0 .../GeneratedWorkspaceStartupProbe.java | 0 .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 106 +++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../exact-decimal/java-lib-core/lib/pom.xml | 142 +++ .../BaseServiceConfiguration.java | 0 .../example/exactdecimalservice/Checkers.java | 0 .../exactdecimalservice/Constants.java | 9 + .../com/example/exactdecimalservice/E.java | 18 + .../EntityMetaRegistry.java | 300 ++++++ .../ExactDecimalServiceUserContext.java | 10 + .../GeneratedRuntimeModule.java | 37 + .../com/example/exactdecimalservice/Q.java | 25 + .../exactdecimalservice/Repositories.java | 0 .../decimalentry/DecimalEntry.java | 149 +++ .../decimalentry/DecimalEntryChecker.java | 70 ++ .../decimalentry/DecimalEntryExpression.java | 61 ++ .../DecimalEntryListExpression.java | 25 + .../decimalentry/DecimalEntryRequest.java | 875 ++++++++++++++++++ .../platform/Platform.java | 130 +++ .../platform/PlatformChecker.java | 52 ++ .../platform/PlatformExpression.java | 51 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 775 ++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/exact-decimal/model.xml | 4 +- examples/exact-decimal/showcase.json | 41 + examples/exact-decimal/verify-local.cjs | 56 +- 70 files changed, 6453 insertions(+), 50 deletions(-) create mode 100644 examples/exact-decimal/generated-scope-hashes.json create mode 100644 examples/exact-decimal/java-app-console/.gitignore create mode 100644 examples/exact-decimal/java-app-console/AGENTS.md create mode 100644 examples/exact-decimal/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/exact-decimal/java-app-console/Makefile create mode 100644 examples/exact-decimal/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/exact-decimal/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/exact-decimal/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/exact-decimal/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/exact-decimal/java-app-console/lib/pom.xml create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Checkers.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Repositories.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java create mode 100644 examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/exact-decimal/java-app-console/pom.xml create mode 100644 examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/App.java create mode 100644 examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/CustomUserContext.java rename examples/exact-decimal/{ => java-app-console/src/main/java/com/example/exactdecimalservice}/GeneratedExactDecimalProbe.java (95%) rename examples/exact-decimal/{ => java-app-console/src/main/java/com/example/exactdecimalservice}/GeneratedMemoryAggregateProbe.java (100%) rename examples/exact-decimal/{ => java-app-console/src/main/java/com/example/exactdecimalservice}/GeneratedWorkspaceStartupProbe.java (100%) create mode 100644 examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/exact-decimal/java-app-console/src/main/resources/application.properties create mode 100644 examples/exact-decimal/java-app-console/teaql-i18n.json create mode 100644 examples/exact-decimal/java-app-console/teaql/checker-model.json create mode 100644 examples/exact-decimal/java-app-console/teaql/model-provenance.json create mode 100644 examples/exact-decimal/java-lib-core/lib/pom.xml create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Checkers.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Constants.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/E.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Q.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Repositories.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java create mode 100644 examples/exact-decimal/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/exact-decimal/java-lib-core/teaql/checker-model.json create mode 100644 examples/exact-decimal/java-lib-core/teaql/model-provenance.json create mode 100644 examples/exact-decimal/showcase.json diff --git a/examples/exact-decimal/README.md b/examples/exact-decimal/README.md index b2024bf91..ed5a6b6d6 100644 --- a/examples/exact-decimal/README.md +++ b/examples/exact-decimal/README.md @@ -1,17 +1,17 @@ -# Generated Java/SQLite exact Decimal example +# Exact settlement quotes -This is a small, generation-dependent runtime example. It uses two entities, -one modeled `number()` field, a local generator checkout and this local Java -runtime checkout. No generated domain source is edited. +The settlement desk quotes wharf and customs fees, recalculates an offshore +settlement and records two rate adjustments using precise decimals. The +`java-lib-core` domain and `java-app-console` workspace are generated from +`model.xml`. Application probes live in the console workspace. ```bash -TEAQL_CODEGEN_DIR=/path/to/teaql-code-gen bash examples/exact-decimal/verify.sh +bash examples/exact-decimal/verify.sh ``` -The verifier copies both source checkouts into one owned temporary build area, -uses the validated local generator entry point, and builds the runtime, generated -library and plain console together in a Maven reactor. It never installs or -deploys TeaQL artifacts into a shared Maven cache. Both rounds use the same two +The verifier copies this source checkout into an owned temporary build area +and checks the recorded generated scopes. It builds the local runtime, generated +library and plain console together in one Maven reactor. Both rounds use the same two SQLite databases (one Q/E probe database and one console startup database): - Generated Q equality, strong `BigDecimal` hydration and E evaluation. @@ -23,10 +23,9 @@ SQLite databases (one Q/E probe database and one console startup database): - The actual generated plain Java/JDBC console startup, including repeated `ensureSchema` against one workspace database. -It also verifies that the generated library hash does not change while the -application code is compiled and executed. Three packaged runtime class hashes -must match the classes built from the paired checkout, excluding accidental -reuse of a cached published version. The Q/E probe retains exactly five rows +It also verifies the generated library hashes before and after execution. Five +packaged runtime class hashes must match classes built from the paired checkout. +The Q/E probe retains exactly five quotes across both rounds. Every run retains its logs, source identities, generated file hashes and small databases under the printed evidence directory; disposable compilers, source copies and JARs are removed even on failure. Set diff --git a/examples/exact-decimal/generated-scope-hashes.json b/examples/exact-decimal/generated-scope-hashes.json new file mode 100644 index 000000000..c20186115 --- /dev/null +++ b/examples/exact-decimal/generated-scope-hashes.json @@ -0,0 +1,68 @@ +{ + "java-app-console": { + ".gitignore": "feaae8bdd78d514fe53fecdeef1b652686b73a1b2c5f25db3e31cc5f23d54f3c", + "AGENTS.md": "6823096349241534e4da8860d8fa686e31e8e71cd2033cd6d69dbf5bd0affa0b", + "DOMAIN_API_GUIDE.md": "3621bc4f8912da6e8b08c9f2b405bbeb57fbd23bc78d7b4a727bc56ea726b418", + "Makefile": "867b2c342b12221d1a2acecbaa3bd83733c576e3cc92709816e1ce4980bacd6c", + "RUNTIME_CUSTOM_GUIDE.md": "b96037f5cdb0fd702e0e5ccccf11145ec35dca997657bc4d24c079145183ab4c", + "STANDARD_TELEMETRY.md": "d7f6bc9832a04d5ca8f98daa845b126f970f9a82d891d54d61c0aed9b6dde4ec", + "TOOL_API_GUIDE.md": "e4b75daf38b9923de797f051a52fa6cc6b181690730f2d115cadc635b9b69521", + "docs/teaql-java-crud-guide.md": "eb4fb3d8705cc643a73180ed6b9e34264a340d17bc69d178664b40bb1bf4b972", + "lib/pom.xml": "6b5f4b250d2a12d0ae71be5cf55f04a65523cc7d4c92d51100f1b221c2c96d1b", + "lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/exactdecimalservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/exactdecimalservice/Constants.java": "c259cd70ce161b59baf9a1dcb710bbad6560f2fb38c05014d673797193de13e9", + "lib/src/main/java/com/example/exactdecimalservice/E.java": "0b0a3c69cb607ac419b1db1ff51f0cb38d5cb28bca7b3b9951d21a713176929d", + "lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java": "9f5b841cd4257496fcf9eba44bcc8cde2762e54f5a71e9bffce4150fad017547", + "lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java": "95a9d352dc588670d3170771112e9794c20a53e741d2c9f2532a768c16f20f0a", + "lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java": "ac451043d78c4cca36f6990a74dc0120fb46ad838f69428963ff72b03387a295", + "lib/src/main/java/com/example/exactdecimalservice/Q.java": "84f7f4a6cf2d6d2b62a86dd63797f10987a2c504e7e913ddf0cb13bd1847061f", + "lib/src/main/java/com/example/exactdecimalservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java": "de8c576c8deaea43ae6a149f692bb2d678be338e61c80c56b4f6526697020221", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java": "1fd47402cb73bc7832beb764486e6e1149360eeb3fd20cd6b05338d563664e8a", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java": "34542589e624f868f78fafde0743d9004b0c4ab7624d0ca46ae67dcb64d6954a", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java": "0102304602ebc071413c7a99735698fd80b235ced4172d9bb85885ee7b384a0f", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java": "ae1ae8e94aabf69b478e0cb7cef98603f0edafd2d3a750a4c0aea7e619d0cbfc", + "lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java": "7ee8eca4957facd27fb4926a320ba8053fdedd938155765336eb04b245b68378", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java": "b2ce2df36468b2494c05ccc2c70958d123b6cfa924571a3f8acc1d75bb5a2dfa", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java": "346ee5991877f8e62cb68b8b1798e73ddcd92c9600509b0fbafd4fd5f2470d63", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java": "a21a49bcf8f7d4eab588e41233d741db5a72eb98bb22c10ab4f640d48cc60138", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java": "384445407d7a9747341f2a7b6517af937c9b2dc925860b1ff16488c281e66b29", + "lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "bb7f36a66ca5878b8b3972e097a4ce170717b5ec9d9b331cdf623284b01e6f7a", + "pom.xml": "f8b53360f42089a5b2a55ac1437c382611d951e2c46027a1d7ad3460e02d44b2", + "src/main/java/com/example/exactdecimalservice/App.java": "aa0e8eec2d216ecec1b63ec6c2b30d73b5659f9acadcc9e87f551aff5b5e3fe1", + "src/main/java/com/example/exactdecimalservice/CustomUserContext.java": "d251bbf8ccc2b875f216d6d3a8ee3fc8924220ee10349cc7f156640a8224b777", + "src/main/java/com/example/exactdecimalservice/WorkspaceTeaQLDatabase.java": "e3e18e7a8626daf4568a30e0ef561284ae426f24a39f97925892cd5470ebad67", + "src/main/resources/application.properties": "75917c5657b6f72dfad852349108ade9fb98189aaa546ffff1848e826d806b42", + "teaql-i18n.json": "58a727df7df3f9067320b23ed6d253214de5aee59e5d992773a5626d5593e284", + "teaql/checker-model.json": "029a899abd5ace355234eb4947820b9fe3af95b2d3c1628416224e7e29109f6f", + "teaql/model-provenance.json": "b23a2327388871fc63b01843de73227a5a438de14de6670adba29ebc2d730124" + }, + "java-lib-core": { + "lib/pom.xml": "c14f1bab27d7eecb900f9a099102745fd8c3ba5f6584cc13a72cb40ff42c958d", + "lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/exactdecimalservice/Checkers.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/exactdecimalservice/Constants.java": "c259cd70ce161b59baf9a1dcb710bbad6560f2fb38c05014d673797193de13e9", + "lib/src/main/java/com/example/exactdecimalservice/E.java": "0b0a3c69cb607ac419b1db1ff51f0cb38d5cb28bca7b3b9951d21a713176929d", + "lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java": "9f5b841cd4257496fcf9eba44bcc8cde2762e54f5a71e9bffce4150fad017547", + "lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java": "95a9d352dc588670d3170771112e9794c20a53e741d2c9f2532a768c16f20f0a", + "lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java": "ac451043d78c4cca36f6990a74dc0120fb46ad838f69428963ff72b03387a295", + "lib/src/main/java/com/example/exactdecimalservice/Q.java": "84f7f4a6cf2d6d2b62a86dd63797f10987a2c504e7e913ddf0cb13bd1847061f", + "lib/src/main/java/com/example/exactdecimalservice/Repositories.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java": "de8c576c8deaea43ae6a149f692bb2d678be338e61c80c56b4f6526697020221", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java": "1fd47402cb73bc7832beb764486e6e1149360eeb3fd20cd6b05338d563664e8a", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java": "34542589e624f868f78fafde0743d9004b0c4ab7624d0ca46ae67dcb64d6954a", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java": "0102304602ebc071413c7a99735698fd80b235ced4172d9bb85885ee7b384a0f", + "lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java": "ae1ae8e94aabf69b478e0cb7cef98603f0edafd2d3a750a4c0aea7e619d0cbfc", + "lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java": "7ee8eca4957facd27fb4926a320ba8053fdedd938155765336eb04b245b68378", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java": "b2ce2df36468b2494c05ccc2c70958d123b6cfa924571a3f8acc1d75bb5a2dfa", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java": "346ee5991877f8e62cb68b8b1798e73ddcd92c9600509b0fbafd4fd5f2470d63", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java": "a21a49bcf8f7d4eab588e41233d741db5a72eb98bb22c10ab4f640d48cc60138", + "lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java": "384445407d7a9747341f2a7b6517af937c9b2dc925860b1ff16488c281e66b29", + "lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "bb7f36a66ca5878b8b3972e097a4ce170717b5ec9d9b331cdf623284b01e6f7a", + "teaql/checker-model.json": "029a899abd5ace355234eb4947820b9fe3af95b2d3c1628416224e7e29109f6f", + "teaql/model-provenance.json": "b23a2327388871fc63b01843de73227a5a438de14de6670adba29ebc2d730124" + } +} diff --git a/examples/exact-decimal/java-app-console/.gitignore b/examples/exact-decimal/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/exact-decimal/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/AGENTS.md b/examples/exact-decimal/java-app-console/AGENTS.md new file mode 100644 index 000000000..e5110538b --- /dev/null +++ b/examples/exact-decimal/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| decimal_entry | Settlement Quote | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/exact-decimal/java-app-console/DOMAIN_API_GUIDE.md b/examples/exact-decimal/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..85e4d80e2 --- /dev/null +++ b/examples/exact-decimal/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/exact-decimal-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| decimal_entry | Settlement Quote | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/Makefile b/examples/exact-decimal/java-app-console/Makefile new file mode 100644 index 000000000..48708e7f4 --- /dev/null +++ b/examples/exact-decimal/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/exact-decimal-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/exact-decimal-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/exact-decimal/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..994865bcd --- /dev/null +++ b/examples/exact-decimal/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/exact-decimal-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/STANDARD_TELEMETRY.md b/examples/exact-decimal/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/exact-decimal/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/exact-decimal/java-app-console/TOOL_API_GUIDE.md b/examples/exact-decimal/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..071f82858 --- /dev/null +++ b/examples/exact-decimal/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/exact-decimal-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/exact-decimal-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/exact-decimal-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/exact-decimal-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/exact-decimal-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/exact-decimal-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/docs/teaql-java-crud-guide.md b/examples/exact-decimal/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..e5c814993 --- /dev/null +++ b/examples/exact-decimal/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.exactdecimalservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.exactdecimalservice.Q; +import com.example.exactdecimalservice.ExactDecimalServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectDecimalEntryListWith(Q.decimalEntries().selectSelf()) + .comment("load with decimalEntryList") + .purpose("fetch child decimalEntryList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `1`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.example.exactdecimalservice.platform.PlatformRequest` \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/pom.xml b/examples/exact-decimal/java-app-console/lib/pom.xml new file mode 100644 index 000000000..0db98813e --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + exact-decimal-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Checkers.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java new file mode 100644 index 000000000..d17d4e4c3 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.exactdecimalservice; + +import com.example.exactdecimalservice.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java new file mode 100644 index 000000000..26ec00ba1 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java @@ -0,0 +1,18 @@ + +package com.example.exactdecimalservice; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryExpression; +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static DecimalEntryExpression decimalEntry(DecimalEntry decimalEntry){ + return new DecimalEntryExpression(new ValueExpression(decimalEntry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.decimalEntry()")); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java new file mode 100644 index 000000000..73e93117f --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java @@ -0,0 +1,300 @@ + +package com.example.exactdecimalservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerDecimalEntry(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.exactdecimalservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.exactdecimalservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.exactdecimalservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.exactdecimalservice.platform.Platform::new); + entityDescriptor.with("name", "Platform") + + .with("module", "Organization") + + .with("module_key", "organization") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Settlement Quote Ledger") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerDecimalEntry() { + FieldLayout.installGenerated(com.example.exactdecimalservice.decimalentry.DecimalEntry.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.exactdecimalservice.decimalentry.DecimalEntry.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.exactdecimalservice.decimalentry.DecimalEntry.class); + entityDescriptor.setEntitySupplier(com.example.exactdecimalservice.decimalentry.DecimalEntry::new); + entityDescriptor.with("name", "Settlement Quote") + + .with("module", "Ledger") + + .with("module_key", "ledger") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.exactdecimalservice.decimalentry.DecimalEntry.PLATFORM_PROPERTY, com.example.exactdecimalservice.platform.Platform.INTERNAL_TYPE, com.example.exactdecimalservice.platform.Platform.DECIMAL_ENTRY_LIST_PROPERTY, com.example.exactdecimalservice.platform.Platform.class) + ; + PropertyDescriptor label = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY, String.class) + ; + PropertyDescriptor amount = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java new file mode 100644 index 000000000..c399c232d --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.exactdecimalservice; + +import io.teaql.core.UserContext; +public interface ExactDecimalServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..731febe8c --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.example.exactdecimalservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.exactdecimalservice.platform.PlatformChecker(), new com.example.exactdecimalservice.decimalentry.DecimalEntryChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:91221f5024a3f4a9fb2107c03a7807ea332b6a396a608b76abb394898177c010\",\"entities\":{\"DecimalEntry\":{\"labels\":{\"en\":\"Settlement Quote\"},\"fields\":[{\"name\":\"amount\",\"labels\":{\"en\":\"amount\"},\"aliases\":[\"Amount\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"label\",\"labels\":{\"en\":\"label\"},\"aliases\":[\"Label\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"decimal_entry_list\",\"targetType\":\"DecimalEntry\",\"labels\":{\"en\":\"Settlement Quote\"},\"aliases\":[\"DecimalEntryList\",\"decimalEntryList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("DecimalEntry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("label", "label"), java.util.Map.entry("amount", "amount"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.exactdecimalservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.exactdecimalservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Settlement Quote Ledger"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java new file mode 100644 index 000000000..0bf183acf --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.exactdecimalservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.exactdecimalservice.platform.PlatformRequest platforms(){ + return new com.example.exactdecimalservice.platform.PlatformRequest(com.example.exactdecimalservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.exactdecimalservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.exactdecimalservice.platform.PlatformRequest(com.example.exactdecimalservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.exactdecimalservice.decimalentry.DecimalEntryRequest decimalEntries(){ + return new com.example.exactdecimalservice.decimalentry.DecimalEntryRequest(com.example.exactdecimalservice.decimalentry.DecimalEntry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.exactdecimalservice.decimalentry.DecimalEntryRequest decimalEntriesWithMinimalFields(){ + return new com.example.exactdecimalservice.decimalentry.DecimalEntryRequest(com.example.exactdecimalservice.decimalentry.DecimalEntry.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Repositories.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java new file mode 100644 index 000000000..43909a4f7 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java @@ -0,0 +1,149 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class DecimalEntry extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "DecimalEntry"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "46367c1f6d22180cb63ea4bcac6772b4e507f4ef69000bb272b73de3ab179c0f"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("label", 2), java.util.Map.entry("amount", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("label", java.util.List.of("label", "label")), java.util.Map.entry("amount", java.util.List.of("amount", "amount")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + DecimalEntry.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String LABEL_PROPERTY = "label"; + public static final String AMOUNT_PROPERTY = "amount"; + private Platform platform; + + private String label; + + private BigDecimal amount; + + + public Platform getPlatform(){ + return this.platform; + } + + public String getLabel(){ + return this.label; + } + + public BigDecimal getAmount(){ + return this.amount; + } + + public DecimalEntry updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public DecimalEntry updateLabel(String label){ + label = (label == null ? null : label.trim()); + if(isPropertyLoaded(LABEL_PROPERTY) && Objects.equals(this.label, label)){ + return this; + } + handleUpdate(LABEL_PROPERTY, getLabel(), label); + this.label = label; + return this; + } + + public DecimalEntry updateAmount(BigDecimal amount){ + if(isPropertyLoaded(AMOUNT_PROPERTY) && Objects.equals(this.amount, amount)){ + return this; + } + handleUpdate(AMOUNT_PROPERTY, getAmount(), amount); + this.amount = amount; + return this; + } + + + public static DecimalEntry refer(Long id){ + DecimalEntry refer = new DecimalEntry(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public DecimalEntry comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "label": this.label = (value == null ? null : ((String)value).trim()); break; + + case "amount": this.amount = (BigDecimal) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "label": return this.label; + case "amount": return this.amount; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "label": return this.label; + case "amount": return this.amount; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java new file mode 100644 index 000000000..d8d1ed9f9 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java @@ -0,0 +1,70 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class DecimalEntryChecker implements Checker{ + + public String type(){ + return DecimalEntry.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, DecimalEntry decimalEntry, ObjectLocation _parentLocation){ + if(needCheck(_context, decimalEntry)){ + markAsChecked(_context, decimalEntry); + doCheck(_context, decimalEntry, _parentLocation); + } + } + + public void doCheck(UserContext _context, DecimalEntry decimalEntry, ObjectLocation _parentLocation){ + if((decimalEntry == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, decimalEntry); + if(decimalEntry.needPersist()){ + } + if(decimalEntry.newItem()){ + }else if(decimalEntry.updateItem()){ + if(!decimalEntry.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!decimalEntry.isPropertyLoaded("label")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "label"), "Mutation requires a fully loaded entity"); + } + if(!decimalEntry.isPropertyLoaded("amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "amount"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, decimalEntry.getProperty(DecimalEntry.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkLabel(_context, decimalEntry.getProperty(DecimalEntry.LABEL_PROPERTY), newLocation(_parentLocation, "label")); + checkAmount(_context, decimalEntry.getProperty(DecimalEntry.AMOUNT_PROPERTY), newLocation(_parentLocation, "amount")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkLabel(UserContext _context, String label, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, label); + if((label == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, label); + + } + public void checkAmount(UserContext _context, BigDecimal amount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, amount); + if((amount == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java new file mode 100644 index 000000000..f82745853 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java @@ -0,0 +1,61 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class DecimalEntryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public DecimalEntryExpression(Expression expression){ + super(expression); + } + + public DecimalEntryExpression(Expression expression, Function function){ + super(expression, function); + } + + public DecimalEntryExpression updateId(Long id){ + return new DecimalEntryExpression(this, $it -> {((DecimalEntry)$it).__internalSet("id", id); return this;}); + } + + public DecimalEntryExpression save(UserContext userContext){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).auditAs("Saved by Expression").save(userContext)); + } + + public DecimalEntryExpression save(String intent, UserContext userContext){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", DecimalEntry::getPlatform)); + } + + public DecimalEntryExpression updatePlatform(Platform platform){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updatePlatform(platform)); + } + + public Expression getLabel(){ + return loaded("label", "getLabel", DecimalEntry::getLabel); + } + public DecimalEntryExpression updateLabel(String label){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updateLabel(label)); + } + + public Expression getAmount(){ + return loaded("amount", "getAmount", DecimalEntry::getAmount); + } + public DecimalEntryExpression updateAmount(BigDecimal amount){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updateAmount(amount)); + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java new file mode 100644 index 000000000..b0a309601 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.exactdecimalservice.decimalentry; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class DecimalEntryListExpression extends SmartListExpression { + public DecimalEntryListExpression(Expression> expression){ + super(expression); + } + + public DecimalEntryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public DecimalEntryExpression first() { + return new DecimalEntryExpression(super.first()); + } + + public DecimalEntryExpression get(int index) { + return new DecimalEntryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java new file mode 100644 index 000000000..ac7ccfed1 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java @@ -0,0 +1,875 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.Q; +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class DecimalEntryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public DecimalEntryRequest(Class returnType){ + this(returnType, () -> (T) new DecimalEntry()); + } + + protected DecimalEntryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public DecimalEntryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public DecimalEntryRequest copy(){ + return (DecimalEntryRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new DecimalEntryRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public DecimalEntryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public DecimalEntryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public DecimalEntryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public DecimalEntryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public DecimalEntryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public DecimalEntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public DecimalEntryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public DecimalEntryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public DecimalEntryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public DecimalEntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (DecimalEntryRequest)super.appendSearchCriteria(searchCriteria); + } + + public DecimalEntryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public DecimalEntryRequest matchingAnyOf(DecimalEntryRequest decimalEntry){ + super.internalMatchAny(decimalEntry); + return this; + } + + public DecimalEntryRequest matchingIdsOf(DecimalEntryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + DecimalEntry.ID_PROPERTY, request, DecimalEntry.ID_PROPERTY)); + } + + public DecimalEntryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public DecimalEntryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public DecimalEntryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public DecimalEntryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectLabel().selectAmount().selectVersion(); + } + + public DecimalEntryRequest selectSelfFields(){ + return selectSelf(); + } + + public DecimalEntryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(DecimalEntry.ID_PROPERTY); + selectProperty(DecimalEntry.PLATFORM_PROPERTY); + selectProperty(DecimalEntry.LABEL_PROPERTY); + selectProperty(DecimalEntry.AMOUNT_PROPERTY); + selectProperty(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectLabel().selectAmount().selectVersion(); + } + + public DecimalEntryRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectLabel().selectAmount().selectVersion(); + } + + + public DecimalEntryRequest selectId(){ + selectProperty(DecimalEntry.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public DecimalEntryRequest unselectId(){ + unselectProperty(DecimalEntry.ID_PROPERTY); + return this; + } + public DecimalEntryRequest selectPlatformIdOnly(){ + selectProperty(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public DecimalEntryRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(DecimalEntry.PLATFORM_PROPERTY); + enhanceRelation(DecimalEntry.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, DecimalEntry.PLATFORM_PROPERTY)); + return this; + } + + public DecimalEntryRequest unselectPlatform(){ + unselectProperty(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + public DecimalEntryRequest selectLabel(){ + selectProperty(DecimalEntry.LABEL_PROPERTY); + return this; + } + + /** + * fill the label with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS label) to fetch label property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public DecimalEntryRequest unselectLabel(){ + unselectProperty(DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest selectAmount(){ + selectProperty(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + /** + * fill the amount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS amount) to fetch amount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the amount with customized aggrFunction, TEAQL uses ({aggrFunction}(amount) AS amount to fetch amount property. + * @param aggrFunction aggrFunction + */ + public DecimalEntryRequest selectAmount(AggrFunction aggrFunction){ + selectProperty(DecimalEntry.AMOUNT_PROPERTY, aggrFunction); + return this; + } + + + public DecimalEntryRequest unselectAmount(){ + unselectProperty(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest selectVersion(){ + selectProperty(DecimalEntry.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public DecimalEntryRequest unselectVersion(){ + unselectProperty(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.ID_PROPERTY, operator, values); + } + + public DecimalEntryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public DecimalEntryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public DecimalEntryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public DecimalEntryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public DecimalEntryRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public DecimalEntryRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public DecimalEntryRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public DecimalEntryRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.PLATFORM_PROPERTY, operator, values); + } + + public DecimalEntryRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public DecimalEntryRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(DecimalEntry.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public DecimalEntryRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(DecimalEntry.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public DecimalEntryRequest filterByLabel(String... label){ + if (label == null || label.length == 0) { + throw new IllegalArgumentException("filterByLabel parameter label cannot be empty"); + } + return appendSearchCriteria(createLabelCriteria(Operator.EQUAL, (Object[])label)); + } + + public DecimalEntryRequest withLabel(Operator operator, Object... values){ + return appendSearchCriteria(createLabelCriteria(operator, values)); + } + + public DecimalEntryRequest withLabelIsUnknown(){ + return withLabel(Operator.IS_NULL); + } + + public DecimalEntryRequest withLabelIsKnown(){ + return withLabel(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLabelCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.LABEL_PROPERTY, operator, values); + } + + public DecimalEntryRequest withLabelIsNot(String label){ + return withLabel(Operator.NOT_EQUAL, label); + } + + public DecimalEntryRequest withLabelIn(String... label){ + return withLabel(Operator.IN, (Object[])label); + } + + public DecimalEntryRequest withLabelNotIn(String... label){ + return withLabel(Operator.NOT_IN, (Object[])label); + } + public DecimalEntryRequest withLabelGreaterThan(String label){ + return withLabel(Operator.GREATER_THAN, label); + } + + public DecimalEntryRequest withLabelGreaterThanOrEqualTo(String label){ + return withLabel(Operator.GREATER_THAN_OR_EQUAL, label); + } + + public DecimalEntryRequest withLabelLessThan(String label){ + return withLabel(Operator.LESS_THAN, label); + } + + public DecimalEntryRequest withLabelLessThanOrEqualTo(String label){ + return withLabel(Operator.LESS_THAN_OR_EQUAL, label); + } + + public DecimalEntryRequest withLabelBetween(String startOfLabel, String endOfLabel){ + return withLabel(Operator.BETWEEN, startOfLabel, endOfLabel); + } + public DecimalEntryRequest withLabelStartingWith(String label){ + return withLabel(Operator.BEGIN_WITH, label); + } + public DecimalEntryRequest withLabelContaining(String label){ + return withLabel(Operator.CONTAIN, label); + } + + public DecimalEntryRequest withLabelNotContaining(String label){ + return withLabel(Operator.NOT_CONTAIN, label); + } + + public DecimalEntryRequest withLabelNotStartingWith(String label){ + return withLabel(Operator.NOT_BEGIN_WITH, label); + } + + public DecimalEntryRequest withLabelEndingWith(String label){ + return withLabel(Operator.END_WITH, label); + } + + public DecimalEntryRequest withLabelNotEndingWith(String label){ + return withLabel(Operator.NOT_END_WITH, label); + } + + public DecimalEntryRequest withLabelIs(String label){ + return withLabel(Operator.EQUAL, label); + } + + public DecimalEntryRequest withLabelSoundingLike(String label){ + return withLabel(Operator.SOUNDS_LIKE, label); + } + + + + public DecimalEntryRequest filterByAmount(BigDecimal... amount){ + if (amount == null || amount.length == 0) { + throw new IllegalArgumentException("filterByAmount parameter amount cannot be empty"); + } + return appendSearchCriteria(createAmountCriteria(Operator.EQUAL, (Object[])amount)); + } + + public DecimalEntryRequest withAmount(Operator operator, Object... values){ + return appendSearchCriteria(createAmountCriteria(operator, values)); + } + + public DecimalEntryRequest withAmountIsUnknown(){ + return withAmount(Operator.IS_NULL); + } + + public DecimalEntryRequest withAmountIsKnown(){ + return withAmount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAmountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.AMOUNT_PROPERTY, operator, values); + } + + public DecimalEntryRequest withAmountIs(BigDecimal amount){ + return withAmount(Operator.EQUAL, amount); + } + + public DecimalEntryRequest withAmountIsNot(BigDecimal amount){ + return withAmount(Operator.NOT_EQUAL, amount); + } + + public DecimalEntryRequest withAmountIn(BigDecimal... amount){ + return withAmount(Operator.IN, (Object[])amount); + } + + public DecimalEntryRequest withAmountNotIn(BigDecimal... amount){ + return withAmount(Operator.NOT_IN, (Object[])amount); + } + public DecimalEntryRequest withAmountGreaterThan(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN, amount); + } + + public DecimalEntryRequest withAmountGreaterThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN_OR_EQUAL, amount); + } + + public DecimalEntryRequest withAmountLessThan(BigDecimal amount){ + return withAmount(Operator.LESS_THAN, amount); + } + + public DecimalEntryRequest withAmountLessThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.LESS_THAN_OR_EQUAL, amount); + } + + public DecimalEntryRequest withAmountBetween(BigDecimal startOfAmount, BigDecimal endOfAmount){ + return withAmount(Operator.BETWEEN, startOfAmount, endOfAmount); + } + + + + public DecimalEntryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public DecimalEntryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public DecimalEntryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public DecimalEntryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.VERSION_PROPERTY, operator, values); + } + + public DecimalEntryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public DecimalEntryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public DecimalEntryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public DecimalEntryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public DecimalEntryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public DecimalEntryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public DecimalEntryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public DecimalEntryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public DecimalEntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public DecimalEntryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public DecimalEntryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public DecimalEntryRequest minAmount(){ + return minAmountAs(prefix("minOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest minAmountAs(String retName){ + super.min(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest maxAmount(){ + return maxAmountAs(prefix("maxOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest maxAmountAs(String retName){ + super.max(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest sumAmount(){ + return sumAmountAs(prefix("sumOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest sumAmountAs(String retName){ + super.sum(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest avgAmount(){ + return avgAmountAs(prefix("avgOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest avgAmountAs(String retName){ + super.avg(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest standardDeviationAmount(){ + return standardDeviationAmountAs(prefix("standardDeviationOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest standardDeviationAmountAs(String retName){ + super.standardDeviation(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest squareRootOfPopulationStandardDeviationAmount(){ + return squareRootOfPopulationStandardDeviationAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest squareRootOfPopulationStandardDeviationAmountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest sampleVarianceAmount(){ + return sampleVarianceAmountAs(prefix("sampleVarianceOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest sampleVarianceAmountAs(String retName){ + super.sampleVariance(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest samplePopulationVarianceAmount(){ + return samplePopulationVarianceAmountAs(prefix("samplePopulationVarianceOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest samplePopulationVarianceAmountAs(String retName){ + super.samplePopulationVariance(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public DecimalEntryRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(DecimalEntry.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public DecimalEntryRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public DecimalEntryRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.ID_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public DecimalEntryRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.PLATFORM_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctLabel(){ + return countDistinctLabelAs("label_distinct_count"); + } + + public DecimalEntryRequest countDistinctLabelAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctAmount(){ + return countDistinctAmountAs("amount_distinct_count"); + } + + public DecimalEntryRequest countDistinctAmountAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public DecimalEntryRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest groupById(){ + groupBy(DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByIdAs(String retName){ + groupBy(retName, DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.ID_PROPERTY, function); + return this; + } + public DecimalEntryRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(DecimalEntry.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public DecimalEntryRequest groupByPlatform(){ + groupBy(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByPlatformAs(String retName){ + groupBy(retName, DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.PLATFORM_PROPERTY, function); + return this; + } + + public DecimalEntryRequest groupByLabel(){ + groupBy(DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByLabelAs(String retName){ + groupBy(retName, DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByLabelWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.LABEL_PROPERTY, function); + return this; + } + + public DecimalEntryRequest groupByAmount(){ + groupBy(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByAmountAs(String retName){ + groupBy(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByAmountWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.AMOUNT_PROPERTY, function); + return this; + } + + public DecimalEntryRequest groupByVersion(){ + groupBy(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByVersionAs(String retName){ + groupBy(retName, DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.VERSION_PROPERTY, function); + return this; + } + + + + public DecimalEntryRequest orderByIdAscending(){ + addOrderByAscending(DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByIdDescending(){ + addOrderByDescending(DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByPlatformAscending(){ + addOrderByAscending(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByPlatformDescending(){ + addOrderByDescending(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByLabelAscending(){ + addOrderByAscending(DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByLabelDescending(){ + addOrderByDescending(DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest orderByLabelAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByLabelDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest orderByAmountAscending(){ + addOrderByAscending(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByAmountDescending(){ + addOrderByDescending(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByVersionAscending(){ + addOrderByAscending(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByVersionDescending(){ + addOrderByDescending(DecimalEntry.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + public DecimalEntryRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public DecimalEntryRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, DecimalEntry.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, DecimalEntry.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public DecimalEntryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public DecimalEntryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public DecimalEntryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public DecimalEntryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public DecimalEntryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public DecimalEntryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java new file mode 100644 index 000000000..068e5825c --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "41daef4cd31b0d2446142c4e2de17ed30f1cc3fd56cbd671ec26e0bad3ef5734"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "decimal_entry_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String DECIMAL_ENTRY_LIST_PROPERTY = "decimal_entry_list"; + private String name; + + private SmartList decimalEntryList; + + public String getName(){ + return this.name; + } + + public SmartList getDecimalEntryList(){ + return this.decimalEntryList == null ? SmartList.unloaded() : this.decimalEntryList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addDecimalEntry(DecimalEntry decimalEntry){ + if (decimalEntry == null){ + return this; + } + + if(null == this.decimalEntryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.decimalEntryList = teaqlUnloadedItems.map(value -> value); + } + + this.decimalEntryList.add(decimalEntry); + decimalEntry.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "decimal_entry_list": this.decimalEntryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "decimal_entry_list": return this.decimalEntryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java new file mode 100644 index 000000000..e247d04f2 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getDecimalEntryList() != null && i < platform.getDecimalEntryList().size(); i++){ + DecimalEntry decimalEntry = platform.getDecimalEntryList().get(i); + new DecimalEntryChecker().checkAndFix(_context, decimalEntry, newLocation(_parentLocation, "decimal_entry_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java new file mode 100644 index 000000000..6a15a11bf --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public DecimalEntryListExpression getDecimalEntryList(){ + return new DecimalEntryListExpression(loaded("decimal_entry_list", "getDecimalEntryList", Platform::getDecimalEntryList)); + } + public PlatformExpression addDecimalEntry(DecimalEntry decimalEntry){ + return new PlatformExpression(this, $it -> ((Platform)$it).addDecimalEntry(decimalEntry)); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..f19338f41 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.exactdecimalservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java new file mode 100644 index 000000000..b9bf27617 --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java @@ -0,0 +1,775 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.Q; +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectDecimalEntryList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectDecimalEntryList(){ + return selectDecimalEntryListWith(Q.decimalEntries().selectSelf()); + } + + public PlatformRequest selectDecimalEntryListWith(DecimalEntryRequest decimalEntryList){ + enhanceRelation(Platform.DECIMAL_ENTRY_LIST_PROPERTY, decimalEntryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectDecimalEntryListWith", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withDecimalEntryListMatching(DecimalEntryRequest decimalEntryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, decimalEntryRequest, DecimalEntry.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutDecimalEntryListMatching(DecimalEntryRequest decimalEntryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, decimalEntryRequest, DecimalEntry.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveDecimalEntries(){ + return withDecimalEntryListMatching(Q.decimalEntries().unlimited()); + } + + public PlatformRequest haveNoDecimalEntries(){ + return withoutDecimalEntryListMatching(Q.decimalEntries().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByDecimalEntriesWithDetails(DecimalEntryRequest subRequest){ + aggregate(Platform.DECIMAL_ENTRY_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + return statsFromDecimalEntriesAs(name, subRequest, false); + } + + public PlatformRequest statsFromDecimalEntriesAs(String name, DecimalEntryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromDecimalEntries(DecimalEntryRequest subRequest){ + return statsFromDecimalEntriesAs(REFINEMENTS, subRequest); + } + public PlatformRequest countDecimalEntries(){ + addRelationCount("Count", Q.decimalEntries().unlimited(), DecimalEntry.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countDecimalEntriesAs(String name){ + addRelationCount(name, Q.decimalEntries().unlimited(), DecimalEntry.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countDecimalEntriesWith(String name, DecimalEntryRequest subRequest){ + addRelationCount(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntriesWith", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest minAmountOfDecimalEntries(){ + addRelationScalarAggregate("minAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minAmountOfDecimalEntriesAs(String name){ + return minAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest minAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxAmountOfDecimalEntries(){ + addRelationScalarAggregate("maxAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxAmountOfDecimalEntriesAs(String name){ + return maxAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest maxAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumAmountOfDecimalEntries(){ + addRelationScalarAggregate("sumAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumAmountOfDecimalEntriesAs(String name){ + return sumAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest sumAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgAmountOfDecimalEntries(){ + addRelationScalarAggregate("avgAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgAmountOfDecimalEntriesAs(String name){ + return avgAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest avgAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationAmountOfDecimalEntries(){ + addRelationScalarAggregate("stdDevAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationAmountOfDecimalEntriesAs(String name){ + return standardDeviationAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest standardDeviationAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntries(){ + addRelationScalarAggregate("stdDevPopAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(String name){ + return squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceAmountOfDecimalEntries(){ + addRelationScalarAggregate("varSampAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceAmountOfDecimalEntriesAs(String name){ + return sampleVarianceAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest sampleVarianceAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceAmountOfDecimalEntries(){ + addRelationScalarAggregate("varPopAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceAmountOfDecimalEntriesAs(String name){ + return samplePopulationVarianceAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest samplePopulationVarianceAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..905bf682c --- /dev/null +++ b/examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.exactdecimalservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/pom.xml b/examples/exact-decimal/java-app-console/pom.xml new file mode 100644 index 000000000..31e9ae3e0 --- /dev/null +++ b/examples/exact-decimal/java-app-console/pom.xml @@ -0,0 +1,98 @@ + + + + 4.0.0 + + com.example + exact-decimal-service + 0.0.1-SNAPSHOT + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.example + exact-decimal-service-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.example.exactdecimalservice.App + + + + + + + + \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/App.java b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/App.java new file mode 100644 index 000000000..dbe02df1d --- /dev/null +++ b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/App.java @@ -0,0 +1,99 @@ + +package com.example.exactdecimalservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/CustomUserContext.java b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/CustomUserContext.java new file mode 100644 index 000000000..62b18ab1a --- /dev/null +++ b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.exactdecimalservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements ExactDecimalServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/GeneratedExactDecimalProbe.java b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedExactDecimalProbe.java similarity index 95% rename from examples/exact-decimal/GeneratedExactDecimalProbe.java rename to examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedExactDecimalProbe.java index b64b08bf4..d4121ade0 100644 --- a/examples/exact-decimal/GeneratedExactDecimalProbe.java +++ b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedExactDecimalProbe.java @@ -53,8 +53,8 @@ public static void main(String[] args) throws Exception { } boolean fresh = existing.isEmpty(); if (!fresh && existing.size() != 5) throw new AssertionError("incomplete retained fixture"); - DecimalEntry first = save(source, platform, existing, "first", new BigDecimal("0.1")); - DecimalEntry second = save(source, platform, existing, "second", new BigDecimal("0.2")); + DecimalEntry first = save(source, platform, existing, "Wharf fee", new BigDecimal("0.1")); + DecimalEntry second = save(source, platform, existing, "Customs fee", new BigDecimal("0.2")); var loaded = Q.decimalEntriesWithMinimalFields() .selectLabel().selectAmount() .withAmountIs(new BigDecimal("0.1")) @@ -62,14 +62,14 @@ public static void main(String[] args) throws Exception { .comment("Read a generated exact Decimal row") .purpose("Verify Q filtering and E hydration") .executeForList(source); - if (loaded.size() != 1 || !"first".equals(E.decimalEntry(loaded.get(0)).getLabel().eval()) + if (loaded.size() != 1 || !"Wharf fee".equals(E.decimalEntry(loaded.get(0)).getLabel().eval()) || E.decimalEntry(loaded.get(0)).getAmount().eval().compareTo(new BigDecimal("0.1")) != 0) { throw new AssertionError("generated Decimal Q/E round-trip failed"); } if (sum(source, List.of(first.getId(), second.getId())).compareTo(new BigDecimal("0.3")) != 0) { throw new AssertionError("generated Decimal SUM is not exact"); } - DecimalEntry preciseEntry = save(source, platform, existing, "precise", new BigDecimal("3.50")); + DecimalEntry preciseEntry = save(source, platform, existing, "Offshore settlement", new BigDecimal("3.50")); BigDecimal scale = reloadAmount(source, preciseEntry.getId()); if (!new BigDecimal("3.50").equals(scale)) { throw new AssertionError("generated Decimal scale was not preserved: " + scale); @@ -84,7 +84,7 @@ public static void main(String[] args) throws Exception { for (String exponent : new String[] {"1E-7", "1E+8"}) { BigDecimal input = new BigDecimal(exponent); - DecimalEntry entry = save(source, platform, existing, "exponent " + exponent, input); + DecimalEntry entry = save(source, platform, existing, "Rate adjustment " + exponent, input); BigDecimal reloaded = reloadAmount(source, entry.getId()); var filtered = Q.decimalEntriesWithMinimalFields().selectAmount() .withIdIs(entry.getId()).withAmountIs(input).limit(1) diff --git a/examples/exact-decimal/GeneratedMemoryAggregateProbe.java b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedMemoryAggregateProbe.java similarity index 100% rename from examples/exact-decimal/GeneratedMemoryAggregateProbe.java rename to examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedMemoryAggregateProbe.java diff --git a/examples/exact-decimal/GeneratedWorkspaceStartupProbe.java b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedWorkspaceStartupProbe.java similarity index 100% rename from examples/exact-decimal/GeneratedWorkspaceStartupProbe.java rename to examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/GeneratedWorkspaceStartupProbe.java diff --git a/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/WorkspaceTeaQLDatabase.java b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..c316d2fa8 --- /dev/null +++ b/examples/exact-decimal/java-app-console/src/main/java/com/example/exactdecimalservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.exactdecimalservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/src/main/resources/application.properties b/examples/exact-decimal/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..ea1fe0971 --- /dev/null +++ b/examples/exact-decimal/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:exactdecimalservice.db diff --git a/examples/exact-decimal/java-app-console/teaql-i18n.json b/examples/exact-decimal/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..20415b81f --- /dev/null +++ b/examples/exact-decimal/java-app-console/teaql-i18n.json @@ -0,0 +1,106 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.decimalEntry.version": "Version", + "property.decimalEntry.label": "Label", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.decimalEntry.platform": "Platform", + "property.decimalEntry.amount": "Amount", + "property.decimalEntry.id": "Id", + "entity.decimalEntry": "Decimal Entry", + "property.platform.version": "Version" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/teaql/checker-model.json b/examples/exact-decimal/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..2d98dd91b --- /dev/null +++ b/examples/exact-decimal/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:91221f5024a3f4a9fb2107c03a7807ea332b6a396a608b76abb394898177c010","entities":{"DecimalEntry":{"labels":{"en":"Settlement Quote"},"fields":[{"name":"amount","labels":{"en":"amount"},"aliases":["Amount"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"label","labels":{"en":"label"},"aliases":["Label"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"decimal_entry_list","targetType":"DecimalEntry","labels":{"en":"Settlement Quote"},"aliases":["DecimalEntryList","decimalEntryList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/teaql/model-provenance.json b/examples/exact-decimal/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..f20e048d3 --- /dev/null +++ b/examples/exact-decimal/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:1a212bf73ff3934fa1e3f1dc7fe5f07ce43983d075eef6f0ca0836d0e18207d1","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/pom.xml b/examples/exact-decimal/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..7bd6ebbf5 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + exact-decimal-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Checkers.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Constants.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Constants.java new file mode 100644 index 000000000..d17d4e4c3 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Constants.java @@ -0,0 +1,9 @@ + +package com.example.exactdecimalservice; + +import com.example.exactdecimalservice.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/E.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/E.java new file mode 100644 index 000000000..26ec00ba1 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/E.java @@ -0,0 +1,18 @@ + +package com.example.exactdecimalservice; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryExpression; +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static DecimalEntryExpression decimalEntry(DecimalEntry decimalEntry){ + return new DecimalEntryExpression(new ValueExpression(decimalEntry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.decimalEntry()")); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java new file mode 100644 index 000000000..73e93117f --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java @@ -0,0 +1,300 @@ + +package com.example.exactdecimalservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerDecimalEntry(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.exactdecimalservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.exactdecimalservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.exactdecimalservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.exactdecimalservice.platform.Platform::new); + entityDescriptor.with("name", "Platform") + + .with("module", "Organization") + + .with("module_key", "organization") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Settlement Quote Ledger") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerDecimalEntry() { + FieldLayout.installGenerated(com.example.exactdecimalservice.decimalentry.DecimalEntry.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.exactdecimalservice.decimalentry.DecimalEntry.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.exactdecimalservice.decimalentry.DecimalEntry.class); + entityDescriptor.setEntitySupplier(com.example.exactdecimalservice.decimalentry.DecimalEntry::new); + entityDescriptor.with("name", "Settlement Quote") + + .with("module", "Ledger") + + .with("module_key", "ledger") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.exactdecimalservice.decimalentry.DecimalEntry.PLATFORM_PROPERTY, com.example.exactdecimalservice.platform.Platform.INTERNAL_TYPE, com.example.exactdecimalservice.platform.Platform.DECIMAL_ENTRY_LIST_PROPERTY, com.example.exactdecimalservice.platform.Platform.class) + ; + PropertyDescriptor label = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY, String.class) + ; + PropertyDescriptor amount = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java new file mode 100644 index 000000000..c399c232d --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.exactdecimalservice; + +import io.teaql.core.UserContext; +public interface ExactDecimalServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..731febe8c --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.example.exactdecimalservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.exactdecimalservice.platform.PlatformChecker(), new com.example.exactdecimalservice.decimalentry.DecimalEntryChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:91221f5024a3f4a9fb2107c03a7807ea332b6a396a608b76abb394898177c010\",\"entities\":{\"DecimalEntry\":{\"labels\":{\"en\":\"Settlement Quote\"},\"fields\":[{\"name\":\"amount\",\"labels\":{\"en\":\"amount\"},\"aliases\":[\"Amount\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"label\",\"labels\":{\"en\":\"label\"},\"aliases\":[\"Label\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"decimal_entry_list\",\"targetType\":\"DecimalEntry\",\"labels\":{\"en\":\"Settlement Quote\"},\"aliases\":[\"DecimalEntryList\",\"decimalEntryList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("DecimalEntry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("label", "label"), java.util.Map.entry("amount", "amount"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.exactdecimalservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.exactdecimalservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Settlement Quote Ledger"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Q.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Q.java new file mode 100644 index 000000000..0bf183acf --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Q.java @@ -0,0 +1,25 @@ + +package com.example.exactdecimalservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.exactdecimalservice.platform.PlatformRequest platforms(){ + return new com.example.exactdecimalservice.platform.PlatformRequest(com.example.exactdecimalservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.exactdecimalservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.exactdecimalservice.platform.PlatformRequest(com.example.exactdecimalservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.exactdecimalservice.decimalentry.DecimalEntryRequest decimalEntries(){ + return new com.example.exactdecimalservice.decimalentry.DecimalEntryRequest(com.example.exactdecimalservice.decimalentry.DecimalEntry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.exactdecimalservice.decimalentry.DecimalEntryRequest decimalEntriesWithMinimalFields(){ + return new com.example.exactdecimalservice.decimalentry.DecimalEntryRequest(com.example.exactdecimalservice.decimalentry.DecimalEntry.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Repositories.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java new file mode 100644 index 000000000..43909a4f7 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java @@ -0,0 +1,149 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class DecimalEntry extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "DecimalEntry"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "46367c1f6d22180cb63ea4bcac6772b4e507f4ef69000bb272b73de3ab179c0f"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("label", 2), java.util.Map.entry("amount", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("label", java.util.List.of("label", "label")), java.util.Map.entry("amount", java.util.List.of("amount", "amount")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + DecimalEntry.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String LABEL_PROPERTY = "label"; + public static final String AMOUNT_PROPERTY = "amount"; + private Platform platform; + + private String label; + + private BigDecimal amount; + + + public Platform getPlatform(){ + return this.platform; + } + + public String getLabel(){ + return this.label; + } + + public BigDecimal getAmount(){ + return this.amount; + } + + public DecimalEntry updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public DecimalEntry updateLabel(String label){ + label = (label == null ? null : label.trim()); + if(isPropertyLoaded(LABEL_PROPERTY) && Objects.equals(this.label, label)){ + return this; + } + handleUpdate(LABEL_PROPERTY, getLabel(), label); + this.label = label; + return this; + } + + public DecimalEntry updateAmount(BigDecimal amount){ + if(isPropertyLoaded(AMOUNT_PROPERTY) && Objects.equals(this.amount, amount)){ + return this; + } + handleUpdate(AMOUNT_PROPERTY, getAmount(), amount); + this.amount = amount; + return this; + } + + + public static DecimalEntry refer(Long id){ + DecimalEntry refer = new DecimalEntry(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public DecimalEntry comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "label": this.label = (value == null ? null : ((String)value).trim()); break; + + case "amount": this.amount = (BigDecimal) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "label": return this.label; + case "amount": return this.amount; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "label": return this.label; + case "amount": return this.amount; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java new file mode 100644 index 000000000..d8d1ed9f9 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java @@ -0,0 +1,70 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class DecimalEntryChecker implements Checker{ + + public String type(){ + return DecimalEntry.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, DecimalEntry decimalEntry, ObjectLocation _parentLocation){ + if(needCheck(_context, decimalEntry)){ + markAsChecked(_context, decimalEntry); + doCheck(_context, decimalEntry, _parentLocation); + } + } + + public void doCheck(UserContext _context, DecimalEntry decimalEntry, ObjectLocation _parentLocation){ + if((decimalEntry == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, decimalEntry); + if(decimalEntry.needPersist()){ + } + if(decimalEntry.newItem()){ + }else if(decimalEntry.updateItem()){ + if(!decimalEntry.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!decimalEntry.isPropertyLoaded("label")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "label"), "Mutation requires a fully loaded entity"); + } + if(!decimalEntry.isPropertyLoaded("amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "amount"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, decimalEntry.getProperty(DecimalEntry.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkLabel(_context, decimalEntry.getProperty(DecimalEntry.LABEL_PROPERTY), newLocation(_parentLocation, "label")); + checkAmount(_context, decimalEntry.getProperty(DecimalEntry.AMOUNT_PROPERTY), newLocation(_parentLocation, "amount")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkLabel(UserContext _context, String label, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, label); + if((label == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, label); + + } + public void checkAmount(UserContext _context, BigDecimal amount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, amount); + if((amount == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java new file mode 100644 index 000000000..f82745853 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java @@ -0,0 +1,61 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class DecimalEntryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public DecimalEntryExpression(Expression expression){ + super(expression); + } + + public DecimalEntryExpression(Expression expression, Function function){ + super(expression, function); + } + + public DecimalEntryExpression updateId(Long id){ + return new DecimalEntryExpression(this, $it -> {((DecimalEntry)$it).__internalSet("id", id); return this;}); + } + + public DecimalEntryExpression save(UserContext userContext){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).auditAs("Saved by Expression").save(userContext)); + } + + public DecimalEntryExpression save(String intent, UserContext userContext){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", DecimalEntry::getPlatform)); + } + + public DecimalEntryExpression updatePlatform(Platform platform){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updatePlatform(platform)); + } + + public Expression getLabel(){ + return loaded("label", "getLabel", DecimalEntry::getLabel); + } + public DecimalEntryExpression updateLabel(String label){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updateLabel(label)); + } + + public Expression getAmount(){ + return loaded("amount", "getAmount", DecimalEntry::getAmount); + } + public DecimalEntryExpression updateAmount(BigDecimal amount){ + return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updateAmount(amount)); + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java new file mode 100644 index 000000000..b0a309601 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.exactdecimalservice.decimalentry; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class DecimalEntryListExpression extends SmartListExpression { + public DecimalEntryListExpression(Expression> expression){ + super(expression); + } + + public DecimalEntryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public DecimalEntryExpression first() { + return new DecimalEntryExpression(super.first()); + } + + public DecimalEntryExpression get(int index) { + return new DecimalEntryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java new file mode 100644 index 000000000..ac7ccfed1 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java @@ -0,0 +1,875 @@ + +package com.example.exactdecimalservice.decimalentry; + +import com.example.exactdecimalservice.Q; +import com.example.exactdecimalservice.platform.Platform; +import com.example.exactdecimalservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class DecimalEntryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public DecimalEntryRequest(Class returnType){ + this(returnType, () -> (T) new DecimalEntry()); + } + + protected DecimalEntryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public DecimalEntryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public DecimalEntryRequest copy(){ + return (DecimalEntryRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new DecimalEntryRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public DecimalEntryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public DecimalEntryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public DecimalEntryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public DecimalEntryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public DecimalEntryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public DecimalEntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public DecimalEntryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public DecimalEntryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public DecimalEntryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public DecimalEntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (DecimalEntryRequest)super.appendSearchCriteria(searchCriteria); + } + + public DecimalEntryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public DecimalEntryRequest matchingAnyOf(DecimalEntryRequest decimalEntry){ + super.internalMatchAny(decimalEntry); + return this; + } + + public DecimalEntryRequest matchingIdsOf(DecimalEntryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + DecimalEntry.ID_PROPERTY, request, DecimalEntry.ID_PROPERTY)); + } + + public DecimalEntryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public DecimalEntryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public DecimalEntryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public DecimalEntryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectLabel().selectAmount().selectVersion(); + } + + public DecimalEntryRequest selectSelfFields(){ + return selectSelf(); + } + + public DecimalEntryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(DecimalEntry.ID_PROPERTY); + selectProperty(DecimalEntry.PLATFORM_PROPERTY); + selectProperty(DecimalEntry.LABEL_PROPERTY); + selectProperty(DecimalEntry.AMOUNT_PROPERTY); + selectProperty(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectLabel().selectAmount().selectVersion(); + } + + public DecimalEntryRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectLabel().selectAmount().selectVersion(); + } + + + public DecimalEntryRequest selectId(){ + selectProperty(DecimalEntry.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public DecimalEntryRequest unselectId(){ + unselectProperty(DecimalEntry.ID_PROPERTY); + return this; + } + public DecimalEntryRequest selectPlatformIdOnly(){ + selectProperty(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public DecimalEntryRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(DecimalEntry.PLATFORM_PROPERTY); + enhanceRelation(DecimalEntry.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, DecimalEntry.PLATFORM_PROPERTY)); + return this; + } + + public DecimalEntryRequest unselectPlatform(){ + unselectProperty(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + public DecimalEntryRequest selectLabel(){ + selectProperty(DecimalEntry.LABEL_PROPERTY); + return this; + } + + /** + * fill the label with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS label) to fetch label property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public DecimalEntryRequest unselectLabel(){ + unselectProperty(DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest selectAmount(){ + selectProperty(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + /** + * fill the amount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS amount) to fetch amount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the amount with customized aggrFunction, TEAQL uses ({aggrFunction}(amount) AS amount to fetch amount property. + * @param aggrFunction aggrFunction + */ + public DecimalEntryRequest selectAmount(AggrFunction aggrFunction){ + selectProperty(DecimalEntry.AMOUNT_PROPERTY, aggrFunction); + return this; + } + + + public DecimalEntryRequest unselectAmount(){ + unselectProperty(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest selectVersion(){ + selectProperty(DecimalEntry.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public DecimalEntryRequest unselectVersion(){ + unselectProperty(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.ID_PROPERTY, operator, values); + } + + public DecimalEntryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public DecimalEntryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public DecimalEntryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public DecimalEntryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public DecimalEntryRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public DecimalEntryRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public DecimalEntryRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public DecimalEntryRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.PLATFORM_PROPERTY, operator, values); + } + + public DecimalEntryRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public DecimalEntryRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(DecimalEntry.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public DecimalEntryRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(DecimalEntry.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public DecimalEntryRequest filterByLabel(String... label){ + if (label == null || label.length == 0) { + throw new IllegalArgumentException("filterByLabel parameter label cannot be empty"); + } + return appendSearchCriteria(createLabelCriteria(Operator.EQUAL, (Object[])label)); + } + + public DecimalEntryRequest withLabel(Operator operator, Object... values){ + return appendSearchCriteria(createLabelCriteria(operator, values)); + } + + public DecimalEntryRequest withLabelIsUnknown(){ + return withLabel(Operator.IS_NULL); + } + + public DecimalEntryRequest withLabelIsKnown(){ + return withLabel(Operator.IS_NOT_NULL); + } + + public SearchCriteria createLabelCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.LABEL_PROPERTY, operator, values); + } + + public DecimalEntryRequest withLabelIsNot(String label){ + return withLabel(Operator.NOT_EQUAL, label); + } + + public DecimalEntryRequest withLabelIn(String... label){ + return withLabel(Operator.IN, (Object[])label); + } + + public DecimalEntryRequest withLabelNotIn(String... label){ + return withLabel(Operator.NOT_IN, (Object[])label); + } + public DecimalEntryRequest withLabelGreaterThan(String label){ + return withLabel(Operator.GREATER_THAN, label); + } + + public DecimalEntryRequest withLabelGreaterThanOrEqualTo(String label){ + return withLabel(Operator.GREATER_THAN_OR_EQUAL, label); + } + + public DecimalEntryRequest withLabelLessThan(String label){ + return withLabel(Operator.LESS_THAN, label); + } + + public DecimalEntryRequest withLabelLessThanOrEqualTo(String label){ + return withLabel(Operator.LESS_THAN_OR_EQUAL, label); + } + + public DecimalEntryRequest withLabelBetween(String startOfLabel, String endOfLabel){ + return withLabel(Operator.BETWEEN, startOfLabel, endOfLabel); + } + public DecimalEntryRequest withLabelStartingWith(String label){ + return withLabel(Operator.BEGIN_WITH, label); + } + public DecimalEntryRequest withLabelContaining(String label){ + return withLabel(Operator.CONTAIN, label); + } + + public DecimalEntryRequest withLabelNotContaining(String label){ + return withLabel(Operator.NOT_CONTAIN, label); + } + + public DecimalEntryRequest withLabelNotStartingWith(String label){ + return withLabel(Operator.NOT_BEGIN_WITH, label); + } + + public DecimalEntryRequest withLabelEndingWith(String label){ + return withLabel(Operator.END_WITH, label); + } + + public DecimalEntryRequest withLabelNotEndingWith(String label){ + return withLabel(Operator.NOT_END_WITH, label); + } + + public DecimalEntryRequest withLabelIs(String label){ + return withLabel(Operator.EQUAL, label); + } + + public DecimalEntryRequest withLabelSoundingLike(String label){ + return withLabel(Operator.SOUNDS_LIKE, label); + } + + + + public DecimalEntryRequest filterByAmount(BigDecimal... amount){ + if (amount == null || amount.length == 0) { + throw new IllegalArgumentException("filterByAmount parameter amount cannot be empty"); + } + return appendSearchCriteria(createAmountCriteria(Operator.EQUAL, (Object[])amount)); + } + + public DecimalEntryRequest withAmount(Operator operator, Object... values){ + return appendSearchCriteria(createAmountCriteria(operator, values)); + } + + public DecimalEntryRequest withAmountIsUnknown(){ + return withAmount(Operator.IS_NULL); + } + + public DecimalEntryRequest withAmountIsKnown(){ + return withAmount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAmountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.AMOUNT_PROPERTY, operator, values); + } + + public DecimalEntryRequest withAmountIs(BigDecimal amount){ + return withAmount(Operator.EQUAL, amount); + } + + public DecimalEntryRequest withAmountIsNot(BigDecimal amount){ + return withAmount(Operator.NOT_EQUAL, amount); + } + + public DecimalEntryRequest withAmountIn(BigDecimal... amount){ + return withAmount(Operator.IN, (Object[])amount); + } + + public DecimalEntryRequest withAmountNotIn(BigDecimal... amount){ + return withAmount(Operator.NOT_IN, (Object[])amount); + } + public DecimalEntryRequest withAmountGreaterThan(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN, amount); + } + + public DecimalEntryRequest withAmountGreaterThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN_OR_EQUAL, amount); + } + + public DecimalEntryRequest withAmountLessThan(BigDecimal amount){ + return withAmount(Operator.LESS_THAN, amount); + } + + public DecimalEntryRequest withAmountLessThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.LESS_THAN_OR_EQUAL, amount); + } + + public DecimalEntryRequest withAmountBetween(BigDecimal startOfAmount, BigDecimal endOfAmount){ + return withAmount(Operator.BETWEEN, startOfAmount, endOfAmount); + } + + + + public DecimalEntryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public DecimalEntryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public DecimalEntryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public DecimalEntryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(DecimalEntry.VERSION_PROPERTY, operator, values); + } + + public DecimalEntryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public DecimalEntryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public DecimalEntryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public DecimalEntryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public DecimalEntryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public DecimalEntryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public DecimalEntryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public DecimalEntryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public DecimalEntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public DecimalEntryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public DecimalEntryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public DecimalEntryRequest minAmount(){ + return minAmountAs(prefix("minOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest minAmountAs(String retName){ + super.min(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest maxAmount(){ + return maxAmountAs(prefix("maxOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest maxAmountAs(String retName){ + super.max(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest sumAmount(){ + return sumAmountAs(prefix("sumOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest sumAmountAs(String retName){ + super.sum(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest avgAmount(){ + return avgAmountAs(prefix("avgOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest avgAmountAs(String retName){ + super.avg(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest standardDeviationAmount(){ + return standardDeviationAmountAs(prefix("standardDeviationOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest standardDeviationAmountAs(String retName){ + super.standardDeviation(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest squareRootOfPopulationStandardDeviationAmount(){ + return squareRootOfPopulationStandardDeviationAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest squareRootOfPopulationStandardDeviationAmountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest sampleVarianceAmount(){ + return sampleVarianceAmountAs(prefix("sampleVarianceOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest sampleVarianceAmountAs(String retName){ + super.sampleVariance(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest samplePopulationVarianceAmount(){ + return samplePopulationVarianceAmountAs(prefix("samplePopulationVarianceOf",DecimalEntry.AMOUNT_PROPERTY)); + } + + public DecimalEntryRequest samplePopulationVarianceAmountAs(String retName){ + super.samplePopulationVariance(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public DecimalEntryRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(DecimalEntry.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public DecimalEntryRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public DecimalEntryRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.ID_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public DecimalEntryRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.PLATFORM_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctLabel(){ + return countDistinctLabelAs("label_distinct_count"); + } + + public DecimalEntryRequest countDistinctLabelAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctAmount(){ + return countDistinctAmountAs("amount_distinct_count"); + } + + public DecimalEntryRequest countDistinctAmountAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + public DecimalEntryRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public DecimalEntryRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest groupById(){ + groupBy(DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByIdAs(String retName){ + groupBy(retName, DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.ID_PROPERTY, function); + return this; + } + public DecimalEntryRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(DecimalEntry.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public DecimalEntryRequest groupByPlatform(){ + groupBy(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByPlatformAs(String retName){ + groupBy(retName, DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.PLATFORM_PROPERTY, function); + return this; + } + + public DecimalEntryRequest groupByLabel(){ + groupBy(DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByLabelAs(String retName){ + groupBy(retName, DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByLabelWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.LABEL_PROPERTY, function); + return this; + } + + public DecimalEntryRequest groupByAmount(){ + groupBy(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByAmountAs(String retName){ + groupBy(retName, DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByAmountWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.AMOUNT_PROPERTY, function); + return this; + } + + public DecimalEntryRequest groupByVersion(){ + groupBy(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByVersionAs(String retName){ + groupBy(retName, DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, DecimalEntry.VERSION_PROPERTY, function); + return this; + } + + + + public DecimalEntryRequest orderByIdAscending(){ + addOrderByAscending(DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByIdDescending(){ + addOrderByDescending(DecimalEntry.ID_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByPlatformAscending(){ + addOrderByAscending(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByPlatformDescending(){ + addOrderByDescending(DecimalEntry.PLATFORM_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByLabelAscending(){ + addOrderByAscending(DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByLabelDescending(){ + addOrderByDescending(DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest orderByLabelAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(DecimalEntry.LABEL_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByLabelDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(DecimalEntry.LABEL_PROPERTY); + return this; + } + public DecimalEntryRequest orderByAmountAscending(){ + addOrderByAscending(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByAmountDescending(){ + addOrderByDescending(DecimalEntry.AMOUNT_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByVersionAscending(){ + addOrderByAscending(DecimalEntry.VERSION_PROPERTY); + return this; + } + + public DecimalEntryRequest orderByVersionDescending(){ + addOrderByDescending(DecimalEntry.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + public DecimalEntryRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public DecimalEntryRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, DecimalEntry.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, DecimalEntry.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public DecimalEntryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public DecimalEntryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public DecimalEntryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public DecimalEntryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public DecimalEntryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public DecimalEntryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java new file mode 100644 index 000000000..068e5825c --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "41daef4cd31b0d2446142c4e2de17ed30f1cc3fd56cbd671ec26e0bad3ef5734"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "decimal_entry_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String DECIMAL_ENTRY_LIST_PROPERTY = "decimal_entry_list"; + private String name; + + private SmartList decimalEntryList; + + public String getName(){ + return this.name; + } + + public SmartList getDecimalEntryList(){ + return this.decimalEntryList == null ? SmartList.unloaded() : this.decimalEntryList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addDecimalEntry(DecimalEntry decimalEntry){ + if (decimalEntry == null){ + return this; + } + + if(null == this.decimalEntryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.decimalEntryList = teaqlUnloadedItems.map(value -> value); + } + + this.decimalEntryList.add(decimalEntry); + decimalEntry.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "decimal_entry_list": this.decimalEntryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "decimal_entry_list": return this.decimalEntryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java new file mode 100644 index 000000000..e247d04f2 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getDecimalEntryList() != null && i < platform.getDecimalEntryList().size(); i++){ + DecimalEntry decimalEntry = platform.getDecimalEntryList().get(i); + new DecimalEntryChecker().checkAndFix(_context, decimalEntry, newLocation(_parentLocation, "decimal_entry_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java new file mode 100644 index 000000000..6a15a11bf --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public DecimalEntryListExpression getDecimalEntryList(){ + return new DecimalEntryListExpression(loaded("decimal_entry_list", "getDecimalEntryList", Platform::getDecimalEntryList)); + } + public PlatformExpression addDecimalEntry(DecimalEntry decimalEntry){ + return new PlatformExpression(this, $it -> ((Platform)$it).addDecimalEntry(decimalEntry)); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..f19338f41 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.exactdecimalservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java new file mode 100644 index 000000000..b9bf27617 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java @@ -0,0 +1,775 @@ + +package com.example.exactdecimalservice.platform; + +import com.example.exactdecimalservice.Q; +import com.example.exactdecimalservice.decimalentry.DecimalEntry; +import com.example.exactdecimalservice.decimalentry.DecimalEntryRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectDecimalEntryList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectDecimalEntryList(){ + return selectDecimalEntryListWith(Q.decimalEntries().selectSelf()); + } + + public PlatformRequest selectDecimalEntryListWith(DecimalEntryRequest decimalEntryList){ + enhanceRelation(Platform.DECIMAL_ENTRY_LIST_PROPERTY, decimalEntryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectDecimalEntryListWith", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withDecimalEntryListMatching(DecimalEntryRequest decimalEntryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, decimalEntryRequest, DecimalEntry.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutDecimalEntryListMatching(DecimalEntryRequest decimalEntryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, decimalEntryRequest, DecimalEntry.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveDecimalEntries(){ + return withDecimalEntryListMatching(Q.decimalEntries().unlimited()); + } + + public PlatformRequest haveNoDecimalEntries(){ + return withoutDecimalEntryListMatching(Q.decimalEntries().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByDecimalEntriesWithDetails(DecimalEntryRequest subRequest){ + aggregate(Platform.DECIMAL_ENTRY_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + return statsFromDecimalEntriesAs(name, subRequest, false); + } + + public PlatformRequest statsFromDecimalEntriesAs(String name, DecimalEntryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromDecimalEntries(DecimalEntryRequest subRequest){ + return statsFromDecimalEntriesAs(REFINEMENTS, subRequest); + } + public PlatformRequest countDecimalEntries(){ + addRelationCount("Count", Q.decimalEntries().unlimited(), DecimalEntry.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countDecimalEntriesAs(String name){ + addRelationCount(name, Q.decimalEntries().unlimited(), DecimalEntry.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countDecimalEntriesWith(String name, DecimalEntryRequest subRequest){ + addRelationCount(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntriesWith", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest minAmountOfDecimalEntries(){ + addRelationScalarAggregate("minAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minAmountOfDecimalEntriesAs(String name){ + return minAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest minAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxAmountOfDecimalEntries(){ + addRelationScalarAggregate("maxAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxAmountOfDecimalEntriesAs(String name){ + return maxAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest maxAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumAmountOfDecimalEntries(){ + addRelationScalarAggregate("sumAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumAmountOfDecimalEntriesAs(String name){ + return sumAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest sumAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgAmountOfDecimalEntries(){ + addRelationScalarAggregate("avgAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgAmountOfDecimalEntriesAs(String name){ + return avgAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest avgAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationAmountOfDecimalEntries(){ + addRelationScalarAggregate("stdDevAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationAmountOfDecimalEntriesAs(String name){ + return standardDeviationAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest standardDeviationAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntries(){ + addRelationScalarAggregate("stdDevPopAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(String name){ + return squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceAmountOfDecimalEntries(){ + addRelationScalarAggregate("varSampAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceAmountOfDecimalEntriesAs(String name){ + return sampleVarianceAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest sampleVarianceAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceAmountOfDecimalEntries(){ + addRelationScalarAggregate("varPopAmountOfDecimalEntries", Q.decimalEntries().unlimited(), + DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceAmountOfDecimalEntriesAs(String name){ + return samplePopulationVarianceAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); + } + + public PlatformRequest samplePopulationVarianceAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, + DecimalEntry.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java b/examples/exact-decimal/java-lib-core/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/exact-decimal/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/exact-decimal/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..905bf682c --- /dev/null +++ b/examples/exact-decimal/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.exactdecimalservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/teaql/checker-model.json b/examples/exact-decimal/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..2d98dd91b --- /dev/null +++ b/examples/exact-decimal/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:91221f5024a3f4a9fb2107c03a7807ea332b6a396a608b76abb394898177c010","entities":{"DecimalEntry":{"labels":{"en":"Settlement Quote"},"fields":[{"name":"amount","labels":{"en":"amount"},"aliases":["Amount"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"label","labels":{"en":"label"},"aliases":["Label"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"decimal_entry_list","targetType":"DecimalEntry","labels":{"en":"Settlement Quote"},"aliases":["DecimalEntryList","decimalEntryList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/exact-decimal/java-lib-core/teaql/model-provenance.json b/examples/exact-decimal/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..f20e048d3 --- /dev/null +++ b/examples/exact-decimal/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:1a212bf73ff3934fa1e3f1dc7fe5f07ce43983d075eef6f0ca0836d0e18207d1","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/exact-decimal/model.xml b/examples/exact-decimal/model.xml index 2184858bf..1c569c2de 100644 --- a/examples/exact-decimal/model.xml +++ b/examples/exact-decimal/model.xml @@ -7,9 +7,9 @@ + name="Settlement Quote Ledger"/> - { throw new Error("Set TEAQL_CODEGEN_DIR to the local generator checkout"); })()); +const runtimeRoot = path.resolve(__dirname, "../.."); const requested = process.env.TEAQL_JAVA_EXACT_EVIDENCE_DIR; const evidence = requested ? path.resolve(requested) : fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-decimal-evidence-")); if (requested) { assert(!fs.existsSync(evidence), "never overwrite retained evidence"); fs.mkdirSync(evidence); } @@ -61,40 +60,37 @@ function generatedHashes(root) { } walk(root); return result; } -const before = {runtime: snapshot(runtimeRoot), generator: snapshot(generatorRoot)}; +const before = {runtime: snapshot(runtimeRoot)}; const scratch = fs.mkdtempSync(path.join(os.tmpdir(), "teaql-java-decimal-build-")); let passed = false, failure, generated, localClasses = {}, artifactSha256; try { const disk = fs.statfsSync(scratch); assert(disk.bavail * disk.bsize > 8 * 1024 ** 3, "8 GiB free build space required"); - const runtime = path.join(scratch, "runtime"), generator = path.join(scratch, "generator"), app = path.join(scratch, "app"); - copy(runtimeRoot, runtime); copy(generatorRoot, generator); - run("generator-build", ["mvn", "-B", "-ntp", "-pl", "generator", "-am", "package", "-DskipTests", "-Dexec.skip=true", - "org.apache.maven.plugins:maven-dependency-plugin:3.8.1:build-classpath", "-Dmdep.outputFile=target/example-classpath.txt"], generator); - const dependencies = fs.readFileSync(path.join(generator, "generator/target/example-classpath.txt"), "utf8").trim(); - assert(dependencies.split(path.delimiter).some(file => file.startsWith(path.join(generator, "model/target") + path.sep)), - "generator must use the model artifact built from this source, not a stale local-cache coordinate"); - const classpath = path.join(generator, "generator/target/classes") + path.delimiter + dependencies; - const originalModel = path.join(runtime, 'examples/exact-decimal/model.xml'); + const runtime = path.join(scratch, "runtime"); + copy(runtimeRoot, runtime); + const example = path.join(runtime, 'examples/exact-decimal'); + const app = path.join(example, 'java-app-console'); + const library = path.join(example, 'java-lib-core'); + const modelSha256 = sha(fs.readFileSync(path.join(example, 'model.xml'))); + const spec = JSON.parse(fs.readFileSync(path.join(example, 'showcase.json'))); + assert.equal(modelSha256, spec.model.sha256); const version = fs.readFileSync(path.join(runtime, "pom.xml"), "utf8").match(/([^<]+)<\/version>/)[1]; - assert(!version.includes("${")); - const originalModelBytes = fs.readFileSync(originalModel); - assert(!originalModelBytes.toString().includes('teaql_java_version=')); - const model = path.join(scratch, 'model.xml'); - const selectedModel = originalModelBytes.toString().replace(/([^<]+)<\/teaql.version>/)[1]; + assert.equal(version, evaluatedVersion, 'Maven reactor must match the evaluated example runtime'); + const scopes = JSON.parse(fs.readFileSync(path.join(example, 'generated-scope-hashes.json'))); + function verifyScopes() { + assert.deepEqual(generatedHashes(library), scopes['java-lib-core']); + const observed = generatedHashes(app); + for (const [name, digest] of Object.entries(scopes['java-app-console'])) { + assert.equal(observed[name], digest, 'generated workspace file changed: ' + name); + } + } + verifyScopes(); + generated = {modelSha256, producer: spec.producer, files: scopes}; fs.writeFileSync(path.join(evidence, "generated-manifest.json"), JSON.stringify(generated, null, 2) + "\n"); - const libraryBefore = generatedHashes(path.join(app, "lib")); - const source = path.join(app, "src/main/java/com/example/exactdecimalservice"); - for (const file of ["GeneratedExactDecimalProbe.java", "GeneratedWorkspaceStartupProbe.java", "GeneratedMemoryAggregateProbe.java"]) - fs.copyFileSync(path.join(runtime, "examples/exact-decimal", file), path.join(source, file)); const reactor = path.join(scratch, "pom.xml"); - fs.writeFileSync(reactor, '4.0.0io.teaql.testexact-decimal-source-reactor0.0.0pomruntimeapp/libapp\n'); + fs.writeFileSync(reactor, '4.0.0io.teaql.testexact-decimal-source-reactor0.0.0pomruntimeruntime/examples/exact-decimal/java-lib-core/libruntime/examples/exact-decimal/java-app-console\n'); run("source-paired-build", ["mvn", "-B", "-ntp", "-f", reactor, "-pl", ":exact-decimal-service", "-am", "package", "-DskipTests", "-Dteaql.version=" + version], scratch); const artifact = path.join(app, "target/exact-decimal-service-0.0.1-SNAPSHOT.jar"); @@ -120,9 +116,9 @@ try { assert(startup.includes("GENERATED_EXACT_DECIMAL_WORKSPACE_PASS")); const memory = run("memory-" + round, ["java", "-cp", artifact, "com.example.exactdecimalservice.GeneratedMemoryAggregateProbe"], scratch); assert(memory.includes("GENERATED_MEMORY_AGGREGATE_PASS q=1 e=1 mutation=1 sum=0.3 empty=null fallback=0 rows=2 sql=0")); - assert.deepEqual(generatedHashes(path.join(app, "lib")), libraryBefore, "generated library changed during application verification"); + verifyScopes(); } - assert.deepEqual({runtime: snapshot(runtimeRoot), generator: snapshot(generatorRoot)}, before, "source changed during verification"); + assert.deepEqual({runtime: snapshot(runtimeRoot)}, before, "source changed during verification"); passed = true; } catch (error) { failure = error.stack; process.exitCode = 1; console.error(error.message); } finally { From 201f1d03101ed44a3afb6a6be616509049d71147 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 16:18:33 +0800 Subject: [PATCH 36/71] Record focused java examples/exact-decimal business qualification --- examples/exact-decimal/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/exact-decimal/showcase.json b/examples/exact-decimal/showcase.json index 43dd2bc76..988a08a1e 100644 --- a/examples/exact-decimal/showcase.json +++ b/examples/exact-decimal/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/freight-and-settlement-scalar-generation/receipt.json", "receiptSHA256": "79779696ae34d3952b5735caa00fa0e1da93311ca8cb7389eec5ccd087368a1a" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-settlement-quotes-native/runtime/exact-decimal/business-receipt.json", + "businessReceiptSHA256": "db95e6b74ca5dd2eeffb97a439aa63adc714c87fde1d4f0ed31cb82d99432ee3", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-settlement-quotes-native/receipt.json", + "nativeReceiptSHA256": "37f55df85b2ba3ea372e6d6ac13276c4723a50091e9a9f95352d9d7c007f3d1c", + "remainingFullRuntimeInventory": true, + "sourceCommit": "26f81f6f66c19ad0772dd3c65d5cc1f861239fc5" + }, "scene": "Exact settlement quotes and accounting aggregation", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/exact-decimal/verify.sh" From 3254d93b3a849dbb784e201c29adbfd62dd8f3f2 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 16:33:21 +0800 Subject: [PATCH 37/71] Define freight quote and delivery domain model for Java --- examples/scalar-type-probe/freight-quote.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/scalar-type-probe/freight-quote.xml diff --git a/examples/scalar-type-probe/freight-quote.xml b/examples/scalar-type-probe/freight-quote.xml new file mode 100644 index 000000000..25f90dfac --- /dev/null +++ b/examples/scalar-type-probe/freight-quote.xml @@ -0,0 +1,10 @@ + + + + + From 80125159c4a326d50be9977c84fb0e4ccc72277f Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 16:36:34 +0800 Subject: [PATCH 38/71] Demonstrate exact Java freight quotes in a generated workspace --- examples/scalar-type-probe/README.md | 16 +- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 66 + .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 ++ .../java-app-console/lib/pom.xml | 102 + .../BaseServiceConfiguration.java | 0 .../freightquotesettlement/Checkers.java | 0 .../freightquotesettlement/Constants.java | 9 + .../com/example/freightquotesettlement/E.java | 18 + .../EntityMetaRegistry.java | 508 +++++ .../FreightQuoteSettlementUserContext.java | 10 + .../GeneratedRuntimeModule.java | 37 + .../com/example/freightquotesettlement/Q.java | 25 + .../freightquotesettlement/Repositories.java | 0 .../freightquote/FreightQuote.java | 273 +++ .../freightquote/FreightQuoteChecker.java | 134 ++ .../freightquote/FreightQuoteExpression.java | 106 + .../FreightQuoteListExpression.java | 25 + .../freightquote/FreightQuoteRequest.java | 1774 +++++++++++++++++ .../platform/Platform.java | 130 ++ .../platform/PlatformChecker.java | 52 + .../platform/PlatformExpression.java | 51 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 1079 ++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-app-console/pom.xml | 103 + .../example/freightquotesettlement/App.java | 99 + .../CustomUserContext.java | 26 + .../FreightQuoteShowcase.java | 140 ++ .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 112 ++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../java-lib-core/lib/pom.xml | 142 ++ .../BaseServiceConfiguration.java | 0 .../freightquotesettlement/Checkers.java | 0 .../freightquotesettlement/Constants.java | 9 + .../com/example/freightquotesettlement/E.java | 18 + .../EntityMetaRegistry.java | 508 +++++ .../FreightQuoteSettlementUserContext.java | 10 + .../GeneratedRuntimeModule.java | 37 + .../com/example/freightquotesettlement/Q.java | 25 + .../freightquotesettlement/Repositories.java | 0 .../freightquote/FreightQuote.java | 273 +++ .../freightquote/FreightQuoteChecker.java | 134 ++ .../freightquote/FreightQuoteExpression.java | 106 + .../FreightQuoteListExpression.java | 25 + .../freightquote/FreightQuoteRequest.java | 1774 +++++++++++++++++ .../platform/Platform.java | 130 ++ .../platform/PlatformChecker.java | 52 + .../platform/PlatformExpression.java | 51 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 1079 ++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/scalar-type-probe/showcase.json | 40 + .../verify-freight-quotes.sh | 76 + scripts/verify-examples.sh | 35 +- 67 files changed, 9870 insertions(+), 35 deletions(-) create mode 100644 examples/scalar-type-probe/java-app-console/.gitignore create mode 100644 examples/scalar-type-probe/java-app-console/AGENTS.md create mode 100644 examples/scalar-type-probe/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/scalar-type-probe/java-app-console/Makefile create mode 100644 examples/scalar-type-probe/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/scalar-type-probe/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/scalar-type-probe/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/scalar-type-probe/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/scalar-type-probe/java-app-console/lib/pom.xml create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Checkers.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Repositories.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java create mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/scalar-type-probe/java-app-console/pom.xml create mode 100644 examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/App.java create mode 100644 examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/CustomUserContext.java create mode 100644 examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java create mode 100644 examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/WorkspaceTeaQLDatabase.java create mode 100644 examples/scalar-type-probe/java-app-console/src/main/resources/application.properties create mode 100644 examples/scalar-type-probe/java-app-console/teaql-i18n.json create mode 100644 examples/scalar-type-probe/java-app-console/teaql/checker-model.json create mode 100644 examples/scalar-type-probe/java-app-console/teaql/model-provenance.json create mode 100644 examples/scalar-type-probe/java-lib-core/lib/pom.xml create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Checkers.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Constants.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/E.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Q.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Repositories.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java create mode 100644 examples/scalar-type-probe/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/scalar-type-probe/java-lib-core/teaql/checker-model.json create mode 100644 examples/scalar-type-probe/java-lib-core/teaql/model-provenance.json create mode 100644 examples/scalar-type-probe/showcase.json create mode 100644 examples/scalar-type-probe/verify-freight-quotes.sh diff --git a/examples/scalar-type-probe/README.md b/examples/scalar-type-probe/README.md index 65a0cdfbd..47dcd05e0 100644 --- a/examples/scalar-type-probe/README.md +++ b/examples/scalar-type-probe/README.md @@ -1,4 +1,18 @@ -# Generated canonical naming / SQLite probe +# Freight quote settlement + +The generated Java console records three freight bids, revises the offshore +rate and queries the exact total. Java's model represents the dispatch +timestamp as a zone-free local date and time. Generated Q, E and the typed +JSON codec preserve that value, the exact amount and the full shipment +number. Missing required amounts are refused before an accepted revision +can change. A second process verifies that revision on the same SQLite file. + +`freight-quote.xml` owns the model. The source-paired verifier builds the +`java-lib-core` domain library and `java-app-console` workspace with the +local runtime, then runs all original scalar and JSON checks. The canonical +inventory launches `examples/scalar-type-probe/verify-freight-quotes.sh`. + +## Generated canonical naming and SQLite calibration Run `node examples/scalar-type-probe/verify-local.cjs` from this runtime checkout. The example always compiles repository-local runtime modules. It never installs diff --git a/examples/scalar-type-probe/java-app-console/.gitignore b/examples/scalar-type-probe/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/AGENTS.md b/examples/scalar-type-probe/java-app-console/AGENTS.md new file mode 100644 index 000000000..4a3eae2b4 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Dispatch Platform | +| freight_quote | Freight Quote | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/scalar-type-probe/java-app-console/DOMAIN_API_GUIDE.md b/examples/scalar-type-probe/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..b8c05f8da --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/freight-quote-settlement.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Dispatch Platform | +| freight_quote | Freight Quote | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/Makefile b/examples/scalar-type-probe/java-app-console/Makefile new file mode 100644 index 000000000..f74fb595d --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/freight-quote-settlement-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/freight-quote-settlement-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/scalar-type-probe/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..d30a9d67b --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/freight-quote-settlement.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/STANDARD_TELEMETRY.md b/examples/scalar-type-probe/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/scalar-type-probe/java-app-console/TOOL_API_GUIDE.md b/examples/scalar-type-probe/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..4572f8064 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/freight-quote-settlement.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/freight-quote-settlement.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/freight-quote-settlement.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/freight-quote-settlement.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/freight-quote-settlement.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/freight-quote-settlement.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/docs/teaql-java-crud-guide.md b/examples/scalar-type-probe/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..770baafa9 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.freightquotesettlement`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.freightquotesettlement.Q; +import com.example.freightquotesettlement.FreightQuoteSettlementUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectFreightQuoteListWith(Q.freightQuotes().selectSelf()) + .comment("load with freightQuoteList") + .purpose("fetch child freightQuoteList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `1`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.example.freightquotesettlement.platform.PlatformRequest` \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/pom.xml b/examples/scalar-type-probe/java-app-console/lib/pom.xml new file mode 100644 index 000000000..94e09187f --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + freight-quote-settlement-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Checkers.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java new file mode 100644 index 000000000..c5f05d388 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java @@ -0,0 +1,9 @@ + +package com.example.freightquotesettlement; + +import com.example.freightquotesettlement.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java new file mode 100644 index 000000000..16334b78c --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java @@ -0,0 +1,18 @@ + +package com.example.freightquotesettlement; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteExpression; +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static FreightQuoteExpression freightQuote(FreightQuote freightQuote){ + return new FreightQuoteExpression(new ValueExpression(freightQuote, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.freightQuote()")); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java new file mode 100644 index 000000000..e928f2055 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java @@ -0,0 +1,508 @@ + +package com.example.freightquotesettlement; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerFreightQuote(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.freightquotesettlement.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.freightquotesettlement.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.freightquotesettlement.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.freightquotesettlement.platform.Platform::new); + entityDescriptor.with("name", "Dispatch Platform") + + .with("module", "Freight") + + .with("module_key", "freight") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Harbor Freight Desk") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerFreightQuote() { + FieldLayout.installGenerated(com.example.freightquotesettlement.freightquote.FreightQuote.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.freightquotesettlement.freightquote.FreightQuote.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.freightquotesettlement.freightquote.FreightQuote.class); + entityDescriptor.setEntitySupplier(com.example.freightquotesettlement.freightquote.FreightQuote::new); + entityDescriptor.with("name", "Freight Quote") + + .with("module", "Freight") + + .with("module_key", "freight") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.freightquotesettlement.freightquote.FreightQuote.PLATFORM_PROPERTY, com.example.freightquotesettlement.platform.Platform.INTERNAL_TYPE, com.example.freightquotesettlement.platform.Platform.FREIGHT_QUOTE_LIST_PROPERTY, com.example.freightquotesettlement.platform.Platform.class) + ; + PropertyDescriptor reference = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY, String.class) + ; + PropertyDescriptor amount = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor shipmentNumber = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY, Long.class) + ; + PropertyDescriptor packageCount = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY, Integer.class) + ; + PropertyDescriptor deliveryDate = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor pickupTime = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor quotedAt = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor instructions = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.INSTRUCTIONS_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalTime") + + .with("sqlType", "TIME") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Time") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.INSTRUCTIONS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java new file mode 100644 index 000000000..2dfb38496 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java @@ -0,0 +1,10 @@ + +package com.example.freightquotesettlement; + +import io.teaql.core.UserContext; +public interface FreightQuoteSettlementUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java new file mode 100644 index 000000000..c90b62ca2 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.example.freightquotesettlement; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.freightquotesettlement.platform.PlatformChecker(), new com.example.freightquotesettlement.freightquote.FreightQuoteChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:3b8da34e762562f0877bfd04865e33c225b4d854c8a5914ea30b4a922d3df3b7\",\"entities\":{\"FreightQuote\":{\"labels\":{\"en\":\"Freight Quote\"},\"fields\":[{\"name\":\"amount\",\"labels\":{\"en\":\"amount\"},\"aliases\":[\"Amount\"]},{\"name\":\"delivery_date\",\"labels\":{\"en\":\"delivery date\"},\"aliases\":[\"DeliveryDate\",\"deliveryDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"instructions\",\"labels\":{\"en\":\"instructions\"},\"aliases\":[\"Instructions\"]},{\"name\":\"package_count\",\"labels\":{\"en\":\"package count\"},\"aliases\":[\"PackageCount\",\"packageCount\"]},{\"name\":\"pickup_time\",\"labels\":{\"en\":\"pickup time\"},\"aliases\":[\"PickupTime\",\"pickupTime\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Dispatch Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"quoted_at\",\"labels\":{\"en\":\"quoted at\"},\"aliases\":[\"QuotedAt\",\"quotedAt\"]},{\"name\":\"reference\",\"labels\":{\"en\":\"reference\"},\"aliases\":[\"Reference\"]},{\"name\":\"shipment_number\",\"labels\":{\"en\":\"shipment number\"},\"aliases\":[\"ShipmentNumber\",\"shipmentNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Dispatch Platform\"},\"fields\":[{\"name\":\"freight_quote_list\",\"targetType\":\"FreightQuote\",\"labels\":{\"en\":\"Freight Quote\"},\"aliases\":[\"FreightQuoteList\",\"freightQuoteList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("FreightQuote", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("reference", "reference"), java.util.Map.entry("amount", "amount"), java.util.Map.entry("shipment_number", "shipmentNumber"), java.util.Map.entry("package_count", "packageCount"), java.util.Map.entry("delivery_date", "deliveryDate"), java.util.Map.entry("pickup_time", "pickupTime"), java.util.Map.entry("quoted_at", "quotedAt"), java.util.Map.entry("instructions", "instructions"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.freightquotesettlement.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.freightquotesettlement.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Harbor Freight Desk"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java new file mode 100644 index 000000000..7e977454e --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java @@ -0,0 +1,25 @@ + +package com.example.freightquotesettlement; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.freightquotesettlement.platform.PlatformRequest platforms(){ + return new com.example.freightquotesettlement.platform.PlatformRequest(com.example.freightquotesettlement.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.freightquotesettlement.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.freightquotesettlement.platform.PlatformRequest(com.example.freightquotesettlement.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.freightquotesettlement.freightquote.FreightQuoteRequest freightQuotes(){ + return new com.example.freightquotesettlement.freightquote.FreightQuoteRequest(com.example.freightquotesettlement.freightquote.FreightQuote.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.freightquotesettlement.freightquote.FreightQuoteRequest freightQuotesWithMinimalFields(){ + return new com.example.freightquotesettlement.freightquote.FreightQuoteRequest(com.example.freightquotesettlement.freightquote.FreightQuote.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Repositories.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java new file mode 100644 index 000000000..4f6fcf146 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java @@ -0,0 +1,273 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class FreightQuote extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "FreightQuote"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "661de8675c51355614d50183496c991171adfdb1f52cc15029141a8114080a1e"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("reference", 2), java.util.Map.entry("amount", 3), java.util.Map.entry("shipment_number", 4), java.util.Map.entry("package_count", 5), java.util.Map.entry("delivery_date", 6), java.util.Map.entry("pickup_time", 7), java.util.Map.entry("quoted_at", 8), java.util.Map.entry("instructions", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("reference", java.util.List.of("reference", "reference")), java.util.Map.entry("amount", java.util.List.of("amount", "amount")), java.util.Map.entry("shipment_number", java.util.List.of("shipmentNumber", "shipment_number")), java.util.Map.entry("package_count", java.util.List.of("packageCount", "package_count")), java.util.Map.entry("delivery_date", java.util.List.of("deliveryDate", "delivery_date")), java.util.Map.entry("pickup_time", java.util.List.of("pickupTime", "pickup_time")), java.util.Map.entry("quoted_at", java.util.List.of("quotedAt", "quoted_at")), java.util.Map.entry("instructions", java.util.List.of("instructions", "instructions")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + FreightQuote.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String REFERENCE_PROPERTY = "reference"; + public static final String AMOUNT_PROPERTY = "amount"; + public static final String SHIPMENT_NUMBER_PROPERTY = "shipment_number"; + public static final String PACKAGE_COUNT_PROPERTY = "package_count"; + public static final String DELIVERY_DATE_PROPERTY = "delivery_date"; + public static final String PICKUP_TIME_PROPERTY = "pickup_time"; + public static final String QUOTED_AT_PROPERTY = "quoted_at"; + public static final String INSTRUCTIONS_PROPERTY = "instructions"; + private Platform platform; + + private String reference; + + private BigDecimal amount; + + private Long shipmentNumber; + + private Integer packageCount; + + private LocalDate deliveryDate; + + private LocalTime pickupTime; + + private LocalDateTime quotedAt; + + private String instructions; + + + public Platform getPlatform(){ + return this.platform; + } + + public String getReference(){ + return this.reference; + } + + public BigDecimal getAmount(){ + return this.amount; + } + + public Long getShipmentNumber(){ + return this.shipmentNumber; + } + + public Integer getPackageCount(){ + return this.packageCount; + } + + public LocalDate getDeliveryDate(){ + return this.deliveryDate; + } + + public LocalTime getPickupTime(){ + return this.pickupTime; + } + + public LocalDateTime getQuotedAt(){ + return this.quotedAt; + } + + public String getInstructions(){ + return this.instructions; + } + + public FreightQuote updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public FreightQuote updateReference(String reference){ + reference = (reference == null ? null : reference.trim()); + if(isPropertyLoaded(REFERENCE_PROPERTY) && Objects.equals(this.reference, reference)){ + return this; + } + handleUpdate(REFERENCE_PROPERTY, getReference(), reference); + this.reference = reference; + return this; + } + + public FreightQuote updateAmount(BigDecimal amount){ + if(isPropertyLoaded(AMOUNT_PROPERTY) && Objects.equals(this.amount, amount)){ + return this; + } + handleUpdate(AMOUNT_PROPERTY, getAmount(), amount); + this.amount = amount; + return this; + } + + public FreightQuote updateShipmentNumber(Long shipmentNumber){ + if(isPropertyLoaded(SHIPMENT_NUMBER_PROPERTY) && Objects.equals(this.shipmentNumber, shipmentNumber)){ + return this; + } + handleUpdate(SHIPMENT_NUMBER_PROPERTY, getShipmentNumber(), shipmentNumber); + this.shipmentNumber = shipmentNumber; + return this; + } + + public FreightQuote updatePackageCount(Integer packageCount){ + if(isPropertyLoaded(PACKAGE_COUNT_PROPERTY) && Objects.equals(this.packageCount, packageCount)){ + return this; + } + handleUpdate(PACKAGE_COUNT_PROPERTY, getPackageCount(), packageCount); + this.packageCount = packageCount; + return this; + } + + public FreightQuote updateDeliveryDate(LocalDate deliveryDate){ + if(isPropertyLoaded(DELIVERY_DATE_PROPERTY) && Objects.equals(this.deliveryDate, deliveryDate)){ + return this; + } + handleUpdate(DELIVERY_DATE_PROPERTY, getDeliveryDate(), deliveryDate); + this.deliveryDate = deliveryDate; + return this; + } + + public FreightQuote updatePickupTime(LocalTime pickupTime){ + if(isPropertyLoaded(PICKUP_TIME_PROPERTY) && Objects.equals(this.pickupTime, pickupTime)){ + return this; + } + handleUpdate(PICKUP_TIME_PROPERTY, getPickupTime(), pickupTime); + this.pickupTime = pickupTime; + return this; + } + + public FreightQuote updateQuotedAt(LocalDateTime quotedAt){ + if(isPropertyLoaded(QUOTED_AT_PROPERTY) && Objects.equals(this.quotedAt, quotedAt)){ + return this; + } + handleUpdate(QUOTED_AT_PROPERTY, getQuotedAt(), quotedAt); + this.quotedAt = quotedAt; + return this; + } + + public FreightQuote updateInstructions(String instructions){ + instructions = (instructions == null ? null : instructions.trim()); + if(isPropertyLoaded(INSTRUCTIONS_PROPERTY) && Objects.equals(this.instructions, instructions)){ + return this; + } + handleUpdate(INSTRUCTIONS_PROPERTY, getInstructions(), instructions); + this.instructions = instructions; + return this; + } + + + public static FreightQuote refer(Long id){ + FreightQuote refer = new FreightQuote(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public FreightQuote comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "reference": this.reference = (value == null ? null : ((String)value).trim()); break; + + case "amount": this.amount = (BigDecimal) value; break; + + case "shipment_number": this.shipmentNumber = (Long) value; break; + + case "package_count": this.packageCount = (Integer) value; break; + + case "delivery_date": this.deliveryDate = (LocalDate) value; break; + + case "pickup_time": this.pickupTime = (LocalTime) value; break; + + case "quoted_at": this.quotedAt = (LocalDateTime) value; break; + + case "instructions": this.instructions = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "reference": return this.reference; + case "amount": return this.amount; + case "shipment_number": return this.shipmentNumber; + case "package_count": return this.packageCount; + case "delivery_date": return this.deliveryDate; + case "pickup_time": return this.pickupTime; + case "quoted_at": return this.quotedAt; + case "instructions": return this.instructions; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "reference": return this.reference; + case "amount": return this.amount; + case "shipmentNumber": return this.shipmentNumber; + case "packageCount": return this.packageCount; + case "deliveryDate": return this.deliveryDate; + case "pickupTime": return this.pickupTime; + case "quotedAt": return this.quotedAt; + case "instructions": return this.instructions; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java new file mode 100644 index 000000000..c716fce7d --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java @@ -0,0 +1,134 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class FreightQuoteChecker implements Checker{ + + public String type(){ + return FreightQuote.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, FreightQuote freightQuote, ObjectLocation _parentLocation){ + if(needCheck(_context, freightQuote)){ + markAsChecked(_context, freightQuote); + doCheck(_context, freightQuote, _parentLocation); + } + } + + public void doCheck(UserContext _context, FreightQuote freightQuote, ObjectLocation _parentLocation){ + if((freightQuote == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, freightQuote); + if(freightQuote.needPersist()){ + } + if(freightQuote.newItem()){ + }else if(freightQuote.updateItem()){ + if(!freightQuote.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("reference")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "reference"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "amount"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("shipment_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "shipment_number"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("package_count")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "package_count"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("delivery_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "delivery_date"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("pickup_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "pickup_time"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("quoted_at")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quoted_at"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("instructions")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "instructions"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, freightQuote.getProperty(FreightQuote.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkReference(_context, freightQuote.getProperty(FreightQuote.REFERENCE_PROPERTY), newLocation(_parentLocation, "reference")); + checkAmount(_context, freightQuote.getProperty(FreightQuote.AMOUNT_PROPERTY), newLocation(_parentLocation, "amount")); + checkShipmentNumber(_context, freightQuote.getProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY), newLocation(_parentLocation, "shipment_number")); + checkPackageCount(_context, freightQuote.getProperty(FreightQuote.PACKAGE_COUNT_PROPERTY), newLocation(_parentLocation, "package_count")); + checkDeliveryDate(_context, freightQuote.getProperty(FreightQuote.DELIVERY_DATE_PROPERTY), newLocation(_parentLocation, "delivery_date")); + checkPickupTime(_context, freightQuote.getProperty(FreightQuote.PICKUP_TIME_PROPERTY), newLocation(_parentLocation, "pickup_time")); + checkQuotedAt(_context, freightQuote.getProperty(FreightQuote.QUOTED_AT_PROPERTY), newLocation(_parentLocation, "quoted_at")); + checkInstructions(_context, freightQuote.getProperty(FreightQuote.INSTRUCTIONS_PROPERTY), newLocation(_parentLocation, "instructions")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkReference(UserContext _context, String reference, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, reference); + if((reference == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, reference); + + } + public void checkAmount(UserContext _context, BigDecimal amount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, amount); + if((amount == null)){ + return; + } + } + public void checkShipmentNumber(UserContext _context, Long shipmentNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, shipmentNumber); + if((shipmentNumber == null)){ + return; + } + } + public void checkPackageCount(UserContext _context, Integer packageCount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, packageCount); + if((packageCount == null)){ + return; + } + } + public void checkDeliveryDate(UserContext _context, LocalDate deliveryDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, deliveryDate); + if((deliveryDate == null)){ + return; + } + } + public void checkPickupTime(UserContext _context, LocalTime pickupTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, pickupTime); + if((pickupTime == null)){ + return; + } + } + public void checkQuotedAt(UserContext _context, LocalDateTime quotedAt, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quotedAt); + if((quotedAt == null)){ + return; + } + } + public void checkInstructions(UserContext _context, String instructions, ObjectLocation _parentLocation){ + if((instructions == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, instructions); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java new file mode 100644 index 000000000..04f2c5ee5 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java @@ -0,0 +1,106 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.function.Function; + +public class FreightQuoteExpression extends ExpressionAdaptor implements BaseEntityExpression { + public FreightQuoteExpression(Expression expression){ + super(expression); + } + + public FreightQuoteExpression(Expression expression, Function function){ + super(expression, function); + } + + public FreightQuoteExpression updateId(Long id){ + return new FreightQuoteExpression(this, $it -> {((FreightQuote)$it).__internalSet("id", id); return this;}); + } + + public FreightQuoteExpression save(UserContext userContext){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).auditAs("Saved by Expression").save(userContext)); + } + + public FreightQuoteExpression save(String intent, UserContext userContext){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", FreightQuote::getPlatform)); + } + + public FreightQuoteExpression updatePlatform(Platform platform){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePlatform(platform)); + } + + public Expression getReference(){ + return loaded("reference", "getReference", FreightQuote::getReference); + } + public FreightQuoteExpression updateReference(String reference){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateReference(reference)); + } + + public Expression getAmount(){ + return loaded("amount", "getAmount", FreightQuote::getAmount); + } + public FreightQuoteExpression updateAmount(BigDecimal amount){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateAmount(amount)); + } + + public Expression getShipmentNumber(){ + return loaded("shipment_number", "getShipmentNumber", FreightQuote::getShipmentNumber); + } + public FreightQuoteExpression updateShipmentNumber(Long shipmentNumber){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateShipmentNumber(shipmentNumber)); + } + + public Expression getPackageCount(){ + return loaded("package_count", "getPackageCount", FreightQuote::getPackageCount); + } + public FreightQuoteExpression updatePackageCount(Integer packageCount){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePackageCount(packageCount)); + } + + public Expression getDeliveryDate(){ + return loaded("delivery_date", "getDeliveryDate", FreightQuote::getDeliveryDate); + } + public FreightQuoteExpression updateDeliveryDate(LocalDate deliveryDate){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateDeliveryDate(deliveryDate)); + } + + public Expression getPickupTime(){ + return loaded("pickup_time", "getPickupTime", FreightQuote::getPickupTime); + } + public FreightQuoteExpression updatePickupTime(LocalTime pickupTime){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePickupTime(pickupTime)); + } + + public Expression getQuotedAt(){ + return loaded("quoted_at", "getQuotedAt", FreightQuote::getQuotedAt); + } + public FreightQuoteExpression updateQuotedAt(LocalDateTime quotedAt){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateQuotedAt(quotedAt)); + } + + public Expression getInstructions(){ + return loaded("instructions", "getInstructions", FreightQuote::getInstructions); + } + public FreightQuoteExpression updateInstructions(String instructions){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateInstructions(instructions)); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java new file mode 100644 index 000000000..0f5131b45 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java @@ -0,0 +1,25 @@ + +package com.example.freightquotesettlement.freightquote; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class FreightQuoteListExpression extends SmartListExpression { + public FreightQuoteListExpression(Expression> expression){ + super(expression); + } + + public FreightQuoteListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public FreightQuoteExpression first() { + return new FreightQuoteExpression(super.first()); + } + + public FreightQuoteExpression get(int index) { + return new FreightQuoteExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java new file mode 100644 index 000000000..e19feac84 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java @@ -0,0 +1,1774 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.Q; +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; +import java.util.Objects; + +public class FreightQuoteRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public FreightQuoteRequest(Class returnType){ + this(returnType, () -> (T) new FreightQuote()); + } + + protected FreightQuoteRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public FreightQuoteRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public FreightQuoteRequest copy(){ + return (FreightQuoteRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new FreightQuoteRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public FreightQuoteRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public FreightQuoteRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public FreightQuoteRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public FreightQuoteRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public FreightQuoteRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public FreightQuoteRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public FreightQuoteRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public FreightQuoteRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public FreightQuoteRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public FreightQuoteRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (FreightQuoteRequest)super.appendSearchCriteria(searchCriteria); + } + + public FreightQuoteRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public FreightQuoteRequest matchingAnyOf(FreightQuoteRequest freightQuote){ + super.internalMatchAny(freightQuote); + return this; + } + + public FreightQuoteRequest matchingIdsOf(FreightQuoteRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + FreightQuote.ID_PROPERTY, request, FreightQuote.ID_PROPERTY)); + } + + public FreightQuoteRequest enhanceChildrenIfNeeded(){ + return this; + } + + public FreightQuoteRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public FreightQuoteRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public FreightQuoteRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); + } + + public FreightQuoteRequest selectSelfFields(){ + return selectSelf(); + } + + public FreightQuoteRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(FreightQuote.ID_PROPERTY); + selectProperty(FreightQuote.PLATFORM_PROPERTY); + selectProperty(FreightQuote.REFERENCE_PROPERTY); + selectProperty(FreightQuote.AMOUNT_PROPERTY); + selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); + selectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); + selectProperty(FreightQuote.PICKUP_TIME_PROPERTY); + selectProperty(FreightQuote.QUOTED_AT_PROPERTY); + selectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); + selectProperty(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); + } + + public FreightQuoteRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); + } + + + public FreightQuoteRequest selectId(){ + selectProperty(FreightQuote.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectId(){ + unselectProperty(FreightQuote.ID_PROPERTY); + return this; + } + public FreightQuoteRequest selectPlatformIdOnly(){ + selectProperty(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public FreightQuoteRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(FreightQuote.PLATFORM_PROPERTY); + enhanceRelation(FreightQuote.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, FreightQuote.PLATFORM_PROPERTY)); + return this; + } + + public FreightQuoteRequest unselectPlatform(){ + unselectProperty(FreightQuote.PLATFORM_PROPERTY); + return this; + } + public FreightQuoteRequest selectReference(){ + selectProperty(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + /** + * fill the reference with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS reference) to fetch reference property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectReference(){ + unselectProperty(FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest selectAmount(){ + selectProperty(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + /** + * fill the amount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS amount) to fetch amount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the amount with customized aggrFunction, TEAQL uses ({aggrFunction}(amount) AS amount to fetch amount property. + * @param aggrFunction aggrFunction + */ + public FreightQuoteRequest selectAmount(AggrFunction aggrFunction){ + selectProperty(FreightQuote.AMOUNT_PROPERTY, aggrFunction); + return this; + } + + + public FreightQuoteRequest unselectAmount(){ + unselectProperty(FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest selectShipmentNumber(){ + selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + /** + * fill the shipmentNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS shipmentNumber) to fetch shipmentNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the shipmentNumber with customized aggrFunction, TEAQL uses ({aggrFunction}(shipmentNumber) AS shipmentNumber to fetch shipmentNumber property. + * @param aggrFunction aggrFunction + */ + public FreightQuoteRequest selectShipmentNumber(AggrFunction aggrFunction){ + selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY, aggrFunction); + return this; + } + + + public FreightQuoteRequest unselectShipmentNumber(){ + unselectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest selectPackageCount(){ + selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + /** + * fill the packageCount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS packageCount) to fetch packageCount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the packageCount with customized aggrFunction, TEAQL uses ({aggrFunction}(packageCount) AS packageCount to fetch packageCount property. + * @param aggrFunction aggrFunction + */ + public FreightQuoteRequest selectPackageCount(AggrFunction aggrFunction){ + selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY, aggrFunction); + return this; + } + + + public FreightQuoteRequest unselectPackageCount(){ + unselectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest selectDeliveryDate(){ + selectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + /** + * fill the deliveryDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS deliveryDate) to fetch deliveryDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectDeliveryDate(){ + unselectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + public FreightQuoteRequest selectPickupTime(){ + selectProperty(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + /** + * fill the pickupTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS pickupTime) to fetch pickupTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectPickupTime(){ + unselectProperty(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + public FreightQuoteRequest selectQuotedAt(){ + selectProperty(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + /** + * fill the quotedAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quotedAt) to fetch quotedAt property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectQuotedAt(){ + unselectProperty(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + public FreightQuoteRequest selectInstructions(){ + selectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + /** + * fill the instructions with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS instructions) to fetch instructions property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectInstructions(){ + unselectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest selectVersion(){ + selectProperty(FreightQuote.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectVersion(){ + unselectProperty(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.ID_PROPERTY, operator, values); + } + + public FreightQuoteRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public FreightQuoteRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public FreightQuoteRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public FreightQuoteRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public FreightQuoteRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public FreightQuoteRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public FreightQuoteRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public FreightQuoteRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.PLATFORM_PROPERTY, operator, values); + } + + public FreightQuoteRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public FreightQuoteRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(FreightQuote.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public FreightQuoteRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(FreightQuote.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public FreightQuoteRequest filterByReference(String... reference){ + if (reference == null || reference.length == 0) { + throw new IllegalArgumentException("filterByReference parameter reference cannot be empty"); + } + return appendSearchCriteria(createReferenceCriteria(Operator.EQUAL, (Object[])reference)); + } + + public FreightQuoteRequest withReference(Operator operator, Object... values){ + return appendSearchCriteria(createReferenceCriteria(operator, values)); + } + + public FreightQuoteRequest withReferenceIsUnknown(){ + return withReference(Operator.IS_NULL); + } + + public FreightQuoteRequest withReferenceIsKnown(){ + return withReference(Operator.IS_NOT_NULL); + } + + public SearchCriteria createReferenceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.REFERENCE_PROPERTY, operator, values); + } + + public FreightQuoteRequest withReferenceIsNot(String reference){ + return withReference(Operator.NOT_EQUAL, reference); + } + + public FreightQuoteRequest withReferenceIn(String... reference){ + return withReference(Operator.IN, (Object[])reference); + } + + public FreightQuoteRequest withReferenceNotIn(String... reference){ + return withReference(Operator.NOT_IN, (Object[])reference); + } + public FreightQuoteRequest withReferenceGreaterThan(String reference){ + return withReference(Operator.GREATER_THAN, reference); + } + + public FreightQuoteRequest withReferenceGreaterThanOrEqualTo(String reference){ + return withReference(Operator.GREATER_THAN_OR_EQUAL, reference); + } + + public FreightQuoteRequest withReferenceLessThan(String reference){ + return withReference(Operator.LESS_THAN, reference); + } + + public FreightQuoteRequest withReferenceLessThanOrEqualTo(String reference){ + return withReference(Operator.LESS_THAN_OR_EQUAL, reference); + } + + public FreightQuoteRequest withReferenceBetween(String startOfReference, String endOfReference){ + return withReference(Operator.BETWEEN, startOfReference, endOfReference); + } + public FreightQuoteRequest withReferenceStartingWith(String reference){ + return withReference(Operator.BEGIN_WITH, reference); + } + public FreightQuoteRequest withReferenceContaining(String reference){ + return withReference(Operator.CONTAIN, reference); + } + + public FreightQuoteRequest withReferenceNotContaining(String reference){ + return withReference(Operator.NOT_CONTAIN, reference); + } + + public FreightQuoteRequest withReferenceNotStartingWith(String reference){ + return withReference(Operator.NOT_BEGIN_WITH, reference); + } + + public FreightQuoteRequest withReferenceEndingWith(String reference){ + return withReference(Operator.END_WITH, reference); + } + + public FreightQuoteRequest withReferenceNotEndingWith(String reference){ + return withReference(Operator.NOT_END_WITH, reference); + } + + public FreightQuoteRequest withReferenceIs(String reference){ + return withReference(Operator.EQUAL, reference); + } + + public FreightQuoteRequest withReferenceSoundingLike(String reference){ + return withReference(Operator.SOUNDS_LIKE, reference); + } + + + + public FreightQuoteRequest filterByAmount(BigDecimal... amount){ + if (amount == null || amount.length == 0) { + throw new IllegalArgumentException("filterByAmount parameter amount cannot be empty"); + } + return appendSearchCriteria(createAmountCriteria(Operator.EQUAL, (Object[])amount)); + } + + public FreightQuoteRequest withAmount(Operator operator, Object... values){ + return appendSearchCriteria(createAmountCriteria(operator, values)); + } + + public FreightQuoteRequest withAmountIsUnknown(){ + return withAmount(Operator.IS_NULL); + } + + public FreightQuoteRequest withAmountIsKnown(){ + return withAmount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAmountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.AMOUNT_PROPERTY, operator, values); + } + + public FreightQuoteRequest withAmountIs(BigDecimal amount){ + return withAmount(Operator.EQUAL, amount); + } + + public FreightQuoteRequest withAmountIsNot(BigDecimal amount){ + return withAmount(Operator.NOT_EQUAL, amount); + } + + public FreightQuoteRequest withAmountIn(BigDecimal... amount){ + return withAmount(Operator.IN, (Object[])amount); + } + + public FreightQuoteRequest withAmountNotIn(BigDecimal... amount){ + return withAmount(Operator.NOT_IN, (Object[])amount); + } + public FreightQuoteRequest withAmountGreaterThan(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN, amount); + } + + public FreightQuoteRequest withAmountGreaterThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN_OR_EQUAL, amount); + } + + public FreightQuoteRequest withAmountLessThan(BigDecimal amount){ + return withAmount(Operator.LESS_THAN, amount); + } + + public FreightQuoteRequest withAmountLessThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.LESS_THAN_OR_EQUAL, amount); + } + + public FreightQuoteRequest withAmountBetween(BigDecimal startOfAmount, BigDecimal endOfAmount){ + return withAmount(Operator.BETWEEN, startOfAmount, endOfAmount); + } + + + + public FreightQuoteRequest filterByShipmentNumber(Long... shipmentNumber){ + if (shipmentNumber == null || shipmentNumber.length == 0) { + throw new IllegalArgumentException("filterByShipmentNumber parameter shipmentNumber cannot be empty"); + } + return appendSearchCriteria(createShipmentNumberCriteria(Operator.EQUAL, (Object[])shipmentNumber)); + } + + public FreightQuoteRequest withShipmentNumber(Operator operator, Object... values){ + return appendSearchCriteria(createShipmentNumberCriteria(operator, values)); + } + + public FreightQuoteRequest withShipmentNumberIsUnknown(){ + return withShipmentNumber(Operator.IS_NULL); + } + + public FreightQuoteRequest withShipmentNumberIsKnown(){ + return withShipmentNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createShipmentNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.SHIPMENT_NUMBER_PROPERTY, operator, values); + } + + public FreightQuoteRequest withShipmentNumberIs(Long shipmentNumber){ + return withShipmentNumber(Operator.EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberIsNot(Long shipmentNumber){ + return withShipmentNumber(Operator.NOT_EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberIn(Long... shipmentNumber){ + return withShipmentNumber(Operator.IN, (Object[])shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberNotIn(Long... shipmentNumber){ + return withShipmentNumber(Operator.NOT_IN, (Object[])shipmentNumber); + } + public FreightQuoteRequest withShipmentNumberGreaterThan(Long shipmentNumber){ + return withShipmentNumber(Operator.GREATER_THAN, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberGreaterThanOrEqualTo(Long shipmentNumber){ + return withShipmentNumber(Operator.GREATER_THAN_OR_EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberLessThan(Long shipmentNumber){ + return withShipmentNumber(Operator.LESS_THAN, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberLessThanOrEqualTo(Long shipmentNumber){ + return withShipmentNumber(Operator.LESS_THAN_OR_EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberBetween(Long startOfShipmentNumber, Long endOfShipmentNumber){ + return withShipmentNumber(Operator.BETWEEN, startOfShipmentNumber, endOfShipmentNumber); + } + + + + public FreightQuoteRequest filterByPackageCount(Integer... packageCount){ + if (packageCount == null || packageCount.length == 0) { + throw new IllegalArgumentException("filterByPackageCount parameter packageCount cannot be empty"); + } + return appendSearchCriteria(createPackageCountCriteria(Operator.EQUAL, (Object[])packageCount)); + } + + public FreightQuoteRequest withPackageCount(Operator operator, Object... values){ + return appendSearchCriteria(createPackageCountCriteria(operator, values)); + } + + public FreightQuoteRequest withPackageCountIsUnknown(){ + return withPackageCount(Operator.IS_NULL); + } + + public FreightQuoteRequest withPackageCountIsKnown(){ + return withPackageCount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPackageCountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.PACKAGE_COUNT_PROPERTY, operator, values); + } + + public FreightQuoteRequest withPackageCountIs(Integer packageCount){ + return withPackageCount(Operator.EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountIsNot(Integer packageCount){ + return withPackageCount(Operator.NOT_EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountIn(Integer... packageCount){ + return withPackageCount(Operator.IN, (Object[])packageCount); + } + + public FreightQuoteRequest withPackageCountNotIn(Integer... packageCount){ + return withPackageCount(Operator.NOT_IN, (Object[])packageCount); + } + public FreightQuoteRequest withPackageCountGreaterThan(Integer packageCount){ + return withPackageCount(Operator.GREATER_THAN, packageCount); + } + + public FreightQuoteRequest withPackageCountGreaterThanOrEqualTo(Integer packageCount){ + return withPackageCount(Operator.GREATER_THAN_OR_EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountLessThan(Integer packageCount){ + return withPackageCount(Operator.LESS_THAN, packageCount); + } + + public FreightQuoteRequest withPackageCountLessThanOrEqualTo(Integer packageCount){ + return withPackageCount(Operator.LESS_THAN_OR_EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountBetween(Integer startOfPackageCount, Integer endOfPackageCount){ + return withPackageCount(Operator.BETWEEN, startOfPackageCount, endOfPackageCount); + } + + + + public FreightQuoteRequest filterByDeliveryDate(LocalDate... deliveryDate){ + if (deliveryDate == null || deliveryDate.length == 0) { + throw new IllegalArgumentException("filterByDeliveryDate parameter deliveryDate cannot be empty"); + } + return appendSearchCriteria(createDeliveryDateCriteria(Operator.EQUAL, (Object[])deliveryDate)); + } + + public FreightQuoteRequest withDeliveryDate(Operator operator, Object... values){ + return appendSearchCriteria(createDeliveryDateCriteria(operator, values)); + } + + public FreightQuoteRequest withDeliveryDateIsUnknown(){ + return withDeliveryDate(Operator.IS_NULL); + } + + public FreightQuoteRequest withDeliveryDateIsKnown(){ + return withDeliveryDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDeliveryDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.DELIVERY_DATE_PROPERTY, operator, values); + } + + public FreightQuoteRequest withDeliveryDateIs(LocalDate deliveryDate){ + return withDeliveryDate(Operator.EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateIsNot(LocalDate deliveryDate){ + return withDeliveryDate(Operator.NOT_EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateIn(LocalDate... deliveryDate){ + return withDeliveryDate(Operator.IN, (Object[])deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateNotIn(LocalDate... deliveryDate){ + return withDeliveryDate(Operator.NOT_IN, (Object[])deliveryDate); + } + public FreightQuoteRequest withDeliveryDateGreaterThan(LocalDate deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateGreaterThanOrEqualTo(LocalDate deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN_OR_EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateLessThan(LocalDate deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateLessThanOrEqualTo(LocalDate deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN_OR_EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateBetween(LocalDate startOfDeliveryDate, LocalDate endOfDeliveryDate){ + return withDeliveryDate(Operator.BETWEEN, startOfDeliveryDate, endOfDeliveryDate); + } + public FreightQuoteRequest withDeliveryDateBefore(LocalDate deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateBefore(Date deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateAfter(LocalDate deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateAfter(Date deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateBetween(Date startOfDeliveryDate, Date endOfDeliveryDate){ + return withDeliveryDate(Operator.BETWEEN, startOfDeliveryDate, endOfDeliveryDate); + } + + + + + public FreightQuoteRequest filterByPickupTime(LocalTime... pickupTime){ + if (pickupTime == null || pickupTime.length == 0) { + throw new IllegalArgumentException("filterByPickupTime parameter pickupTime cannot be empty"); + } + return appendSearchCriteria(createPickupTimeCriteria(Operator.EQUAL, (Object[])pickupTime)); + } + + public FreightQuoteRequest withPickupTime(Operator operator, Object... values){ + return appendSearchCriteria(createPickupTimeCriteria(operator, values)); + } + + public FreightQuoteRequest withPickupTimeIsUnknown(){ + return withPickupTime(Operator.IS_NULL); + } + + public FreightQuoteRequest withPickupTimeIsKnown(){ + return withPickupTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPickupTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.PICKUP_TIME_PROPERTY, operator, values); + } + + public FreightQuoteRequest withPickupTimeIs(LocalTime pickupTime){ + return withPickupTime(Operator.EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeIsNot(LocalTime pickupTime){ + return withPickupTime(Operator.NOT_EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeIn(LocalTime... pickupTime){ + return withPickupTime(Operator.IN, (Object[])pickupTime); + } + + public FreightQuoteRequest withPickupTimeNotIn(LocalTime... pickupTime){ + return withPickupTime(Operator.NOT_IN, (Object[])pickupTime); + } + public FreightQuoteRequest withPickupTimeGreaterThan(LocalTime pickupTime){ + return withPickupTime(Operator.GREATER_THAN, pickupTime); + } + + public FreightQuoteRequest withPickupTimeGreaterThanOrEqualTo(LocalTime pickupTime){ + return withPickupTime(Operator.GREATER_THAN_OR_EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeLessThan(LocalTime pickupTime){ + return withPickupTime(Operator.LESS_THAN, pickupTime); + } + + public FreightQuoteRequest withPickupTimeLessThanOrEqualTo(LocalTime pickupTime){ + return withPickupTime(Operator.LESS_THAN_OR_EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeBetween(LocalTime startOfPickupTime, LocalTime endOfPickupTime){ + return withPickupTime(Operator.BETWEEN, startOfPickupTime, endOfPickupTime); + } + + + public FreightQuoteRequest filterByQuotedAt(LocalDateTime... quotedAt){ + if (quotedAt == null || quotedAt.length == 0) { + throw new IllegalArgumentException("filterByQuotedAt parameter quotedAt cannot be empty"); + } + return appendSearchCriteria(createQuotedAtCriteria(Operator.EQUAL, (Object[])quotedAt)); + } + + public FreightQuoteRequest withQuotedAt(Operator operator, Object... values){ + return appendSearchCriteria(createQuotedAtCriteria(operator, values)); + } + + public FreightQuoteRequest withQuotedAtIsUnknown(){ + return withQuotedAt(Operator.IS_NULL); + } + + public FreightQuoteRequest withQuotedAtIsKnown(){ + return withQuotedAt(Operator.IS_NOT_NULL); + } + + public SearchCriteria createQuotedAtCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.QUOTED_AT_PROPERTY, operator, values); + } + + public FreightQuoteRequest withQuotedAtIs(LocalDateTime quotedAt){ + return withQuotedAt(Operator.EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtIsNot(LocalDateTime quotedAt){ + return withQuotedAt(Operator.NOT_EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtIn(LocalDateTime... quotedAt){ + return withQuotedAt(Operator.IN, (Object[])quotedAt); + } + + public FreightQuoteRequest withQuotedAtNotIn(LocalDateTime... quotedAt){ + return withQuotedAt(Operator.NOT_IN, (Object[])quotedAt); + } + public FreightQuoteRequest withQuotedAtGreaterThan(LocalDateTime quotedAt){ + return withQuotedAt(Operator.GREATER_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtGreaterThanOrEqualTo(LocalDateTime quotedAt){ + return withQuotedAt(Operator.GREATER_THAN_OR_EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtLessThan(LocalDateTime quotedAt){ + return withQuotedAt(Operator.LESS_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtLessThanOrEqualTo(LocalDateTime quotedAt){ + return withQuotedAt(Operator.LESS_THAN_OR_EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtBetween(LocalDateTime startOfQuotedAt, LocalDateTime endOfQuotedAt){ + return withQuotedAt(Operator.BETWEEN, startOfQuotedAt, endOfQuotedAt); + } + public FreightQuoteRequest withQuotedAtBefore(LocalDateTime quotedAt){ + return withQuotedAt(Operator.LESS_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtBefore(Date quotedAt){ + return withQuotedAt(Operator.LESS_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtAfter(LocalDateTime quotedAt){ + return withQuotedAt(Operator.GREATER_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtAfter(Date quotedAt){ + return withQuotedAt(Operator.GREATER_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtBetween(Date startOfQuotedAt, Date endOfQuotedAt){ + return withQuotedAt(Operator.BETWEEN, startOfQuotedAt, endOfQuotedAt); + } + + + + + public FreightQuoteRequest filterByInstructions(String... instructions){ + if (instructions == null || instructions.length == 0) { + throw new IllegalArgumentException("filterByInstructions parameter instructions cannot be empty"); + } + return appendSearchCriteria(createInstructionsCriteria(Operator.EQUAL, (Object[])instructions)); + } + + public FreightQuoteRequest withInstructions(Operator operator, Object... values){ + return appendSearchCriteria(createInstructionsCriteria(operator, values)); + } + + public FreightQuoteRequest withInstructionsIsUnknown(){ + return withInstructions(Operator.IS_NULL); + } + + public FreightQuoteRequest withInstructionsIsKnown(){ + return withInstructions(Operator.IS_NOT_NULL); + } + + public SearchCriteria createInstructionsCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.INSTRUCTIONS_PROPERTY, operator, values); + } + + public FreightQuoteRequest withInstructionsIsNot(String instructions){ + return withInstructions(Operator.NOT_EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsIn(String... instructions){ + return withInstructions(Operator.IN, (Object[])instructions); + } + + public FreightQuoteRequest withInstructionsNotIn(String... instructions){ + return withInstructions(Operator.NOT_IN, (Object[])instructions); + } + public FreightQuoteRequest withInstructionsGreaterThan(String instructions){ + return withInstructions(Operator.GREATER_THAN, instructions); + } + + public FreightQuoteRequest withInstructionsGreaterThanOrEqualTo(String instructions){ + return withInstructions(Operator.GREATER_THAN_OR_EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsLessThan(String instructions){ + return withInstructions(Operator.LESS_THAN, instructions); + } + + public FreightQuoteRequest withInstructionsLessThanOrEqualTo(String instructions){ + return withInstructions(Operator.LESS_THAN_OR_EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsBetween(String startOfInstructions, String endOfInstructions){ + return withInstructions(Operator.BETWEEN, startOfInstructions, endOfInstructions); + } + public FreightQuoteRequest withInstructionsStartingWith(String instructions){ + return withInstructions(Operator.BEGIN_WITH, instructions); + } + public FreightQuoteRequest withInstructionsContaining(String instructions){ + return withInstructions(Operator.CONTAIN, instructions); + } + + public FreightQuoteRequest withInstructionsNotContaining(String instructions){ + return withInstructions(Operator.NOT_CONTAIN, instructions); + } + + public FreightQuoteRequest withInstructionsNotStartingWith(String instructions){ + return withInstructions(Operator.NOT_BEGIN_WITH, instructions); + } + + public FreightQuoteRequest withInstructionsEndingWith(String instructions){ + return withInstructions(Operator.END_WITH, instructions); + } + + public FreightQuoteRequest withInstructionsNotEndingWith(String instructions){ + return withInstructions(Operator.NOT_END_WITH, instructions); + } + + public FreightQuoteRequest withInstructionsIs(String instructions){ + return withInstructions(Operator.EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsSoundingLike(String instructions){ + return withInstructions(Operator.SOUNDS_LIKE, instructions); + } + + + + public FreightQuoteRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public FreightQuoteRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public FreightQuoteRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public FreightQuoteRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.VERSION_PROPERTY, operator, values); + } + + public FreightQuoteRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public FreightQuoteRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public FreightQuoteRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public FreightQuoteRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public FreightQuoteRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public FreightQuoteRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public FreightQuoteRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public FreightQuoteRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public FreightQuoteRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public FreightQuoteRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public FreightQuoteRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public FreightQuoteRequest minAmount(){ + return minAmountAs(prefix("minOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest minAmountAs(String retName){ + super.min(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest maxAmount(){ + return maxAmountAs(prefix("maxOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest maxAmountAs(String retName){ + super.max(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sumAmount(){ + return sumAmountAs(prefix("sumOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest sumAmountAs(String retName){ + super.sum(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest avgAmount(){ + return avgAmountAs(prefix("avgOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest avgAmountAs(String retName){ + super.avg(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest standardDeviationAmount(){ + return standardDeviationAmountAs(prefix("standardDeviationOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest standardDeviationAmountAs(String retName){ + super.standardDeviation(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest squareRootOfPopulationStandardDeviationAmount(){ + return squareRootOfPopulationStandardDeviationAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest squareRootOfPopulationStandardDeviationAmountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sampleVarianceAmount(){ + return sampleVarianceAmountAs(prefix("sampleVarianceOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest sampleVarianceAmountAs(String retName){ + super.sampleVariance(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest samplePopulationVarianceAmount(){ + return samplePopulationVarianceAmountAs(prefix("samplePopulationVarianceOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest samplePopulationVarianceAmountAs(String retName){ + super.samplePopulationVariance(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest minShipmentNumber(){ + return minShipmentNumberAs(prefix("minOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest minShipmentNumberAs(String retName){ + super.min(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest maxShipmentNumber(){ + return maxShipmentNumberAs(prefix("maxOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest maxShipmentNumberAs(String retName){ + super.max(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest sumShipmentNumber(){ + return sumShipmentNumberAs(prefix("sumOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest sumShipmentNumberAs(String retName){ + super.sum(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest avgShipmentNumber(){ + return avgShipmentNumberAs(prefix("avgOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest avgShipmentNumberAs(String retName){ + super.avg(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest standardDeviationShipmentNumber(){ + return standardDeviationShipmentNumberAs(prefix("standardDeviationOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest standardDeviationShipmentNumberAs(String retName){ + super.standardDeviation(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest squareRootOfPopulationStandardDeviationShipmentNumber(){ + return squareRootOfPopulationStandardDeviationShipmentNumberAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest squareRootOfPopulationStandardDeviationShipmentNumberAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest sampleVarianceShipmentNumber(){ + return sampleVarianceShipmentNumberAs(prefix("sampleVarianceOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest sampleVarianceShipmentNumberAs(String retName){ + super.sampleVariance(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest samplePopulationVarianceShipmentNumber(){ + return samplePopulationVarianceShipmentNumberAs(prefix("samplePopulationVarianceOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest samplePopulationVarianceShipmentNumberAs(String retName){ + super.samplePopulationVariance(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest minPackageCount(){ + return minPackageCountAs(prefix("minOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest minPackageCountAs(String retName){ + super.min(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest maxPackageCount(){ + return maxPackageCountAs(prefix("maxOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest maxPackageCountAs(String retName){ + super.max(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sumPackageCount(){ + return sumPackageCountAs(prefix("sumOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest sumPackageCountAs(String retName){ + super.sum(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest avgPackageCount(){ + return avgPackageCountAs(prefix("avgOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest avgPackageCountAs(String retName){ + super.avg(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest standardDeviationPackageCount(){ + return standardDeviationPackageCountAs(prefix("standardDeviationOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest standardDeviationPackageCountAs(String retName){ + super.standardDeviation(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest squareRootOfPopulationStandardDeviationPackageCount(){ + return squareRootOfPopulationStandardDeviationPackageCountAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest squareRootOfPopulationStandardDeviationPackageCountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sampleVariancePackageCount(){ + return sampleVariancePackageCountAs(prefix("sampleVarianceOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest sampleVariancePackageCountAs(String retName){ + super.sampleVariance(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest samplePopulationVariancePackageCount(){ + return samplePopulationVariancePackageCountAs(prefix("samplePopulationVarianceOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest samplePopulationVariancePackageCountAs(String retName){ + super.samplePopulationVariance(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public FreightQuoteRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(FreightQuote.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + public FreightQuoteRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public FreightQuoteRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.ID_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public FreightQuoteRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.PLATFORM_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctReference(){ + return countDistinctReferenceAs("reference_distinct_count"); + } + + public FreightQuoteRequest countDistinctReferenceAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctAmount(){ + return countDistinctAmountAs("amount_distinct_count"); + } + + public FreightQuoteRequest countDistinctAmountAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctShipmentNumber(){ + return countDistinctShipmentNumberAs("shipment_number_distinct_count"); + } + + public FreightQuoteRequest countDistinctShipmentNumberAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctPackageCount(){ + return countDistinctPackageCountAs("package_count_distinct_count"); + } + + public FreightQuoteRequest countDistinctPackageCountAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctDeliveryDate(){ + return countDistinctDeliveryDateAs("delivery_date_distinct_count"); + } + + public FreightQuoteRequest countDistinctDeliveryDateAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctPickupTime(){ + return countDistinctPickupTimeAs("pickup_time_distinct_count"); + } + + public FreightQuoteRequest countDistinctPickupTimeAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctQuotedAt(){ + return countDistinctQuotedAtAs("quoted_at_distinct_count"); + } + + public FreightQuoteRequest countDistinctQuotedAtAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctInstructions(){ + return countDistinctInstructionsAs("instructions_distinct_count"); + } + + public FreightQuoteRequest countDistinctInstructionsAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public FreightQuoteRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest groupById(){ + groupBy(FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByIdAs(String retName){ + groupBy(retName, FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.ID_PROPERTY, function); + return this; + } + public FreightQuoteRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(FreightQuote.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public FreightQuoteRequest groupByPlatform(){ + groupBy(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPlatformAs(String retName){ + groupBy(retName, FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.PLATFORM_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByReference(){ + groupBy(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByReferenceAs(String retName){ + groupBy(retName, FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByReferenceWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.REFERENCE_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByAmount(){ + groupBy(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByAmountAs(String retName){ + groupBy(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByAmountWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.AMOUNT_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByShipmentNumber(){ + groupBy(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByShipmentNumberAs(String retName){ + groupBy(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByShipmentNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByPackageCount(){ + groupBy(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPackageCountAs(String retName){ + groupBy(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPackageCountWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.PACKAGE_COUNT_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByDeliveryDate(){ + groupBy(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByDeliveryDateAs(String retName){ + groupBy(retName, FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByDeliveryDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.DELIVERY_DATE_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByPickupTime(){ + groupBy(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPickupTimeAs(String retName){ + groupBy(retName, FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPickupTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.PICKUP_TIME_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByQuotedAt(){ + groupBy(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByQuotedAtAs(String retName){ + groupBy(retName, FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByQuotedAtWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.QUOTED_AT_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByInstructions(){ + groupBy(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByInstructionsAs(String retName){ + groupBy(retName, FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByInstructionsWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.INSTRUCTIONS_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByVersion(){ + groupBy(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByVersionAs(String retName){ + groupBy(retName, FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.VERSION_PROPERTY, function); + return this; + } + + + + public FreightQuoteRequest orderByIdAscending(){ + addOrderByAscending(FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByIdDescending(){ + addOrderByDescending(FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPlatformAscending(){ + addOrderByAscending(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPlatformDescending(){ + addOrderByDescending(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByReferenceAscending(){ + addOrderByAscending(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByReferenceDescending(){ + addOrderByDescending(FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest orderByReferenceAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByReferenceDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest orderByAmountAscending(){ + addOrderByAscending(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByAmountDescending(){ + addOrderByDescending(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByShipmentNumberAscending(){ + addOrderByAscending(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByShipmentNumberDescending(){ + addOrderByDescending(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPackageCountAscending(){ + addOrderByAscending(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPackageCountDescending(){ + addOrderByDescending(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByDeliveryDateAscending(){ + addOrderByAscending(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByDeliveryDateDescending(){ + addOrderByDescending(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPickupTimeAscending(){ + addOrderByAscending(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPickupTimeDescending(){ + addOrderByDescending(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByQuotedAtAscending(){ + addOrderByAscending(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByQuotedAtDescending(){ + addOrderByDescending(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByInstructionsAscending(){ + addOrderByAscending(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByInstructionsDescending(){ + addOrderByDescending(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest orderByInstructionsAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByInstructionsDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest orderByVersionAscending(){ + addOrderByAscending(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByVersionDescending(){ + addOrderByDescending(FreightQuote.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + + + + + + public FreightQuoteRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public FreightQuoteRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, FreightQuote.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, FreightQuote.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public FreightQuoteRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public FreightQuoteRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public FreightQuoteRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public FreightQuoteRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public FreightQuoteRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public FreightQuoteRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java new file mode 100644 index 000000000..d3f9a3cf4 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e43c5eed054b71b94131c0d8733d90a89b34235c2ba8726ec08f9f3687a87edf"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "freight_quote_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String FREIGHT_QUOTE_LIST_PROPERTY = "freight_quote_list"; + private String name; + + private SmartList freightQuoteList; + + public String getName(){ + return this.name; + } + + public SmartList getFreightQuoteList(){ + return this.freightQuoteList == null ? SmartList.unloaded() : this.freightQuoteList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addFreightQuote(FreightQuote freightQuote){ + if (freightQuote == null){ + return this; + } + + if(null == this.freightQuoteList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.freightQuoteList = teaqlUnloadedItems.map(value -> value); + } + + this.freightQuoteList.add(freightQuote); + freightQuote.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "freight_quote_list": this.freightQuoteList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "freight_quote_list": return this.freightQuoteList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java new file mode 100644 index 000000000..649f1cf3f --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getFreightQuoteList() != null && i < platform.getFreightQuoteList().size(); i++){ + FreightQuote freightQuote = platform.getFreightQuoteList().get(i); + new FreightQuoteChecker().checkAndFix(_context, freightQuote, newLocation(_parentLocation, "freight_quote_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java new file mode 100644 index 000000000..1cbee6f9a --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public FreightQuoteListExpression getFreightQuoteList(){ + return new FreightQuoteListExpression(loaded("freight_quote_list", "getFreightQuoteList", Platform::getFreightQuoteList)); + } + public PlatformExpression addFreightQuote(FreightQuote freightQuote){ + return new PlatformExpression(this, $it -> ((Platform)$it).addFreightQuote(freightQuote)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java new file mode 100644 index 000000000..bee3a3854 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.freightquotesettlement.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java new file mode 100644 index 000000000..28e42e082 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java @@ -0,0 +1,1079 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.Q; +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectFreightQuoteList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectFreightQuoteList(){ + return selectFreightQuoteListWith(Q.freightQuotes().selectSelf()); + } + + public PlatformRequest selectFreightQuoteListWith(FreightQuoteRequest freightQuoteList){ + enhanceRelation(Platform.FREIGHT_QUOTE_LIST_PROPERTY, freightQuoteList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectFreightQuoteListWith", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withFreightQuoteListMatching(FreightQuoteRequest freightQuoteRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, freightQuoteRequest, FreightQuote.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutFreightQuoteListMatching(FreightQuoteRequest freightQuoteRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, freightQuoteRequest, FreightQuote.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveFreightQuotes(){ + return withFreightQuoteListMatching(Q.freightQuotes().unlimited()); + } + + public PlatformRequest haveNoFreightQuotes(){ + return withoutFreightQuoteListMatching(Q.freightQuotes().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByFreightQuotesWithDetails(FreightQuoteRequest subRequest){ + aggregate(Platform.FREIGHT_QUOTE_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + return statsFromFreightQuotesAs(name, subRequest, false); + } + + public PlatformRequest statsFromFreightQuotesAs(String name, FreightQuoteRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromFreightQuotes(FreightQuoteRequest subRequest){ + return statsFromFreightQuotesAs(REFINEMENTS, subRequest); + } + public PlatformRequest countFreightQuotes(){ + addRelationCount("Count", Q.freightQuotes().unlimited(), FreightQuote.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countFreightQuotesAs(String name){ + addRelationCount(name, Q.freightQuotes().unlimited(), FreightQuote.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countFreightQuotesWith(String name, FreightQuoteRequest subRequest){ + addRelationCount(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotesWith", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minAmountOfFreightQuotes(){ + addRelationScalarAggregate("minAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minAmountOfFreightQuotesAs(String name){ + return minAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest minAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxAmountOfFreightQuotes(){ + addRelationScalarAggregate("maxAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxAmountOfFreightQuotesAs(String name){ + return maxAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest maxAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumAmountOfFreightQuotes(){ + addRelationScalarAggregate("sumAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumAmountOfFreightQuotesAs(String name){ + return sumAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sumAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgAmountOfFreightQuotes(){ + addRelationScalarAggregate("avgAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgAmountOfFreightQuotesAs(String name){ + return avgAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest avgAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationAmountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationAmountOfFreightQuotesAs(String name){ + return standardDeviationAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest standardDeviationAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPopAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(String name){ + return squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceAmountOfFreightQuotes(){ + addRelationScalarAggregate("varSampAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceAmountOfFreightQuotesAs(String name){ + return sampleVarianceAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sampleVarianceAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceAmountOfFreightQuotes(){ + addRelationScalarAggregate("varPopAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceAmountOfFreightQuotesAs(String name){ + return samplePopulationVarianceAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("minShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minShipmentNumberOfFreightQuotesAs(String name){ + return minShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest minShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("maxShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxShipmentNumberOfFreightQuotesAs(String name){ + return maxShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest maxShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("sumShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumShipmentNumberOfFreightQuotesAs(String name){ + return sumShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sumShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("avgShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgShipmentNumberOfFreightQuotesAs(String name){ + return avgShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest avgShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("stdDevShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationShipmentNumberOfFreightQuotesAs(String name){ + return standardDeviationShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest standardDeviationShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPopShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(String name){ + return squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("varSampShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotesAs(String name){ + return sampleVarianceShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("varPopShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotesAs(String name){ + return samplePopulationVarianceShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("minPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minPackageCountOfFreightQuotesAs(String name){ + return minPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest minPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("maxPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxPackageCountOfFreightQuotesAs(String name){ + return maxPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest maxPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("sumPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumPackageCountOfFreightQuotesAs(String name){ + return sumPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sumPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("avgPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgPackageCountOfFreightQuotesAs(String name){ + return avgPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest avgPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationPackageCountOfFreightQuotesAs(String name){ + return standardDeviationPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest standardDeviationPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPopPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(String name){ + return squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVariancePackageCountOfFreightQuotes(){ + addRelationScalarAggregate("varSampPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVariancePackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVariancePackageCountOfFreightQuotesAs(String name){ + return sampleVariancePackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sampleVariancePackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVariancePackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotes(){ + addRelationScalarAggregate("varPopPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVariancePackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotesAs(String name){ + return samplePopulationVariancePackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVariancePackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..3159e1a6b --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.freightquotesettlement.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/pom.xml b/examples/scalar-type-probe/java-app-console/pom.xml new file mode 100644 index 000000000..390d4008c --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + com.example + freight-quote-settlement + 0.0.1-SNAPSHOT + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + io.teaql + teaql-jackson + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.example + freight-quote-settlement-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.example.freightquotesettlement.App + + + + + + + + diff --git a/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/App.java b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/App.java new file mode 100644 index 000000000..fd660a3dd --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/App.java @@ -0,0 +1,99 @@ + +package com.example.freightquotesettlement; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/CustomUserContext.java b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/CustomUserContext.java new file mode 100644 index 000000000..7a0ed4a33 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.freightquotesettlement; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements FreightQuoteSettlementUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java new file mode 100644 index 000000000..0d1684f84 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java @@ -0,0 +1,140 @@ +package com.example.freightquotesettlement; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.teaql.core.checker.CheckException; +import io.teaql.core.checker.CheckResult; +import io.teaql.core.value.TeaQLNotLoadedException; +import io.teaql.jackson.TeaQLModule; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import java.math.BigDecimal; +import java.nio.file.Path; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.sqlite.SQLiteDataSource; + +public final class FreightQuoteShowcase { + private static final BigDecimal PRECISE = new BigDecimal("123456789012.3456789"); + private static final BigDecimal TOTAL = new BigDecimal("123456789012.6456789"); + private static final long FIRST_SHIPMENT = 9_007_199_254_740_993L; + private static final LocalDate DELIVERY_DATE = LocalDate.of(2026, 10, 31); + private static final LocalTime PICKUP_TIME = LocalTime.of(9, 30, 15, 123_456_000); + private static final LocalDateTime QUOTED_AT = DELIVERY_DATE.atTime(1, 45, 0, 123_000_000); + + private FreightQuoteShowcase() {} + + public static void main(String[] args) throws Exception { + if (args.length != 2 || !List.of("first", "restart").contains(args[1])) { + throw new IllegalArgumentException("Supply a database and first or restart"); + } + var database = new SQLiteDataSource(); + database.setUrl("jdbc:sqlite:" + Path.of(args[0]).toAbsolutePath()); + var jdbc = new JdbcSqlExecutor(database); + var app = new App(); + var runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(jdbc, database)), app.teaQLDatabase(jdbc, database)); + var context = new CustomUserContext(runtime); + context.ensureSchema(); + if ("first".equals(args[1])) registerQuotes(context); + + var rows = Q.freightQuotes().orderByAmountAscending().limit(4) + .comment("Compare outstanding freight bids").purpose("Rank freight bids numerically").executeForList(context); + require(rows.stream().map(FreightQuote::getReference).toList().equals(List.of("SEA-001", "SEA-002", "SEA-003")), + "Unexpected quote rank or count"); + require(rows.stream().map(row -> E.freightQuote(row).getAmount().eval()).toList() + .equals(List.of(new BigDecimal("0.10"), new BigDecimal("0.20"), PRECISE)), "Persisted amount or scale changed"); + require(rows.stream().map(FreightQuote::getShipmentNumber).toList() + .equals(List.of(FIRST_SHIPMENT, FIRST_SHIPMENT + 1, FIRST_SHIPMENT + 2)), "Shipment numbers changed"); + require(rows.stream().map(FreightQuote::getInstructions).toList() + .equals(Arrays.asList(null, "", "Hold for inspection")), "Null and empty instructions were conflated"); + var high = rows.get(2); + var match = Q.freightQuotes().withAmountIs(PRECISE).limit(1) + .comment("Find the revised offshore freight rate").purpose("Match an exact Decimal amount").executeForOne(context); + require(match != null && Objects.equals(match.getId(), high.getId()) && high.getVersion() == 2, + "Exact amount selected a different freight quote"); + var aggregate = Q.freightQuotesWithMinimalFields().sumAmountAs("total") + .comment("Sum the outstanding freight bids").purpose("Keep exact base-ten precision").aggregation(context).toList(); + require(aggregate.size() == 1 && TOTAL.equals(aggregate.get(0).get("total")), "The freight total changed"); + var mapper = new ObjectMapper().findAndRegisterModules().registerModule(new TeaQLModule(context)); + verifyWire(context, mapper, high); + + high.updateAmount(null); + try { + high.auditAs("Reject a quote without its required amount").save(context); + throw new AssertionError("Missing freight amount was persisted"); + } catch (CheckException failure) { + require(failure.getViolates().stream().anyMatch(violation -> + violation.getRuleId() == CheckResult.RuleId.REQUIRED && violation.getLocation().modelPath().equals("amount")), + "Missing freight amount was rejected at the wrong field"); + } + var retained = readQuote(context, "SEA-003"); + require(retained.getVersion() == 2 && PRECISE.equals(retained.getAmount()), "Rejected quote changed persisted state"); + System.out.println("FREIGHT_QUOTE=" + mapper.writeValueAsString(Map.of( + "phase", args[1], "quotes", rows.size(), "total", TOTAL.toPlainString(), + "precise", retained.getAmount().toPlainString(), "version", retained.getVersion(), + "invalidAmountRejected", true, "sparseInstructionsNotLoaded", true))); + } + + private static void registerQuotes(CustomUserContext context) { + var platform = Q.platforms().withIdIs(1L).limit(1).comment("Locate the dispatch platform") + .purpose("Attach quotes to the configured freight desk").executeForOne(context); + require(platform != null, "Missing dispatch platform"); + record Bid(String reference, String amount, int count, String instructions) {} + var bids = List.of(new Bid("SEA-001", "0.10", 2, null), new Bid("SEA-002", "0.20", 3, ""), + new Bid("SEA-003", "3.50", Integer.MAX_VALUE, "Hold for inspection")); + for (int index = 0; index < bids.size(); index++) { + var bid = bids.get(index); + var quote = Q.freightQuotes().comment("Prepare a freight quote") + .purpose("Price the shipment for its delivery window").newEntity(context); + quote.updatePlatform(platform).updateReference(bid.reference()).updateAmount(new BigDecimal(bid.amount())) + .updateShipmentNumber(FIRST_SHIPMENT + index).updatePackageCount(bid.count()) + .updateDeliveryDate(DELIVERY_DATE).updatePickupTime(PICKUP_TIME).updateQuotedAt(QUOTED_AT) + .updateInstructions(bid.instructions()); + quote.auditAs("Register a freight quote").save(context); + } + var revised = readQuote(context, "SEA-003"); + require(new BigDecimal("3.50").equals(revised.getAmount()), "The initial offshore rate lost its Decimal scale"); + revised.updateAmount(PRECISE).auditAs("Accept the revised offshore freight rate").save(context); + } + + private static FreightQuote readQuote(CustomUserContext context, String reference) { + var quote = Q.freightQuotes().withReferenceIs(reference).limit(1).comment("Read the selected freight quote") + .purpose("Verify the retained delivery commitment").executeForOne(context); + require(quote != null, "The freight quote is missing"); + return quote; + } + + private static void verifyWire(CustomUserContext context, ObjectMapper mapper, FreightQuote high) throws Exception { + var wire = mapper.readTree(mapper.writeValueAsString(high)); + require(PRECISE.toPlainString().equals(wire.path("amount").textValue()) + && Long.toString(FIRST_SHIPMENT + 2).equals(wire.path("shipmentNumber").textValue()) + && wire.path("packageCount").isIntegralNumber() && wire.path("packageCount").intValue() == Integer.MAX_VALUE, + "JSON changed Decimal, Long or Integer width"); + var restored = E.freightQuote(mapper.treeToValue(wire, FreightQuote.class)); + require(PRECISE.equals(restored.getAmount().eval()) && restored.getShipmentNumber().eval() == FIRST_SHIPMENT + 2 + && DELIVERY_DATE.equals(restored.getDeliveryDate().eval()) && PICKUP_TIME.equals(restored.getPickupTime().eval()) + && QUOTED_AT.equals(restored.getQuotedAt().eval()), "Decoded quote changed a numeric or temporal value"); + + var sparse = Q.freightQuotesWithMinimalFields().withIdIs(high.getId()).selectReference().limit(1) + .comment("Read only the quote reference").purpose("Keep unselected delivery instructions distinct") + .executeForOne(context); + require(sparse != null, "The sparse freight quote is missing"); + var projected = mapper.readTree(mapper.writeValueAsString(sparse)); + require(!projected.has("instructions"), "Sparse JSON included unselected instructions"); + try { + E.freightQuote(mapper.treeToValue(projected, FreightQuote.class)).getInstructions().eval(); + throw new AssertionError("Unselected instructions became a value"); + } catch (TeaQLNotLoadedException expected) { + // The generated expression still distinguishes unloaded instructions from null. + } + } + + private static void require(boolean condition, String message) { + if (!condition) throw new AssertionError(message); + } +} diff --git a/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/WorkspaceTeaQLDatabase.java b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..10f0a4834 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/src/main/java/com/example/freightquotesettlement/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.freightquotesettlement; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/src/main/resources/application.properties b/examples/scalar-type-probe/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..ecbbc2fe8 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:freightquotesettlement.db diff --git a/examples/scalar-type-probe/java-app-console/teaql-i18n.json b/examples/scalar-type-probe/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..faa9095d7 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/teaql-i18n.json @@ -0,0 +1,112 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.freightQuote.reference": "Reference", + "property.freightQuote.instructions": "Instructions", + "property.freightQuote.deliveryDate": "Delivery Date", + "property.freightQuote.quotedAt": "Quoted At", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.freightQuote.shipmentNumber": "Shipment Number", + "property.freightQuote.version": "Version", + "entity.freightQuote": "Freight Quote", + "property.freightQuote.pickupTime": "Pickup Time", + "property.freightQuote.packageCount": "Package Count", + "property.freightQuote.platform": "Platform", + "property.freightQuote.id": "Id", + "property.freightQuote.amount": "Amount", + "property.platform.version": "Version" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/teaql/checker-model.json b/examples/scalar-type-probe/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..3940f6a01 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:3b8da34e762562f0877bfd04865e33c225b4d854c8a5914ea30b4a922d3df3b7","entities":{"FreightQuote":{"labels":{"en":"Freight Quote"},"fields":[{"name":"amount","labels":{"en":"amount"},"aliases":["Amount"]},{"name":"delivery_date","labels":{"en":"delivery date"},"aliases":["DeliveryDate","deliveryDate"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"instructions","labels":{"en":"instructions"},"aliases":["Instructions"]},{"name":"package_count","labels":{"en":"package count"},"aliases":["PackageCount","packageCount"]},{"name":"pickup_time","labels":{"en":"pickup time"},"aliases":["PickupTime","pickupTime"]},{"name":"platform","targetType":"Platform","labels":{"en":"Dispatch Platform"},"aliases":["Platform"]},{"name":"quoted_at","labels":{"en":"quoted at"},"aliases":["QuotedAt","quotedAt"]},{"name":"reference","labels":{"en":"reference"},"aliases":["Reference"]},{"name":"shipment_number","labels":{"en":"shipment number"},"aliases":["ShipmentNumber","shipmentNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Dispatch Platform"},"fields":[{"name":"freight_quote_list","targetType":"FreightQuote","labels":{"en":"Freight Quote"},"aliases":["FreightQuoteList","freightQuoteList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/teaql/model-provenance.json b/examples/scalar-type-probe/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..d07d09102 --- /dev/null +++ b/examples/scalar-type-probe/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:833c5fc594652f4247ab0587040cdcba5da043d91c9d16cb602e28863fe69ca5","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/pom.xml b/examples/scalar-type-probe/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..980168926 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + freight-quote-settlement-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Checkers.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Constants.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Constants.java new file mode 100644 index 000000000..c5f05d388 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Constants.java @@ -0,0 +1,9 @@ + +package com.example.freightquotesettlement; + +import com.example.freightquotesettlement.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/E.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/E.java new file mode 100644 index 000000000..16334b78c --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/E.java @@ -0,0 +1,18 @@ + +package com.example.freightquotesettlement; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteExpression; +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static FreightQuoteExpression freightQuote(FreightQuote freightQuote){ + return new FreightQuoteExpression(new ValueExpression(freightQuote, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.freightQuote()")); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java new file mode 100644 index 000000000..e928f2055 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java @@ -0,0 +1,508 @@ + +package com.example.freightquotesettlement; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerFreightQuote(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.freightquotesettlement.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.freightquotesettlement.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.freightquotesettlement.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.freightquotesettlement.platform.Platform::new); + entityDescriptor.with("name", "Dispatch Platform") + + .with("module", "Freight") + + .with("module_key", "freight") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Harbor Freight Desk") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerFreightQuote() { + FieldLayout.installGenerated(com.example.freightquotesettlement.freightquote.FreightQuote.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.freightquotesettlement.freightquote.FreightQuote.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.freightquotesettlement.freightquote.FreightQuote.class); + entityDescriptor.setEntitySupplier(com.example.freightquotesettlement.freightquote.FreightQuote::new); + entityDescriptor.with("name", "Freight Quote") + + .with("module", "Freight") + + .with("module_key", "freight") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.freightquotesettlement.freightquote.FreightQuote.PLATFORM_PROPERTY, com.example.freightquotesettlement.platform.Platform.INTERNAL_TYPE, com.example.freightquotesettlement.platform.Platform.FREIGHT_QUOTE_LIST_PROPERTY, com.example.freightquotesettlement.platform.Platform.class) + ; + PropertyDescriptor reference = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY, String.class) + ; + PropertyDescriptor amount = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor shipmentNumber = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY, Long.class) + ; + PropertyDescriptor packageCount = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY, Integer.class) + ; + PropertyDescriptor deliveryDate = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor pickupTime = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY, LocalTime.class) + ; + PropertyDescriptor quotedAt = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor instructions = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.INSTRUCTIONS_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalTime") + + .with("sqlType", "TIME") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Time") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.INSTRUCTIONS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java new file mode 100644 index 000000000..2dfb38496 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java @@ -0,0 +1,10 @@ + +package com.example.freightquotesettlement; + +import io.teaql.core.UserContext; +public interface FreightQuoteSettlementUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java new file mode 100644 index 000000000..c90b62ca2 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.example.freightquotesettlement; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.freightquotesettlement.platform.PlatformChecker(), new com.example.freightquotesettlement.freightquote.FreightQuoteChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:3b8da34e762562f0877bfd04865e33c225b4d854c8a5914ea30b4a922d3df3b7\",\"entities\":{\"FreightQuote\":{\"labels\":{\"en\":\"Freight Quote\"},\"fields\":[{\"name\":\"amount\",\"labels\":{\"en\":\"amount\"},\"aliases\":[\"Amount\"]},{\"name\":\"delivery_date\",\"labels\":{\"en\":\"delivery date\"},\"aliases\":[\"DeliveryDate\",\"deliveryDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"instructions\",\"labels\":{\"en\":\"instructions\"},\"aliases\":[\"Instructions\"]},{\"name\":\"package_count\",\"labels\":{\"en\":\"package count\"},\"aliases\":[\"PackageCount\",\"packageCount\"]},{\"name\":\"pickup_time\",\"labels\":{\"en\":\"pickup time\"},\"aliases\":[\"PickupTime\",\"pickupTime\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Dispatch Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"quoted_at\",\"labels\":{\"en\":\"quoted at\"},\"aliases\":[\"QuotedAt\",\"quotedAt\"]},{\"name\":\"reference\",\"labels\":{\"en\":\"reference\"},\"aliases\":[\"Reference\"]},{\"name\":\"shipment_number\",\"labels\":{\"en\":\"shipment number\"},\"aliases\":[\"ShipmentNumber\",\"shipmentNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Dispatch Platform\"},\"fields\":[{\"name\":\"freight_quote_list\",\"targetType\":\"FreightQuote\",\"labels\":{\"en\":\"Freight Quote\"},\"aliases\":[\"FreightQuoteList\",\"freightQuoteList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("FreightQuote", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("reference", "reference"), java.util.Map.entry("amount", "amount"), java.util.Map.entry("shipment_number", "shipmentNumber"), java.util.Map.entry("package_count", "packageCount"), java.util.Map.entry("delivery_date", "deliveryDate"), java.util.Map.entry("pickup_time", "pickupTime"), java.util.Map.entry("quoted_at", "quotedAt"), java.util.Map.entry("instructions", "instructions"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.freightquotesettlement.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.freightquotesettlement.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Harbor Freight Desk"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Q.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Q.java new file mode 100644 index 000000000..7e977454e --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Q.java @@ -0,0 +1,25 @@ + +package com.example.freightquotesettlement; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.freightquotesettlement.platform.PlatformRequest platforms(){ + return new com.example.freightquotesettlement.platform.PlatformRequest(com.example.freightquotesettlement.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.freightquotesettlement.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.freightquotesettlement.platform.PlatformRequest(com.example.freightquotesettlement.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.freightquotesettlement.freightquote.FreightQuoteRequest freightQuotes(){ + return new com.example.freightquotesettlement.freightquote.FreightQuoteRequest(com.example.freightquotesettlement.freightquote.FreightQuote.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.freightquotesettlement.freightquote.FreightQuoteRequest freightQuotesWithMinimalFields(){ + return new com.example.freightquotesettlement.freightquote.FreightQuoteRequest(com.example.freightquotesettlement.freightquote.FreightQuote.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Repositories.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java new file mode 100644 index 000000000..4f6fcf146 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java @@ -0,0 +1,273 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class FreightQuote extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "FreightQuote"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "661de8675c51355614d50183496c991171adfdb1f52cc15029141a8114080a1e"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("reference", 2), java.util.Map.entry("amount", 3), java.util.Map.entry("shipment_number", 4), java.util.Map.entry("package_count", 5), java.util.Map.entry("delivery_date", 6), java.util.Map.entry("pickup_time", 7), java.util.Map.entry("quoted_at", 8), java.util.Map.entry("instructions", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("reference", java.util.List.of("reference", "reference")), java.util.Map.entry("amount", java.util.List.of("amount", "amount")), java.util.Map.entry("shipment_number", java.util.List.of("shipmentNumber", "shipment_number")), java.util.Map.entry("package_count", java.util.List.of("packageCount", "package_count")), java.util.Map.entry("delivery_date", java.util.List.of("deliveryDate", "delivery_date")), java.util.Map.entry("pickup_time", java.util.List.of("pickupTime", "pickup_time")), java.util.Map.entry("quoted_at", java.util.List.of("quotedAt", "quoted_at")), java.util.Map.entry("instructions", java.util.List.of("instructions", "instructions")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + FreightQuote.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String REFERENCE_PROPERTY = "reference"; + public static final String AMOUNT_PROPERTY = "amount"; + public static final String SHIPMENT_NUMBER_PROPERTY = "shipment_number"; + public static final String PACKAGE_COUNT_PROPERTY = "package_count"; + public static final String DELIVERY_DATE_PROPERTY = "delivery_date"; + public static final String PICKUP_TIME_PROPERTY = "pickup_time"; + public static final String QUOTED_AT_PROPERTY = "quoted_at"; + public static final String INSTRUCTIONS_PROPERTY = "instructions"; + private Platform platform; + + private String reference; + + private BigDecimal amount; + + private Long shipmentNumber; + + private Integer packageCount; + + private LocalDate deliveryDate; + + private LocalTime pickupTime; + + private LocalDateTime quotedAt; + + private String instructions; + + + public Platform getPlatform(){ + return this.platform; + } + + public String getReference(){ + return this.reference; + } + + public BigDecimal getAmount(){ + return this.amount; + } + + public Long getShipmentNumber(){ + return this.shipmentNumber; + } + + public Integer getPackageCount(){ + return this.packageCount; + } + + public LocalDate getDeliveryDate(){ + return this.deliveryDate; + } + + public LocalTime getPickupTime(){ + return this.pickupTime; + } + + public LocalDateTime getQuotedAt(){ + return this.quotedAt; + } + + public String getInstructions(){ + return this.instructions; + } + + public FreightQuote updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public FreightQuote updateReference(String reference){ + reference = (reference == null ? null : reference.trim()); + if(isPropertyLoaded(REFERENCE_PROPERTY) && Objects.equals(this.reference, reference)){ + return this; + } + handleUpdate(REFERENCE_PROPERTY, getReference(), reference); + this.reference = reference; + return this; + } + + public FreightQuote updateAmount(BigDecimal amount){ + if(isPropertyLoaded(AMOUNT_PROPERTY) && Objects.equals(this.amount, amount)){ + return this; + } + handleUpdate(AMOUNT_PROPERTY, getAmount(), amount); + this.amount = amount; + return this; + } + + public FreightQuote updateShipmentNumber(Long shipmentNumber){ + if(isPropertyLoaded(SHIPMENT_NUMBER_PROPERTY) && Objects.equals(this.shipmentNumber, shipmentNumber)){ + return this; + } + handleUpdate(SHIPMENT_NUMBER_PROPERTY, getShipmentNumber(), shipmentNumber); + this.shipmentNumber = shipmentNumber; + return this; + } + + public FreightQuote updatePackageCount(Integer packageCount){ + if(isPropertyLoaded(PACKAGE_COUNT_PROPERTY) && Objects.equals(this.packageCount, packageCount)){ + return this; + } + handleUpdate(PACKAGE_COUNT_PROPERTY, getPackageCount(), packageCount); + this.packageCount = packageCount; + return this; + } + + public FreightQuote updateDeliveryDate(LocalDate deliveryDate){ + if(isPropertyLoaded(DELIVERY_DATE_PROPERTY) && Objects.equals(this.deliveryDate, deliveryDate)){ + return this; + } + handleUpdate(DELIVERY_DATE_PROPERTY, getDeliveryDate(), deliveryDate); + this.deliveryDate = deliveryDate; + return this; + } + + public FreightQuote updatePickupTime(LocalTime pickupTime){ + if(isPropertyLoaded(PICKUP_TIME_PROPERTY) && Objects.equals(this.pickupTime, pickupTime)){ + return this; + } + handleUpdate(PICKUP_TIME_PROPERTY, getPickupTime(), pickupTime); + this.pickupTime = pickupTime; + return this; + } + + public FreightQuote updateQuotedAt(LocalDateTime quotedAt){ + if(isPropertyLoaded(QUOTED_AT_PROPERTY) && Objects.equals(this.quotedAt, quotedAt)){ + return this; + } + handleUpdate(QUOTED_AT_PROPERTY, getQuotedAt(), quotedAt); + this.quotedAt = quotedAt; + return this; + } + + public FreightQuote updateInstructions(String instructions){ + instructions = (instructions == null ? null : instructions.trim()); + if(isPropertyLoaded(INSTRUCTIONS_PROPERTY) && Objects.equals(this.instructions, instructions)){ + return this; + } + handleUpdate(INSTRUCTIONS_PROPERTY, getInstructions(), instructions); + this.instructions = instructions; + return this; + } + + + public static FreightQuote refer(Long id){ + FreightQuote refer = new FreightQuote(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public FreightQuote comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "reference": this.reference = (value == null ? null : ((String)value).trim()); break; + + case "amount": this.amount = (BigDecimal) value; break; + + case "shipment_number": this.shipmentNumber = (Long) value; break; + + case "package_count": this.packageCount = (Integer) value; break; + + case "delivery_date": this.deliveryDate = (LocalDate) value; break; + + case "pickup_time": this.pickupTime = (LocalTime) value; break; + + case "quoted_at": this.quotedAt = (LocalDateTime) value; break; + + case "instructions": this.instructions = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "reference": return this.reference; + case "amount": return this.amount; + case "shipment_number": return this.shipmentNumber; + case "package_count": return this.packageCount; + case "delivery_date": return this.deliveryDate; + case "pickup_time": return this.pickupTime; + case "quoted_at": return this.quotedAt; + case "instructions": return this.instructions; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "reference": return this.reference; + case "amount": return this.amount; + case "shipmentNumber": return this.shipmentNumber; + case "packageCount": return this.packageCount; + case "deliveryDate": return this.deliveryDate; + case "pickupTime": return this.pickupTime; + case "quotedAt": return this.quotedAt; + case "instructions": return this.instructions; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java new file mode 100644 index 000000000..c716fce7d --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java @@ -0,0 +1,134 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; + +public class FreightQuoteChecker implements Checker{ + + public String type(){ + return FreightQuote.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, FreightQuote freightQuote, ObjectLocation _parentLocation){ + if(needCheck(_context, freightQuote)){ + markAsChecked(_context, freightQuote); + doCheck(_context, freightQuote, _parentLocation); + } + } + + public void doCheck(UserContext _context, FreightQuote freightQuote, ObjectLocation _parentLocation){ + if((freightQuote == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, freightQuote); + if(freightQuote.needPersist()){ + } + if(freightQuote.newItem()){ + }else if(freightQuote.updateItem()){ + if(!freightQuote.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("reference")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "reference"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("amount")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "amount"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("shipment_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "shipment_number"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("package_count")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "package_count"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("delivery_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "delivery_date"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("pickup_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "pickup_time"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("quoted_at")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quoted_at"), "Mutation requires a fully loaded entity"); + } + if(!freightQuote.isPropertyLoaded("instructions")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "instructions"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, freightQuote.getProperty(FreightQuote.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkReference(_context, freightQuote.getProperty(FreightQuote.REFERENCE_PROPERTY), newLocation(_parentLocation, "reference")); + checkAmount(_context, freightQuote.getProperty(FreightQuote.AMOUNT_PROPERTY), newLocation(_parentLocation, "amount")); + checkShipmentNumber(_context, freightQuote.getProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY), newLocation(_parentLocation, "shipment_number")); + checkPackageCount(_context, freightQuote.getProperty(FreightQuote.PACKAGE_COUNT_PROPERTY), newLocation(_parentLocation, "package_count")); + checkDeliveryDate(_context, freightQuote.getProperty(FreightQuote.DELIVERY_DATE_PROPERTY), newLocation(_parentLocation, "delivery_date")); + checkPickupTime(_context, freightQuote.getProperty(FreightQuote.PICKUP_TIME_PROPERTY), newLocation(_parentLocation, "pickup_time")); + checkQuotedAt(_context, freightQuote.getProperty(FreightQuote.QUOTED_AT_PROPERTY), newLocation(_parentLocation, "quoted_at")); + checkInstructions(_context, freightQuote.getProperty(FreightQuote.INSTRUCTIONS_PROPERTY), newLocation(_parentLocation, "instructions")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkReference(UserContext _context, String reference, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, reference); + if((reference == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, reference); + + } + public void checkAmount(UserContext _context, BigDecimal amount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, amount); + if((amount == null)){ + return; + } + } + public void checkShipmentNumber(UserContext _context, Long shipmentNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, shipmentNumber); + if((shipmentNumber == null)){ + return; + } + } + public void checkPackageCount(UserContext _context, Integer packageCount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, packageCount); + if((packageCount == null)){ + return; + } + } + public void checkDeliveryDate(UserContext _context, LocalDate deliveryDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, deliveryDate); + if((deliveryDate == null)){ + return; + } + } + public void checkPickupTime(UserContext _context, LocalTime pickupTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, pickupTime); + if((pickupTime == null)){ + return; + } + } + public void checkQuotedAt(UserContext _context, LocalDateTime quotedAt, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quotedAt); + if((quotedAt == null)){ + return; + } + } + public void checkInstructions(UserContext _context, String instructions, ObjectLocation _parentLocation){ + if((instructions == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, instructions); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java new file mode 100644 index 000000000..04f2c5ee5 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java @@ -0,0 +1,106 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.function.Function; + +public class FreightQuoteExpression extends ExpressionAdaptor implements BaseEntityExpression { + public FreightQuoteExpression(Expression expression){ + super(expression); + } + + public FreightQuoteExpression(Expression expression, Function function){ + super(expression, function); + } + + public FreightQuoteExpression updateId(Long id){ + return new FreightQuoteExpression(this, $it -> {((FreightQuote)$it).__internalSet("id", id); return this;}); + } + + public FreightQuoteExpression save(UserContext userContext){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).auditAs("Saved by Expression").save(userContext)); + } + + public FreightQuoteExpression save(String intent, UserContext userContext){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", FreightQuote::getPlatform)); + } + + public FreightQuoteExpression updatePlatform(Platform platform){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePlatform(platform)); + } + + public Expression getReference(){ + return loaded("reference", "getReference", FreightQuote::getReference); + } + public FreightQuoteExpression updateReference(String reference){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateReference(reference)); + } + + public Expression getAmount(){ + return loaded("amount", "getAmount", FreightQuote::getAmount); + } + public FreightQuoteExpression updateAmount(BigDecimal amount){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateAmount(amount)); + } + + public Expression getShipmentNumber(){ + return loaded("shipment_number", "getShipmentNumber", FreightQuote::getShipmentNumber); + } + public FreightQuoteExpression updateShipmentNumber(Long shipmentNumber){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateShipmentNumber(shipmentNumber)); + } + + public Expression getPackageCount(){ + return loaded("package_count", "getPackageCount", FreightQuote::getPackageCount); + } + public FreightQuoteExpression updatePackageCount(Integer packageCount){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePackageCount(packageCount)); + } + + public Expression getDeliveryDate(){ + return loaded("delivery_date", "getDeliveryDate", FreightQuote::getDeliveryDate); + } + public FreightQuoteExpression updateDeliveryDate(LocalDate deliveryDate){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateDeliveryDate(deliveryDate)); + } + + public Expression getPickupTime(){ + return loaded("pickup_time", "getPickupTime", FreightQuote::getPickupTime); + } + public FreightQuoteExpression updatePickupTime(LocalTime pickupTime){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePickupTime(pickupTime)); + } + + public Expression getQuotedAt(){ + return loaded("quoted_at", "getQuotedAt", FreightQuote::getQuotedAt); + } + public FreightQuoteExpression updateQuotedAt(LocalDateTime quotedAt){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateQuotedAt(quotedAt)); + } + + public Expression getInstructions(){ + return loaded("instructions", "getInstructions", FreightQuote::getInstructions); + } + public FreightQuoteExpression updateInstructions(String instructions){ + return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateInstructions(instructions)); + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java new file mode 100644 index 000000000..0f5131b45 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java @@ -0,0 +1,25 @@ + +package com.example.freightquotesettlement.freightquote; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class FreightQuoteListExpression extends SmartListExpression { + public FreightQuoteListExpression(Expression> expression){ + super(expression); + } + + public FreightQuoteListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public FreightQuoteExpression first() { + return new FreightQuoteExpression(super.first()); + } + + public FreightQuoteExpression get(int index) { + return new FreightQuoteExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java new file mode 100644 index 000000000..e19feac84 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java @@ -0,0 +1,1774 @@ + +package com.example.freightquotesettlement.freightquote; + +import com.example.freightquotesettlement.Q; +import com.example.freightquotesettlement.platform.Platform; +import com.example.freightquotesettlement.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; +import java.util.Objects; + +public class FreightQuoteRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public FreightQuoteRequest(Class returnType){ + this(returnType, () -> (T) new FreightQuote()); + } + + protected FreightQuoteRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public FreightQuoteRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public FreightQuoteRequest copy(){ + return (FreightQuoteRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new FreightQuoteRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public FreightQuoteRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public FreightQuoteRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public FreightQuoteRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public FreightQuoteRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public FreightQuoteRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public FreightQuoteRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public FreightQuoteRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public FreightQuoteRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public FreightQuoteRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public FreightQuoteRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (FreightQuoteRequest)super.appendSearchCriteria(searchCriteria); + } + + public FreightQuoteRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public FreightQuoteRequest matchingAnyOf(FreightQuoteRequest freightQuote){ + super.internalMatchAny(freightQuote); + return this; + } + + public FreightQuoteRequest matchingIdsOf(FreightQuoteRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + FreightQuote.ID_PROPERTY, request, FreightQuote.ID_PROPERTY)); + } + + public FreightQuoteRequest enhanceChildrenIfNeeded(){ + return this; + } + + public FreightQuoteRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public FreightQuoteRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public FreightQuoteRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); + } + + public FreightQuoteRequest selectSelfFields(){ + return selectSelf(); + } + + public FreightQuoteRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(FreightQuote.ID_PROPERTY); + selectProperty(FreightQuote.PLATFORM_PROPERTY); + selectProperty(FreightQuote.REFERENCE_PROPERTY); + selectProperty(FreightQuote.AMOUNT_PROPERTY); + selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); + selectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); + selectProperty(FreightQuote.PICKUP_TIME_PROPERTY); + selectProperty(FreightQuote.QUOTED_AT_PROPERTY); + selectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); + selectProperty(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); + } + + public FreightQuoteRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); + } + + + public FreightQuoteRequest selectId(){ + selectProperty(FreightQuote.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectId(){ + unselectProperty(FreightQuote.ID_PROPERTY); + return this; + } + public FreightQuoteRequest selectPlatformIdOnly(){ + selectProperty(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public FreightQuoteRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(FreightQuote.PLATFORM_PROPERTY); + enhanceRelation(FreightQuote.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, FreightQuote.PLATFORM_PROPERTY)); + return this; + } + + public FreightQuoteRequest unselectPlatform(){ + unselectProperty(FreightQuote.PLATFORM_PROPERTY); + return this; + } + public FreightQuoteRequest selectReference(){ + selectProperty(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + /** + * fill the reference with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS reference) to fetch reference property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectReference(){ + unselectProperty(FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest selectAmount(){ + selectProperty(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + /** + * fill the amount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS amount) to fetch amount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the amount with customized aggrFunction, TEAQL uses ({aggrFunction}(amount) AS amount to fetch amount property. + * @param aggrFunction aggrFunction + */ + public FreightQuoteRequest selectAmount(AggrFunction aggrFunction){ + selectProperty(FreightQuote.AMOUNT_PROPERTY, aggrFunction); + return this; + } + + + public FreightQuoteRequest unselectAmount(){ + unselectProperty(FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest selectShipmentNumber(){ + selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + /** + * fill the shipmentNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS shipmentNumber) to fetch shipmentNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the shipmentNumber with customized aggrFunction, TEAQL uses ({aggrFunction}(shipmentNumber) AS shipmentNumber to fetch shipmentNumber property. + * @param aggrFunction aggrFunction + */ + public FreightQuoteRequest selectShipmentNumber(AggrFunction aggrFunction){ + selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY, aggrFunction); + return this; + } + + + public FreightQuoteRequest unselectShipmentNumber(){ + unselectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest selectPackageCount(){ + selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + /** + * fill the packageCount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS packageCount) to fetch packageCount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the packageCount with customized aggrFunction, TEAQL uses ({aggrFunction}(packageCount) AS packageCount to fetch packageCount property. + * @param aggrFunction aggrFunction + */ + public FreightQuoteRequest selectPackageCount(AggrFunction aggrFunction){ + selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY, aggrFunction); + return this; + } + + + public FreightQuoteRequest unselectPackageCount(){ + unselectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest selectDeliveryDate(){ + selectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + /** + * fill the deliveryDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS deliveryDate) to fetch deliveryDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectDeliveryDate(){ + unselectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + public FreightQuoteRequest selectPickupTime(){ + selectProperty(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + /** + * fill the pickupTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS pickupTime) to fetch pickupTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectPickupTime(){ + unselectProperty(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + public FreightQuoteRequest selectQuotedAt(){ + selectProperty(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + /** + * fill the quotedAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quotedAt) to fetch quotedAt property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectQuotedAt(){ + unselectProperty(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + public FreightQuoteRequest selectInstructions(){ + selectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + /** + * fill the instructions with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS instructions) to fetch instructions property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectInstructions(){ + unselectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest selectVersion(){ + selectProperty(FreightQuote.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public FreightQuoteRequest unselectVersion(){ + unselectProperty(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.ID_PROPERTY, operator, values); + } + + public FreightQuoteRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public FreightQuoteRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public FreightQuoteRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public FreightQuoteRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public FreightQuoteRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public FreightQuoteRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public FreightQuoteRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public FreightQuoteRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.PLATFORM_PROPERTY, operator, values); + } + + public FreightQuoteRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public FreightQuoteRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(FreightQuote.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public FreightQuoteRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(FreightQuote.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public FreightQuoteRequest filterByReference(String... reference){ + if (reference == null || reference.length == 0) { + throw new IllegalArgumentException("filterByReference parameter reference cannot be empty"); + } + return appendSearchCriteria(createReferenceCriteria(Operator.EQUAL, (Object[])reference)); + } + + public FreightQuoteRequest withReference(Operator operator, Object... values){ + return appendSearchCriteria(createReferenceCriteria(operator, values)); + } + + public FreightQuoteRequest withReferenceIsUnknown(){ + return withReference(Operator.IS_NULL); + } + + public FreightQuoteRequest withReferenceIsKnown(){ + return withReference(Operator.IS_NOT_NULL); + } + + public SearchCriteria createReferenceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.REFERENCE_PROPERTY, operator, values); + } + + public FreightQuoteRequest withReferenceIsNot(String reference){ + return withReference(Operator.NOT_EQUAL, reference); + } + + public FreightQuoteRequest withReferenceIn(String... reference){ + return withReference(Operator.IN, (Object[])reference); + } + + public FreightQuoteRequest withReferenceNotIn(String... reference){ + return withReference(Operator.NOT_IN, (Object[])reference); + } + public FreightQuoteRequest withReferenceGreaterThan(String reference){ + return withReference(Operator.GREATER_THAN, reference); + } + + public FreightQuoteRequest withReferenceGreaterThanOrEqualTo(String reference){ + return withReference(Operator.GREATER_THAN_OR_EQUAL, reference); + } + + public FreightQuoteRequest withReferenceLessThan(String reference){ + return withReference(Operator.LESS_THAN, reference); + } + + public FreightQuoteRequest withReferenceLessThanOrEqualTo(String reference){ + return withReference(Operator.LESS_THAN_OR_EQUAL, reference); + } + + public FreightQuoteRequest withReferenceBetween(String startOfReference, String endOfReference){ + return withReference(Operator.BETWEEN, startOfReference, endOfReference); + } + public FreightQuoteRequest withReferenceStartingWith(String reference){ + return withReference(Operator.BEGIN_WITH, reference); + } + public FreightQuoteRequest withReferenceContaining(String reference){ + return withReference(Operator.CONTAIN, reference); + } + + public FreightQuoteRequest withReferenceNotContaining(String reference){ + return withReference(Operator.NOT_CONTAIN, reference); + } + + public FreightQuoteRequest withReferenceNotStartingWith(String reference){ + return withReference(Operator.NOT_BEGIN_WITH, reference); + } + + public FreightQuoteRequest withReferenceEndingWith(String reference){ + return withReference(Operator.END_WITH, reference); + } + + public FreightQuoteRequest withReferenceNotEndingWith(String reference){ + return withReference(Operator.NOT_END_WITH, reference); + } + + public FreightQuoteRequest withReferenceIs(String reference){ + return withReference(Operator.EQUAL, reference); + } + + public FreightQuoteRequest withReferenceSoundingLike(String reference){ + return withReference(Operator.SOUNDS_LIKE, reference); + } + + + + public FreightQuoteRequest filterByAmount(BigDecimal... amount){ + if (amount == null || amount.length == 0) { + throw new IllegalArgumentException("filterByAmount parameter amount cannot be empty"); + } + return appendSearchCriteria(createAmountCriteria(Operator.EQUAL, (Object[])amount)); + } + + public FreightQuoteRequest withAmount(Operator operator, Object... values){ + return appendSearchCriteria(createAmountCriteria(operator, values)); + } + + public FreightQuoteRequest withAmountIsUnknown(){ + return withAmount(Operator.IS_NULL); + } + + public FreightQuoteRequest withAmountIsKnown(){ + return withAmount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAmountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.AMOUNT_PROPERTY, operator, values); + } + + public FreightQuoteRequest withAmountIs(BigDecimal amount){ + return withAmount(Operator.EQUAL, amount); + } + + public FreightQuoteRequest withAmountIsNot(BigDecimal amount){ + return withAmount(Operator.NOT_EQUAL, amount); + } + + public FreightQuoteRequest withAmountIn(BigDecimal... amount){ + return withAmount(Operator.IN, (Object[])amount); + } + + public FreightQuoteRequest withAmountNotIn(BigDecimal... amount){ + return withAmount(Operator.NOT_IN, (Object[])amount); + } + public FreightQuoteRequest withAmountGreaterThan(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN, amount); + } + + public FreightQuoteRequest withAmountGreaterThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.GREATER_THAN_OR_EQUAL, amount); + } + + public FreightQuoteRequest withAmountLessThan(BigDecimal amount){ + return withAmount(Operator.LESS_THAN, amount); + } + + public FreightQuoteRequest withAmountLessThanOrEqualTo(BigDecimal amount){ + return withAmount(Operator.LESS_THAN_OR_EQUAL, amount); + } + + public FreightQuoteRequest withAmountBetween(BigDecimal startOfAmount, BigDecimal endOfAmount){ + return withAmount(Operator.BETWEEN, startOfAmount, endOfAmount); + } + + + + public FreightQuoteRequest filterByShipmentNumber(Long... shipmentNumber){ + if (shipmentNumber == null || shipmentNumber.length == 0) { + throw new IllegalArgumentException("filterByShipmentNumber parameter shipmentNumber cannot be empty"); + } + return appendSearchCriteria(createShipmentNumberCriteria(Operator.EQUAL, (Object[])shipmentNumber)); + } + + public FreightQuoteRequest withShipmentNumber(Operator operator, Object... values){ + return appendSearchCriteria(createShipmentNumberCriteria(operator, values)); + } + + public FreightQuoteRequest withShipmentNumberIsUnknown(){ + return withShipmentNumber(Operator.IS_NULL); + } + + public FreightQuoteRequest withShipmentNumberIsKnown(){ + return withShipmentNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createShipmentNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.SHIPMENT_NUMBER_PROPERTY, operator, values); + } + + public FreightQuoteRequest withShipmentNumberIs(Long shipmentNumber){ + return withShipmentNumber(Operator.EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberIsNot(Long shipmentNumber){ + return withShipmentNumber(Operator.NOT_EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberIn(Long... shipmentNumber){ + return withShipmentNumber(Operator.IN, (Object[])shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberNotIn(Long... shipmentNumber){ + return withShipmentNumber(Operator.NOT_IN, (Object[])shipmentNumber); + } + public FreightQuoteRequest withShipmentNumberGreaterThan(Long shipmentNumber){ + return withShipmentNumber(Operator.GREATER_THAN, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberGreaterThanOrEqualTo(Long shipmentNumber){ + return withShipmentNumber(Operator.GREATER_THAN_OR_EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberLessThan(Long shipmentNumber){ + return withShipmentNumber(Operator.LESS_THAN, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberLessThanOrEqualTo(Long shipmentNumber){ + return withShipmentNumber(Operator.LESS_THAN_OR_EQUAL, shipmentNumber); + } + + public FreightQuoteRequest withShipmentNumberBetween(Long startOfShipmentNumber, Long endOfShipmentNumber){ + return withShipmentNumber(Operator.BETWEEN, startOfShipmentNumber, endOfShipmentNumber); + } + + + + public FreightQuoteRequest filterByPackageCount(Integer... packageCount){ + if (packageCount == null || packageCount.length == 0) { + throw new IllegalArgumentException("filterByPackageCount parameter packageCount cannot be empty"); + } + return appendSearchCriteria(createPackageCountCriteria(Operator.EQUAL, (Object[])packageCount)); + } + + public FreightQuoteRequest withPackageCount(Operator operator, Object... values){ + return appendSearchCriteria(createPackageCountCriteria(operator, values)); + } + + public FreightQuoteRequest withPackageCountIsUnknown(){ + return withPackageCount(Operator.IS_NULL); + } + + public FreightQuoteRequest withPackageCountIsKnown(){ + return withPackageCount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPackageCountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.PACKAGE_COUNT_PROPERTY, operator, values); + } + + public FreightQuoteRequest withPackageCountIs(Integer packageCount){ + return withPackageCount(Operator.EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountIsNot(Integer packageCount){ + return withPackageCount(Operator.NOT_EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountIn(Integer... packageCount){ + return withPackageCount(Operator.IN, (Object[])packageCount); + } + + public FreightQuoteRequest withPackageCountNotIn(Integer... packageCount){ + return withPackageCount(Operator.NOT_IN, (Object[])packageCount); + } + public FreightQuoteRequest withPackageCountGreaterThan(Integer packageCount){ + return withPackageCount(Operator.GREATER_THAN, packageCount); + } + + public FreightQuoteRequest withPackageCountGreaterThanOrEqualTo(Integer packageCount){ + return withPackageCount(Operator.GREATER_THAN_OR_EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountLessThan(Integer packageCount){ + return withPackageCount(Operator.LESS_THAN, packageCount); + } + + public FreightQuoteRequest withPackageCountLessThanOrEqualTo(Integer packageCount){ + return withPackageCount(Operator.LESS_THAN_OR_EQUAL, packageCount); + } + + public FreightQuoteRequest withPackageCountBetween(Integer startOfPackageCount, Integer endOfPackageCount){ + return withPackageCount(Operator.BETWEEN, startOfPackageCount, endOfPackageCount); + } + + + + public FreightQuoteRequest filterByDeliveryDate(LocalDate... deliveryDate){ + if (deliveryDate == null || deliveryDate.length == 0) { + throw new IllegalArgumentException("filterByDeliveryDate parameter deliveryDate cannot be empty"); + } + return appendSearchCriteria(createDeliveryDateCriteria(Operator.EQUAL, (Object[])deliveryDate)); + } + + public FreightQuoteRequest withDeliveryDate(Operator operator, Object... values){ + return appendSearchCriteria(createDeliveryDateCriteria(operator, values)); + } + + public FreightQuoteRequest withDeliveryDateIsUnknown(){ + return withDeliveryDate(Operator.IS_NULL); + } + + public FreightQuoteRequest withDeliveryDateIsKnown(){ + return withDeliveryDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDeliveryDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.DELIVERY_DATE_PROPERTY, operator, values); + } + + public FreightQuoteRequest withDeliveryDateIs(LocalDate deliveryDate){ + return withDeliveryDate(Operator.EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateIsNot(LocalDate deliveryDate){ + return withDeliveryDate(Operator.NOT_EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateIn(LocalDate... deliveryDate){ + return withDeliveryDate(Operator.IN, (Object[])deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateNotIn(LocalDate... deliveryDate){ + return withDeliveryDate(Operator.NOT_IN, (Object[])deliveryDate); + } + public FreightQuoteRequest withDeliveryDateGreaterThan(LocalDate deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateGreaterThanOrEqualTo(LocalDate deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN_OR_EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateLessThan(LocalDate deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateLessThanOrEqualTo(LocalDate deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN_OR_EQUAL, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateBetween(LocalDate startOfDeliveryDate, LocalDate endOfDeliveryDate){ + return withDeliveryDate(Operator.BETWEEN, startOfDeliveryDate, endOfDeliveryDate); + } + public FreightQuoteRequest withDeliveryDateBefore(LocalDate deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateBefore(Date deliveryDate){ + return withDeliveryDate(Operator.LESS_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateAfter(LocalDate deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateAfter(Date deliveryDate){ + return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); + } + + public FreightQuoteRequest withDeliveryDateBetween(Date startOfDeliveryDate, Date endOfDeliveryDate){ + return withDeliveryDate(Operator.BETWEEN, startOfDeliveryDate, endOfDeliveryDate); + } + + + + + public FreightQuoteRequest filterByPickupTime(LocalTime... pickupTime){ + if (pickupTime == null || pickupTime.length == 0) { + throw new IllegalArgumentException("filterByPickupTime parameter pickupTime cannot be empty"); + } + return appendSearchCriteria(createPickupTimeCriteria(Operator.EQUAL, (Object[])pickupTime)); + } + + public FreightQuoteRequest withPickupTime(Operator operator, Object... values){ + return appendSearchCriteria(createPickupTimeCriteria(operator, values)); + } + + public FreightQuoteRequest withPickupTimeIsUnknown(){ + return withPickupTime(Operator.IS_NULL); + } + + public FreightQuoteRequest withPickupTimeIsKnown(){ + return withPickupTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPickupTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.PICKUP_TIME_PROPERTY, operator, values); + } + + public FreightQuoteRequest withPickupTimeIs(LocalTime pickupTime){ + return withPickupTime(Operator.EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeIsNot(LocalTime pickupTime){ + return withPickupTime(Operator.NOT_EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeIn(LocalTime... pickupTime){ + return withPickupTime(Operator.IN, (Object[])pickupTime); + } + + public FreightQuoteRequest withPickupTimeNotIn(LocalTime... pickupTime){ + return withPickupTime(Operator.NOT_IN, (Object[])pickupTime); + } + public FreightQuoteRequest withPickupTimeGreaterThan(LocalTime pickupTime){ + return withPickupTime(Operator.GREATER_THAN, pickupTime); + } + + public FreightQuoteRequest withPickupTimeGreaterThanOrEqualTo(LocalTime pickupTime){ + return withPickupTime(Operator.GREATER_THAN_OR_EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeLessThan(LocalTime pickupTime){ + return withPickupTime(Operator.LESS_THAN, pickupTime); + } + + public FreightQuoteRequest withPickupTimeLessThanOrEqualTo(LocalTime pickupTime){ + return withPickupTime(Operator.LESS_THAN_OR_EQUAL, pickupTime); + } + + public FreightQuoteRequest withPickupTimeBetween(LocalTime startOfPickupTime, LocalTime endOfPickupTime){ + return withPickupTime(Operator.BETWEEN, startOfPickupTime, endOfPickupTime); + } + + + public FreightQuoteRequest filterByQuotedAt(LocalDateTime... quotedAt){ + if (quotedAt == null || quotedAt.length == 0) { + throw new IllegalArgumentException("filterByQuotedAt parameter quotedAt cannot be empty"); + } + return appendSearchCriteria(createQuotedAtCriteria(Operator.EQUAL, (Object[])quotedAt)); + } + + public FreightQuoteRequest withQuotedAt(Operator operator, Object... values){ + return appendSearchCriteria(createQuotedAtCriteria(operator, values)); + } + + public FreightQuoteRequest withQuotedAtIsUnknown(){ + return withQuotedAt(Operator.IS_NULL); + } + + public FreightQuoteRequest withQuotedAtIsKnown(){ + return withQuotedAt(Operator.IS_NOT_NULL); + } + + public SearchCriteria createQuotedAtCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.QUOTED_AT_PROPERTY, operator, values); + } + + public FreightQuoteRequest withQuotedAtIs(LocalDateTime quotedAt){ + return withQuotedAt(Operator.EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtIsNot(LocalDateTime quotedAt){ + return withQuotedAt(Operator.NOT_EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtIn(LocalDateTime... quotedAt){ + return withQuotedAt(Operator.IN, (Object[])quotedAt); + } + + public FreightQuoteRequest withQuotedAtNotIn(LocalDateTime... quotedAt){ + return withQuotedAt(Operator.NOT_IN, (Object[])quotedAt); + } + public FreightQuoteRequest withQuotedAtGreaterThan(LocalDateTime quotedAt){ + return withQuotedAt(Operator.GREATER_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtGreaterThanOrEqualTo(LocalDateTime quotedAt){ + return withQuotedAt(Operator.GREATER_THAN_OR_EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtLessThan(LocalDateTime quotedAt){ + return withQuotedAt(Operator.LESS_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtLessThanOrEqualTo(LocalDateTime quotedAt){ + return withQuotedAt(Operator.LESS_THAN_OR_EQUAL, quotedAt); + } + + public FreightQuoteRequest withQuotedAtBetween(LocalDateTime startOfQuotedAt, LocalDateTime endOfQuotedAt){ + return withQuotedAt(Operator.BETWEEN, startOfQuotedAt, endOfQuotedAt); + } + public FreightQuoteRequest withQuotedAtBefore(LocalDateTime quotedAt){ + return withQuotedAt(Operator.LESS_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtBefore(Date quotedAt){ + return withQuotedAt(Operator.LESS_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtAfter(LocalDateTime quotedAt){ + return withQuotedAt(Operator.GREATER_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtAfter(Date quotedAt){ + return withQuotedAt(Operator.GREATER_THAN, quotedAt); + } + + public FreightQuoteRequest withQuotedAtBetween(Date startOfQuotedAt, Date endOfQuotedAt){ + return withQuotedAt(Operator.BETWEEN, startOfQuotedAt, endOfQuotedAt); + } + + + + + public FreightQuoteRequest filterByInstructions(String... instructions){ + if (instructions == null || instructions.length == 0) { + throw new IllegalArgumentException("filterByInstructions parameter instructions cannot be empty"); + } + return appendSearchCriteria(createInstructionsCriteria(Operator.EQUAL, (Object[])instructions)); + } + + public FreightQuoteRequest withInstructions(Operator operator, Object... values){ + return appendSearchCriteria(createInstructionsCriteria(operator, values)); + } + + public FreightQuoteRequest withInstructionsIsUnknown(){ + return withInstructions(Operator.IS_NULL); + } + + public FreightQuoteRequest withInstructionsIsKnown(){ + return withInstructions(Operator.IS_NOT_NULL); + } + + public SearchCriteria createInstructionsCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.INSTRUCTIONS_PROPERTY, operator, values); + } + + public FreightQuoteRequest withInstructionsIsNot(String instructions){ + return withInstructions(Operator.NOT_EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsIn(String... instructions){ + return withInstructions(Operator.IN, (Object[])instructions); + } + + public FreightQuoteRequest withInstructionsNotIn(String... instructions){ + return withInstructions(Operator.NOT_IN, (Object[])instructions); + } + public FreightQuoteRequest withInstructionsGreaterThan(String instructions){ + return withInstructions(Operator.GREATER_THAN, instructions); + } + + public FreightQuoteRequest withInstructionsGreaterThanOrEqualTo(String instructions){ + return withInstructions(Operator.GREATER_THAN_OR_EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsLessThan(String instructions){ + return withInstructions(Operator.LESS_THAN, instructions); + } + + public FreightQuoteRequest withInstructionsLessThanOrEqualTo(String instructions){ + return withInstructions(Operator.LESS_THAN_OR_EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsBetween(String startOfInstructions, String endOfInstructions){ + return withInstructions(Operator.BETWEEN, startOfInstructions, endOfInstructions); + } + public FreightQuoteRequest withInstructionsStartingWith(String instructions){ + return withInstructions(Operator.BEGIN_WITH, instructions); + } + public FreightQuoteRequest withInstructionsContaining(String instructions){ + return withInstructions(Operator.CONTAIN, instructions); + } + + public FreightQuoteRequest withInstructionsNotContaining(String instructions){ + return withInstructions(Operator.NOT_CONTAIN, instructions); + } + + public FreightQuoteRequest withInstructionsNotStartingWith(String instructions){ + return withInstructions(Operator.NOT_BEGIN_WITH, instructions); + } + + public FreightQuoteRequest withInstructionsEndingWith(String instructions){ + return withInstructions(Operator.END_WITH, instructions); + } + + public FreightQuoteRequest withInstructionsNotEndingWith(String instructions){ + return withInstructions(Operator.NOT_END_WITH, instructions); + } + + public FreightQuoteRequest withInstructionsIs(String instructions){ + return withInstructions(Operator.EQUAL, instructions); + } + + public FreightQuoteRequest withInstructionsSoundingLike(String instructions){ + return withInstructions(Operator.SOUNDS_LIKE, instructions); + } + + + + public FreightQuoteRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public FreightQuoteRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public FreightQuoteRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public FreightQuoteRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(FreightQuote.VERSION_PROPERTY, operator, values); + } + + public FreightQuoteRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public FreightQuoteRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public FreightQuoteRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public FreightQuoteRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public FreightQuoteRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public FreightQuoteRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public FreightQuoteRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public FreightQuoteRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public FreightQuoteRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public FreightQuoteRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public FreightQuoteRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public FreightQuoteRequest minAmount(){ + return minAmountAs(prefix("minOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest minAmountAs(String retName){ + super.min(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest maxAmount(){ + return maxAmountAs(prefix("maxOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest maxAmountAs(String retName){ + super.max(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sumAmount(){ + return sumAmountAs(prefix("sumOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest sumAmountAs(String retName){ + super.sum(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest avgAmount(){ + return avgAmountAs(prefix("avgOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest avgAmountAs(String retName){ + super.avg(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest standardDeviationAmount(){ + return standardDeviationAmountAs(prefix("standardDeviationOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest standardDeviationAmountAs(String retName){ + super.standardDeviation(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest squareRootOfPopulationStandardDeviationAmount(){ + return squareRootOfPopulationStandardDeviationAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest squareRootOfPopulationStandardDeviationAmountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sampleVarianceAmount(){ + return sampleVarianceAmountAs(prefix("sampleVarianceOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest sampleVarianceAmountAs(String retName){ + super.sampleVariance(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest samplePopulationVarianceAmount(){ + return samplePopulationVarianceAmountAs(prefix("samplePopulationVarianceOf",FreightQuote.AMOUNT_PROPERTY)); + } + + public FreightQuoteRequest samplePopulationVarianceAmountAs(String retName){ + super.samplePopulationVariance(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest minShipmentNumber(){ + return minShipmentNumberAs(prefix("minOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest minShipmentNumberAs(String retName){ + super.min(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest maxShipmentNumber(){ + return maxShipmentNumberAs(prefix("maxOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest maxShipmentNumberAs(String retName){ + super.max(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest sumShipmentNumber(){ + return sumShipmentNumberAs(prefix("sumOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest sumShipmentNumberAs(String retName){ + super.sum(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest avgShipmentNumber(){ + return avgShipmentNumberAs(prefix("avgOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest avgShipmentNumberAs(String retName){ + super.avg(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest standardDeviationShipmentNumber(){ + return standardDeviationShipmentNumberAs(prefix("standardDeviationOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest standardDeviationShipmentNumberAs(String retName){ + super.standardDeviation(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest squareRootOfPopulationStandardDeviationShipmentNumber(){ + return squareRootOfPopulationStandardDeviationShipmentNumberAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest squareRootOfPopulationStandardDeviationShipmentNumberAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest sampleVarianceShipmentNumber(){ + return sampleVarianceShipmentNumberAs(prefix("sampleVarianceOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest sampleVarianceShipmentNumberAs(String retName){ + super.sampleVariance(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest samplePopulationVarianceShipmentNumber(){ + return samplePopulationVarianceShipmentNumberAs(prefix("samplePopulationVarianceOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); + } + + public FreightQuoteRequest samplePopulationVarianceShipmentNumberAs(String retName){ + super.samplePopulationVariance(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest minPackageCount(){ + return minPackageCountAs(prefix("minOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest minPackageCountAs(String retName){ + super.min(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest maxPackageCount(){ + return maxPackageCountAs(prefix("maxOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest maxPackageCountAs(String retName){ + super.max(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sumPackageCount(){ + return sumPackageCountAs(prefix("sumOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest sumPackageCountAs(String retName){ + super.sum(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest avgPackageCount(){ + return avgPackageCountAs(prefix("avgOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest avgPackageCountAs(String retName){ + super.avg(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest standardDeviationPackageCount(){ + return standardDeviationPackageCountAs(prefix("standardDeviationOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest standardDeviationPackageCountAs(String retName){ + super.standardDeviation(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest squareRootOfPopulationStandardDeviationPackageCount(){ + return squareRootOfPopulationStandardDeviationPackageCountAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest squareRootOfPopulationStandardDeviationPackageCountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest sampleVariancePackageCount(){ + return sampleVariancePackageCountAs(prefix("sampleVarianceOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest sampleVariancePackageCountAs(String retName){ + super.sampleVariance(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest samplePopulationVariancePackageCount(){ + return samplePopulationVariancePackageCountAs(prefix("samplePopulationVarianceOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); + } + + public FreightQuoteRequest samplePopulationVariancePackageCountAs(String retName){ + super.samplePopulationVariance(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public FreightQuoteRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(FreightQuote.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + + + + + public FreightQuoteRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public FreightQuoteRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.ID_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public FreightQuoteRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.PLATFORM_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctReference(){ + return countDistinctReferenceAs("reference_distinct_count"); + } + + public FreightQuoteRequest countDistinctReferenceAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctAmount(){ + return countDistinctAmountAs("amount_distinct_count"); + } + + public FreightQuoteRequest countDistinctAmountAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.AMOUNT_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctShipmentNumber(){ + return countDistinctShipmentNumberAs("shipment_number_distinct_count"); + } + + public FreightQuoteRequest countDistinctShipmentNumberAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctPackageCount(){ + return countDistinctPackageCountAs("package_count_distinct_count"); + } + + public FreightQuoteRequest countDistinctPackageCountAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctDeliveryDate(){ + return countDistinctDeliveryDateAs("delivery_date_distinct_count"); + } + + public FreightQuoteRequest countDistinctDeliveryDateAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctPickupTime(){ + return countDistinctPickupTimeAs("pickup_time_distinct_count"); + } + + public FreightQuoteRequest countDistinctPickupTimeAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctQuotedAt(){ + return countDistinctQuotedAtAs("quoted_at_distinct_count"); + } + + public FreightQuoteRequest countDistinctQuotedAtAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctInstructions(){ + return countDistinctInstructionsAs("instructions_distinct_count"); + } + + public FreightQuoteRequest countDistinctInstructionsAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public FreightQuoteRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest groupById(){ + groupBy(FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByIdAs(String retName){ + groupBy(retName, FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.ID_PROPERTY, function); + return this; + } + public FreightQuoteRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(FreightQuote.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public FreightQuoteRequest groupByPlatform(){ + groupBy(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPlatformAs(String retName){ + groupBy(retName, FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.PLATFORM_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByReference(){ + groupBy(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByReferenceAs(String retName){ + groupBy(retName, FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByReferenceWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.REFERENCE_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByAmount(){ + groupBy(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByAmountAs(String retName){ + groupBy(retName, FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByAmountWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.AMOUNT_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByShipmentNumber(){ + groupBy(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByShipmentNumberAs(String retName){ + groupBy(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByShipmentNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByPackageCount(){ + groupBy(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPackageCountAs(String retName){ + groupBy(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPackageCountWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.PACKAGE_COUNT_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByDeliveryDate(){ + groupBy(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByDeliveryDateAs(String retName){ + groupBy(retName, FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByDeliveryDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.DELIVERY_DATE_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByPickupTime(){ + groupBy(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPickupTimeAs(String retName){ + groupBy(retName, FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByPickupTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.PICKUP_TIME_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByQuotedAt(){ + groupBy(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByQuotedAtAs(String retName){ + groupBy(retName, FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByQuotedAtWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.QUOTED_AT_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByInstructions(){ + groupBy(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByInstructionsAs(String retName){ + groupBy(retName, FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByInstructionsWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.INSTRUCTIONS_PROPERTY, function); + return this; + } + + public FreightQuoteRequest groupByVersion(){ + groupBy(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByVersionAs(String retName){ + groupBy(retName, FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, FreightQuote.VERSION_PROPERTY, function); + return this; + } + + + + public FreightQuoteRequest orderByIdAscending(){ + addOrderByAscending(FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByIdDescending(){ + addOrderByDescending(FreightQuote.ID_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPlatformAscending(){ + addOrderByAscending(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPlatformDescending(){ + addOrderByDescending(FreightQuote.PLATFORM_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByReferenceAscending(){ + addOrderByAscending(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByReferenceDescending(){ + addOrderByDescending(FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest orderByReferenceAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(FreightQuote.REFERENCE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByReferenceDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(FreightQuote.REFERENCE_PROPERTY); + return this; + } + public FreightQuoteRequest orderByAmountAscending(){ + addOrderByAscending(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByAmountDescending(){ + addOrderByDescending(FreightQuote.AMOUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByShipmentNumberAscending(){ + addOrderByAscending(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByShipmentNumberDescending(){ + addOrderByDescending(FreightQuote.SHIPMENT_NUMBER_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPackageCountAscending(){ + addOrderByAscending(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPackageCountDescending(){ + addOrderByDescending(FreightQuote.PACKAGE_COUNT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByDeliveryDateAscending(){ + addOrderByAscending(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByDeliveryDateDescending(){ + addOrderByDescending(FreightQuote.DELIVERY_DATE_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPickupTimeAscending(){ + addOrderByAscending(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByPickupTimeDescending(){ + addOrderByDescending(FreightQuote.PICKUP_TIME_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByQuotedAtAscending(){ + addOrderByAscending(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByQuotedAtDescending(){ + addOrderByDescending(FreightQuote.QUOTED_AT_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByInstructionsAscending(){ + addOrderByAscending(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByInstructionsDescending(){ + addOrderByDescending(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest orderByInstructionsAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByInstructionsDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(FreightQuote.INSTRUCTIONS_PROPERTY); + return this; + } + public FreightQuoteRequest orderByVersionAscending(){ + addOrderByAscending(FreightQuote.VERSION_PROPERTY); + return this; + } + + public FreightQuoteRequest orderByVersionDescending(){ + addOrderByDescending(FreightQuote.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + + + + + + public FreightQuoteRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public FreightQuoteRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, FreightQuote.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, FreightQuote.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public FreightQuoteRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public FreightQuoteRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public FreightQuoteRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public FreightQuoteRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public FreightQuoteRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public FreightQuoteRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java new file mode 100644 index 000000000..d3f9a3cf4 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e43c5eed054b71b94131c0d8733d90a89b34235c2ba8726ec08f9f3687a87edf"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "freight_quote_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String FREIGHT_QUOTE_LIST_PROPERTY = "freight_quote_list"; + private String name; + + private SmartList freightQuoteList; + + public String getName(){ + return this.name; + } + + public SmartList getFreightQuoteList(){ + return this.freightQuoteList == null ? SmartList.unloaded() : this.freightQuoteList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addFreightQuote(FreightQuote freightQuote){ + if (freightQuote == null){ + return this; + } + + if(null == this.freightQuoteList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.freightQuoteList = teaqlUnloadedItems.map(value -> value); + } + + this.freightQuoteList.add(freightQuote); + freightQuote.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "freight_quote_list": this.freightQuoteList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "freight_quote_list": return this.freightQuoteList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java new file mode 100644 index 000000000..649f1cf3f --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getFreightQuoteList() != null && i < platform.getFreightQuoteList().size(); i++){ + FreightQuote freightQuote = platform.getFreightQuoteList().get(i); + new FreightQuoteChecker().checkAndFix(_context, freightQuote, newLocation(_parentLocation, "freight_quote_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java new file mode 100644 index 000000000..1cbee6f9a --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public FreightQuoteListExpression getFreightQuoteList(){ + return new FreightQuoteListExpression(loaded("freight_quote_list", "getFreightQuoteList", Platform::getFreightQuoteList)); + } + public PlatformExpression addFreightQuote(FreightQuote freightQuote){ + return new PlatformExpression(this, $it -> ((Platform)$it).addFreightQuote(freightQuote)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java new file mode 100644 index 000000000..bee3a3854 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.freightquotesettlement.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java new file mode 100644 index 000000000..28e42e082 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java @@ -0,0 +1,1079 @@ + +package com.example.freightquotesettlement.platform; + +import com.example.freightquotesettlement.Q; +import com.example.freightquotesettlement.freightquote.FreightQuote; +import com.example.freightquotesettlement.freightquote.FreightQuoteRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectFreightQuoteList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectFreightQuoteList(){ + return selectFreightQuoteListWith(Q.freightQuotes().selectSelf()); + } + + public PlatformRequest selectFreightQuoteListWith(FreightQuoteRequest freightQuoteList){ + enhanceRelation(Platform.FREIGHT_QUOTE_LIST_PROPERTY, freightQuoteList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectFreightQuoteListWith", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withFreightQuoteListMatching(FreightQuoteRequest freightQuoteRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, freightQuoteRequest, FreightQuote.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutFreightQuoteListMatching(FreightQuoteRequest freightQuoteRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, freightQuoteRequest, FreightQuote.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveFreightQuotes(){ + return withFreightQuoteListMatching(Q.freightQuotes().unlimited()); + } + + public PlatformRequest haveNoFreightQuotes(){ + return withoutFreightQuoteListMatching(Q.freightQuotes().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByFreightQuotesWithDetails(FreightQuoteRequest subRequest){ + aggregate(Platform.FREIGHT_QUOTE_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + return statsFromFreightQuotesAs(name, subRequest, false); + } + + public PlatformRequest statsFromFreightQuotesAs(String name, FreightQuoteRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromFreightQuotes(FreightQuoteRequest subRequest){ + return statsFromFreightQuotesAs(REFINEMENTS, subRequest); + } + public PlatformRequest countFreightQuotes(){ + addRelationCount("Count", Q.freightQuotes().unlimited(), FreightQuote.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countFreightQuotesAs(String name){ + addRelationCount(name, Q.freightQuotes().unlimited(), FreightQuote.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countFreightQuotesWith(String name, FreightQuoteRequest subRequest){ + addRelationCount(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotesWith", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minAmountOfFreightQuotes(){ + addRelationScalarAggregate("minAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minAmountOfFreightQuotesAs(String name){ + return minAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest minAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxAmountOfFreightQuotes(){ + addRelationScalarAggregate("maxAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxAmountOfFreightQuotesAs(String name){ + return maxAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest maxAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumAmountOfFreightQuotes(){ + addRelationScalarAggregate("sumAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumAmountOfFreightQuotesAs(String name){ + return sumAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sumAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgAmountOfFreightQuotes(){ + addRelationScalarAggregate("avgAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgAmountOfFreightQuotesAs(String name){ + return avgAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest avgAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationAmountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationAmountOfFreightQuotesAs(String name){ + return standardDeviationAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest standardDeviationAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPopAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(String name){ + return squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceAmountOfFreightQuotes(){ + addRelationScalarAggregate("varSampAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceAmountOfFreightQuotesAs(String name){ + return sampleVarianceAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sampleVarianceAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceAmountOfFreightQuotes(){ + addRelationScalarAggregate("varPopAmountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceAmountOfFreightQuotesAs(String name){ + return samplePopulationVarianceAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.AMOUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("minShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minShipmentNumberOfFreightQuotesAs(String name){ + return minShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest minShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("maxShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxShipmentNumberOfFreightQuotesAs(String name){ + return maxShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest maxShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("sumShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumShipmentNumberOfFreightQuotesAs(String name){ + return sumShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sumShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("avgShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgShipmentNumberOfFreightQuotesAs(String name){ + return avgShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest avgShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("stdDevShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationShipmentNumberOfFreightQuotesAs(String name){ + return standardDeviationShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest standardDeviationShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPopShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(String name){ + return squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("varSampShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotesAs(String name){ + return sampleVarianceShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotes(){ + addRelationScalarAggregate("varPopShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotesAs(String name){ + return samplePopulationVarianceShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.SHIPMENT_NUMBER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("minPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minPackageCountOfFreightQuotesAs(String name){ + return minPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest minPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("maxPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxPackageCountOfFreightQuotesAs(String name){ + return maxPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest maxPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("sumPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumPackageCountOfFreightQuotesAs(String name){ + return sumPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sumPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("avgPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgPackageCountOfFreightQuotesAs(String name){ + return avgPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest avgPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationPackageCountOfFreightQuotesAs(String name){ + return standardDeviationPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest standardDeviationPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotes(){ + addRelationScalarAggregate("stdDevPopPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(String name){ + return squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVariancePackageCountOfFreightQuotes(){ + addRelationScalarAggregate("varSampPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVariancePackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVariancePackageCountOfFreightQuotesAs(String name){ + return sampleVariancePackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest sampleVariancePackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVariancePackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotes(){ + addRelationScalarAggregate("varPopPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), + FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVariancePackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotesAs(String name){ + return samplePopulationVariancePackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); + } + + public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ + addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, + FreightQuote.PACKAGE_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVariancePackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java b/examples/scalar-type-probe/java-lib-core/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/scalar-type-probe/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..3159e1a6b --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.freightquotesettlement.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/teaql/checker-model.json b/examples/scalar-type-probe/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..3940f6a01 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:3b8da34e762562f0877bfd04865e33c225b4d854c8a5914ea30b4a922d3df3b7","entities":{"FreightQuote":{"labels":{"en":"Freight Quote"},"fields":[{"name":"amount","labels":{"en":"amount"},"aliases":["Amount"]},{"name":"delivery_date","labels":{"en":"delivery date"},"aliases":["DeliveryDate","deliveryDate"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"instructions","labels":{"en":"instructions"},"aliases":["Instructions"]},{"name":"package_count","labels":{"en":"package count"},"aliases":["PackageCount","packageCount"]},{"name":"pickup_time","labels":{"en":"pickup time"},"aliases":["PickupTime","pickupTime"]},{"name":"platform","targetType":"Platform","labels":{"en":"Dispatch Platform"},"aliases":["Platform"]},{"name":"quoted_at","labels":{"en":"quoted at"},"aliases":["QuotedAt","quotedAt"]},{"name":"reference","labels":{"en":"reference"},"aliases":["Reference"]},{"name":"shipment_number","labels":{"en":"shipment number"},"aliases":["ShipmentNumber","shipmentNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Dispatch Platform"},"fields":[{"name":"freight_quote_list","targetType":"FreightQuote","labels":{"en":"Freight Quote"},"aliases":["FreightQuoteList","freightQuoteList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-lib-core/teaql/model-provenance.json b/examples/scalar-type-probe/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..d07d09102 --- /dev/null +++ b/examples/scalar-type-probe/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:833c5fc594652f4247ab0587040cdcba5da043d91c9d16cb602e28863fe69ca5","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/scalar-type-probe/showcase.json b/examples/scalar-type-probe/showcase.json new file mode 100644 index 000000000..cbbfb26ff --- /dev/null +++ b/examples/scalar-type-probe/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/scalar-type-probe", + "library": { + "generatedFilesManifestSHA256": "8208d2d6ed02503f52d05851889e0a4b37d96ab26a6058fc04ea1fed15cfc958", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "freight-quote.xml", + "sha256": "076fdf926be1a8b71e61cdfaf66b539f54c1ac2182e1f2bc75897dfab52d6d38" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-freight-quote-generation/receipt.json", + "receiptSHA256": "a5350a3ac3793dbf2d0f0700fe6ef73501f68cfd66b2d13d30d31c07d08555a1" + }, + "scene": "Precise freight quotes and delivery commitments", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/scalar-type-probe/verify-freight-quotes.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java" + ], + "generatedFilesManifestSHA256": "1157a515e32373a53a8284422c878f0e433e9d4870e4ca779ca7e88ba36384fa", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/scalar-type-probe/verify-freight-quotes.sh b/examples/scalar-type-probe/verify-freight-quotes.sh new file mode 100644 index 000000000..3498a5d64 --- /dev/null +++ b/examples/scalar-type-probe/verify-freight-quotes.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" +if [[ -n "${TEAQL_FREIGHT_QUOTE_EVIDENCE_DIR:-}" ]]; then + evidence="$TEAQL_FREIGHT_QUOTE_EVIDENCE_DIR" + mkdir "$evidence" +else + evidence="$(mktemp -d -t teaql-java-freight-evidence.XXXXXXXX)" +fi +evidence="$(cd "$evidence" && pwd)" +scratch="$(mktemp -d -t teaql-java-freight-build.XXXXXXXX)" +cleanup() { + status=$? + trap - EXIT + rm -rf -- "$scratch" || { [[ "$status" != 0 ]] || status=1; } + exit "$status" +} +trap cleanup EXIT +trap 'exit 130' INT +trap 'exit 143' TERM + +source="$scratch/source" +mkdir "$source" +git -C "$repo" archive HEAD | tar -xf - -C "$source" +app="$source/examples/scalar-type-probe/java-app-console" +library="$source/examples/scalar-type-probe/java-lib-core/lib" +cp "$app/pom.xml" "$evidence/workspace-pom.xml" +diff -qr "$app/lib/src" "$library/src" +cat > "$scratch/pom.xml" <<'XML' + + 4.0.0 + io.teaql.examples + freight-quote-source-reactor + 1.0.0 + pom + + source + source/examples/scalar-type-probe/java-lib-core/lib + source/examples/scalar-type-probe/java-app-console + + +XML +mvn -o -B -ntp -f "$scratch/pom.xml" -pl :freight-quote-settlement -am package -DskipTests > "$evidence/build.log" 2>&1 || { + tail -80 "$evidence/build.log" + exit 1 +} +artifact="$app/target/freight-quote-settlement-0.0.1-SNAPSHOT.jar" +sha256sum "$artifact" > "$evidence/application.sha256" +class_origins=( + 'teaql-core:io/teaql/core/UserContext.class' + 'teaql-runtime:io/teaql/runtime/TeaQLRuntime.class' + 'teaql-sqlite:io/teaql/core/sqlite/SqliteDecimalFunctions.class' + 'teaql-jackson:io/teaql/jackson/TeaQLModule.class' +) +for origin in "${class_origins[@]}"; do + module="${origin%%:*}" + entry="${origin#*:}" + unzip -p "$artifact" "$entry" | cmp - "$source/$module/target/classes/$entry" + sha256sum "$source/$module/target/classes/$entry" +done > "$evidence/runtime-classes.sha256" +for phase in first restart; do + java -cp "$artifact" com.example.freightquotesettlement.FreightQuoteShowcase "$evidence/freight.sqlite" "$phase" | tee "$evidence/$phase.log" +done +mkdir "$evidence/calibration" +for name in scalar finite restoration-views outer-replay jdbc-exact sql-millis empty memory-empty; do + options=() + if [[ "$name" != scalar ]]; then options+=("--$name"); fi + TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence/calibration/$name" node "$example/verify-local.cjs" "${options[@]}" | tee "$evidence/calibration/$name.log" +done +for name in profiles lifecycle numeric temporal local-datetime rejected explicit-null loaded-revert version-lifecycle; do + options=() + if [[ "$name" != profiles ]]; then options+=("--$name"); fi + TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence/calibration/json-$name" node "$example/verify-json-profiles.cjs" "${options[@]}" | tee "$evidence/calibration/json-$name.log" +done +echo "PASS Freight quotes and scalar calibrations. Evidence at $evidence" diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 2c0b35af6..b0e37747a 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -54,40 +54,7 @@ TEAQL_JAVA_STANDARD_ORDER_EVIDENCE_DIR="$verification_dir/standard-order" bash e TEAQL_CODEGEN_DIR="$build_dir/generator" bash examples/shared-load-state/verify.sh --generate TEAQL_JAVA_EXACT_EVIDENCE_DIR="$evidence_dir/exact-decimal" \ bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/exact-decimal/verify.sh" -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/scalar-type-probe" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/scalar-finite" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --finite -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/restoration-views" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --restoration-views -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/outer-replay" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --outer-replay -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/jdbc-exact" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --jdbc-exact -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/sql-millisecond" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --sql-millis -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/empty-aggregates" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --empty -TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/memory-empty-aggregates" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --memory-empty -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-profiles" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-lifecycle" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --lifecycle -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-numeric" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --numeric -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-temporal" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --temporal -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-local-datetime" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --local-datetime -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/rejected-mutation" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --rejected -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/explicit-null" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --explicit-null -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/loaded-revert" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --loaded-revert -TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/version-lifecycle" \ - node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --version-lifecycle +TEAQL_FREIGHT_QUOTE_EVIDENCE_DIR="$evidence_dir/freight-quotes" bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-freight-quotes.sh" node "$repo/examples/conformance/context-derived/verify-local.cjs" TEAQL_NATURAL_MESSAGES_EVIDENCE_DIR="$evidence_dir/natural-messages" \ node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/conformance/natural-messages/verify-local.cjs" From a5e09f0686bd9981b7e69b783baf5ab9ef3b5383 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 16:53:23 +0800 Subject: [PATCH 39/71] Record focused java examples/scalar-type-probe business qualification --- examples/scalar-type-probe/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/scalar-type-probe/showcase.json b/examples/scalar-type-probe/showcase.json index cbbfb26ff..9599588d7 100644 --- a/examples/scalar-type-probe/showcase.json +++ b/examples/scalar-type-probe/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-freight-quote-generation/receipt.json", "receiptSHA256": "a5350a3ac3793dbf2d0f0700fe6ef73501f68cfd66b2d13d30d31c07d08555a1" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-freight-quotes-retained-readback/business-receipt.json", + "businessReceiptSHA256": "1ab8d2ea8f7c0fa4665b39afa3f6d364855bea76a776c1a35cb2760e1b32d3e2", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-freight-quotes-retained-readback/receipt.json", + "nativeReceiptSHA256": "274a2fe93705ef8c055d42c7ab5a91ecef82e279e64a56f7cf70740efe8a2f45", + "remainingFullRuntimeInventory": true, + "sourceCommit": "80125159c4a326d50be9977c84fb0e4ccc72277f" + }, "scene": "Precise freight quotes and delivery commitments", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/scalar-type-probe/verify-freight-quotes.sh" From c78341b4f189c6f38c2081c932806762f940efea Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 17:36:26 +0800 Subject: [PATCH 40/71] Run the TraceChain test fixture in the generated console workspace --- examples/trace-chain/README.md | 6 + .../trace-chain/java-app-console/.gitignore | 53 + .../trace-chain/java-app-console/AGENTS.md | 70 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 33 + .../trace-chain/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 190 +++ .../trace-chain/java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../com/teaql/tracechainservice/Checkers.java | 0 .../teaql/tracechainservice/Constants.java | 0 .../java/com/teaql/tracechainservice/E.java | 0 .../tracechainservice/EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 .../java/com/teaql/tracechainservice/Q.java | 0 .../teaql/tracechainservice/Repositories.java | 0 .../TraceChainServiceUserContext.java | 0 .../customerorder/CustomerOrder.java | 0 .../customerorder/CustomerOrderChecker.java | 0 .../CustomerOrderExpression.java | 0 .../CustomerOrderListExpression.java | 0 .../customerorder/CustomerOrderRequest.java | 0 .../orderitem/OrderItem.java | 0 .../orderitem/OrderItemChecker.java | 0 .../orderitem/OrderItemExpression.java | 0 .../orderitem/OrderItemListExpression.java | 0 .../orderitem/OrderItemRequest.java | 0 .../tracechainservice/payment/Payment.java | 0 .../payment/PaymentChecker.java | 0 .../payment/PaymentExpression.java | 0 .../payment/PaymentListExpression.java | 0 .../payment/PaymentRequest.java | 0 .../paymentattempt/PaymentAttempt.java | 0 .../paymentattempt/PaymentAttemptChecker.java | 0 .../PaymentAttemptExpression.java | 0 .../PaymentAttemptListExpression.java | 0 .../paymentattempt/PaymentAttemptRequest.java | 0 .../tracechainservice/platform/Platform.java | 0 .../platform/PlatformChecker.java | 0 .../platform/PlatformExpression.java | 0 .../platform/PlatformListExpression.java | 0 .../platform/PlatformRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../tracechainservice/shipment/Shipment.java | 0 .../shipment/ShipmentChecker.java | 0 .../shipment/ShipmentExpression.java | 0 .../shipment/ShipmentListExpression.java | 0 .../shipment/ShipmentRequest.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 examples/trace-chain/java-app-console/pom.xml | 115 ++ .../java/com/teaql/tracechainservice/App.java | 99 ++ .../tracechainservice/CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../GeneratedAggregateTraceExampleTest.java | 0 .../GeneratedFacetTraceExampleTest.java | 0 ...GeneratedReverseFacetTraceExampleTest.java | 0 ...GeneratedStandardTelemetryExampleTest.java | 0 .../GeneratedTraceChainExampleTest.java | 0 .../teaql/examples/tracechain/IdDatabase.java | 0 .../java-app-console/teaql-i18n.json | 126 ++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 0 .../{ => java-lib-core}/lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 .../com/teaql/tracechainservice/Checkers.java | 0 .../teaql/tracechainservice/Constants.java | 9 + .../java/com/teaql/tracechainservice/E.java | 38 + .../tracechainservice/EntityMetaRegistry.java | 799 +++++++++++++ .../GeneratedRuntimeModule.java | 41 + .../java/com/teaql/tracechainservice/Q.java | 61 + .../teaql/tracechainservice/Repositories.java | 0 .../TraceChainServiceUserContext.java | 10 + .../customerorder/CustomerOrder.java | 216 ++++ .../customerorder/CustomerOrderChecker.java | 89 ++ .../CustomerOrderExpression.java | 84 ++ .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 1017 +++++++++++++++++ .../orderitem/OrderItem.java | 128 +++ .../orderitem/OrderItemChecker.java | 59 + .../orderitem/OrderItemExpression.java | 53 + .../orderitem/OrderItemListExpression.java | 25 + .../orderitem/OrderItemRequest.java | 689 +++++++++++ .../tracechainservice/payment/Payment.java | 151 +++ .../payment/PaymentChecker.java | 65 ++ .../payment/PaymentExpression.java | 61 + .../payment/PaymentListExpression.java | 25 + .../payment/PaymentRequest.java | 750 ++++++++++++ .../paymentattempt/PaymentAttempt.java | 128 +++ .../paymentattempt/PaymentAttemptChecker.java | 59 + .../PaymentAttemptExpression.java | 53 + .../PaymentAttemptListExpression.java | 25 + .../paymentattempt/PaymentAttemptRequest.java | 689 +++++++++++ .../tracechainservice/platform/Platform.java | 130 +++ .../platform/PlatformChecker.java | 52 + .../platform/PlatformExpression.java | 51 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 623 ++++++++++ .../sampledata/SampleDataService.java | 0 .../tracechainservice/shipment/Shipment.java | 128 +++ .../shipment/ShipmentChecker.java | 59 + .../shipment/ShipmentExpression.java | 53 + .../shipment/ShipmentListExpression.java | 25 + .../shipment/ShipmentRequest.java | 689 +++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/trace-chain/pom.xml | 34 +- examples/trace-chain/showcase.json | 42 + .../trace-chain/verify-standard-telemetry.sh | 7 +- examples/trace-chain/verify.sh | 6 +- pom.xml | 4 +- 114 files changed, 8278 insertions(+), 33 deletions(-) create mode 100644 examples/trace-chain/java-app-console/.gitignore create mode 100644 examples/trace-chain/java-app-console/AGENTS.md create mode 100644 examples/trace-chain/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/trace-chain/java-app-console/Makefile create mode 100644 examples/trace-chain/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/trace-chain/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/trace-chain/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/trace-chain/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/trace-chain/java-app-console/lib/pom.xml rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/Checkers.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/Constants.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/E.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/Q.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/Repositories.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java (100%) rename examples/trace-chain/{ => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) create mode 100644 examples/trace-chain/java-app-console/pom.xml create mode 100644 examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/App.java create mode 100644 examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/CustomUserContext.java create mode 100644 examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/trace-chain/java-app-console/src/main/resources/application.properties rename examples/trace-chain/{ => java-app-console}/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java (100%) rename examples/trace-chain/{ => java-app-console}/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java (100%) rename examples/trace-chain/{ => java-app-console}/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java (100%) rename examples/trace-chain/{ => java-app-console}/src/test/java/io/teaql/examples/tracechain/GeneratedStandardTelemetryExampleTest.java (100%) rename examples/trace-chain/{ => java-app-console}/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java (100%) rename examples/trace-chain/{ => java-app-console}/src/test/java/io/teaql/examples/tracechain/IdDatabase.java (100%) create mode 100644 examples/trace-chain/java-app-console/teaql-i18n.json rename examples/trace-chain/{ => java-app-console}/teaql/checker-model.json (100%) rename examples/trace-chain/{ => java-app-console}/teaql/model-provenance.json (100%) rename examples/trace-chain/{ => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Checkers.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Constants.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/E.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Q.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Repositories.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java create mode 100644 examples/trace-chain/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/trace-chain/java-lib-core/teaql/checker-model.json create mode 100644 examples/trace-chain/java-lib-core/teaql/model-provenance.json create mode 100644 examples/trace-chain/showcase.json diff --git a/examples/trace-chain/README.md b/examples/trace-chain/README.md index 0a5a74bb8..2a4dc66d7 100644 --- a/examples/trace-chain/README.md +++ b/examples/trace-chain/README.md @@ -1,5 +1,11 @@ # Java generated API Trace Chain example +The mixed order graph, failed saves and standard telemetry run in the +generated `java-app-console` workspace, using the sibling `java-lib-core` +library from `model.xml`. Run `bash examples/trace-chain/verify.sh` for the +order graph and `bash examples/trace-chain/verify-standard-telemetry.sh` for +the standard telemetry demonstrations. + This focused example uses the six-entity KSML model in [model.xml](model.xml), an unchanged generated domain library, and the runtime from this checkout. Business creation, graph attachment, deletion, recovery, query and expression access use diff --git a/examples/trace-chain/java-app-console/.gitignore b/examples/trace-chain/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/trace-chain/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/AGENTS.md b/examples/trace-chain/java-app-console/AGENTS.md new file mode 100644 index 000000000..f19b41647 --- /dev/null +++ b/examples/trace-chain/java-app-console/AGENTS.md @@ -0,0 +1,70 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| customer_order | Customer Order | +| order_item | Order Item | +| payment | Payment | +| payment_attempt | Payment Attempt | +| shipment | Shipment | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/trace-chain/java-app-console/DOMAIN_API_GUIDE.md b/examples/trace-chain/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..768589273 --- /dev/null +++ b/examples/trace-chain/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,33 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/trace-chain-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| customer_order | Customer Order | +| order_item | Order Item | +| payment | Payment | +| payment_attempt | Payment Attempt | +| shipment | Shipment | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/Makefile b/examples/trace-chain/java-app-console/Makefile new file mode 100644 index 000000000..c07be7789 --- /dev/null +++ b/examples/trace-chain/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/trace-chain-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/trace-chain-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/trace-chain/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..d4bfa105f --- /dev/null +++ b/examples/trace-chain/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/trace-chain-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/STANDARD_TELEMETRY.md b/examples/trace-chain/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/trace-chain/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/trace-chain/java-app-console/TOOL_API_GUIDE.md b/examples/trace-chain/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..f9d18891c --- /dev/null +++ b/examples/trace-chain/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/trace-chain-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/trace-chain-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/trace-chain-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/docs/teaql-java-crud-guide.md b/examples/trace-chain/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..eb9a623bb --- /dev/null +++ b/examples/trace-chain/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,190 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.tracechainservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.TraceChainServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.customerOrders() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.customerOrders() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new CustomerOrder(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.customerOrders() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.customerOrders() + .selectPlatformWith(Q.platforms().selectSelf()) + .comment("load with platform") + .purpose("fetch associated platform") + .executeForList(userContext); +``` + + + +```java +var list = Q.customerOrders() + .selectOrderItemListWith(Q.orderItems().selectSelf()) + .comment("load with orderItemList") + .purpose("fetch child orderItemList") + .executeForList(userContext); +``` + +```java +var list = Q.customerOrders() + .selectPaymentListWith(Q.payments().selectSelf()) + .comment("load with paymentList") + .purpose("fetch child paymentList") + .executeForList(userContext); +``` + +```java +var list = Q.customerOrders() + .selectShipmentListWith(Q.shipments().selectSelf()) + .comment("load with shipmentList") + .purpose("fetch child shipmentList") + .executeForList(userContext); +``` + +```java +var list = Q.payments() + .selectCustomerOrderWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrder") + .purpose("fetch associated customerOrder") + .executeForList(userContext); +``` + + +```java +var list = Q.payments() + .selectPaymentAttemptListWith(Q.paymentAttempts().selectSelf()) + .comment("load with paymentAttemptList") + .purpose("fetch child paymentAttemptList") + .executeForList(userContext); +``` + + +```java +var list = Q.platforms() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `CustomerOrder`: reverse relations `3`, query `Q.customerOrders()`, save `new CustomerOrder().auditAs("comment").save(userContext)`, request `com.teaql.tracechainservice.customerorder.CustomerOrderRequest` +- `Payment`: reverse relations `1`, query `Q.payments()`, save `new Payment().auditAs("comment").save(userContext)`, request `com.teaql.tracechainservice.payment.PaymentRequest` +- `Platform`: reverse relations `1`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.teaql.tracechainservice.platform.PlatformRequest` \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/pom.xml b/examples/trace-chain/java-app-console/lib/pom.xml new file mode 100644 index 000000000..178e63624 --- /dev/null +++ b/examples/trace-chain/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + trace-chain-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Checkers.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Checkers.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Checkers.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Checkers.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Constants.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Constants.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Constants.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Constants.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/E.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/E.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/E.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Q.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Q.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Q.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Q.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Repositories.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Repositories.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/Repositories.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Repositories.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java diff --git a/examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java similarity index 100% rename from examples/trace-chain/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java rename to examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java diff --git a/examples/trace-chain/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/trace-chain/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/trace-chain/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/trace-chain/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/trace-chain/java-app-console/pom.xml b/examples/trace-chain/java-app-console/pom.xml new file mode 100644 index 000000000..bf3f045cb --- /dev/null +++ b/examples/trace-chain/java-app-console/pom.xml @@ -0,0 +1,115 @@ + + + + 4.0.0 + + + io.teaql + teaql-java-parent + 6.3.0 + ../../../pom.xml + + teaql-trace-chain-example + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.teaql + trace-chain-service-core + ${libversion} + + io.teaqlteaql-runtime + io.teaqlteaql-sqlite + io.teaqlteaql-opentelemetry${teaql.version}test + junitjunittest + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + ${teaql.trace.database} + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.teaql.tracechainservice.App + + + + + + + + \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/App.java b/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/App.java new file mode 100644 index 000000000..8421a2d9d --- /dev/null +++ b/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/App.java @@ -0,0 +1,99 @@ + +package com.teaql.tracechainservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/CustomUserContext.java b/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/CustomUserContext.java new file mode 100644 index 000000000..8e3478706 --- /dev/null +++ b/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.tracechainservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements TraceChainServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/WorkspaceTeaQLDatabase.java b/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..c02187626 --- /dev/null +++ b/examples/trace-chain/java-app-console/src/main/java/com/teaql/tracechainservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.tracechainservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/src/main/resources/application.properties b/examples/trace-chain/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..74474ba19 --- /dev/null +++ b/examples/trace-chain/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:tracechainservice.db diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java similarity index 100% rename from examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java rename to examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedAggregateTraceExampleTest.java diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java similarity index 100% rename from examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java rename to examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedFacetTraceExampleTest.java diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java similarity index 100% rename from examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java rename to examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedReverseFacetTraceExampleTest.java diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedStandardTelemetryExampleTest.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedStandardTelemetryExampleTest.java similarity index 100% rename from examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedStandardTelemetryExampleTest.java rename to examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedStandardTelemetryExampleTest.java diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java similarity index 100% rename from examples/trace-chain/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java rename to examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java diff --git a/examples/trace-chain/src/test/java/io/teaql/examples/tracechain/IdDatabase.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/IdDatabase.java similarity index 100% rename from examples/trace-chain/src/test/java/io/teaql/examples/tracechain/IdDatabase.java rename to examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/IdDatabase.java diff --git a/examples/trace-chain/java-app-console/teaql-i18n.json b/examples/trace-chain/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..f63a00082 --- /dev/null +++ b/examples/trace-chain/java-app-console/teaql-i18n.json @@ -0,0 +1,126 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.shipment.version": "Version", + "property.customerOrder.orderNumber": "Order Number", + "property.orderItem.id": "Id", + "property.shipment.referenceCode": "Reference Code", + "property.customerOrder.description": "Description", + "entity.orderItem": "Order Item", + "property.orderItem.customerOrder": "Customer Order", + "property.orderItem.name": "Name", + "entity.customerOrder": "Customer Order", + "property.payment.customerOrder": "Customer Order", + "property.customerOrder.id": "Id", + "property.paymentAttempt.version": "Version", + "property.payment.version": "Version", + "property.shipment.customerOrder": "Customer Order", + "property.paymentAttempt.id": "Id", + "property.customerOrder.version": "Version", + "property.payment.id": "Id", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.customerOrder.platform": "Platform", + "entity.payment": "Payment", + "property.shipment.id": "Id", + "property.payment.referenceCode": "Reference Code", + "property.paymentAttempt.referenceCode": "Reference Code", + "entity.shipment": "Shipment", + "property.orderItem.version": "Version", + "property.platform.version": "Version", + "property.paymentAttempt.payment": "Payment", + "entity.paymentAttempt": "Payment Attempt" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/trace-chain/teaql/checker-model.json b/examples/trace-chain/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/trace-chain/teaql/checker-model.json rename to examples/trace-chain/java-app-console/teaql/checker-model.json diff --git a/examples/trace-chain/teaql/model-provenance.json b/examples/trace-chain/java-app-console/teaql/model-provenance.json similarity index 100% rename from examples/trace-chain/teaql/model-provenance.json rename to examples/trace-chain/java-app-console/teaql/model-provenance.json diff --git a/examples/trace-chain/lib/pom.xml b/examples/trace-chain/java-lib-core/lib/pom.xml similarity index 100% rename from examples/trace-chain/lib/pom.xml rename to examples/trace-chain/java-lib-core/lib/pom.xml diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Checkers.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Constants.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Constants.java new file mode 100644 index 000000000..75826fd12 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.tracechainservice; + +import com.teaql.tracechainservice.platform.Platform; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/E.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/E.java new file mode 100644 index 000000000..0ae2c18a9 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/E.java @@ -0,0 +1,38 @@ + +package com.teaql.tracechainservice; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; +import com.teaql.tracechainservice.orderitem.OrderItem; +import com.teaql.tracechainservice.orderitem.OrderItemExpression; +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentExpression; +import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; +import com.teaql.tracechainservice.paymentattempt.PaymentAttemptExpression; +import com.teaql.tracechainservice.platform.Platform; +import com.teaql.tracechainservice.platform.PlatformExpression; +import com.teaql.tracechainservice.shipment.Shipment; +import com.teaql.tracechainservice.shipment.ShipmentExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } + public static OrderItemExpression orderItem(OrderItem orderItem){ + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); + } + public static PaymentExpression payment(Payment payment){ + return new PaymentExpression(new ValueExpression(payment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.payment()")); + } + public static PaymentAttemptExpression paymentAttempt(PaymentAttempt paymentAttempt){ + return new PaymentAttemptExpression(new ValueExpression(paymentAttempt, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.paymentAttempt()")); + } + public static ShipmentExpression shipment(Shipment shipment){ + return new ShipmentExpression(new ValueExpression(shipment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.shipment()")); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java new file mode 100644 index 000000000..75a93b749 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java @@ -0,0 +1,799 @@ + +package com.teaql.tracechainservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerCustomerOrder(); + registerOrderItem(); + registerPayment(); + registerPaymentAttempt(); + registerShipment(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.teaql.tracechainservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.tracechainservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.tracechainservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.platform.Platform::new); + entityDescriptor.with("name", "Platform") + + .with("module", "Trace Chain") + + .with("module_key", "trace-chain") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Trace Chain Verification") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.tracechainservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.tracechainservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.customerorder.CustomerOrder::new); + entityDescriptor.with("name", "Customer Order") + + .with("module", "Trace Chain") + + .with("module_key", "trace-chain") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.customerorder.CustomerOrder.PLATFORM_PROPERTY, com.teaql.tracechainservice.platform.Platform.INTERNAL_TYPE, com.teaql.tracechainservice.platform.Platform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.tracechainservice.platform.Platform.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor description = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderItem() { + FieldLayout.installGenerated(com.teaql.tracechainservice.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.tracechainservice.orderitem.OrderItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.tracechainservice.orderitem.OrderItem.class); + entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.orderitem.OrderItem::new); + entityDescriptor.with("name", "Order Item") + + .with("module", "Trace Chain") + + .with("module_key", "trace-chain") + + .with("audit_mask_fields", "name") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerPayment() { + FieldLayout.installGenerated(com.teaql.tracechainservice.payment.Payment.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.tracechainservice.payment.Payment.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.tracechainservice.payment.Payment.class); + entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.payment.Payment::new); + entityDescriptor.with("name", "Payment") + + .with("module", "Trace Chain") + + .with("module_key", "trace-chain") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.payment.Payment.CUSTOMER_ORDER_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.tracechainservice.customerorder.CustomerOrder.PAYMENT_LIST_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor referenceCode = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerPaymentAttempt() { + FieldLayout.installGenerated(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class); + entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.paymentattempt.PaymentAttempt::new); + entityDescriptor.with("name", "Payment Attempt") + + .with("module", "Trace Chain") + + .with("module_key", "trace-chain") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY, Long.class) + ; + PropertyDescriptor payment = + entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.paymentattempt.PaymentAttempt.PAYMENT_PROPERTY, com.teaql.tracechainservice.payment.Payment.INTERNAL_TYPE, com.teaql.tracechainservice.payment.Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, com.teaql.tracechainservice.payment.Payment.class) + ; + PropertyDescriptor referenceCode = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.PAYMENT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerShipment() { + FieldLayout.installGenerated(com.teaql.tracechainservice.shipment.Shipment.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.tracechainservice.shipment.Shipment.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.tracechainservice.shipment.Shipment.class); + entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.shipment.Shipment::new); + entityDescriptor.with("name", "Shipment") + + .with("module", "Trace Chain") + + .with("module_key", "trace-chain") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.shipment.Shipment.CUSTOMER_ORDER_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.tracechainservice.customerorder.CustomerOrder.SHIPMENT_LIST_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor referenceCode = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..b55a80e8f --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java @@ -0,0 +1,41 @@ +package com.teaql.tracechainservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.tracechainservice.platform.PlatformChecker(), new com.teaql.tracechainservice.customerorder.CustomerOrderChecker(), new com.teaql.tracechainservice.orderitem.OrderItemChecker(), new com.teaql.tracechainservice.payment.PaymentChecker(), new com.teaql.tracechainservice.paymentattempt.PaymentAttemptChecker(), new com.teaql.tracechainservice.shipment.ShipmentChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:3360338e7162e546ad5c97348770bb50933b4da775b55b99a9707d39f93c8b0a\",\"entities\":{\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"description\",\"labels\":{\"en\":\"description\"},\"aliases\":[\"Description\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"Order Item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"payment_list\",\"targetType\":\"Payment\",\"labels\":{\"en\":\"Payment\"},\"aliases\":[\"PaymentList\",\"paymentList\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"shipment_list\",\"targetType\":\"Shipment\",\"labels\":{\"en\":\"Shipment\"},\"aliases\":[\"ShipmentList\",\"shipmentList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"Order Item\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Payment\":{\"labels\":{\"en\":\"Payment\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"payment_attempt_list\",\"targetType\":\"PaymentAttempt\",\"labels\":{\"en\":\"Payment Attempt\"},\"aliases\":[\"PaymentAttemptList\",\"paymentAttemptList\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PaymentAttempt\":{\"labels\":{\"en\":\"Payment Attempt\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"payment\",\"targetType\":\"Payment\",\"labels\":{\"en\":\"Payment\"},\"aliases\":[\"Payment\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Shipment\":{\"labels\":{\"en\":\"Shipment\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("description", "description"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Payment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("reference_code", "referenceCode"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("PaymentAttempt", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("payment", "payment"), java.util.Map.entry("reference_code", "referenceCode"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Shipment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("reference_code", "referenceCode"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.tracechainservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.tracechainservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Trace Chain Verification"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + } +} diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Q.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Q.java new file mode 100644 index 000000000..ba794b229 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Q.java @@ -0,0 +1,61 @@ + +package com.teaql.tracechainservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.tracechainservice.platform.PlatformRequest platforms(){ + return new com.teaql.tracechainservice.platform.PlatformRequest(com.teaql.tracechainservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.tracechainservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.teaql.tracechainservice.platform.PlatformRequest(com.teaql.tracechainservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.tracechainservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.teaql.tracechainservice.customerorder.CustomerOrderRequest(com.teaql.tracechainservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.tracechainservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.teaql.tracechainservice.customerorder.CustomerOrderRequest(com.teaql.tracechainservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.tracechainservice.orderitem.OrderItemRequest orderItems(){ + return new com.teaql.tracechainservice.orderitem.OrderItemRequest(com.teaql.tracechainservice.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.tracechainservice.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ + return new com.teaql.tracechainservice.orderitem.OrderItemRequest(com.teaql.tracechainservice.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.tracechainservice.payment.PaymentRequest payments(){ + return new com.teaql.tracechainservice.payment.PaymentRequest(com.teaql.tracechainservice.payment.Payment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.tracechainservice.payment.PaymentRequest paymentsWithMinimalFields(){ + return new com.teaql.tracechainservice.payment.PaymentRequest(com.teaql.tracechainservice.payment.Payment.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest paymentAttempts(){ + return new com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest paymentAttemptsWithMinimalFields(){ + return new com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.tracechainservice.shipment.ShipmentRequest shipments(){ + return new com.teaql.tracechainservice.shipment.ShipmentRequest(com.teaql.tracechainservice.shipment.Shipment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.tracechainservice.shipment.ShipmentRequest shipmentsWithMinimalFields(){ + return new com.teaql.tracechainservice.shipment.ShipmentRequest(com.teaql.tracechainservice.shipment.Shipment.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Repositories.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java new file mode 100644 index 000000000..0fb4cb2ae --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.tracechainservice; + +import io.teaql.core.UserContext; +public interface TraceChainServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..7d8b00783 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java @@ -0,0 +1,216 @@ + +package com.teaql.tracechainservice.customerorder; + +import com.teaql.tracechainservice.orderitem.OrderItem; +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.platform.Platform; +import com.teaql.tracechainservice.shipment.Shipment; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f10d535b66998395625745c0c3f6032ed01350e7f851687673b5ff1eb94a4337"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("order_number", 2), java.util.Map.entry("description", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("description", java.util.List.of("description", "description")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list", "payment_list", "shipment_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String DESCRIPTION_PROPERTY = "description"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + public static final String PAYMENT_LIST_PROPERTY = "payment_list"; + public static final String SHIPMENT_LIST_PROPERTY = "shipment_list"; + private Platform platform; + + private String orderNumber; + + private String description; + + private SmartList orderItemList; + private SmartList paymentList; + private SmartList shipmentList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getOrderNumber(){ + return this.orderNumber; + } + + public String getDescription(){ + return this.description; + } + + public SmartList getOrderItemList(){ + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; + } + public SmartList getPaymentList(){ + return this.paymentList == null ? SmartList.unloaded() : this.paymentList; + } + public SmartList getShipmentList(){ + return this.shipmentList == null ? SmartList.unloaded() : this.shipmentList; + } + public CustomerOrder updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateDescription(String description){ + description = (description == null ? null : description.trim()); + if(isPropertyLoaded(DESCRIPTION_PROPERTY) && Objects.equals(this.description, description)){ + return this; + } + handleUpdate(DESCRIPTION_PROPERTY, getDescription(), description); + this.description = description; + return this; + } + + public CustomerOrder addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); + } + + this.orderItemList.add(orderItem); + orderItem.updateCustomerOrder(this); + return this; + } + public CustomerOrder addPayment(Payment payment){ + if (payment == null){ + return this; + } + + if(null == this.paymentList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.paymentList = teaqlUnloadedItems.map(value -> value); + } + + this.paymentList.add(payment); + payment.updateCustomerOrder(this); + return this; + } + public CustomerOrder addShipment(Shipment shipment){ + if (shipment == null){ + return this; + } + + if(null == this.shipmentList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.shipmentList = teaqlUnloadedItems.map(value -> value); + } + + this.shipmentList.add(shipment); + shipment.updateCustomerOrder(this); + return this; + } + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "description": this.description = (value == null ? null : ((String)value).trim()); break; + + case "order_item_list": this.orderItemList = (SmartList) value; break; + case "payment_list": this.paymentList = (SmartList) value; break; + case "shipment_list": this.shipmentList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "order_number": return this.orderNumber; + case "description": return this.description; + case "order_item_list": return this.orderItemList; + case "payment_list": return this.paymentList; + case "shipment_list": return this.shipmentList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "orderNumber": return this.orderNumber; + case "description": return this.description; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..2dbe2f874 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,89 @@ + +package com.teaql.tracechainservice.customerorder; + +import com.teaql.tracechainservice.orderitem.OrderItem; +import com.teaql.tracechainservice.orderitem.OrderItemChecker; +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentChecker; +import com.teaql.tracechainservice.platform.Platform; +import com.teaql.tracechainservice.platform.PlatformChecker; +import com.teaql.tracechainservice.shipment.Shipment; +import com.teaql.tracechainservice.shipment.ShipmentChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + }else if(customerOrder.updateItem()){ + if(!customerOrder.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("description")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "description"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, customerOrder.getProperty(CustomerOrder.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkDescription(_context, customerOrder.getProperty(CustomerOrder.DESCRIPTION_PROPERTY), newLocation(_parentLocation, "description")); + for(int i = 0; customerOrder.getOrderItemList() != null && i < customerOrder.getOrderItemList().size(); i++){ + OrderItem orderItem = customerOrder.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + for(int i = 0; customerOrder.getPaymentList() != null && i < customerOrder.getPaymentList().size(); i++){ + Payment payment = customerOrder.getPaymentList().get(i); + new PaymentChecker().checkAndFix(_context, payment, newLocation(_parentLocation, "payment_list", i)); + } + for(int i = 0; customerOrder.getShipmentList() != null && i < customerOrder.getShipmentList().size(); i++){ + Shipment shipment = customerOrder.getShipmentList().get(i); + new ShipmentChecker().checkAndFix(_context, shipment, newLocation(_parentLocation, "shipment_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkDescription(UserContext _context, String description, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, description); + if((description == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, description); + + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..05cb88590 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,84 @@ + +package com.teaql.tracechainservice.customerorder; + +import com.teaql.tracechainservice.orderitem.OrderItem; +import com.teaql.tracechainservice.orderitem.OrderItemListExpression; +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentListExpression; +import com.teaql.tracechainservice.platform.Platform; +import com.teaql.tracechainservice.platform.PlatformExpression; +import com.teaql.tracechainservice.shipment.Shipment; +import com.teaql.tracechainservice.shipment.ShipmentListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", CustomerOrder::getPlatform)); + } + + public CustomerOrderExpression updatePlatform(Platform platform){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updatePlatform(platform)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public Expression getDescription(){ + return loaded("description", "getDescription", CustomerOrder::getDescription); + } + public CustomerOrderExpression updateDescription(String description){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateDescription(description)); + } + + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", CustomerOrder::getOrderItemList)); + } + public PaymentListExpression getPaymentList(){ + return new PaymentListExpression(loaded("payment_list", "getPaymentList", CustomerOrder::getPaymentList)); + } + public ShipmentListExpression getShipmentList(){ + return new ShipmentListExpression(loaded("shipment_list", "getShipmentList", CustomerOrder::getShipmentList)); + } + public CustomerOrderExpression addOrderItem(OrderItem orderItem){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderItem(orderItem)); + } + public CustomerOrderExpression addPayment(Payment payment){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addPayment(payment)); + } + public CustomerOrderExpression addShipment(Shipment shipment){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addShipment(shipment)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..2d57458eb --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.tracechainservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..59adf8813 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,1017 @@ + +package com.teaql.tracechainservice.customerorder; + +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.orderitem.OrderItem; +import com.teaql.tracechainservice.orderitem.OrderItemRequest; +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentRequest; +import com.teaql.tracechainservice.platform.Platform; +import com.teaql.tracechainservice.platform.PlatformRequest; +import com.teaql.tracechainservice.shipment.Shipment; +import com.teaql.tracechainservice.shipment.ShipmentRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectOrderNumber().selectDescription().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.PLATFORM_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.DESCRIPTION_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectOrderNumber().selectDescription().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + selectOrderItemList().selectPaymentList().selectShipmentList(); + return selectId().selectPlatform().selectOrderNumber().selectDescription().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectPlatformIdOnly(){ + selectProperty(CustomerOrder.PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(CustomerOrder.PLATFORM_PROPERTY); + enhanceRelation(CustomerOrder.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, CustomerOrder.PLATFORM_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectPlatform(){ + unselectProperty(CustomerOrder.PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectDescription(){ + selectProperty(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + + /** + * fill the description with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS description) to fetch description property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectDescription(){ + unselectProperty(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public CustomerOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest selectPaymentList(){ + return selectPaymentListWith(Q.payments().selectSelf()); + } + + public CustomerOrderRequest selectPaymentListWith(PaymentRequest paymentList){ + enhanceRelation(CustomerOrder.PAYMENT_LIST_PROPERTY, paymentList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentListWith", null, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest selectShipmentList(){ + return selectShipmentListWith(Q.shipments().selectSelf()); + } + + public CustomerOrderRequest selectShipmentListWith(ShipmentRequest shipmentList){ + enhanceRelation(CustomerOrder.SHIPMENT_LIST_PROPERTY, shipmentList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectShipmentListWith", null, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public CustomerOrderRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public CustomerOrderRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public CustomerOrderRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.PLATFORM_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public CustomerOrderRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByDescription(String... description){ + if (description == null || description.length == 0) { + throw new IllegalArgumentException("filterByDescription parameter description cannot be empty"); + } + return appendSearchCriteria(createDescriptionCriteria(Operator.EQUAL, (Object[])description)); + } + + public CustomerOrderRequest withDescription(Operator operator, Object... values){ + return appendSearchCriteria(createDescriptionCriteria(operator, values)); + } + + public CustomerOrderRequest withDescriptionIsUnknown(){ + return withDescription(Operator.IS_NULL); + } + + public CustomerOrderRequest withDescriptionIsKnown(){ + return withDescription(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDescriptionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.DESCRIPTION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withDescriptionIsNot(String description){ + return withDescription(Operator.NOT_EQUAL, description); + } + + public CustomerOrderRequest withDescriptionIn(String... description){ + return withDescription(Operator.IN, (Object[])description); + } + + public CustomerOrderRequest withDescriptionNotIn(String... description){ + return withDescription(Operator.NOT_IN, (Object[])description); + } + public CustomerOrderRequest withDescriptionGreaterThan(String description){ + return withDescription(Operator.GREATER_THAN, description); + } + + public CustomerOrderRequest withDescriptionGreaterThanOrEqualTo(String description){ + return withDescription(Operator.GREATER_THAN_OR_EQUAL, description); + } + + public CustomerOrderRequest withDescriptionLessThan(String description){ + return withDescription(Operator.LESS_THAN, description); + } + + public CustomerOrderRequest withDescriptionLessThanOrEqualTo(String description){ + return withDescription(Operator.LESS_THAN_OR_EQUAL, description); + } + + public CustomerOrderRequest withDescriptionBetween(String startOfDescription, String endOfDescription){ + return withDescription(Operator.BETWEEN, startOfDescription, endOfDescription); + } + public CustomerOrderRequest withDescriptionStartingWith(String description){ + return withDescription(Operator.BEGIN_WITH, description); + } + public CustomerOrderRequest withDescriptionContaining(String description){ + return withDescription(Operator.CONTAIN, description); + } + + public CustomerOrderRequest withDescriptionNotContaining(String description){ + return withDescription(Operator.NOT_CONTAIN, description); + } + + public CustomerOrderRequest withDescriptionNotStartingWith(String description){ + return withDescription(Operator.NOT_BEGIN_WITH, description); + } + + public CustomerOrderRequest withDescriptionEndingWith(String description){ + return withDescription(Operator.END_WITH, description); + } + + public CustomerOrderRequest withDescriptionNotEndingWith(String description){ + return withDescription(Operator.NOT_END_WITH, description); + } + + public CustomerOrderRequest withDescriptionIs(String description){ + return withDescription(Operator.EQUAL, description); + } + + public CustomerOrderRequest withDescriptionSoundingLike(String description){ + return withDescription(Operator.SOUNDS_LIKE, description); + } + + + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public CustomerOrderRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + public CustomerOrderRequest withPaymentListMatching(PaymentRequest paymentRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, paymentRequest, Payment.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutPaymentListMatching(PaymentRequest paymentRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, paymentRequest, Payment.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest havePayments(){ + return withPaymentListMatching(Q.payments().unlimited()); + } + + public CustomerOrderRequest haveNoPayments(){ + return withoutPaymentListMatching(Q.payments().unlimited()); + } + public CustomerOrderRequest withShipmentListMatching(ShipmentRequest shipmentRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, shipmentRequest, Shipment.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutShipmentListMatching(ShipmentRequest shipmentRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, shipmentRequest, Shipment.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest haveShipments(){ + return withShipmentListMatching(Q.shipments().unlimited()); + } + + public CustomerOrderRequest haveNoShipments(){ + return withoutShipmentListMatching(Q.shipments().unlimited()); + } + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public CustomerOrderRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(CustomerOrder.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public CustomerOrderRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctDescription(){ + return countDistinctDescriptionAs("description_distinct_count"); + } + + public CustomerOrderRequest countDistinctDescriptionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + public CustomerOrderRequest groupByPaymentsWithDetails(PaymentRequest subRequest){ + aggregate(CustomerOrder.PAYMENT_LIST_PROPERTY, subRequest); + return this; + } + public CustomerOrderRequest groupByShipmentsWithDetails(ShipmentRequest subRequest){ + aggregate(CustomerOrder.SHIPMENT_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(CustomerOrder.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public CustomerOrderRequest groupByPlatform(){ + groupBy(CustomerOrder.PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByPlatformAs(String retName){ + groupBy(retName, CustomerOrder.PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.PLATFORM_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByDescription(){ + groupBy(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByDescriptionAs(String retName){ + groupBy(retName, CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByDescriptionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.DESCRIPTION_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByPlatformAscending(){ + addOrderByAscending(CustomerOrder.PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByPlatformDescending(){ + addOrderByDescending(CustomerOrder.PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByDescriptionAscending(){ + addOrderByAscending(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByDescriptionDescending(){ + addOrderByDescending(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + public CustomerOrderRequest orderByDescriptionAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByDescriptionDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.DESCRIPTION_PROPERTY); + return this; + } + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public CustomerOrderRequest statsFromPaymentsAs(String name, PaymentRequest subRequest){ + return statsFromPaymentsAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromPaymentsAs(String name, PaymentRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Payment.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPaymentsAs", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromPayments(PaymentRequest subRequest){ + return statsFromPaymentsAs(REFINEMENTS, subRequest); + } + public CustomerOrderRequest statsFromShipmentsAs(String name, ShipmentRequest subRequest){ + return statsFromShipmentsAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromShipmentsAs(String name, ShipmentRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, Shipment.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromShipmentsAs", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromShipments(ShipmentRequest subRequest){ + return statsFromShipmentsAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + public CustomerOrderRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest countPayments(){ + addRelationCount("Count", Q.payments().unlimited(), Payment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPayments", null, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countPaymentsAs(String name){ + addRelationCount(name, Q.payments().unlimited(), Payment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentsAs", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countPaymentsWith(String name, PaymentRequest subRequest){ + addRelationCount(name, subRequest, Payment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentsWith", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest countShipments(){ + addRelationCount("Count", Q.shipments().unlimited(), Shipment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipments", null, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countShipmentsAs(String name){ + addRelationCount(name, Q.shipments().unlimited(), Shipment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipmentsAs", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countShipmentsWith(String name, ShipmentRequest subRequest){ + addRelationCount(name, subRequest, Shipment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipmentsWith", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, CustomerOrder.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java new file mode 100644 index 000000000..2284e067e --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java @@ -0,0 +1,128 @@ + +package com.teaql.tracechainservice.orderitem; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f1e0aaf75e3389eec4a68edadfb443fdc23c5cce2449a98cf55d935ed897b6fb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("name", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String NAME_PROPERTY = "name"; + private CustomerOrder customerOrder; + + private String name; + + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public String getName(){ + return this.name; + } + + public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public OrderItem updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + + public static OrderItem refer(Long id){ + OrderItem refer = new OrderItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "name": return this.name; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java new file mode 100644 index 000000000..be1b79b87 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java @@ -0,0 +1,59 @@ + +package com.teaql.tracechainservice.orderitem; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class OrderItemChecker implements Checker{ + + public String type(){ + return OrderItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if(needCheck(_context, orderItem)){ + markAsChecked(_context, orderItem); + doCheck(_context, orderItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if((orderItem == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + } + if(orderItem.newItem()){ + }else if(orderItem.updateItem()){ + if(!orderItem.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, orderItem.getProperty(OrderItem.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkName(_context, orderItem.getProperty(OrderItem.NAME_PROPERTY), newLocation(_parentLocation, "name")); + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java new file mode 100644 index 000000000..f89f73eae --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java @@ -0,0 +1,53 @@ + +package com.teaql.tracechainservice.orderitem; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderItemExpression(Expression expression){ + super(expression); + } + + public OrderItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderItemExpression updateId(Long id){ + return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); + } + + public OrderItemExpression save(UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderItemExpression save(String intent, UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderItem::getCustomerOrder)); + } + + public OrderItemExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCustomerOrder(customerOrder)); + } + + public Expression getName(){ + return loaded("name", "getName", OrderItem::getName); + } + public OrderItemExpression updateName(String name){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateName(name)); + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java new file mode 100644 index 000000000..ae16d0f16 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.tracechainservice.orderitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderItemListExpression extends SmartListExpression { + public OrderItemListExpression(Expression> expression){ + super(expression); + } + + public OrderItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderItemExpression first() { + return new OrderItemExpression(super.first()); + } + + public OrderItemExpression get(int index) { + return new OrderItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java new file mode 100644 index 000000000..7c957950e --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java @@ -0,0 +1,689 @@ + +package com.teaql.tracechainservice.orderitem; + +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class OrderItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderItemRequest(Class returnType){ + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ + super.internalMatchAny(orderItem); + return this; + } + + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + + public OrderItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectName().selectVersion(); + } + + public OrderItemRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderItem.NAME_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectName().selectVersion(); + } + + public OrderItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectCustomerOrder().selectName().selectVersion(); + } + + + public OrderItemRequest selectId(){ + selectProperty(OrderItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectId(){ + unselectProperty(OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest selectCustomerOrderIdOnly(){ + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public OrderItemRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderItem.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public OrderItemRequest unselectCustomerOrder(){ + unselectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderItemRequest selectName(){ + selectProperty(OrderItem.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectName(){ + unselectProperty(OrderItem.NAME_PROPERTY); + return this; + } + public OrderItemRequest selectVersion(){ + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectVersion(){ + unselectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); + } + + public OrderItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderItemRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public OrderItemRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public OrderItemRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public OrderItemRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public OrderItemRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public OrderItemRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public OrderItemRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public OrderItemRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public OrderItemRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public OrderItemRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public OrderItemRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.NAME_PROPERTY, operator, values); + } + + public OrderItemRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public OrderItemRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public OrderItemRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public OrderItemRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public OrderItemRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public OrderItemRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public OrderItemRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public OrderItemRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public OrderItemRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public OrderItemRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public OrderItemRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public OrderItemRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public OrderItemRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public OrderItemRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public OrderItemRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public OrderItemRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public OrderItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); + } + + public OrderItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderItemRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public OrderItemRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + + + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderItemRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public OrderItemRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, OrderItem.NAME_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupById(){ + groupBy(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdAs(String retName){ + groupBy(retName, OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.ID_PROPERTY, function); + return this; + } + public OrderItemRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public OrderItemRequest groupByCustomerOrder(){ + groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByName(){ + groupBy(OrderItem.NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByNameAs(String retName){ + groupBy(retName, OrderItem.NAME_PROPERTY); + return this; + } + + public OrderItemRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.NAME_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByVersion(){ + groupBy(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionAs(String retName){ + groupBy(retName, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.VERSION_PROPERTY, function); + return this; + } + + + + public OrderItemRequest orderByIdAscending(){ + addOrderByAscending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByIdDescending(){ + addOrderByDescending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByCustomerOrderAscending(){ + addOrderByAscending(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByCustomerOrderDescending(){ + addOrderByDescending(OrderItem.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderByNameAscending(){ + addOrderByAscending(OrderItem.NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByNameDescending(){ + addOrderByDescending(OrderItem.NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderItem.NAME_PROPERTY); + return this; + } + + public OrderItemRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderItem.NAME_PROPERTY); + return this; + } + public OrderItemRequest orderByVersionAscending(){ + addOrderByAscending(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionDescending(){ + addOrderByDescending(OrderItem.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + + + + public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderItem.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java new file mode 100644 index 000000000..193bc7080 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java @@ -0,0 +1,151 @@ + +package com.teaql.tracechainservice.payment; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Payment extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Payment"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7a1e8a9603ba1bf577f0e3318f5c68e0b1e8d16c08f14ba596bf5292689211cb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "payment_attempt_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Payment.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String REFERENCE_CODE_PROPERTY = "reference_code"; + public static final String PAYMENT_ATTEMPT_LIST_PROPERTY = "payment_attempt_list"; + private CustomerOrder customerOrder; + + private String referenceCode; + + private SmartList paymentAttemptList; + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public String getReferenceCode(){ + return this.referenceCode; + } + + public SmartList getPaymentAttemptList(){ + return this.paymentAttemptList == null ? SmartList.unloaded() : this.paymentAttemptList; + } + public Payment updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public Payment updateReferenceCode(String referenceCode){ + referenceCode = (referenceCode == null ? null : referenceCode.trim()); + if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ + return this; + } + handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); + this.referenceCode = referenceCode; + return this; + } + + public Payment addPaymentAttempt(PaymentAttempt paymentAttempt){ + if (paymentAttempt == null){ + return this; + } + + if(null == this.paymentAttemptList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.paymentAttemptList = teaqlUnloadedItems.map(value -> value); + } + + this.paymentAttemptList.add(paymentAttempt); + paymentAttempt.updatePayment(this); + return this; + } + + public static Payment refer(Long id){ + Payment refer = new Payment(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Payment comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; + + case "payment_attempt_list": this.paymentAttemptList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "reference_code": return this.referenceCode; + case "payment_attempt_list": return this.paymentAttemptList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "referenceCode": return this.referenceCode; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java new file mode 100644 index 000000000..2afb8566f --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.tracechainservice.payment; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; +import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; +import com.teaql.tracechainservice.paymentattempt.PaymentAttemptChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PaymentChecker implements Checker{ + + public String type(){ + return Payment.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Payment payment, ObjectLocation _parentLocation){ + if(needCheck(_context, payment)){ + markAsChecked(_context, payment); + doCheck(_context, payment, _parentLocation); + } + } + + public void doCheck(UserContext _context, Payment payment, ObjectLocation _parentLocation){ + if((payment == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, payment); + if(payment.needPersist()){ + } + if(payment.newItem()){ + }else if(payment.updateItem()){ + if(!payment.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!payment.isPropertyLoaded("reference_code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, payment.getProperty(Payment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkReferenceCode(_context, payment.getProperty(Payment.REFERENCE_CODE_PROPERTY), newLocation(_parentLocation, "reference_code")); + for(int i = 0; payment.getPaymentAttemptList() != null && i < payment.getPaymentAttemptList().size(); i++){ + PaymentAttempt paymentAttempt = payment.getPaymentAttemptList().get(i); + new PaymentAttemptChecker().checkAndFix(_context, paymentAttempt, newLocation(_parentLocation, "payment_attempt_list", i)); + } + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkReferenceCode(UserContext _context, String referenceCode, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, referenceCode); + if((referenceCode == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, referenceCode); + + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java new file mode 100644 index 000000000..3d2cb6c48 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.tracechainservice.payment; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; +import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; +import com.teaql.tracechainservice.paymentattempt.PaymentAttemptListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PaymentExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PaymentExpression(Expression expression){ + super(expression); + } + + public PaymentExpression(Expression expression, Function function){ + super(expression, function); + } + + public PaymentExpression updateId(Long id){ + return new PaymentExpression(this, $it -> {((Payment)$it).__internalSet("id", id); return this;}); + } + + public PaymentExpression save(UserContext userContext){ + return new PaymentExpression(this, $it -> ((Payment)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PaymentExpression save(String intent, UserContext userContext){ + return new PaymentExpression(this, $it -> ((Payment)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", Payment::getCustomerOrder)); + } + + public PaymentExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new PaymentExpression(this, $it -> ((Payment)$it).updateCustomerOrder(customerOrder)); + } + + public Expression getReferenceCode(){ + return loaded("reference_code", "getReferenceCode", Payment::getReferenceCode); + } + public PaymentExpression updateReferenceCode(String referenceCode){ + return new PaymentExpression(this, $it -> ((Payment)$it).updateReferenceCode(referenceCode)); + } + + public PaymentAttemptListExpression getPaymentAttemptList(){ + return new PaymentAttemptListExpression(loaded("payment_attempt_list", "getPaymentAttemptList", Payment::getPaymentAttemptList)); + } + public PaymentExpression addPaymentAttempt(PaymentAttempt paymentAttempt){ + return new PaymentExpression(this, $it -> ((Payment)$it).addPaymentAttempt(paymentAttempt)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java new file mode 100644 index 000000000..53bd95325 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.tracechainservice.payment; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PaymentListExpression extends SmartListExpression { + public PaymentListExpression(Expression> expression){ + super(expression); + } + + public PaymentListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PaymentExpression first() { + return new PaymentExpression(super.first()); + } + + public PaymentExpression get(int index) { + return new PaymentExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java new file mode 100644 index 000000000..2c2aff0a8 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java @@ -0,0 +1,750 @@ + +package com.teaql.tracechainservice.payment; + +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; +import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; +import com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PaymentRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PaymentRequest(Class returnType){ + this(returnType, () -> (T) new Payment()); + } + + protected PaymentRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PaymentRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PaymentRequest copy(){ + return (PaymentRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PaymentRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PaymentRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PaymentRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PaymentRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PaymentRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PaymentRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PaymentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PaymentRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PaymentRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PaymentRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PaymentRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PaymentRequest)super.appendSearchCriteria(searchCriteria); + } + + public PaymentRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PaymentRequest matchingAnyOf(PaymentRequest payment){ + super.internalMatchAny(payment); + return this; + } + + public PaymentRequest matchingIdsOf(PaymentRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Payment.ID_PROPERTY, request, Payment.ID_PROPERTY)); + } + + public PaymentRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PaymentRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PaymentRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PaymentRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectReferenceCode().selectVersion(); + } + + public PaymentRequest selectSelfFields(){ + return selectSelf(); + } + + public PaymentRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Payment.ID_PROPERTY); + selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); + selectProperty(Payment.REFERENCE_CODE_PROPERTY); + selectProperty(Payment.VERSION_PROPERTY); + return this; + } + + public PaymentRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); + } + + public PaymentRequest selectChildren(){ + super.selectAny(); + selectPaymentAttemptList(); + return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); + } + + + public PaymentRequest selectId(){ + selectProperty(Payment.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PaymentRequest unselectId(){ + unselectProperty(Payment.ID_PROPERTY); + return this; + } + public PaymentRequest selectCustomerOrderIdOnly(){ + selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public PaymentRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public PaymentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, Payment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public PaymentRequest unselectCustomerOrder(){ + unselectProperty(Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public PaymentRequest selectReferenceCode(){ + selectProperty(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + + /** + * fill the referenceCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS referenceCode) to fetch referenceCode property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PaymentRequest unselectReferenceCode(){ + unselectProperty(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentRequest selectVersion(){ + selectProperty(Payment.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PaymentRequest unselectVersion(){ + unselectProperty(Payment.VERSION_PROPERTY); + return this; + } + public PaymentRequest selectPaymentAttemptList(){ + return selectPaymentAttemptListWith(Q.paymentAttempts().selectSelf()); + } + + public PaymentRequest selectPaymentAttemptListWith(PaymentAttemptRequest paymentAttemptList){ + enhanceRelation(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, paymentAttemptList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentAttemptListWith", null, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; + } + + public PaymentRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Payment.ID_PROPERTY, operator, values); + } + + public PaymentRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PaymentRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PaymentRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PaymentRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PaymentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public PaymentRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public PaymentRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public PaymentRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Payment.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public PaymentRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public PaymentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public PaymentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public PaymentRequest filterByReferenceCode(String... referenceCode){ + if (referenceCode == null || referenceCode.length == 0) { + throw new IllegalArgumentException("filterByReferenceCode parameter referenceCode cannot be empty"); + } + return appendSearchCriteria(createReferenceCodeCriteria(Operator.EQUAL, (Object[])referenceCode)); + } + + public PaymentRequest withReferenceCode(Operator operator, Object... values){ + return appendSearchCriteria(createReferenceCodeCriteria(operator, values)); + } + + public PaymentRequest withReferenceCodeIsUnknown(){ + return withReferenceCode(Operator.IS_NULL); + } + + public PaymentRequest withReferenceCodeIsKnown(){ + return withReferenceCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createReferenceCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Payment.REFERENCE_CODE_PROPERTY, operator, values); + } + + public PaymentRequest withReferenceCodeIsNot(String referenceCode){ + return withReferenceCode(Operator.NOT_EQUAL, referenceCode); + } + + public PaymentRequest withReferenceCodeIn(String... referenceCode){ + return withReferenceCode(Operator.IN, (Object[])referenceCode); + } + + public PaymentRequest withReferenceCodeNotIn(String... referenceCode){ + return withReferenceCode(Operator.NOT_IN, (Object[])referenceCode); + } + public PaymentRequest withReferenceCodeGreaterThan(String referenceCode){ + return withReferenceCode(Operator.GREATER_THAN, referenceCode); + } + + public PaymentRequest withReferenceCodeGreaterThanOrEqualTo(String referenceCode){ + return withReferenceCode(Operator.GREATER_THAN_OR_EQUAL, referenceCode); + } + + public PaymentRequest withReferenceCodeLessThan(String referenceCode){ + return withReferenceCode(Operator.LESS_THAN, referenceCode); + } + + public PaymentRequest withReferenceCodeLessThanOrEqualTo(String referenceCode){ + return withReferenceCode(Operator.LESS_THAN_OR_EQUAL, referenceCode); + } + + public PaymentRequest withReferenceCodeBetween(String startOfReferenceCode, String endOfReferenceCode){ + return withReferenceCode(Operator.BETWEEN, startOfReferenceCode, endOfReferenceCode); + } + public PaymentRequest withReferenceCodeStartingWith(String referenceCode){ + return withReferenceCode(Operator.BEGIN_WITH, referenceCode); + } + public PaymentRequest withReferenceCodeContaining(String referenceCode){ + return withReferenceCode(Operator.CONTAIN, referenceCode); + } + + public PaymentRequest withReferenceCodeNotContaining(String referenceCode){ + return withReferenceCode(Operator.NOT_CONTAIN, referenceCode); + } + + public PaymentRequest withReferenceCodeNotStartingWith(String referenceCode){ + return withReferenceCode(Operator.NOT_BEGIN_WITH, referenceCode); + } + + public PaymentRequest withReferenceCodeEndingWith(String referenceCode){ + return withReferenceCode(Operator.END_WITH, referenceCode); + } + + public PaymentRequest withReferenceCodeNotEndingWith(String referenceCode){ + return withReferenceCode(Operator.NOT_END_WITH, referenceCode); + } + + public PaymentRequest withReferenceCodeIs(String referenceCode){ + return withReferenceCode(Operator.EQUAL, referenceCode); + } + + public PaymentRequest withReferenceCodeSoundingLike(String referenceCode){ + return withReferenceCode(Operator.SOUNDS_LIKE, referenceCode); + } + + + + public PaymentRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PaymentRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PaymentRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PaymentRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Payment.VERSION_PROPERTY, operator, values); + } + + public PaymentRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PaymentRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PaymentRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PaymentRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PaymentRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PaymentRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PaymentRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PaymentRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PaymentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PaymentRequest withPaymentAttemptListMatching(PaymentAttemptRequest paymentAttemptRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Payment.ID_PROPERTY, paymentAttemptRequest, PaymentAttempt.PAYMENT_PROPERTY)); + } + + public PaymentRequest withoutPaymentAttemptListMatching(PaymentAttemptRequest paymentAttemptRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Payment.ID_PROPERTY, paymentAttemptRequest, PaymentAttempt.PAYMENT_PROPERTY))); + } + + public PaymentRequest havePaymentAttempts(){ + return withPaymentAttemptListMatching(Q.paymentAttempts().unlimited()); + } + + public PaymentRequest haveNoPaymentAttempts(){ + return withoutPaymentAttemptListMatching(Q.paymentAttempts().unlimited()); + } + + public PaymentRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PaymentRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PaymentRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public PaymentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(Payment.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + + + public PaymentRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PaymentRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Payment.ID_PROPERTY); + return this; + } + public PaymentRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public PaymentRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public PaymentRequest countDistinctReferenceCode(){ + return countDistinctReferenceCodeAs("reference_code_distinct_count"); + } + + public PaymentRequest countDistinctReferenceCodeAs(String alias){ + super.countDistinctProperty(alias, Payment.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PaymentRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Payment.VERSION_PROPERTY); + return this; + } + public PaymentRequest groupByPaymentAttemptsWithDetails(PaymentAttemptRequest subRequest){ + aggregate(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, subRequest); + return this; + } + + public PaymentRequest groupById(){ + groupBy(Payment.ID_PROPERTY); + return this; + } + + public PaymentRequest groupByIdAs(String retName){ + groupBy(retName, Payment.ID_PROPERTY); + return this; + } + + public PaymentRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Payment.ID_PROPERTY, function); + return this; + } + public PaymentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(Payment.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public PaymentRequest groupByCustomerOrder(){ + groupBy(Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public PaymentRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public PaymentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, Payment.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + + public PaymentRequest groupByReferenceCode(){ + groupBy(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentRequest groupByReferenceCodeAs(String retName){ + groupBy(retName, Payment.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentRequest groupByReferenceCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Payment.REFERENCE_CODE_PROPERTY, function); + return this; + } + + public PaymentRequest groupByVersion(){ + groupBy(Payment.VERSION_PROPERTY); + return this; + } + + public PaymentRequest groupByVersionAs(String retName){ + groupBy(retName, Payment.VERSION_PROPERTY); + return this; + } + + public PaymentRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Payment.VERSION_PROPERTY, function); + return this; + } + + + + public PaymentRequest orderByIdAscending(){ + addOrderByAscending(Payment.ID_PROPERTY); + return this; + } + + public PaymentRequest orderByIdDescending(){ + addOrderByDescending(Payment.ID_PROPERTY); + return this; + } + + public PaymentRequest orderByCustomerOrderAscending(){ + addOrderByAscending(Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public PaymentRequest orderByCustomerOrderDescending(){ + addOrderByDescending(Payment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public PaymentRequest orderByReferenceCodeAscending(){ + addOrderByAscending(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentRequest orderByReferenceCodeDescending(){ + addOrderByDescending(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentRequest orderByReferenceCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentRequest orderByReferenceCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Payment.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentRequest orderByVersionAscending(){ + addOrderByAscending(Payment.VERSION_PROPERTY); + return this; + } + + public PaymentRequest orderByVersionDescending(){ + addOrderByDescending(Payment.VERSION_PROPERTY); + return this; + } + + + public PaymentRequest statsFromPaymentAttemptsAs(String name, PaymentAttemptRequest subRequest){ + return statsFromPaymentAttemptsAs(name, subRequest, false); + } + + public PaymentRequest statsFromPaymentAttemptsAs(String name, PaymentAttemptRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, PaymentAttempt.PAYMENT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPaymentAttemptsAs", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; + } + + public PaymentRequest statsFromPaymentAttempts(PaymentAttemptRequest subRequest){ + return statsFromPaymentAttemptsAs(REFINEMENTS, subRequest); + } + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + + + public PaymentRequest countPaymentAttempts(){ + addRelationCount("Count", Q.paymentAttempts().unlimited(), PaymentAttempt.PAYMENT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttempts", null, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; + } + + public PaymentRequest countPaymentAttemptsAs(String name){ + addRelationCount(name, Q.paymentAttempts().unlimited(), PaymentAttempt.PAYMENT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttemptsAs", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; + } + + public PaymentRequest countPaymentAttemptsWith(String name, PaymentAttemptRequest subRequest){ + addRelationCount(name, subRequest, PaymentAttempt.PAYMENT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttemptsWith", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); + return this; + } + + public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, Payment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public PaymentRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PaymentRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PaymentRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PaymentRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PaymentRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PaymentRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java new file mode 100644 index 000000000..1ddd7d89d --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java @@ -0,0 +1,128 @@ + +package com.teaql.tracechainservice.paymentattempt; + +import com.teaql.tracechainservice.payment.Payment; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class PaymentAttempt extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "PaymentAttempt"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e8c46db1ccaafe0f9d90335a74f7dd234482731b27d51dbebb2e9f07bebc02eb"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("payment", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("payment", java.util.List.of("payment", "payment")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + PaymentAttempt.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PAYMENT_PROPERTY = "payment"; + public static final String REFERENCE_CODE_PROPERTY = "reference_code"; + private Payment payment; + + private String referenceCode; + + + public Payment getPayment(){ + return this.payment; + } + + public String getReferenceCode(){ + return this.referenceCode; + } + + public PaymentAttempt updatePayment(Payment payment){ + if(isPropertyLoaded(PAYMENT_PROPERTY) && Objects.equals(this.payment, payment)){ + return this; + } + handleUpdate(PAYMENT_PROPERTY, getPayment(), payment); + this.payment = payment; + return this; + } + + public PaymentAttempt updateReferenceCode(String referenceCode){ + referenceCode = (referenceCode == null ? null : referenceCode.trim()); + if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ + return this; + } + handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); + this.referenceCode = referenceCode; + return this; + } + + + public static PaymentAttempt refer(Long id){ + PaymentAttempt refer = new PaymentAttempt(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public PaymentAttempt comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "payment": this.payment = (Payment) value; break; + + case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "payment": return this.payment; + case "reference_code": return this.referenceCode; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "payment": return this.payment; + case "referenceCode": return this.referenceCode; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java new file mode 100644 index 000000000..58896b529 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java @@ -0,0 +1,59 @@ + +package com.teaql.tracechainservice.paymentattempt; + +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PaymentAttemptChecker implements Checker{ + + public String type(){ + return PaymentAttempt.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, PaymentAttempt paymentAttempt, ObjectLocation _parentLocation){ + if(needCheck(_context, paymentAttempt)){ + markAsChecked(_context, paymentAttempt); + doCheck(_context, paymentAttempt, _parentLocation); + } + } + + public void doCheck(UserContext _context, PaymentAttempt paymentAttempt, ObjectLocation _parentLocation){ + if((paymentAttempt == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, paymentAttempt); + if(paymentAttempt.needPersist()){ + } + if(paymentAttempt.newItem()){ + }else if(paymentAttempt.updateItem()){ + if(!paymentAttempt.isPropertyLoaded("payment")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "payment"), "Mutation requires a fully loaded entity"); + } + if(!paymentAttempt.isPropertyLoaded("reference_code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); + } + + } + checkPayment(_context, paymentAttempt.getProperty(PaymentAttempt.PAYMENT_PROPERTY), newLocation(_parentLocation, "payment")); + checkReferenceCode(_context, paymentAttempt.getProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY), newLocation(_parentLocation, "reference_code")); + } + + public void checkPayment(UserContext _context, Payment payment, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, payment); + if((payment == null)){ + return; + } + new PaymentChecker().checkAndFix(_context, payment, _parentLocation); + } + public void checkReferenceCode(UserContext _context, String referenceCode, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, referenceCode); + if((referenceCode == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, referenceCode); + + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java new file mode 100644 index 000000000..cc3a5db9c --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java @@ -0,0 +1,53 @@ + +package com.teaql.tracechainservice.paymentattempt; + +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PaymentAttemptExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PaymentAttemptExpression(Expression expression){ + super(expression); + } + + public PaymentAttemptExpression(Expression expression, Function function){ + super(expression, function); + } + + public PaymentAttemptExpression updateId(Long id){ + return new PaymentAttemptExpression(this, $it -> {((PaymentAttempt)$it).__internalSet("id", id); return this;}); + } + + public PaymentAttemptExpression save(UserContext userContext){ + return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PaymentAttemptExpression save(String intent, UserContext userContext){ + return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PaymentExpression getPayment(){ + return new PaymentExpression(loaded("payment", "getPayment", PaymentAttempt::getPayment)); + } + + public PaymentAttemptExpression updatePayment(Payment payment){ + return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).updatePayment(payment)); + } + + public Expression getReferenceCode(){ + return loaded("reference_code", "getReferenceCode", PaymentAttempt::getReferenceCode); + } + public PaymentAttemptExpression updateReferenceCode(String referenceCode){ + return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).updateReferenceCode(referenceCode)); + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java new file mode 100644 index 000000000..6178260e1 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.tracechainservice.paymentattempt; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PaymentAttemptListExpression extends SmartListExpression { + public PaymentAttemptListExpression(Expression> expression){ + super(expression); + } + + public PaymentAttemptListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PaymentAttemptExpression first() { + return new PaymentAttemptExpression(super.first()); + } + + public PaymentAttemptExpression get(int index) { + return new PaymentAttemptExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java new file mode 100644 index 000000000..6fd063951 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java @@ -0,0 +1,689 @@ + +package com.teaql.tracechainservice.paymentattempt; + +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.payment.Payment; +import com.teaql.tracechainservice.payment.PaymentRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PaymentAttemptRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PaymentAttemptRequest(Class returnType){ + this(returnType, () -> (T) new PaymentAttempt()); + } + + protected PaymentAttemptRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PaymentAttemptRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PaymentAttemptRequest copy(){ + return (PaymentAttemptRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PaymentAttemptRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PaymentAttemptRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PaymentAttemptRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PaymentAttemptRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PaymentAttemptRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PaymentAttemptRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PaymentAttemptRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PaymentAttemptRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PaymentAttemptRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PaymentAttemptRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PaymentAttemptRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PaymentAttemptRequest)super.appendSearchCriteria(searchCriteria); + } + + public PaymentAttemptRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PaymentAttemptRequest matchingAnyOf(PaymentAttemptRequest paymentAttempt){ + super.internalMatchAny(paymentAttempt); + return this; + } + + public PaymentAttemptRequest matchingIdsOf(PaymentAttemptRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + PaymentAttempt.ID_PROPERTY, request, PaymentAttempt.ID_PROPERTY)); + } + + public PaymentAttemptRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PaymentAttemptRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PaymentAttemptRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PaymentAttemptRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPaymentIdOnly().selectReferenceCode().selectVersion(); + } + + public PaymentAttemptRequest selectSelfFields(){ + return selectSelf(); + } + + public PaymentAttemptRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(PaymentAttempt.ID_PROPERTY); + selectProperty(PaymentAttempt.PAYMENT_PROPERTY); + selectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); + selectProperty(PaymentAttempt.VERSION_PROPERTY); + return this; + } + + public PaymentAttemptRequest selectAll(){ + super.selectAll(); + return selectId().selectPayment().selectReferenceCode().selectVersion(); + } + + public PaymentAttemptRequest selectChildren(){ + super.selectAny(); + return selectId().selectPayment().selectReferenceCode().selectVersion(); + } + + + public PaymentAttemptRequest selectId(){ + selectProperty(PaymentAttempt.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PaymentAttemptRequest unselectId(){ + unselectProperty(PaymentAttempt.ID_PROPERTY); + return this; + } + public PaymentAttemptRequest selectPaymentIdOnly(){ + selectProperty(PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + + public PaymentAttemptRequest selectPayment(){ + return selectPaymentWith(Q.payments().unlimited().selectSelf()); + } + + public PaymentAttemptRequest selectPaymentWith(PaymentRequest payment){ + selectProperty(PaymentAttempt.PAYMENT_PROPERTY); + enhanceRelation(PaymentAttempt.PAYMENT_PROPERTY, payment, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentWith", null, PaymentAttempt.PAYMENT_PROPERTY)); + return this; + } + + public PaymentAttemptRequest unselectPayment(){ + unselectProperty(PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + public PaymentAttemptRequest selectReferenceCode(){ + selectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + + /** + * fill the referenceCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS referenceCode) to fetch referenceCode property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PaymentAttemptRequest unselectReferenceCode(){ + unselectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentAttemptRequest selectVersion(){ + selectProperty(PaymentAttempt.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PaymentAttemptRequest unselectVersion(){ + unselectProperty(PaymentAttempt.VERSION_PROPERTY); + return this; + } + + public PaymentAttemptRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PaymentAttempt.ID_PROPERTY, operator, values); + } + + public PaymentAttemptRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PaymentAttemptRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PaymentAttemptRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PaymentAttemptRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PaymentAttemptRequest filterByPayment(Payment... payment){ + if (payment == null || payment.length == 0) { + throw new IllegalArgumentException("filterByPayment parameter payment cannot be empty"); + } + return appendSearchCriteria(createPaymentCriteria(Operator.EQUAL, (Object[])payment)); + } + + public PaymentAttemptRequest withPayment(Operator operator, Object... values){ + return appendSearchCriteria(createPaymentCriteria(operator, values)); + } + + public PaymentAttemptRequest withPaymentIsUnknown(){ + return withPayment(Operator.IS_NULL); + } + + public PaymentAttemptRequest withPaymentIsKnown(){ + return withPayment(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPaymentCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PaymentAttempt.PAYMENT_PROPERTY, operator, values); + } + + public PaymentAttemptRequest filterByPayment(Long payment){ + if(payment == null){ + return this; + } + return withPayment(Operator.EQUAL, payment); + } + public PaymentAttemptRequest withPaymentMatching(PaymentRequest payment){ + return appendSearchCriteria(new SubQuerySearchCriteria(PaymentAttempt.PAYMENT_PROPERTY, payment, Payment.ID_PROPERTY)); + } + + public PaymentAttemptRequest withoutPaymentMatching(PaymentRequest payment){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(PaymentAttempt.PAYMENT_PROPERTY, payment, Payment.ID_PROPERTY))); + } + + public PaymentAttemptRequest filterByReferenceCode(String... referenceCode){ + if (referenceCode == null || referenceCode.length == 0) { + throw new IllegalArgumentException("filterByReferenceCode parameter referenceCode cannot be empty"); + } + return appendSearchCriteria(createReferenceCodeCriteria(Operator.EQUAL, (Object[])referenceCode)); + } + + public PaymentAttemptRequest withReferenceCode(Operator operator, Object... values){ + return appendSearchCriteria(createReferenceCodeCriteria(operator, values)); + } + + public PaymentAttemptRequest withReferenceCodeIsUnknown(){ + return withReferenceCode(Operator.IS_NULL); + } + + public PaymentAttemptRequest withReferenceCodeIsKnown(){ + return withReferenceCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createReferenceCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PaymentAttempt.REFERENCE_CODE_PROPERTY, operator, values); + } + + public PaymentAttemptRequest withReferenceCodeIsNot(String referenceCode){ + return withReferenceCode(Operator.NOT_EQUAL, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeIn(String... referenceCode){ + return withReferenceCode(Operator.IN, (Object[])referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeNotIn(String... referenceCode){ + return withReferenceCode(Operator.NOT_IN, (Object[])referenceCode); + } + public PaymentAttemptRequest withReferenceCodeGreaterThan(String referenceCode){ + return withReferenceCode(Operator.GREATER_THAN, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeGreaterThanOrEqualTo(String referenceCode){ + return withReferenceCode(Operator.GREATER_THAN_OR_EQUAL, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeLessThan(String referenceCode){ + return withReferenceCode(Operator.LESS_THAN, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeLessThanOrEqualTo(String referenceCode){ + return withReferenceCode(Operator.LESS_THAN_OR_EQUAL, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeBetween(String startOfReferenceCode, String endOfReferenceCode){ + return withReferenceCode(Operator.BETWEEN, startOfReferenceCode, endOfReferenceCode); + } + public PaymentAttemptRequest withReferenceCodeStartingWith(String referenceCode){ + return withReferenceCode(Operator.BEGIN_WITH, referenceCode); + } + public PaymentAttemptRequest withReferenceCodeContaining(String referenceCode){ + return withReferenceCode(Operator.CONTAIN, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeNotContaining(String referenceCode){ + return withReferenceCode(Operator.NOT_CONTAIN, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeNotStartingWith(String referenceCode){ + return withReferenceCode(Operator.NOT_BEGIN_WITH, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeEndingWith(String referenceCode){ + return withReferenceCode(Operator.END_WITH, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeNotEndingWith(String referenceCode){ + return withReferenceCode(Operator.NOT_END_WITH, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeIs(String referenceCode){ + return withReferenceCode(Operator.EQUAL, referenceCode); + } + + public PaymentAttemptRequest withReferenceCodeSoundingLike(String referenceCode){ + return withReferenceCode(Operator.SOUNDS_LIKE, referenceCode); + } + + + + public PaymentAttemptRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PaymentAttemptRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PaymentAttemptRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PaymentAttemptRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(PaymentAttempt.VERSION_PROPERTY, operator, values); + } + + public PaymentAttemptRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PaymentAttemptRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PaymentAttemptRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PaymentAttemptRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PaymentAttemptRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PaymentAttemptRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PaymentAttemptRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PaymentAttemptRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PaymentAttemptRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public PaymentAttemptRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PaymentAttemptRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PaymentAttemptRequest groupByPaymentWithDetails(){ + return groupByPaymentWithDetails(Q.payments().unlimited()); + } + + public PaymentAttemptRequest groupByPaymentWithDetails(PaymentRequest subRequest){ + aggregate(PaymentAttempt.PAYMENT_PROPERTY, subRequest); + return this; + } + + + + public PaymentAttemptRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PaymentAttemptRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.ID_PROPERTY); + return this; + } + public PaymentAttemptRequest countDistinctPayment(){ + return countDistinctPaymentAs("payment_distinct_count"); + } + + public PaymentAttemptRequest countDistinctPaymentAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + public PaymentAttemptRequest countDistinctReferenceCode(){ + return countDistinctReferenceCodeAs("reference_code_distinct_count"); + } + + public PaymentAttemptRequest countDistinctReferenceCodeAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentAttemptRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PaymentAttemptRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, PaymentAttempt.VERSION_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupById(){ + groupBy(PaymentAttempt.ID_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByIdAs(String retName){ + groupBy(retName, PaymentAttempt.ID_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, PaymentAttempt.ID_PROPERTY, function); + return this; + } + public PaymentAttemptRequest groupByPaymentWith(PaymentRequest subRequest){ + groupBy(PaymentAttempt.PAYMENT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPaymentWith", null, "payment")); + return this; + } + public PaymentAttemptRequest groupByPayment(){ + groupBy(PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByPaymentAs(String retName){ + groupBy(retName, PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByPaymentWithFunction(String retName, AggrFunction function){ + groupBy(retName, PaymentAttempt.PAYMENT_PROPERTY, function); + return this; + } + + public PaymentAttemptRequest groupByReferenceCode(){ + groupBy(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByReferenceCodeAs(String retName){ + groupBy(retName, PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByReferenceCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, PaymentAttempt.REFERENCE_CODE_PROPERTY, function); + return this; + } + + public PaymentAttemptRequest groupByVersion(){ + groupBy(PaymentAttempt.VERSION_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByVersionAs(String retName){ + groupBy(retName, PaymentAttempt.VERSION_PROPERTY); + return this; + } + + public PaymentAttemptRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, PaymentAttempt.VERSION_PROPERTY, function); + return this; + } + + + + public PaymentAttemptRequest orderByIdAscending(){ + addOrderByAscending(PaymentAttempt.ID_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByIdDescending(){ + addOrderByDescending(PaymentAttempt.ID_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByPaymentAscending(){ + addOrderByAscending(PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByPaymentDescending(){ + addOrderByDescending(PaymentAttempt.PAYMENT_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByReferenceCodeAscending(){ + addOrderByAscending(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByReferenceCodeDescending(){ + addOrderByDescending(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentAttemptRequest orderByReferenceCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByReferenceCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(PaymentAttempt.REFERENCE_CODE_PROPERTY); + return this; + } + public PaymentAttemptRequest orderByVersionAscending(){ + addOrderByAscending(PaymentAttempt.VERSION_PROPERTY); + return this; + } + + public PaymentAttemptRequest orderByVersionDescending(){ + addOrderByDescending(PaymentAttempt.VERSION_PROPERTY); + return this; + } + + + public PaymentRequest rollUpToPayment(){ + PaymentRequest payment = Q.payments().unlimited(); + this.internalRollUpTo("payment", payment, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPayment", null, "payment")); + return payment; + } + + + + + public PaymentAttemptRequest facetByPaymentAs(String facetName, PaymentRequest payment){ + return facetByPaymentAs(facetName, payment, true); + } + + public PaymentAttemptRequest facetByPaymentAs(String facetName, PaymentRequest payment, boolean includeAllFacets){ + addFacet(facetName, PaymentAttempt.PAYMENT_PROPERTY, payment, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPaymentAs", facetName, PaymentAttempt.PAYMENT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public PaymentAttemptRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PaymentAttemptRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PaymentAttemptRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PaymentAttemptRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PaymentAttemptRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PaymentAttemptRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java new file mode 100644 index 000000000..fbcfc1fa5 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java @@ -0,0 +1,130 @@ + +package com.teaql.tracechainservice.platform; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "81fa96c3f6326be443cf018cd91970555d84dce1efa01c2aaee273740033ba30"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java new file mode 100644 index 000000000..3ae00c5a1 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.tracechainservice.platform; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; platform.getCustomerOrderList() != null && i < platform.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = platform.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java new file mode 100644 index 000000000..dfc331232 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.tracechainservice.platform; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Platform::getCustomerOrderList)); + } + public PlatformExpression addCustomerOrder(CustomerOrder customerOrder){ + return new PlatformExpression(this, $it -> ((Platform)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..f32743588 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.tracechainservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java new file mode 100644 index 000000000..56b45f02b --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.tracechainservice.platform; + +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectName().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public PlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(Platform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerOrderRequest, CustomerOrder.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerOrderRequest, CustomerOrder.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public PlatformRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(Platform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public PlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public PlatformRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java new file mode 100644 index 000000000..aba60f2e7 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java @@ -0,0 +1,128 @@ + +package com.teaql.tracechainservice.shipment; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Shipment extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Shipment"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c70893faccb3360294f70bb0d6b23a9b27af2975a33d01706b90254feff5a0cd"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Shipment.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String REFERENCE_CODE_PROPERTY = "reference_code"; + private CustomerOrder customerOrder; + + private String referenceCode; + + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public String getReferenceCode(){ + return this.referenceCode; + } + + public Shipment updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public Shipment updateReferenceCode(String referenceCode){ + referenceCode = (referenceCode == null ? null : referenceCode.trim()); + if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ + return this; + } + handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); + this.referenceCode = referenceCode; + return this; + } + + + public static Shipment refer(Long id){ + Shipment refer = new Shipment(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Shipment comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "reference_code": return this.referenceCode; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "referenceCode": return this.referenceCode; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java new file mode 100644 index 000000000..aed815082 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java @@ -0,0 +1,59 @@ + +package com.teaql.tracechainservice.shipment; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class ShipmentChecker implements Checker{ + + public String type(){ + return Shipment.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Shipment shipment, ObjectLocation _parentLocation){ + if(needCheck(_context, shipment)){ + markAsChecked(_context, shipment); + doCheck(_context, shipment, _parentLocation); + } + } + + public void doCheck(UserContext _context, Shipment shipment, ObjectLocation _parentLocation){ + if((shipment == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, shipment); + if(shipment.needPersist()){ + } + if(shipment.newItem()){ + }else if(shipment.updateItem()){ + if(!shipment.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!shipment.isPropertyLoaded("reference_code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, shipment.getProperty(Shipment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkReferenceCode(_context, shipment.getProperty(Shipment.REFERENCE_CODE_PROPERTY), newLocation(_parentLocation, "reference_code")); + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkReferenceCode(UserContext _context, String referenceCode, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, referenceCode); + if((referenceCode == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, referenceCode); + + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java new file mode 100644 index 000000000..61cbd74f8 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java @@ -0,0 +1,53 @@ + +package com.teaql.tracechainservice.shipment; + +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class ShipmentExpression extends ExpressionAdaptor implements BaseEntityExpression { + public ShipmentExpression(Expression expression){ + super(expression); + } + + public ShipmentExpression(Expression expression, Function function){ + super(expression, function); + } + + public ShipmentExpression updateId(Long id){ + return new ShipmentExpression(this, $it -> {((Shipment)$it).__internalSet("id", id); return this;}); + } + + public ShipmentExpression save(UserContext userContext){ + return new ShipmentExpression(this, $it -> ((Shipment)$it).auditAs("Saved by Expression").save(userContext)); + } + + public ShipmentExpression save(String intent, UserContext userContext){ + return new ShipmentExpression(this, $it -> ((Shipment)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", Shipment::getCustomerOrder)); + } + + public ShipmentExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new ShipmentExpression(this, $it -> ((Shipment)$it).updateCustomerOrder(customerOrder)); + } + + public Expression getReferenceCode(){ + return loaded("reference_code", "getReferenceCode", Shipment::getReferenceCode); + } + public ShipmentExpression updateReferenceCode(String referenceCode){ + return new ShipmentExpression(this, $it -> ((Shipment)$it).updateReferenceCode(referenceCode)); + } + +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java new file mode 100644 index 000000000..01969ef0f --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.tracechainservice.shipment; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class ShipmentListExpression extends SmartListExpression { + public ShipmentListExpression(Expression> expression){ + super(expression); + } + + public ShipmentListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public ShipmentExpression first() { + return new ShipmentExpression(super.first()); + } + + public ShipmentExpression get(int index) { + return new ShipmentExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java new file mode 100644 index 000000000..458288c02 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java @@ -0,0 +1,689 @@ + +package com.teaql.tracechainservice.shipment; + +import com.teaql.tracechainservice.Q; +import com.teaql.tracechainservice.customerorder.CustomerOrder; +import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class ShipmentRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public ShipmentRequest(Class returnType){ + this(returnType, () -> (T) new Shipment()); + } + + protected ShipmentRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public ShipmentRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public ShipmentRequest copy(){ + return (ShipmentRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new ShipmentRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public ShipmentRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public ShipmentRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public ShipmentRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public ShipmentRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public ShipmentRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public ShipmentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public ShipmentRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public ShipmentRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public ShipmentRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public ShipmentRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (ShipmentRequest)super.appendSearchCriteria(searchCriteria); + } + + public ShipmentRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public ShipmentRequest matchingAnyOf(ShipmentRequest shipment){ + super.internalMatchAny(shipment); + return this; + } + + public ShipmentRequest matchingIdsOf(ShipmentRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Shipment.ID_PROPERTY, request, Shipment.ID_PROPERTY)); + } + + public ShipmentRequest enhanceChildrenIfNeeded(){ + return this; + } + + public ShipmentRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public ShipmentRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public ShipmentRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectReferenceCode().selectVersion(); + } + + public ShipmentRequest selectSelfFields(){ + return selectSelf(); + } + + public ShipmentRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Shipment.ID_PROPERTY); + selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); + selectProperty(Shipment.REFERENCE_CODE_PROPERTY); + selectProperty(Shipment.VERSION_PROPERTY); + return this; + } + + public ShipmentRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); + } + + public ShipmentRequest selectChildren(){ + super.selectAny(); + return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); + } + + + public ShipmentRequest selectId(){ + selectProperty(Shipment.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ShipmentRequest unselectId(){ + unselectProperty(Shipment.ID_PROPERTY); + return this; + } + public ShipmentRequest selectCustomerOrderIdOnly(){ + selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public ShipmentRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public ShipmentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, Shipment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public ShipmentRequest unselectCustomerOrder(){ + unselectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public ShipmentRequest selectReferenceCode(){ + selectProperty(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + + /** + * fill the referenceCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS referenceCode) to fetch referenceCode property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ShipmentRequest unselectReferenceCode(){ + unselectProperty(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + public ShipmentRequest selectVersion(){ + selectProperty(Shipment.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public ShipmentRequest unselectVersion(){ + unselectProperty(Shipment.VERSION_PROPERTY); + return this; + } + + public ShipmentRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Shipment.ID_PROPERTY, operator, values); + } + + public ShipmentRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public ShipmentRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public ShipmentRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public ShipmentRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public ShipmentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public ShipmentRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public ShipmentRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public ShipmentRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Shipment.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public ShipmentRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public ShipmentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public ShipmentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public ShipmentRequest filterByReferenceCode(String... referenceCode){ + if (referenceCode == null || referenceCode.length == 0) { + throw new IllegalArgumentException("filterByReferenceCode parameter referenceCode cannot be empty"); + } + return appendSearchCriteria(createReferenceCodeCriteria(Operator.EQUAL, (Object[])referenceCode)); + } + + public ShipmentRequest withReferenceCode(Operator operator, Object... values){ + return appendSearchCriteria(createReferenceCodeCriteria(operator, values)); + } + + public ShipmentRequest withReferenceCodeIsUnknown(){ + return withReferenceCode(Operator.IS_NULL); + } + + public ShipmentRequest withReferenceCodeIsKnown(){ + return withReferenceCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createReferenceCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Shipment.REFERENCE_CODE_PROPERTY, operator, values); + } + + public ShipmentRequest withReferenceCodeIsNot(String referenceCode){ + return withReferenceCode(Operator.NOT_EQUAL, referenceCode); + } + + public ShipmentRequest withReferenceCodeIn(String... referenceCode){ + return withReferenceCode(Operator.IN, (Object[])referenceCode); + } + + public ShipmentRequest withReferenceCodeNotIn(String... referenceCode){ + return withReferenceCode(Operator.NOT_IN, (Object[])referenceCode); + } + public ShipmentRequest withReferenceCodeGreaterThan(String referenceCode){ + return withReferenceCode(Operator.GREATER_THAN, referenceCode); + } + + public ShipmentRequest withReferenceCodeGreaterThanOrEqualTo(String referenceCode){ + return withReferenceCode(Operator.GREATER_THAN_OR_EQUAL, referenceCode); + } + + public ShipmentRequest withReferenceCodeLessThan(String referenceCode){ + return withReferenceCode(Operator.LESS_THAN, referenceCode); + } + + public ShipmentRequest withReferenceCodeLessThanOrEqualTo(String referenceCode){ + return withReferenceCode(Operator.LESS_THAN_OR_EQUAL, referenceCode); + } + + public ShipmentRequest withReferenceCodeBetween(String startOfReferenceCode, String endOfReferenceCode){ + return withReferenceCode(Operator.BETWEEN, startOfReferenceCode, endOfReferenceCode); + } + public ShipmentRequest withReferenceCodeStartingWith(String referenceCode){ + return withReferenceCode(Operator.BEGIN_WITH, referenceCode); + } + public ShipmentRequest withReferenceCodeContaining(String referenceCode){ + return withReferenceCode(Operator.CONTAIN, referenceCode); + } + + public ShipmentRequest withReferenceCodeNotContaining(String referenceCode){ + return withReferenceCode(Operator.NOT_CONTAIN, referenceCode); + } + + public ShipmentRequest withReferenceCodeNotStartingWith(String referenceCode){ + return withReferenceCode(Operator.NOT_BEGIN_WITH, referenceCode); + } + + public ShipmentRequest withReferenceCodeEndingWith(String referenceCode){ + return withReferenceCode(Operator.END_WITH, referenceCode); + } + + public ShipmentRequest withReferenceCodeNotEndingWith(String referenceCode){ + return withReferenceCode(Operator.NOT_END_WITH, referenceCode); + } + + public ShipmentRequest withReferenceCodeIs(String referenceCode){ + return withReferenceCode(Operator.EQUAL, referenceCode); + } + + public ShipmentRequest withReferenceCodeSoundingLike(String referenceCode){ + return withReferenceCode(Operator.SOUNDS_LIKE, referenceCode); + } + + + + public ShipmentRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public ShipmentRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public ShipmentRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public ShipmentRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Shipment.VERSION_PROPERTY, operator, values); + } + + public ShipmentRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public ShipmentRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public ShipmentRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public ShipmentRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public ShipmentRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public ShipmentRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public ShipmentRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public ShipmentRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public ShipmentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public ShipmentRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public ShipmentRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public ShipmentRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public ShipmentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(Shipment.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + + + public ShipmentRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public ShipmentRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Shipment.ID_PROPERTY); + return this; + } + public ShipmentRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public ShipmentRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public ShipmentRequest countDistinctReferenceCode(){ + return countDistinctReferenceCodeAs("reference_code_distinct_count"); + } + + public ShipmentRequest countDistinctReferenceCodeAs(String alias){ + super.countDistinctProperty(alias, Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + public ShipmentRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public ShipmentRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Shipment.VERSION_PROPERTY); + return this; + } + + public ShipmentRequest groupById(){ + groupBy(Shipment.ID_PROPERTY); + return this; + } + + public ShipmentRequest groupByIdAs(String retName){ + groupBy(retName, Shipment.ID_PROPERTY); + return this; + } + + public ShipmentRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Shipment.ID_PROPERTY, function); + return this; + } + public ShipmentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(Shipment.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public ShipmentRequest groupByCustomerOrder(){ + groupBy(Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public ShipmentRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public ShipmentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, Shipment.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + + public ShipmentRequest groupByReferenceCode(){ + groupBy(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + + public ShipmentRequest groupByReferenceCodeAs(String retName){ + groupBy(retName, Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + + public ShipmentRequest groupByReferenceCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Shipment.REFERENCE_CODE_PROPERTY, function); + return this; + } + + public ShipmentRequest groupByVersion(){ + groupBy(Shipment.VERSION_PROPERTY); + return this; + } + + public ShipmentRequest groupByVersionAs(String retName){ + groupBy(retName, Shipment.VERSION_PROPERTY); + return this; + } + + public ShipmentRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Shipment.VERSION_PROPERTY, function); + return this; + } + + + + public ShipmentRequest orderByIdAscending(){ + addOrderByAscending(Shipment.ID_PROPERTY); + return this; + } + + public ShipmentRequest orderByIdDescending(){ + addOrderByDescending(Shipment.ID_PROPERTY); + return this; + } + + public ShipmentRequest orderByCustomerOrderAscending(){ + addOrderByAscending(Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public ShipmentRequest orderByCustomerOrderDescending(){ + addOrderByDescending(Shipment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public ShipmentRequest orderByReferenceCodeAscending(){ + addOrderByAscending(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + + public ShipmentRequest orderByReferenceCodeDescending(){ + addOrderByDescending(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + public ShipmentRequest orderByReferenceCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + + public ShipmentRequest orderByReferenceCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Shipment.REFERENCE_CODE_PROPERTY); + return this; + } + public ShipmentRequest orderByVersionAscending(){ + addOrderByAscending(Shipment.VERSION_PROPERTY); + return this; + } + + public ShipmentRequest orderByVersionDescending(){ + addOrderByDescending(Shipment.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + + + + public ShipmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public ShipmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, Shipment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public ShipmentRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public ShipmentRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public ShipmentRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public ShipmentRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public ShipmentRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public ShipmentRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/trace-chain/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..ccb7914c4 --- /dev/null +++ b/examples/trace-chain/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.tracechainservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/teaql/checker-model.json b/examples/trace-chain/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..636e3770e --- /dev/null +++ b/examples/trace-chain/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:3360338e7162e546ad5c97348770bb50933b4da775b55b99a9707d39f93c8b0a","entities":{"CustomerOrder":{"labels":{"en":"Customer Order"},"fields":[{"name":"description","labels":{"en":"description"},"aliases":["Description"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"Order Item"},"aliases":["OrderItemList","orderItemList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"payment_list","targetType":"Payment","labels":{"en":"Payment"},"aliases":["PaymentList","paymentList"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"shipment_list","targetType":"Shipment","labels":{"en":"Shipment"},"aliases":["ShipmentList","shipmentList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderItem":{"labels":{"en":"Order Item"},"fields":[{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Payment":{"labels":{"en":"Payment"},"fields":[{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"payment_attempt_list","targetType":"PaymentAttempt","labels":{"en":"Payment Attempt"},"aliases":["PaymentAttemptList","paymentAttemptList"]},{"name":"reference_code","labels":{"en":"reference code"},"aliases":["ReferenceCode","referenceCode"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"PaymentAttempt":{"labels":{"en":"Payment Attempt"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"payment","targetType":"Payment","labels":{"en":"Payment"},"aliases":["Payment"]},{"name":"reference_code","labels":{"en":"reference code"},"aliases":["ReferenceCode","referenceCode"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Shipment":{"labels":{"en":"Shipment"},"fields":[{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"reference_code","labels":{"en":"reference code"},"aliases":["ReferenceCode","referenceCode"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/trace-chain/java-lib-core/teaql/model-provenance.json b/examples/trace-chain/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..bfc689539 --- /dev/null +++ b/examples/trace-chain/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:0b866ad8968101e3bf9429741f62228178182bf20d17f1092221810fd1a46e67","generatorVersion":"021b1ed8"} \ No newline at end of file diff --git a/examples/trace-chain/pom.xml b/examples/trace-chain/pom.xml index 3df008b9c..6068cce17 100644 --- a/examples/trace-chain/pom.xml +++ b/examples/trace-chain/pom.xml @@ -1,27 +1,11 @@ - - + 4.0.0 - - io.teaql - teaql-java-parent - 6.3.0 - ../../pom.xml - - teaql-trace-chain-example - Generated API Trace Chain SQLite acceptance - 21 - - com.teaqltrace-chain-service-core0.0.1-SNAPSHOT - io.teaqlteaql-runtime - io.teaqlteaql-sqlite - io.teaqlteaql-provider-jdbc - io.teaqlteaql-opentelemetry${project.version}test - junitjunittest - - - org.apache.maven.pluginsmaven-surefire-plugin3.2.5 - ${teaql.trace.database} - + com.teaql.examples + trace-chain-showcase + 1.0.0 + pom + + java-lib-core/lib + java-app-console + diff --git a/examples/trace-chain/showcase.json b/examples/trace-chain/showcase.json new file mode 100644 index 000000000..d462949bb --- /dev/null +++ b/examples/trace-chain/showcase.json @@ -0,0 +1,42 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/trace-chain", + "library": { + "generatedFilesManifestSHA256": "0657b896f40e4c4a0a60064ff3a6f15669d343e2c10b8be66babcf1678d5c321", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "c9743d776718c7b27c97792f75f492fdc99bf427e4bd0c24bf3492de6520c9a2" + }, + "producer": { + "generator": { + "artifactKind": "unsigned unpublished versioned source candidate; not a released artifact", + "baseRelease": "v4.2.0", + "candidatePreparationReceiptSHA256": "52b4c2042be58624c08d07186b7081cf6ad4c0fccfc8e9724bee7f9280b5c02f", + "candidateVersion": "4.3.0", + "jarSHA256": "3a4988ada43aeb01d5cbba5901c1eef64c58b2bd4142c99fd7692cf1dc413e9e", + "sourceCommit": "021b1ed8bee5db7eef38a6b1e3a3ef2e7ac69daa", + "sourceQualificationReceiptSHA256": "5119b9f3a5c95fb84f527885fdd5bac0fe79a56352a55b8acf116f67fd12787d", + "tag": "unsigned-candidate-v4.3.0" + }, + "receipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-v430-candidate/receipt.json", + "receiptSHA256": "9bf2a08fa9c5bec0d9b1a2e1420044ffdd6bc71c6a1a09ce70d81d1cf0cdbd0a" + }, + "scene": "Save, roll back and replay customer order graphs with shared products, payment and shipment trace evidence", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/trace-chain/verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml" + ], + "generatedFilesManifestSHA256": "9334c3c2f4c242922eed10f4dc1dbca1897c02add8118477e9ec6c3ac4d5034c", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/trace-chain/verify-standard-telemetry.sh b/examples/trace-chain/verify-standard-telemetry.sh index 1d2b3b394..effa5b283 100755 --- a/examples/trace-chain/verify-standard-telemetry.sh +++ b/examples/trace-chain/verify-standard-telemetry.sh @@ -3,14 +3,15 @@ set -euo pipefail example_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" repo_dir="$(cd "$example_dir/../.." && pwd)" -run_dir="$(mktemp -d -t teaql-java-standard-telemetry.XXXXXXXX)" +run_dir="${TEAQL_TRACE_CHAIN_STANDARD_EVIDENCE_DIR:-$(mktemp -d -t teaql-java-standard-telemetry.XXXXXXXX)}" +mkdir -p "$run_dir" names=(TEAQL_TELEMETRY_ENABLED TEAQL_TELEMETRY_SERVICE_NAME TEAQL_TELEMETRY_OTLP_ENDPOINT) disabled=(env -u "${names[0]}" -u "${names[1]}" -u "${names[2]}") -args=(-B -f "$repo_dir/pom.xml" -Pruntime-examples -pl examples/trace-chain -am +args=(-B -f "$repo_dir/pom.xml" -Pruntime-examples -pl examples/trace-chain/java-app-console -am -Dtest=GeneratedStandardTelemetryExampleTest -Dsurefire.failIfNoSpecifiedTests=false test) library_manifest() { - (cd "$example_dir" && find lib -type f ! -path '*/target/*' -print0 | + (cd "$example_dir" && find java-lib-core -type f ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) } library_manifest > "$run_dir/library-before.sha256" diff --git a/examples/trace-chain/verify.sh b/examples/trace-chain/verify.sh index 8c855608e..0a6c1498f 100644 --- a/examples/trace-chain/verify.sh +++ b/examples/trace-chain/verify.sh @@ -9,13 +9,13 @@ run_dir="$(cd "$run_dir" && pwd)" database="$run_dir/trace-chain.db" library_manifest() { - (cd "$example_dir" && find lib -type f ! -path '*/target/*' -print0 | + (cd "$example_dir" && find java-lib-core -type f ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) } library_manifest > "$run_dir/library-before.sha256" # Install only from this checkout. No candidate download, deploy, tag or publication. -mvn -B -f "$repo_dir/pom.xml" -Pruntime-examples -pl examples/trace-chain -am \ +mvn -B -f "$repo_dir/pom.xml" -Pruntime-examples -pl examples/trace-chain/java-app-console -am \ install -DskipTests > "$run_dir/local-source-install.log" 2>&1 markers=( @@ -44,7 +44,7 @@ markers=( ) for repetition in 1 2; do log="$run_dir/run-$repetition.log" - if ! mvn -B -f "$example_dir/pom.xml" -Dtest=GeneratedTraceChainExampleTest,GeneratedFacetTraceExampleTest,GeneratedReverseFacetTraceExampleTest,GeneratedAggregateTraceExampleTest \ + if ! mvn -B -f "$example_dir/java-app-console/pom.xml" -Dtest=GeneratedTraceChainExampleTest,GeneratedFacetTraceExampleTest,GeneratedReverseFacetTraceExampleTest,GeneratedAggregateTraceExampleTest \ "-Dteaql.trace.database=$database" test > "$log" 2>&1; then tail -n 100 "$log" >&2 exit 1 diff --git a/pom.xml b/pom.xml index d78805f3d..a369e8d94 100644 --- a/pom.xml +++ b/pom.xml @@ -375,8 +375,8 @@ examples/school-management/java-lib-core/lib examples/school-management/java-app-console - examples/trace-chain/lib - examples/trace-chain + examples/trace-chain/java-lib-core/lib + examples/trace-chain/java-app-console examples/standard-order/java-lib-core/lib examples/standard-order/java-app-console From 175650aeec08aae80e74384eb3d7bd9731156b33 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 17:39:37 +0800 Subject: [PATCH 41/71] Identify each normative order graph in the restart evidence --- .../examples/tracechain/GeneratedTraceChainExampleTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java index d70f3b673..7808cd16c 100644 --- a/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java +++ b/examples/trace-chain/java-app-console/src/test/java/io/teaql/examples/tracechain/GeneratedTraceChainExampleTest.java @@ -735,6 +735,8 @@ private static void assertExactGraphIdentities(String boundary, Set Date: Fri, 20 Nov 2026 17:41:38 +0800 Subject: [PATCH 42/71] Record focused java examples/trace-chain business qualification --- examples/trace-chain/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/trace-chain/showcase.json b/examples/trace-chain/showcase.json index d462949bb..7f460b404 100644 --- a/examples/trace-chain/showcase.json +++ b/examples/trace-chain/showcase.json @@ -24,9 +24,17 @@ "receipt": "teaql-conformance/evidence/2026-11-19-runtime-examples-refresh/generation-v430-candidate/receipt.json", "receiptSHA256": "9bf2a08fa9c5bec0d9b1a2e1420044ffdd6bc71c6a1a09ce70d81d1cf0cdbd0a" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-trace-chain-identified-order-graphs/runtime/trace-chain/receipt.json", + "businessReceiptSHA256": "355c2885c7f05ec9709a4e9d7d04b2cdfdd011ca0260a8f1a3f06ba61f543adf", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-trace-chain-identified-order-graphs/receipt.json", + "nativeReceiptSHA256": "3f41d49139cd3a9f1915599ce58805d92285863152a831e08913845c63dfb115", + "remainingFullRuntimeInventory": true, + "sourceCommit": "175650aeec08aae80e74384eb3d7bd9731156b33" + }, "scene": "Save, roll back and replay customer order graphs with shared products, payment and shipment trace evidence", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/trace-chain/verify.sh" From b0a549321ed76987dbeb7a860d06188a85b576db Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:34:02 +0800 Subject: [PATCH 43/71] File and retrieve an order receipt in the Java model workspace --- .../java-app-console/.gitignore | 53 + .../object-storage/java-app-console/AGENTS.md | 67 + .../java-app-console/DOMAIN_API_GUIDE.md | 30 + .../object-storage/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 153 ++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../orderattachmentservice/Checkers.java | 0 .../orderattachmentservice/Constants.java | 9 + .../com/teaql/orderattachmentservice/E.java | 23 + .../EntityMetaRegistry.java | 507 +++++++ .../GeneratedRuntimeModule.java | 38 + .../OrderAttachmentServiceUserContext.java | 10 + .../com/teaql/orderattachmentservice/Q.java | 34 + .../orderattachmentservice/Repositories.java | 0 .../commerceplatform/CommercePlatform.java | 130 ++ .../CommercePlatformChecker.java | 52 + .../CommercePlatformExpression.java | 51 + .../CommercePlatformListExpression.java | 25 + .../CommercePlatformRequest.java | 623 ++++++++ .../customerorder/CustomerOrder.java | 151 ++ .../customerorder/CustomerOrderChecker.java | 65 + .../CustomerOrderExpression.java | 61 + .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 900 +++++++++++ .../orderattachment/OrderAttachment.java | 211 +++ .../OrderAttachmentChecker.java | 105 ++ .../OrderAttachmentExpression.java | 81 + .../OrderAttachmentListExpression.java | 25 + .../OrderAttachmentRequest.java | 1315 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../object-storage/java-app-console/pom.xml | 50 + .../com/teaql/orderattachmentservice/App.java | 198 +++ .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 114 ++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../object-storage/java-lib-core/lib/pom.xml | 142 ++ .../BaseServiceConfiguration.java | 0 .../orderattachmentservice/Checkers.java | 0 .../orderattachmentservice/Constants.java | 9 + .../com/teaql/orderattachmentservice/E.java | 23 + .../EntityMetaRegistry.java | 507 +++++++ .../GeneratedRuntimeModule.java | 38 + .../OrderAttachmentServiceUserContext.java | 10 + .../com/teaql/orderattachmentservice/Q.java | 34 + .../orderattachmentservice/Repositories.java | 0 .../commerceplatform/CommercePlatform.java | 130 ++ .../CommercePlatformChecker.java | 52 + .../CommercePlatformExpression.java | 51 + .../CommercePlatformListExpression.java | 25 + .../CommercePlatformRequest.java | 623 ++++++++ .../customerorder/CustomerOrder.java | 151 ++ .../customerorder/CustomerOrderChecker.java | 65 + .../CustomerOrderExpression.java | 61 + .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 900 +++++++++++ .../orderattachment/OrderAttachment.java | 211 +++ .../OrderAttachmentChecker.java | 105 ++ .../OrderAttachmentExpression.java | 81 + .../OrderAttachmentListExpression.java | 25 + .../OrderAttachmentRequest.java | 1315 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/object-storage/model.xml | 8 + examples/object-storage/showcase.json | 40 + examples/object-storage/verify.sh | 40 +- examples/object-storage/workspace-pom.xml | 13 + 76 files changed, 10133 insertions(+), 3 deletions(-) create mode 100644 examples/object-storage/java-app-console/.gitignore create mode 100644 examples/object-storage/java-app-console/AGENTS.md create mode 100644 examples/object-storage/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/object-storage/java-app-console/Makefile create mode 100644 examples/object-storage/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/object-storage/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/object-storage/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/object-storage/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/object-storage/java-app-console/lib/pom.xml create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java create mode 100644 examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/object-storage/java-app-console/pom.xml create mode 100644 examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java create mode 100644 examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/CustomUserContext.java create mode 100644 examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/object-storage/java-app-console/src/main/resources/application.properties create mode 100644 examples/object-storage/java-app-console/teaql-i18n.json create mode 100644 examples/object-storage/java-app-console/teaql/checker-model.json create mode 100644 examples/object-storage/java-app-console/teaql/model-provenance.json create mode 100644 examples/object-storage/java-lib-core/lib/pom.xml create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/E.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Q.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java create mode 100644 examples/object-storage/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/object-storage/java-lib-core/teaql/checker-model.json create mode 100644 examples/object-storage/java-lib-core/teaql/model-provenance.json create mode 100644 examples/object-storage/model.xml create mode 100644 examples/object-storage/showcase.json create mode 100644 examples/object-storage/workspace-pom.xml diff --git a/examples/object-storage/java-app-console/.gitignore b/examples/object-storage/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/object-storage/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/object-storage/java-app-console/AGENTS.md b/examples/object-storage/java-app-console/AGENTS.md new file mode 100644 index 000000000..aed77e31f --- /dev/null +++ b/examples/object-storage/java-app-console/AGENTS.md @@ -0,0 +1,67 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| commerce_platform | commerce_platform | +| customer_order | customer_order | +| order_attachment | order_attachment | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/object-storage/java-app-console/DOMAIN_API_GUIDE.md b/examples/object-storage/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..fd1c172c9 --- /dev/null +++ b/examples/object-storage/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,30 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/order-attachment-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| commerce_platform | commerce_platform | +| customer_order | customer_order | +| order_attachment | order_attachment | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/object-storage/java-app-console/Makefile b/examples/object-storage/java-app-console/Makefile new file mode 100644 index 000000000..700007da4 --- /dev/null +++ b/examples/object-storage/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/order-attachment-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/order-attachment-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/object-storage/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/object-storage/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..623742fd8 --- /dev/null +++ b/examples/object-storage/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/order-attachment-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/object-storage/java-app-console/STANDARD_TELEMETRY.md b/examples/object-storage/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/object-storage/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/object-storage/java-app-console/TOOL_API_GUIDE.md b/examples/object-storage/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..ad8167b18 --- /dev/null +++ b/examples/object-storage/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/order-attachment-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/order-attachment-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/order-attachment-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/order-attachment-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/order-attachment-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/order-attachment-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/object-storage/java-app-console/docs/teaql-java-crud-guide.md b/examples/object-storage/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..4ac379fde --- /dev/null +++ b/examples/object-storage/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,153 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.orderattachmentservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.OrderAttachmentServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.commercePlatforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.commercePlatforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new CommercePlatform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.commercePlatforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.commercePlatforms() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.customerOrders() + .selectCommercePlatformWith(Q.commercePlatforms().selectSelf()) + .comment("load with commercePlatform") + .purpose("fetch associated commercePlatform") + .executeForList(userContext); +``` + +```java +var list = Q.customerOrders() + .selectOrderAttachmentListWith(Q.orderAttachments().selectSelf()) + .comment("load with orderAttachmentList") + .purpose("fetch child orderAttachmentList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `CommercePlatform`: reverse relations `1`, query `Q.commercePlatforms()`, save `new CommercePlatform().auditAs("comment").save(userContext)`, request `com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest` +- `CustomerOrder`: reverse relations `1`, query `Q.customerOrders()`, save `new CustomerOrder().auditAs("comment").save(userContext)`, request `com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest` \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/pom.xml b/examples/object-storage/java-app-console/lib/pom.xml new file mode 100644 index 000000000..a52d2b079 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + order-attachment-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java new file mode 100644 index 000000000..d36ec5d66 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.orderattachmentservice; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; + +public interface Constants { + public static final long COMMERCE_PLATFORM_ID = 1l; + public static final CommercePlatform COMMERCE_PLATFORM = CommercePlatform.refer(COMMERCE_PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java new file mode 100644 index 000000000..53a6d4cc2 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java @@ -0,0 +1,23 @@ + +package com.teaql.orderattachmentservice; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformExpression; +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderExpression; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static CommercePlatformExpression commercePlatform(CommercePlatform commercePlatform){ + return new CommercePlatformExpression(new ValueExpression(commercePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.commercePlatform()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } + public static OrderAttachmentExpression orderAttachment(OrderAttachment orderAttachment){ + return new OrderAttachmentExpression(new ValueExpression(orderAttachment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderAttachment()")); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java new file mode 100644 index 000000000..a22089ee9 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java @@ -0,0 +1,507 @@ + +package com.teaql.orderattachmentservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerCommercePlatform(); + registerCustomerOrder(); + registerOrderAttachment(); + } + private void registerCommercePlatform() { + FieldLayout.installGenerated(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class); + entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Order Attachments") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.orderattachmentservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.orderattachmentservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.customerorder.CustomerOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.orderattachmentservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderAttachment() { + FieldLayout.installGenerated(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class); + entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.orderattachment.OrderAttachment::new); + entityDescriptor.with("audit_mask_fields", "object_key") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CUSTOMER_ORDER_PROPERTY, com.teaql.orderattachmentservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, com.teaql.orderattachmentservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor fileName = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY, String.class) + ; + PropertyDescriptor contentType = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY, String.class) + ; + PropertyDescriptor contentLength = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY, Integer.class) + ; + PropertyDescriptor contentSha256 = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY, String.class) + ; + PropertyDescriptor objectKey = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..5eaae4cfb --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.orderattachmentservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformChecker(), new com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker(), new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:f6fb4b9ca6d876325850fdce5a0d2ab5c57f19c74af6bbffb2b494779e9c27b9\",\"entities\":{\"CommercePlatform\":{\"labels\":{\"en\":\"commerce platform\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"customer order\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_attachment_list\",\"targetType\":\"OrderAttachment\",\"labels\":{\"en\":\"order attachment\"},\"aliases\":[\"OrderAttachmentList\",\"orderAttachmentList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderAttachment\":{\"labels\":{\"en\":\"order attachment\"},\"fields\":[{\"name\":\"content_length\",\"labels\":{\"en\":\"content length\"},\"aliases\":[\"ContentLength\",\"contentLength\"]},{\"name\":\"content_sha256\",\"labels\":{\"en\":\"content sha256\"},\"aliases\":[\"ContentSha256\",\"contentSha256\"]},{\"name\":\"content_type\",\"labels\":{\"en\":\"content type\"},\"aliases\":[\"ContentType\",\"contentType\"]},{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"file_name\",\"labels\":{\"en\":\"file name\"},\"aliases\":[\"FileName\",\"fileName\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"object_key\",\"labels\":{\"en\":\"object key\"},\"aliases\":[\"ObjectKey\",\"objectKey\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("CommercePlatform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderAttachment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("file_name", "fileName"), java.util.Map.entry("content_type", "contentType"), java.util.Map.entry("content_length", "contentLength"), java.util.Map.entry("content_sha256", "contentSha256"), java.util.Map.entry("object_key", "objectKey"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.commercePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.orderattachmentservice.commerceplatform.CommercePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.orderattachmentservice.commerceplatform.CommercePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Order Attachments"); + domainRoot.auditAs("create generated Domain Root CommercePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("CommercePlatform", domainRoot.getId())); + } +} diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java new file mode 100644 index 000000000..8f2790ae4 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.orderattachmentservice; + +import io.teaql.core.UserContext; +public interface OrderAttachmentServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java new file mode 100644 index 000000000..8140571a8 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.orderattachmentservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest commercePlatforms(){ + return new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest commercePlatformsWithMinimalFields(){ + return new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest orderAttachments(){ + return new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest orderAttachmentsWithMinimalFields(){ + return new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java new file mode 100644 index 000000000..ea18484f9 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java @@ -0,0 +1,130 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CommercePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CommercePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f218c9feeb79e3ee25bbe5cc22ff2017c941db6ed0e708a35970fd1dcfec84df"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CommercePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public CommercePlatform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCommercePlatform(this); + return this; + } + + public static CommercePlatform refer(Long id){ + CommercePlatform refer = new CommercePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CommercePlatform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java new file mode 100644 index 000000000..235f3133b --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CommercePlatformChecker implements Checker{ + + public String type(){ + return CommercePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, commercePlatform)){ + markAsChecked(_context, commercePlatform); + doCheck(_context, commercePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if((commercePlatform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, commercePlatform); + if(commercePlatform.needPersist()){ + } + if(commercePlatform.newItem()){ + }else if(commercePlatform.updateItem()){ + if(!commercePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; commercePlatform.getCustomerOrderList() != null && i < commercePlatform.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = commercePlatform.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java new file mode 100644 index 000000000..23cba6c0e --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CommercePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CommercePlatformExpression(Expression expression){ + super(expression); + } + + public CommercePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public CommercePlatformExpression updateId(Long id){ + return new CommercePlatformExpression(this, $it -> {((CommercePlatform)$it).__internalSet("id", id); return this;}); + } + + public CommercePlatformExpression save(UserContext userContext){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CommercePlatformExpression save(String intent, UserContext userContext){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", CommercePlatform::getName); + } + public CommercePlatformExpression updateName(String name){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateName(name)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CommercePlatform::getCustomerOrderList)); + } + public CommercePlatformExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java new file mode 100644 index 000000000..11881d250 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CommercePlatformListExpression extends SmartListExpression { + public CommercePlatformListExpression(Expression> expression){ + super(expression); + } + + public CommercePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CommercePlatformExpression first() { + return new CommercePlatformExpression(super.first()); + } + + public CommercePlatformExpression get(int index) { + return new CommercePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java new file mode 100644 index 000000000..67f989e2a --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CommercePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CommercePlatformRequest(Class returnType){ + this(returnType, () -> (T) new CommercePlatform()); + } + + protected CommercePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CommercePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CommercePlatformRequest copy(){ + return (CommercePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CommercePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CommercePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CommercePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CommercePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CommercePlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CommercePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CommercePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CommercePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CommercePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CommercePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public CommercePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CommercePlatformRequest matchingAnyOf(CommercePlatformRequest commercePlatform){ + super.internalMatchAny(commercePlatform); + return this; + } + + public CommercePlatformRequest matchingIdsOf(CommercePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CommercePlatform.ID_PROPERTY, request, CommercePlatform.ID_PROPERTY)); + } + + public CommercePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CommercePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CommercePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CommercePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public CommercePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public CommercePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CommercePlatform.ID_PROPERTY); + selectProperty(CommercePlatform.NAME_PROPERTY); + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public CommercePlatformRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectName().selectVersion(); + } + + + public CommercePlatformRequest selectId(){ + selectProperty(CommercePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectId(){ + unselectProperty(CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest selectName(){ + selectProperty(CommercePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectName(){ + unselectProperty(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest selectVersion(){ + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectVersion(){ + unselectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CommercePlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.ID_PROPERTY, operator, values); + } + + public CommercePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CommercePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CommercePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CommercePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CommercePlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CommercePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CommercePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CommercePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.NAME_PROPERTY, operator, values); + } + + public CommercePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CommercePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CommercePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CommercePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CommercePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CommercePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CommercePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CommercePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CommercePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CommercePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CommercePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CommercePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CommercePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CommercePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CommercePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CommercePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CommercePlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CommercePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CommercePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CommercePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.VERSION_PROPERTY, operator, values); + } + + public CommercePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CommercePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CommercePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CommercePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CommercePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CommercePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CommercePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CommercePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CommercePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CommercePlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CommercePlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CommercePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CommercePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CommercePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CommercePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public CommercePlatformRequest groupById(){ + groupBy(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByIdAs(String retName){ + groupBy(retName, CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.ID_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByName(){ + groupBy(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByNameAs(String retName){ + groupBy(retName, CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.NAME_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByVersion(){ + groupBy(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public CommercePlatformRequest orderByIdAscending(){ + addOrderByAscending(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByIdDescending(){ + addOrderByDescending(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameAscending(){ + addOrderByAscending(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameDescending(){ + addOrderByDescending(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest orderByVersionAscending(){ + addOrderByAscending(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByVersionDescending(){ + addOrderByDescending(CommercePlatform.VERSION_PROPERTY); + return this; + } + + + public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public CommercePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CommercePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CommercePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CommercePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CommercePlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CommercePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..1587b1fef --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java @@ -0,0 +1,151 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "0f43e8a9f92ac574b08050817425a1e7ebc7b9b011cd14c379fdf99b1cc834a0"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("order_number", 1), java.util.Map.entry("commerce_platform", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_attachment_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String ORDER_ATTACHMENT_LIST_PROPERTY = "order_attachment_list"; + private String orderNumber; + + private CommercePlatform commercePlatform; + + private SmartList orderAttachmentList; + + public String getOrderNumber(){ + return this.orderNumber; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public SmartList getOrderAttachmentList(){ + return this.orderAttachmentList == null ? SmartList.unloaded() : this.orderAttachmentList; + } + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public CustomerOrder addOrderAttachment(OrderAttachment orderAttachment){ + if (orderAttachment == null){ + return this; + } + + if(null == this.orderAttachmentList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderAttachmentList = teaqlUnloadedItems.map(value -> value); + } + + this.orderAttachmentList.add(orderAttachment); + orderAttachment.updateCustomerOrder(this); + return this; + } + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "order_attachment_list": this.orderAttachmentList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "order_number": return this.orderNumber; + case "commerce_platform": return this.commercePlatform; + case "order_attachment_list": return this.orderAttachmentList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "orderNumber": return this.orderNumber; + case "commercePlatform": return this.commercePlatform; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..eaa9c2278 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformChecker; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + }else if(customerOrder.updateItem()){ + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + + } + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkCommercePlatform(_context, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + for(int i = 0; customerOrder.getOrderAttachmentList() != null && i < customerOrder.getOrderAttachmentList().size(); i++){ + OrderAttachment orderAttachment = customerOrder.getOrderAttachmentList().get(i); + new OrderAttachmentChecker().checkAndFix(_context, orderAttachment, newLocation(_parentLocation, "order_attachment_list", i)); + } + } + + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..4ec32fd79 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformExpression; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", CustomerOrder::getCommercePlatform)); + } + + public CustomerOrderExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCommercePlatform(commercePlatform)); + } + + public OrderAttachmentListExpression getOrderAttachmentList(){ + return new OrderAttachmentListExpression(loaded("order_attachment_list", "getOrderAttachmentList", CustomerOrder::getOrderAttachmentList)); + } + public CustomerOrderExpression addOrderAttachment(OrderAttachment orderAttachment){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderAttachment(orderAttachment)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..7975ccd86 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..962b95968 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,900 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectOrderNumber().selectCommercePlatformIdOnly().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectOrderNumber().selectCommercePlatform().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + selectOrderAttachmentList(); + return selectId().selectOrderNumber().selectCommercePlatform().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectCommercePlatformIdOnly(){ + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCommercePlatform(){ + unselectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderAttachmentList(){ + return selectOrderAttachmentListWith(Q.orderAttachments().selectSelf()); + } + + public CustomerOrderRequest selectOrderAttachmentListWith(OrderAttachmentRequest orderAttachmentList){ + enhanceRelation(CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, orderAttachmentList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderAttachmentListWith", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public CustomerOrderRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public CustomerOrderRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public CustomerOrderRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public CustomerOrderRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerOrderRequest withOrderAttachmentListMatching(OrderAttachmentRequest orderAttachmentRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderAttachmentRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutOrderAttachmentListMatching(OrderAttachmentRequest orderAttachmentRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderAttachmentRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest haveOrderAttachments(){ + return withOrderAttachmentListMatching(Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest haveNoOrderAttachments(){ + return withoutOrderAttachmentListMatching(Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public CustomerOrderRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public CustomerOrderRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest groupByOrderAttachmentsWithDetails(OrderAttachmentRequest subRequest){ + aggregate(CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public CustomerOrderRequest groupByCommercePlatform(){ + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByCommercePlatformAscending(){ + addOrderByAscending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCommercePlatformDescending(){ + addOrderByDescending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest statsFromOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + return statsFromOrderAttachmentsAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromOrderAttachments(OrderAttachmentRequest subRequest){ + return statsFromOrderAttachmentsAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + public CustomerOrderRequest countOrderAttachments(){ + addRelationCount("Count", Q.orderAttachments().unlimited(), OrderAttachment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderAttachmentsAs(String name){ + addRelationCount(name, Q.orderAttachments().unlimited(), OrderAttachment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderAttachmentsWith(String name, OrderAttachmentRequest subRequest){ + addRelationCount(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachmentsWith", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest minContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("minContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest minContentLengthOfOrderAttachmentsAs(String name){ + return minContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest minContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest maxContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("maxContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest maxContentLengthOfOrderAttachmentsAs(String name){ + return maxContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest maxContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sumContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("sumContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sumContentLengthOfOrderAttachmentsAs(String name){ + return sumContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest sumContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest avgContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("avgContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest avgContentLengthOfOrderAttachmentsAs(String name){ + return avgContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest avgContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("stdDevContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachmentsAs(String name){ + return standardDeviationContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("stdDevPopContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(String name){ + return squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("varSampContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachmentsAs(String name){ + return sampleVarianceContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("varPopContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachmentsAs(String name){ + return samplePopulationVarianceContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java new file mode 100644 index 000000000..4f1fcae88 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java @@ -0,0 +1,211 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderAttachment extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderAttachment"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "1b7e0fc32cc094c60c46058779d5933a02527a724ffa64e3e722a9670f3883aa"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("file_name", 2), java.util.Map.entry("content_type", 3), java.util.Map.entry("content_length", 4), java.util.Map.entry("content_sha256", 5), java.util.Map.entry("object_key", 6), java.util.Map.entry("version", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("file_name", java.util.List.of("fileName", "file_name")), java.util.Map.entry("content_type", java.util.List.of("contentType", "content_type")), java.util.Map.entry("content_length", java.util.List.of("contentLength", "content_length")), java.util.Map.entry("content_sha256", java.util.List.of("contentSha256", "content_sha256")), java.util.Map.entry("object_key", java.util.List.of("objectKey", "object_key")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderAttachment.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String FILE_NAME_PROPERTY = "file_name"; + public static final String CONTENT_TYPE_PROPERTY = "content_type"; + public static final String CONTENT_LENGTH_PROPERTY = "content_length"; + public static final String CONTENT_SHA256_PROPERTY = "content_sha256"; + public static final String OBJECT_KEY_PROPERTY = "object_key"; + private CustomerOrder customerOrder; + + private String fileName; + + private String contentType; + + private Integer contentLength; + + private String contentSha256; + + private String objectKey; + + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public String getFileName(){ + return this.fileName; + } + + public String getContentType(){ + return this.contentType; + } + + public Integer getContentLength(){ + return this.contentLength; + } + + public String getContentSha256(){ + return this.contentSha256; + } + + public String getObjectKey(){ + return this.objectKey; + } + + public OrderAttachment updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public OrderAttachment updateFileName(String fileName){ + fileName = (fileName == null ? null : fileName.trim()); + if(isPropertyLoaded(FILE_NAME_PROPERTY) && Objects.equals(this.fileName, fileName)){ + return this; + } + handleUpdate(FILE_NAME_PROPERTY, getFileName(), fileName); + this.fileName = fileName; + return this; + } + + public OrderAttachment updateContentType(String contentType){ + contentType = (contentType == null ? null : contentType.trim()); + if(isPropertyLoaded(CONTENT_TYPE_PROPERTY) && Objects.equals(this.contentType, contentType)){ + return this; + } + handleUpdate(CONTENT_TYPE_PROPERTY, getContentType(), contentType); + this.contentType = contentType; + return this; + } + + public OrderAttachment updateContentLength(Integer contentLength){ + if(isPropertyLoaded(CONTENT_LENGTH_PROPERTY) && Objects.equals(this.contentLength, contentLength)){ + return this; + } + handleUpdate(CONTENT_LENGTH_PROPERTY, getContentLength(), contentLength); + this.contentLength = contentLength; + return this; + } + + public OrderAttachment updateContentSha256(String contentSha256){ + contentSha256 = (contentSha256 == null ? null : contentSha256.trim()); + if(isPropertyLoaded(CONTENT_SHA256_PROPERTY) && Objects.equals(this.contentSha256, contentSha256)){ + return this; + } + handleUpdate(CONTENT_SHA256_PROPERTY, getContentSha256(), contentSha256); + this.contentSha256 = contentSha256; + return this; + } + + public OrderAttachment updateObjectKey(String objectKey){ + objectKey = (objectKey == null ? null : objectKey.trim()); + if(isPropertyLoaded(OBJECT_KEY_PROPERTY) && Objects.equals(this.objectKey, objectKey)){ + return this; + } + handleUpdate(OBJECT_KEY_PROPERTY, getObjectKey(), objectKey); + this.objectKey = objectKey; + return this; + } + + + public static OrderAttachment refer(Long id){ + OrderAttachment refer = new OrderAttachment(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderAttachment comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "file_name": this.fileName = (value == null ? null : ((String)value).trim()); break; + + case "content_type": this.contentType = (value == null ? null : ((String)value).trim()); break; + + case "content_length": this.contentLength = (Integer) value; break; + + case "content_sha256": this.contentSha256 = (value == null ? null : ((String)value).trim()); break; + + case "object_key": this.objectKey = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "file_name": return this.fileName; + case "content_type": return this.contentType; + case "content_length": return this.contentLength; + case "content_sha256": return this.contentSha256; + case "object_key": return this.objectKey; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "fileName": return this.fileName; + case "contentType": return this.contentType; + case "contentLength": return this.contentLength; + case "contentSha256": return this.contentSha256; + case "objectKey": return this.objectKey; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java new file mode 100644 index 000000000..48b076160 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java @@ -0,0 +1,105 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class OrderAttachmentChecker implements Checker{ + + public String type(){ + return OrderAttachment.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderAttachment orderAttachment, ObjectLocation _parentLocation){ + if(needCheck(_context, orderAttachment)){ + markAsChecked(_context, orderAttachment); + doCheck(_context, orderAttachment, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderAttachment orderAttachment, ObjectLocation _parentLocation){ + if((orderAttachment == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderAttachment); + if(orderAttachment.needPersist()){ + } + if(orderAttachment.newItem()){ + }else if(orderAttachment.updateItem()){ + if(!orderAttachment.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("file_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "file_name"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("content_type")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "content_type"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("content_length")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "content_length"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("content_sha256")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "content_sha256"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("object_key")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "object_key"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, orderAttachment.getProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkFileName(_context, orderAttachment.getProperty(OrderAttachment.FILE_NAME_PROPERTY), newLocation(_parentLocation, "file_name")); + checkContentType(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_TYPE_PROPERTY), newLocation(_parentLocation, "content_type")); + checkContentLength(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY), newLocation(_parentLocation, "content_length")); + checkContentSha256(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_SHA256_PROPERTY), newLocation(_parentLocation, "content_sha256")); + checkObjectKey(_context, orderAttachment.getProperty(OrderAttachment.OBJECT_KEY_PROPERTY), newLocation(_parentLocation, "object_key")); + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkFileName(UserContext _context, String fileName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, fileName); + if((fileName == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, fileName); + + } + public void checkContentType(UserContext _context, String contentType, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contentType); + if((contentType == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, contentType); + + } + public void checkContentLength(UserContext _context, Integer contentLength, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contentLength); + if((contentLength == null)){ + return; + } + } + public void checkContentSha256(UserContext _context, String contentSha256, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contentSha256); + if((contentSha256 == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, contentSha256); + + } + public void checkObjectKey(UserContext _context, String objectKey, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, objectKey); + if((objectKey == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, objectKey); + + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java new file mode 100644 index 000000000..8ae231192 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java @@ -0,0 +1,81 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class OrderAttachmentExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderAttachmentExpression(Expression expression){ + super(expression); + } + + public OrderAttachmentExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderAttachmentExpression updateId(Long id){ + return new OrderAttachmentExpression(this, $it -> {((OrderAttachment)$it).__internalSet("id", id); return this;}); + } + + public OrderAttachmentExpression save(UserContext userContext){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderAttachmentExpression save(String intent, UserContext userContext){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderAttachment::getCustomerOrder)); + } + + public OrderAttachmentExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateCustomerOrder(customerOrder)); + } + + public Expression getFileName(){ + return loaded("file_name", "getFileName", OrderAttachment::getFileName); + } + public OrderAttachmentExpression updateFileName(String fileName){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateFileName(fileName)); + } + + public Expression getContentType(){ + return loaded("content_type", "getContentType", OrderAttachment::getContentType); + } + public OrderAttachmentExpression updateContentType(String contentType){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentType(contentType)); + } + + public Expression getContentLength(){ + return loaded("content_length", "getContentLength", OrderAttachment::getContentLength); + } + public OrderAttachmentExpression updateContentLength(Integer contentLength){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentLength(contentLength)); + } + + public Expression getContentSha256(){ + return loaded("content_sha256", "getContentSha256", OrderAttachment::getContentSha256); + } + public OrderAttachmentExpression updateContentSha256(String contentSha256){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentSha256(contentSha256)); + } + + public Expression getObjectKey(){ + return loaded("object_key", "getObjectKey", OrderAttachment::getObjectKey); + } + public OrderAttachmentExpression updateObjectKey(String objectKey){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateObjectKey(objectKey)); + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java new file mode 100644 index 000000000..bcdb7e29e --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderAttachmentListExpression extends SmartListExpression { + public OrderAttachmentListExpression(Expression> expression){ + super(expression); + } + + public OrderAttachmentListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderAttachmentExpression first() { + return new OrderAttachmentExpression(super.first()); + } + + public OrderAttachmentExpression get(int index) { + return new OrderAttachmentExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java new file mode 100644 index 000000000..ebb47f9cf --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java @@ -0,0 +1,1315 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class OrderAttachmentRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderAttachmentRequest(Class returnType){ + this(returnType, () -> (T) new OrderAttachment()); + } + + protected OrderAttachmentRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderAttachmentRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderAttachmentRequest copy(){ + return (OrderAttachmentRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderAttachmentRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderAttachmentRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderAttachmentRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderAttachmentRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderAttachmentRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderAttachmentRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderAttachmentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderAttachmentRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderAttachmentRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderAttachmentRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderAttachmentRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderAttachmentRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderAttachmentRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderAttachmentRequest matchingAnyOf(OrderAttachmentRequest orderAttachment){ + super.internalMatchAny(orderAttachment); + return this; + } + + public OrderAttachmentRequest matchingIdsOf(OrderAttachmentRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderAttachment.ID_PROPERTY, request, OrderAttachment.ID_PROPERTY)); + } + + public OrderAttachmentRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderAttachmentRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderAttachmentRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderAttachmentRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); + } + + public OrderAttachmentRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderAttachmentRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderAttachment.ID_PROPERTY); + selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderAttachment.FILE_NAME_PROPERTY); + selectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); + selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); + selectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); + selectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); + selectProperty(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); + } + + public OrderAttachmentRequest selectChildren(){ + super.selectAny(); + return selectId().selectCustomerOrder().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); + } + + + public OrderAttachmentRequest selectId(){ + selectProperty(OrderAttachment.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectId(){ + unselectProperty(OrderAttachment.ID_PROPERTY); + return this; + } + public OrderAttachmentRequest selectCustomerOrderIdOnly(){ + selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public OrderAttachmentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public OrderAttachmentRequest unselectCustomerOrder(){ + unselectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderAttachmentRequest selectFileName(){ + selectProperty(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + /** + * fill the fileName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS fileName) to fetch fileName property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectFileName(){ + unselectProperty(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest selectContentType(){ + selectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + /** + * fill the contentType with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentType) to fetch contentType property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectContentType(){ + unselectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest selectContentLength(){ + selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + /** + * fill the contentLength with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentLength) to fetch contentLength property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the contentLength with customized aggrFunction, TEAQL uses ({aggrFunction}(contentLength) AS contentLength to fetch contentLength property. + * @param aggrFunction aggrFunction + */ + public OrderAttachmentRequest selectContentLength(AggrFunction aggrFunction){ + selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY, aggrFunction); + return this; + } + + + public OrderAttachmentRequest unselectContentLength(){ + unselectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest selectContentSha256(){ + selectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + /** + * fill the contentSha256 with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentSha256) to fetch contentSha256 property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectContentSha256(){ + unselectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest selectObjectKey(){ + selectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + /** + * fill the objectKey with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS objectKey) to fetch objectKey property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectObjectKey(){ + unselectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest selectVersion(){ + selectProperty(OrderAttachment.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectVersion(){ + unselectProperty(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.ID_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderAttachmentRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderAttachmentRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderAttachmentRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderAttachmentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public OrderAttachmentRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public OrderAttachmentRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public OrderAttachmentRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public OrderAttachmentRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public OrderAttachmentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public OrderAttachmentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public OrderAttachmentRequest filterByFileName(String... fileName){ + if (fileName == null || fileName.length == 0) { + throw new IllegalArgumentException("filterByFileName parameter fileName cannot be empty"); + } + return appendSearchCriteria(createFileNameCriteria(Operator.EQUAL, (Object[])fileName)); + } + + public OrderAttachmentRequest withFileName(Operator operator, Object... values){ + return appendSearchCriteria(createFileNameCriteria(operator, values)); + } + + public OrderAttachmentRequest withFileNameIsUnknown(){ + return withFileName(Operator.IS_NULL); + } + + public OrderAttachmentRequest withFileNameIsKnown(){ + return withFileName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createFileNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.FILE_NAME_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withFileNameIsNot(String fileName){ + return withFileName(Operator.NOT_EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameIn(String... fileName){ + return withFileName(Operator.IN, (Object[])fileName); + } + + public OrderAttachmentRequest withFileNameNotIn(String... fileName){ + return withFileName(Operator.NOT_IN, (Object[])fileName); + } + public OrderAttachmentRequest withFileNameGreaterThan(String fileName){ + return withFileName(Operator.GREATER_THAN, fileName); + } + + public OrderAttachmentRequest withFileNameGreaterThanOrEqualTo(String fileName){ + return withFileName(Operator.GREATER_THAN_OR_EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameLessThan(String fileName){ + return withFileName(Operator.LESS_THAN, fileName); + } + + public OrderAttachmentRequest withFileNameLessThanOrEqualTo(String fileName){ + return withFileName(Operator.LESS_THAN_OR_EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameBetween(String startOfFileName, String endOfFileName){ + return withFileName(Operator.BETWEEN, startOfFileName, endOfFileName); + } + public OrderAttachmentRequest withFileNameStartingWith(String fileName){ + return withFileName(Operator.BEGIN_WITH, fileName); + } + public OrderAttachmentRequest withFileNameContaining(String fileName){ + return withFileName(Operator.CONTAIN, fileName); + } + + public OrderAttachmentRequest withFileNameNotContaining(String fileName){ + return withFileName(Operator.NOT_CONTAIN, fileName); + } + + public OrderAttachmentRequest withFileNameNotStartingWith(String fileName){ + return withFileName(Operator.NOT_BEGIN_WITH, fileName); + } + + public OrderAttachmentRequest withFileNameEndingWith(String fileName){ + return withFileName(Operator.END_WITH, fileName); + } + + public OrderAttachmentRequest withFileNameNotEndingWith(String fileName){ + return withFileName(Operator.NOT_END_WITH, fileName); + } + + public OrderAttachmentRequest withFileNameIs(String fileName){ + return withFileName(Operator.EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameSoundingLike(String fileName){ + return withFileName(Operator.SOUNDS_LIKE, fileName); + } + + + + public OrderAttachmentRequest filterByContentType(String... contentType){ + if (contentType == null || contentType.length == 0) { + throw new IllegalArgumentException("filterByContentType parameter contentType cannot be empty"); + } + return appendSearchCriteria(createContentTypeCriteria(Operator.EQUAL, (Object[])contentType)); + } + + public OrderAttachmentRequest withContentType(Operator operator, Object... values){ + return appendSearchCriteria(createContentTypeCriteria(operator, values)); + } + + public OrderAttachmentRequest withContentTypeIsUnknown(){ + return withContentType(Operator.IS_NULL); + } + + public OrderAttachmentRequest withContentTypeIsKnown(){ + return withContentType(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContentTypeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CONTENT_TYPE_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withContentTypeIsNot(String contentType){ + return withContentType(Operator.NOT_EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeIn(String... contentType){ + return withContentType(Operator.IN, (Object[])contentType); + } + + public OrderAttachmentRequest withContentTypeNotIn(String... contentType){ + return withContentType(Operator.NOT_IN, (Object[])contentType); + } + public OrderAttachmentRequest withContentTypeGreaterThan(String contentType){ + return withContentType(Operator.GREATER_THAN, contentType); + } + + public OrderAttachmentRequest withContentTypeGreaterThanOrEqualTo(String contentType){ + return withContentType(Operator.GREATER_THAN_OR_EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeLessThan(String contentType){ + return withContentType(Operator.LESS_THAN, contentType); + } + + public OrderAttachmentRequest withContentTypeLessThanOrEqualTo(String contentType){ + return withContentType(Operator.LESS_THAN_OR_EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeBetween(String startOfContentType, String endOfContentType){ + return withContentType(Operator.BETWEEN, startOfContentType, endOfContentType); + } + public OrderAttachmentRequest withContentTypeStartingWith(String contentType){ + return withContentType(Operator.BEGIN_WITH, contentType); + } + public OrderAttachmentRequest withContentTypeContaining(String contentType){ + return withContentType(Operator.CONTAIN, contentType); + } + + public OrderAttachmentRequest withContentTypeNotContaining(String contentType){ + return withContentType(Operator.NOT_CONTAIN, contentType); + } + + public OrderAttachmentRequest withContentTypeNotStartingWith(String contentType){ + return withContentType(Operator.NOT_BEGIN_WITH, contentType); + } + + public OrderAttachmentRequest withContentTypeEndingWith(String contentType){ + return withContentType(Operator.END_WITH, contentType); + } + + public OrderAttachmentRequest withContentTypeNotEndingWith(String contentType){ + return withContentType(Operator.NOT_END_WITH, contentType); + } + + public OrderAttachmentRequest withContentTypeIs(String contentType){ + return withContentType(Operator.EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeSoundingLike(String contentType){ + return withContentType(Operator.SOUNDS_LIKE, contentType); + } + + + + public OrderAttachmentRequest filterByContentLength(Integer... contentLength){ + if (contentLength == null || contentLength.length == 0) { + throw new IllegalArgumentException("filterByContentLength parameter contentLength cannot be empty"); + } + return appendSearchCriteria(createContentLengthCriteria(Operator.EQUAL, (Object[])contentLength)); + } + + public OrderAttachmentRequest withContentLength(Operator operator, Object... values){ + return appendSearchCriteria(createContentLengthCriteria(operator, values)); + } + + public OrderAttachmentRequest withContentLengthIsUnknown(){ + return withContentLength(Operator.IS_NULL); + } + + public OrderAttachmentRequest withContentLengthIsKnown(){ + return withContentLength(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContentLengthCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CONTENT_LENGTH_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withContentLengthIs(Integer contentLength){ + return withContentLength(Operator.EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthIsNot(Integer contentLength){ + return withContentLength(Operator.NOT_EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthIn(Integer... contentLength){ + return withContentLength(Operator.IN, (Object[])contentLength); + } + + public OrderAttachmentRequest withContentLengthNotIn(Integer... contentLength){ + return withContentLength(Operator.NOT_IN, (Object[])contentLength); + } + public OrderAttachmentRequest withContentLengthGreaterThan(Integer contentLength){ + return withContentLength(Operator.GREATER_THAN, contentLength); + } + + public OrderAttachmentRequest withContentLengthGreaterThanOrEqualTo(Integer contentLength){ + return withContentLength(Operator.GREATER_THAN_OR_EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthLessThan(Integer contentLength){ + return withContentLength(Operator.LESS_THAN, contentLength); + } + + public OrderAttachmentRequest withContentLengthLessThanOrEqualTo(Integer contentLength){ + return withContentLength(Operator.LESS_THAN_OR_EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthBetween(Integer startOfContentLength, Integer endOfContentLength){ + return withContentLength(Operator.BETWEEN, startOfContentLength, endOfContentLength); + } + + + + public OrderAttachmentRequest filterByContentSha256(String... contentSha256){ + if (contentSha256 == null || contentSha256.length == 0) { + throw new IllegalArgumentException("filterByContentSha256 parameter contentSha256 cannot be empty"); + } + return appendSearchCriteria(createContentSha256Criteria(Operator.EQUAL, (Object[])contentSha256)); + } + + public OrderAttachmentRequest withContentSha256(Operator operator, Object... values){ + return appendSearchCriteria(createContentSha256Criteria(operator, values)); + } + + public OrderAttachmentRequest withContentSha256IsUnknown(){ + return withContentSha256(Operator.IS_NULL); + } + + public OrderAttachmentRequest withContentSha256IsKnown(){ + return withContentSha256(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContentSha256Criteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CONTENT_SHA256_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withContentSha256IsNot(String contentSha256){ + return withContentSha256(Operator.NOT_EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256In(String... contentSha256){ + return withContentSha256(Operator.IN, (Object[])contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotIn(String... contentSha256){ + return withContentSha256(Operator.NOT_IN, (Object[])contentSha256); + } + public OrderAttachmentRequest withContentSha256GreaterThan(String contentSha256){ + return withContentSha256(Operator.GREATER_THAN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256GreaterThanOrEqualTo(String contentSha256){ + return withContentSha256(Operator.GREATER_THAN_OR_EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256LessThan(String contentSha256){ + return withContentSha256(Operator.LESS_THAN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256LessThanOrEqualTo(String contentSha256){ + return withContentSha256(Operator.LESS_THAN_OR_EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256Between(String startOfContentSha256, String endOfContentSha256){ + return withContentSha256(Operator.BETWEEN, startOfContentSha256, endOfContentSha256); + } + public OrderAttachmentRequest withContentSha256StartingWith(String contentSha256){ + return withContentSha256(Operator.BEGIN_WITH, contentSha256); + } + public OrderAttachmentRequest withContentSha256Containing(String contentSha256){ + return withContentSha256(Operator.CONTAIN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotContaining(String contentSha256){ + return withContentSha256(Operator.NOT_CONTAIN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotStartingWith(String contentSha256){ + return withContentSha256(Operator.NOT_BEGIN_WITH, contentSha256); + } + + public OrderAttachmentRequest withContentSha256EndingWith(String contentSha256){ + return withContentSha256(Operator.END_WITH, contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotEndingWith(String contentSha256){ + return withContentSha256(Operator.NOT_END_WITH, contentSha256); + } + + public OrderAttachmentRequest withContentSha256Is(String contentSha256){ + return withContentSha256(Operator.EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256SoundingLike(String contentSha256){ + return withContentSha256(Operator.SOUNDS_LIKE, contentSha256); + } + + + + public OrderAttachmentRequest filterByObjectKey(String... objectKey){ + if (objectKey == null || objectKey.length == 0) { + throw new IllegalArgumentException("filterByObjectKey parameter objectKey cannot be empty"); + } + return appendSearchCriteria(createObjectKeyCriteria(Operator.EQUAL, (Object[])objectKey)); + } + + public OrderAttachmentRequest withObjectKey(Operator operator, Object... values){ + return appendSearchCriteria(createObjectKeyCriteria(operator, values)); + } + + public OrderAttachmentRequest withObjectKeyIsUnknown(){ + return withObjectKey(Operator.IS_NULL); + } + + public OrderAttachmentRequest withObjectKeyIsKnown(){ + return withObjectKey(Operator.IS_NOT_NULL); + } + + public SearchCriteria createObjectKeyCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.OBJECT_KEY_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withObjectKeyIsNot(String objectKey){ + return withObjectKey(Operator.NOT_EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeyIn(String... objectKey){ + return withObjectKey(Operator.IN, (Object[])objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotIn(String... objectKey){ + return withObjectKey(Operator.NOT_IN, (Object[])objectKey); + } + public OrderAttachmentRequest withObjectKeyGreaterThan(String objectKey){ + return withObjectKey(Operator.GREATER_THAN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyGreaterThanOrEqualTo(String objectKey){ + return withObjectKey(Operator.GREATER_THAN_OR_EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeyLessThan(String objectKey){ + return withObjectKey(Operator.LESS_THAN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyLessThanOrEqualTo(String objectKey){ + return withObjectKey(Operator.LESS_THAN_OR_EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeyBetween(String startOfObjectKey, String endOfObjectKey){ + return withObjectKey(Operator.BETWEEN, startOfObjectKey, endOfObjectKey); + } + public OrderAttachmentRequest withObjectKeyStartingWith(String objectKey){ + return withObjectKey(Operator.BEGIN_WITH, objectKey); + } + public OrderAttachmentRequest withObjectKeyContaining(String objectKey){ + return withObjectKey(Operator.CONTAIN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotContaining(String objectKey){ + return withObjectKey(Operator.NOT_CONTAIN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotStartingWith(String objectKey){ + return withObjectKey(Operator.NOT_BEGIN_WITH, objectKey); + } + + public OrderAttachmentRequest withObjectKeyEndingWith(String objectKey){ + return withObjectKey(Operator.END_WITH, objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotEndingWith(String objectKey){ + return withObjectKey(Operator.NOT_END_WITH, objectKey); + } + + public OrderAttachmentRequest withObjectKeyIs(String objectKey){ + return withObjectKey(Operator.EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeySoundingLike(String objectKey){ + return withObjectKey(Operator.SOUNDS_LIKE, objectKey); + } + + + + public OrderAttachmentRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderAttachmentRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderAttachmentRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderAttachmentRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.VERSION_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderAttachmentRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderAttachmentRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderAttachmentRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderAttachmentRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderAttachmentRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderAttachmentRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderAttachmentRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderAttachmentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderAttachmentRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderAttachmentRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderAttachmentRequest minContentLength(){ + return minContentLengthAs(prefix("minOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest minContentLengthAs(String retName){ + super.min(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest maxContentLength(){ + return maxContentLengthAs(prefix("maxOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest maxContentLengthAs(String retName){ + super.max(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest sumContentLength(){ + return sumContentLengthAs(prefix("sumOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest sumContentLengthAs(String retName){ + super.sum(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest avgContentLength(){ + return avgContentLengthAs(prefix("avgOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest avgContentLengthAs(String retName){ + super.avg(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest standardDeviationContentLength(){ + return standardDeviationContentLengthAs(prefix("standardDeviationOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest standardDeviationContentLengthAs(String retName){ + super.standardDeviation(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest squareRootOfPopulationStandardDeviationContentLength(){ + return squareRootOfPopulationStandardDeviationContentLengthAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest squareRootOfPopulationStandardDeviationContentLengthAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest sampleVarianceContentLength(){ + return sampleVarianceContentLengthAs(prefix("sampleVarianceOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest sampleVarianceContentLengthAs(String retName){ + super.sampleVariance(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest samplePopulationVarianceContentLength(){ + return samplePopulationVarianceContentLengthAs(prefix("samplePopulationVarianceOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest samplePopulationVarianceContentLengthAs(String retName){ + super.samplePopulationVariance(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public OrderAttachmentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderAttachment.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + + + + + + + public OrderAttachmentRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderAttachmentRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.ID_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderAttachmentRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctFileName(){ + return countDistinctFileNameAs("file_name_distinct_count"); + } + + public OrderAttachmentRequest countDistinctFileNameAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctContentType(){ + return countDistinctContentTypeAs("content_type_distinct_count"); + } + + public OrderAttachmentRequest countDistinctContentTypeAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctContentLength(){ + return countDistinctContentLengthAs("content_length_distinct_count"); + } + + public OrderAttachmentRequest countDistinctContentLengthAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctContentSha256(){ + return countDistinctContentSha256As("content_sha256_distinct_count"); + } + + public OrderAttachmentRequest countDistinctContentSha256As(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctObjectKey(){ + return countDistinctObjectKeyAs("object_key_distinct_count"); + } + + public OrderAttachmentRequest countDistinctObjectKeyAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderAttachmentRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupById(){ + groupBy(OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByIdAs(String retName){ + groupBy(retName, OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.ID_PROPERTY, function); + return this; + } + public OrderAttachmentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(OrderAttachment.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public OrderAttachmentRequest groupByCustomerOrder(){ + groupBy(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByFileName(){ + groupBy(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByFileNameAs(String retName){ + groupBy(retName, OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByFileNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.FILE_NAME_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByContentType(){ + groupBy(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentTypeAs(String retName){ + groupBy(retName, OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentTypeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CONTENT_TYPE_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByContentLength(){ + groupBy(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentLengthAs(String retName){ + groupBy(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentLengthWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByContentSha256(){ + groupBy(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentSha256As(String retName){ + groupBy(retName, OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentSha256WithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CONTENT_SHA256_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByObjectKey(){ + groupBy(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByObjectKeyAs(String retName){ + groupBy(retName, OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByObjectKeyWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.OBJECT_KEY_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByVersion(){ + groupBy(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByVersionAs(String retName){ + groupBy(retName, OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.VERSION_PROPERTY, function); + return this; + } + + + + public OrderAttachmentRequest orderByIdAscending(){ + addOrderByAscending(OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByIdDescending(){ + addOrderByDescending(OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByCustomerOrderAscending(){ + addOrderByAscending(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByCustomerOrderDescending(){ + addOrderByDescending(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByFileNameAscending(){ + addOrderByAscending(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByFileNameDescending(){ + addOrderByDescending(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByFileNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByFileNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentTypeAscending(){ + addOrderByAscending(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentTypeDescending(){ + addOrderByDescending(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentTypeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentTypeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentLengthAscending(){ + addOrderByAscending(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentLengthDescending(){ + addOrderByDescending(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentSha256Ascending(){ + addOrderByAscending(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentSha256Descending(){ + addOrderByDescending(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentSha256AscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentSha256DescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByObjectKeyAscending(){ + addOrderByAscending(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByObjectKeyDescending(){ + addOrderByDescending(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByObjectKeyAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByObjectKeyDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByVersionAscending(){ + addOrderByAscending(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByVersionDescending(){ + addOrderByDescending(OrderAttachment.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + + + + + + + + public OrderAttachmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public OrderAttachmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderAttachmentRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderAttachmentRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderAttachmentRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderAttachmentRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderAttachmentRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderAttachmentRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..09a7e0e70 --- /dev/null +++ b/examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.orderattachmentservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/object-storage/java-app-console/pom.xml b/examples/object-storage/java-app-console/pom.xml new file mode 100644 index 000000000..ed5911da6 --- /dev/null +++ b/examples/object-storage/java-app-console/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + com.teaql.examples + order-attachment-service-console + 1.0.0 + + 21 + UTF-8 + 6.3.0 + + + + com.teaql + order-attachment-service-core + 0.0.1-SNAPSHOT + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-object-storage-s3 + ${teaql.version} + + + org.xerial + sqlite-jdbc + 3.47.2.0 + + + com.zaxxer + HikariCP + 6.3.0 + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.5.0 + com.teaql.orderattachmentservice.App + + + + diff --git a/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java new file mode 100644 index 000000000..1bf17cc71 --- /dev/null +++ b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java @@ -0,0 +1,198 @@ +package com.teaql.orderattachmentservice; + +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.UserContext; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.storage.ObjectStorage.Key; +import io.teaql.core.storage.ObjectStorage.PutOptions; +import io.teaql.core.storage.ObjectStorage.WriteMode; +import io.teaql.core.storage.ObjectStorageObserver; +import io.teaql.core.storage.ObjectStorageProvider; +import io.teaql.core.storage.StorageException; +import io.teaql.objectstorage.s3.S3ObjectStorage; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.AppAuditEventSink; +import io.teaql.runtime.SafeAuditEvent; +import io.teaql.runtime.TeaQLRuntime; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HexFormat; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import javax.sql.DataSource; + +public class App { + private static final byte[] RECEIPT = "TeaQL order receipt fixture\nItem: tea\nTotal: 12.50\n".getBytes(StandardCharsets.UTF_8); + private static final String FILENAME = "receipt.txt"; + private static final String CONTENT_TYPE = "text/plain"; + + public static void main(String[] args) throws Exception { + int round = Integer.parseInt(required("TEAQL_ATTACHMENT_ROUND")); + require(round == 1 || round == 2, "round must be 1 or 2"); + var config = new HikariConfig(); + config.setJdbcUrl("jdbc:sqlite:" + required("TEAQL_ATTACHMENT_DB")); + config.setMaximumPoolSize(1); + var credentials = StaticCredentialsProvider.create(AwsBasicCredentials.create( + required("TEAQL_S3_ACCESS_KEY"), required("TEAQL_S3_SECRET_KEY"))); + try (var source = new HikariDataSource(config); + var provider = S3ObjectStorage.connect(URI.create(required("TEAQL_S3_ENDPOINT")), Region.US_EAST_1, + credentials, required("TEAQL_S3_BUCKET"), true)) { + var app = new App(); + var executor = new JdbcSqlExecutor(source); + try (var runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source))) { + var context = new CustomUserContext(runtime); + verify(context, provider, Path.of(required("TEAQL_ATTACHMENT_DOWNLOAD")), round); + } + } + } + + private static void verify(UserContext context, ObjectStorageProvider provider, Path download, int round) throws Exception { + var events = new ArrayList(); + var audits = new ArrayList(); + context.putAttribute(ObjectStorageProvider.class.getName(), provider); + context.putAttribute(ObjectStorageObserver.class.getName(), (ObjectStorageObserver) (caller, operation, intent) -> { + require(caller == context, "storage observation escaped the attachment Context"); + return outcome -> events.add(operation + "|" + intent + "|" + outcome); + }); + context.putAttribute(AppAuditEventSink.class.getName(), (AppAuditEventSink) (caller, event) -> { + if (List.of("CustomerOrder", "OrderAttachment").contains(event.entityType())) audits.add(event); + }); + var storage = context.objectStorage("file and retrieve an order receipt"); + context.ensureSchema(); + + var platform = Q.commercePlatforms().withIdIs(1L).limit(1).comment("load the commerce platform") + .purpose("associate the new order to its root").executeForList(context).get(0); + String orderNumber = "ATTACH-ORDER-" + round; + var order = Q.customerOrders().comment("prepare receipt order").purpose("file a receipt against this order").newEntity(context); + order.updateOrderNumber(orderNumber); + order.updateCommercePlatform(platform); + order.auditAs("place the order receiving the receipt").save(context); + + var key = new Key("private-order-attachments/" + UUID.randomUUID()); + var digest = checksum(RECEIPT); + boolean uploaded = false; + try { + require(!storage.exists(key), "new attachment key already exists"); + storage.putBytes(key, RECEIPT, new PutOptions(RECEIPT.length, CONTENT_TYPE, Map.of("receipt-sha256", digest), WriteMode.CREATE_ONLY)); + uploaded = true; + var attachment = Q.orderAttachments().comment("prepare receipt attachment") + .purpose("save the uploaded receipt reference on its order").newEntity(context); + attachment.updateCustomerOrder(order); + attachment.updateFileName(FILENAME); + attachment.updateContentType(CONTENT_TYPE); + attachment.updateContentLength(RECEIPT.length); + attachment.updateContentSha256(digest); + attachment.updateObjectKey(key.value()); + attachment.auditAs("associate the stored receipt with its order").save(context); + + var rows = attachments(context, order.getId()); + require(rows.size() == 1 && Objects.equals(rows.get(0).getId(), attachment.getId()), "persisted order association mismatch"); + var expression = E.orderAttachment(rows.get(0)); + require(FILENAME.equals(expression.getFileName().eval()) && CONTENT_TYPE.equals(expression.getContentType().eval()), + "stored receipt filename or type mismatch"); + require(Objects.equals(expression.getContentLength().eval(), RECEIPT.length) + && digest.equals(expression.getContentSha256().eval()), "stored receipt bytes metadata mismatch"); + var reference = expression.getObjectKey().eval(); + require(key.value().equals(reference), "stored receipt reference mismatch"); + var persistedKey = new Key(reference); + var metadata = storage.head(persistedKey).orElseThrow(); + require(metadata.size() == RECEIPT.length && CONTENT_TYPE.equals(metadata.contentType()) + && digest.equals(metadata.customMetadata().get("receipt-sha256")), "provider metadata mismatch"); + byte[] replacement = "replacement".getBytes(StandardCharsets.UTF_8); + expect(StorageException.Code.CONFLICT, () -> storage.putBytes(persistedKey, replacement, PutOptions.create(replacement.length))); + expect(StorageException.Code.TOO_LARGE, () -> storage.getBytes(persistedKey, RECEIPT.length - 1)); + byte[] downloaded = storage.getBytes(persistedKey, RECEIPT.length); + require(Arrays.equals(downloaded, RECEIPT) && checksum(downloaded).equals(digest), "retrieved receipt changed"); + Files.write(download, downloaded); + + storage.delete(persistedKey); + uploaded = false; + expect(StorageException.Code.NOT_FOUND, () -> storage.get(persistedKey)); + require(!storage.exists(persistedKey), "missing object reported present"); + require(attachments(context, order.getId()).stream().map(OrderAttachment::getId).toList().equals(List.of(attachment.getId())), + "missing object changed the order association"); + require(!events.isEmpty() && audits.stream().map(SafeAuditEvent::entityType).toList().equals(List.of("CustomerOrder", "OrderAttachment")), + "committed order and attachment audits missing"); + require(!events.toString().contains(key.value()) && !audits.toString().contains(key.value()), "private object key reached safe events"); + + System.out.printf("ATTACHMENT_ORIGIN %s%n", OrderAttachment.class.getProtectionDomain().getCodeSource().getLocation()); + System.out.printf("S3_PROVIDER_ORIGIN %s%n", S3ObjectStorage.class.getProtectionDomain().getCodeSource().getLocation()); + System.out.printf("ORDER_ATTACHMENT {\"round\":%d,\"order\":%d,\"attachment\":%d,\"orderNumber\":\"%s\",\"filename\":\"%s\",\"contentType\":\"%s\"," + + "\"length\":%d,\"sha256\":\"%s\",\"conflict\":true,\"sizeRefused\":true,\"missing\":true,\"businessAudits\":%d}%n", + round, order.getId(), attachment.getId(), orderNumber, FILENAME, CONTENT_TYPE, downloaded.length, digest, audits.size()); + } finally { + if (uploaded) storage.delete(key); + } + } + + private static List attachments(UserContext context, Long orderId) { + return Q.orderAttachments().filterByCustomerOrder(orderId).limit(2).comment("load order attachments") + .purpose("retrieve this order's stored receipt").executeForList(context).stream().toList(); + } + + private static String checksum(byte[] bytes) throws Exception { + return HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(bytes)); + } + + private static String required(String name) { + var value = System.getenv(name); + if (value == null || value.isBlank()) throw new IllegalStateException("Missing " + name); + return value; + } + + private static void require(boolean ok, String reason) { + if (!ok) throw new AssertionError(reason); + } + + private static void expect(StorageException.Code code, Runnable operation) { + try { operation.run(); } + catch (StorageException error) { require(error.code() == code, "unexpected storage error"); return; } + throw new AssertionError("expected typed storage error"); + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor(JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor("default", executor, dataSource); + } + + public DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + var registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, DataSource source) { + return new WorkspaceTeaQLDatabase(executor, source); + } + + public TeaQLRuntime teaQLRuntime(EntityMetaFactory metadata, DataServiceRegistry registry, WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder().metadata(metadata).registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .queryExecutionLogging(false).mutationExecutionLogging(false) + .build().install(GeneratedRuntimeModule.module()); + } +} diff --git a/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/CustomUserContext.java b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/CustomUserContext.java new file mode 100644 index 000000000..589679c9d --- /dev/null +++ b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.orderattachmentservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements OrderAttachmentServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/WorkspaceTeaQLDatabase.java b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..de12456ee --- /dev/null +++ b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.orderattachmentservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/src/main/resources/application.properties b/examples/object-storage/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..d28f00663 --- /dev/null +++ b/examples/object-storage/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:orderattachmentservice.db diff --git a/examples/object-storage/java-app-console/teaql-i18n.json b/examples/object-storage/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..2c7430a4f --- /dev/null +++ b/examples/object-storage/java-app-console/teaql-i18n.json @@ -0,0 +1,114 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.customerOrder.orderNumber": "Order Number", + "property.commercePlatform.name": "Name", + "property.orderAttachment.contentType": "Content Type", + "property.commercePlatform.id": "Id", + "entity.commercePlatform": "Commerce Platform", + "property.orderAttachment.contentLength": "Content Length", + "entity.customerOrder": "Customer Order", + "property.orderAttachment.customerOrder": "Customer Order", + "property.orderAttachment.fileName": "File Name", + "property.customerOrder.id": "Id", + "property.orderAttachment.id": "Id", + "property.orderAttachment.contentSha256": "Content Sha256", + "entity.orderAttachment": "Order Attachment", + "property.orderAttachment.version": "Version", + "property.commercePlatform.version": "Version", + "property.orderAttachment.objectKey": "Object Key", + "property.customerOrder.commercePlatform": "Commerce Platform", + "property.customerOrder.version": "Version" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/teaql/checker-model.json b/examples/object-storage/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..8e70b24cf --- /dev/null +++ b/examples/object-storage/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:f6fb4b9ca6d876325850fdce5a0d2ab5c57f19c74af6bbffb2b494779e9c27b9","entities":{"CommercePlatform":{"labels":{"en":"commerce platform"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerOrder":{"labels":{"en":"customer order"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_attachment_list","targetType":"OrderAttachment","labels":{"en":"order attachment"},"aliases":["OrderAttachmentList","orderAttachmentList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderAttachment":{"labels":{"en":"order attachment"},"fields":[{"name":"content_length","labels":{"en":"content length"},"aliases":["ContentLength","contentLength"]},{"name":"content_sha256","labels":{"en":"content sha256"},"aliases":["ContentSha256","contentSha256"]},{"name":"content_type","labels":{"en":"content type"},"aliases":["ContentType","contentType"]},{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"file_name","labels":{"en":"file name"},"aliases":["FileName","fileName"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"object_key","labels":{"en":"object key"},"aliases":["ObjectKey","objectKey"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/teaql/model-provenance.json b/examples/object-storage/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..06554042f --- /dev/null +++ b/examples/object-storage/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:08f94683ccf143a5f5b1e9d39d647b338b410f1ebf18918b9832ca7a75ebbc12","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/pom.xml b/examples/object-storage/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..7b35f6bea --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.teaql + order-attachment-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java new file mode 100644 index 000000000..d36ec5d66 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.orderattachmentservice; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; + +public interface Constants { + public static final long COMMERCE_PLATFORM_ID = 1l; + public static final CommercePlatform COMMERCE_PLATFORM = CommercePlatform.refer(COMMERCE_PLATFORM_ID); +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/E.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/E.java new file mode 100644 index 000000000..53a6d4cc2 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/E.java @@ -0,0 +1,23 @@ + +package com.teaql.orderattachmentservice; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformExpression; +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderExpression; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static CommercePlatformExpression commercePlatform(CommercePlatform commercePlatform){ + return new CommercePlatformExpression(new ValueExpression(commercePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.commercePlatform()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } + public static OrderAttachmentExpression orderAttachment(OrderAttachment orderAttachment){ + return new OrderAttachmentExpression(new ValueExpression(orderAttachment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderAttachment()")); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java new file mode 100644 index 000000000..a22089ee9 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java @@ -0,0 +1,507 @@ + +package com.teaql.orderattachmentservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerCommercePlatform(); + registerCustomerOrder(); + registerOrderAttachment(); + } + private void registerCommercePlatform() { + FieldLayout.installGenerated(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class); + entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Order Attachments") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.orderattachmentservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.orderattachmentservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.customerorder.CustomerOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor commercePlatform = + entityDescriptor.addObjectProperty($factory, com.teaql.orderattachmentservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderAttachment() { + FieldLayout.installGenerated(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class); + entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.orderattachment.OrderAttachment::new); + entityDescriptor.with("audit_mask_fields", "object_key") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY, Long.class) + ; + PropertyDescriptor customerOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CUSTOMER_ORDER_PROPERTY, com.teaql.orderattachmentservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, com.teaql.orderattachmentservice.customerorder.CustomerOrder.class) + ; + PropertyDescriptor fileName = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY, String.class) + ; + PropertyDescriptor contentType = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY, String.class) + ; + PropertyDescriptor contentLength = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY, Integer.class) + ; + PropertyDescriptor contentSha256 = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY, String.class) + ; + PropertyDescriptor objectKey = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..5eaae4cfb --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.orderattachmentservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformChecker(), new com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker(), new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:f6fb4b9ca6d876325850fdce5a0d2ab5c57f19c74af6bbffb2b494779e9c27b9\",\"entities\":{\"CommercePlatform\":{\"labels\":{\"en\":\"commerce platform\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"customer order\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_attachment_list\",\"targetType\":\"OrderAttachment\",\"labels\":{\"en\":\"order attachment\"},\"aliases\":[\"OrderAttachmentList\",\"orderAttachmentList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderAttachment\":{\"labels\":{\"en\":\"order attachment\"},\"fields\":[{\"name\":\"content_length\",\"labels\":{\"en\":\"content length\"},\"aliases\":[\"ContentLength\",\"contentLength\"]},{\"name\":\"content_sha256\",\"labels\":{\"en\":\"content sha256\"},\"aliases\":[\"ContentSha256\",\"contentSha256\"]},{\"name\":\"content_type\",\"labels\":{\"en\":\"content type\"},\"aliases\":[\"ContentType\",\"contentType\"]},{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"file_name\",\"labels\":{\"en\":\"file name\"},\"aliases\":[\"FileName\",\"fileName\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"object_key\",\"labels\":{\"en\":\"object key\"},\"aliases\":[\"ObjectKey\",\"objectKey\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("CommercePlatform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderAttachment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("file_name", "fileName"), java.util.Map.entry("content_type", "contentType"), java.util.Map.entry("content_length", "contentLength"), java.util.Map.entry("content_sha256", "contentSha256"), java.util.Map.entry("object_key", "objectKey"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.commercePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.orderattachmentservice.commerceplatform.CommercePlatform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.orderattachmentservice.commerceplatform.CommercePlatform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Order Attachments"); + domainRoot.auditAs("create generated Domain Root CommercePlatform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("CommercePlatform", domainRoot.getId())); + } +} diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java new file mode 100644 index 000000000..8f2790ae4 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.orderattachmentservice; + +import io.teaql.core.UserContext; +public interface OrderAttachmentServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Q.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Q.java new file mode 100644 index 000000000..8140571a8 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.orderattachmentservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest commercePlatforms(){ + return new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest commercePlatformsWithMinimalFields(){ + return new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest orderAttachments(){ + return new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest orderAttachmentsWithMinimalFields(){ + return new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java new file mode 100644 index 000000000..ea18484f9 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java @@ -0,0 +1,130 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CommercePlatform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CommercePlatform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f218c9feeb79e3ee25bbe5cc22ff2017c941db6ed0e708a35970fd1dcfec84df"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CommercePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public CommercePlatform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCommercePlatform(this); + return this; + } + + public static CommercePlatform refer(Long id){ + CommercePlatform refer = new CommercePlatform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CommercePlatform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java new file mode 100644 index 000000000..235f3133b --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CommercePlatformChecker implements Checker{ + + public String type(){ + return CommercePlatform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if(needCheck(_context, commercePlatform)){ + markAsChecked(_context, commercePlatform); + doCheck(_context, commercePlatform, _parentLocation); + } + } + + public void doCheck(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + if((commercePlatform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, commercePlatform); + if(commercePlatform.needPersist()){ + } + if(commercePlatform.newItem()){ + }else if(commercePlatform.updateItem()){ + if(!commercePlatform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; commercePlatform.getCustomerOrderList() != null && i < commercePlatform.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = commercePlatform.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java new file mode 100644 index 000000000..23cba6c0e --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CommercePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CommercePlatformExpression(Expression expression){ + super(expression); + } + + public CommercePlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public CommercePlatformExpression updateId(Long id){ + return new CommercePlatformExpression(this, $it -> {((CommercePlatform)$it).__internalSet("id", id); return this;}); + } + + public CommercePlatformExpression save(UserContext userContext){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CommercePlatformExpression save(String intent, UserContext userContext){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", CommercePlatform::getName); + } + public CommercePlatformExpression updateName(String name){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateName(name)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CommercePlatform::getCustomerOrderList)); + } + public CommercePlatformExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java new file mode 100644 index 000000000..11881d250 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CommercePlatformListExpression extends SmartListExpression { + public CommercePlatformListExpression(Expression> expression){ + super(expression); + } + + public CommercePlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CommercePlatformExpression first() { + return new CommercePlatformExpression(super.first()); + } + + public CommercePlatformExpression get(int index) { + return new CommercePlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java new file mode 100644 index 000000000..67f989e2a --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.orderattachmentservice.commerceplatform; + +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CommercePlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CommercePlatformRequest(Class returnType){ + this(returnType, () -> (T) new CommercePlatform()); + } + + protected CommercePlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CommercePlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CommercePlatformRequest copy(){ + return (CommercePlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CommercePlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CommercePlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CommercePlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CommercePlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CommercePlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CommercePlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CommercePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CommercePlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CommercePlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CommercePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CommercePlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public CommercePlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CommercePlatformRequest matchingAnyOf(CommercePlatformRequest commercePlatform){ + super.internalMatchAny(commercePlatform); + return this; + } + + public CommercePlatformRequest matchingIdsOf(CommercePlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CommercePlatform.ID_PROPERTY, request, CommercePlatform.ID_PROPERTY)); + } + + public CommercePlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CommercePlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CommercePlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CommercePlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public CommercePlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public CommercePlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CommercePlatform.ID_PROPERTY); + selectProperty(CommercePlatform.NAME_PROPERTY); + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public CommercePlatformRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectName().selectVersion(); + } + + + public CommercePlatformRequest selectId(){ + selectProperty(CommercePlatform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectId(){ + unselectProperty(CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest selectName(){ + selectProperty(CommercePlatform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectName(){ + unselectProperty(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest selectVersion(){ + selectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CommercePlatformRequest unselectVersion(){ + unselectProperty(CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CommercePlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.ID_PROPERTY, operator, values); + } + + public CommercePlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CommercePlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CommercePlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CommercePlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CommercePlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public CommercePlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public CommercePlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public CommercePlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.NAME_PROPERTY, operator, values); + } + + public CommercePlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public CommercePlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public CommercePlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public CommercePlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public CommercePlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public CommercePlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public CommercePlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public CommercePlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public CommercePlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public CommercePlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public CommercePlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public CommercePlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public CommercePlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public CommercePlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public CommercePlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public CommercePlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public CommercePlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CommercePlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CommercePlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CommercePlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CommercePlatform.VERSION_PROPERTY, operator, values); + } + + public CommercePlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CommercePlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CommercePlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CommercePlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CommercePlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CommercePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CommercePlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CommercePlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CommercePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CommercePlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + } + + public CommercePlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY))); + } + + public CommercePlatformRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CommercePlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CommercePlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CommercePlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CommercePlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.ID_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CommercePlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CommercePlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CommercePlatform.VERSION_PROPERTY); + return this; + } + public CommercePlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public CommercePlatformRequest groupById(){ + groupBy(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByIdAs(String retName){ + groupBy(retName, CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.ID_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByName(){ + groupBy(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByNameAs(String retName){ + groupBy(retName, CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.NAME_PROPERTY, function); + return this; + } + + public CommercePlatformRequest groupByVersion(){ + groupBy(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByVersionAs(String retName){ + groupBy(retName, CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CommercePlatform.VERSION_PROPERTY, function); + return this; + } + + + + public CommercePlatformRequest orderByIdAscending(){ + addOrderByAscending(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByIdDescending(){ + addOrderByDescending(CommercePlatform.ID_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameAscending(){ + addOrderByAscending(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameDescending(){ + addOrderByDescending(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CommercePlatform.NAME_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CommercePlatform.NAME_PROPERTY); + return this; + } + public CommercePlatformRequest orderByVersionAscending(){ + addOrderByAscending(CommercePlatform.VERSION_PROPERTY); + return this; + } + + public CommercePlatformRequest orderByVersionDescending(){ + addOrderByDescending(CommercePlatform.VERSION_PROPERTY); + return this; + } + + + public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CommercePlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public CommercePlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CommercePlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CommercePlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CommercePlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CommercePlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CommercePlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..1587b1fef --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java @@ -0,0 +1,151 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "0f43e8a9f92ac574b08050817425a1e7ebc7b9b011cd14c379fdf99b1cc834a0"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("order_number", 1), java.util.Map.entry("commerce_platform", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_attachment_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; + public static final String ORDER_ATTACHMENT_LIST_PROPERTY = "order_attachment_list"; + private String orderNumber; + + private CommercePlatform commercePlatform; + + private SmartList orderAttachmentList; + + public String getOrderNumber(){ + return this.orderNumber; + } + + public CommercePlatform getCommercePlatform(){ + return this.commercePlatform; + } + + public SmartList getOrderAttachmentList(){ + return this.orderAttachmentList == null ? SmartList.unloaded() : this.orderAttachmentList; + } + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateCommercePlatform(CommercePlatform commercePlatform){ + if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ + return this; + } + handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); + this.commercePlatform = commercePlatform; + return this; + } + + public CustomerOrder addOrderAttachment(OrderAttachment orderAttachment){ + if (orderAttachment == null){ + return this; + } + + if(null == this.orderAttachmentList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderAttachmentList = teaqlUnloadedItems.map(value -> value); + } + + this.orderAttachmentList.add(orderAttachment); + orderAttachment.updateCustomerOrder(this); + return this; + } + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; + + case "order_attachment_list": this.orderAttachmentList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "order_number": return this.orderNumber; + case "commerce_platform": return this.commercePlatform; + case "order_attachment_list": return this.orderAttachmentList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "orderNumber": return this.orderNumber; + case "commercePlatform": return this.commercePlatform; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..eaa9c2278 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformChecker; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + }else if(customerOrder.updateItem()){ + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("commerce_platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); + } + + } + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkCommercePlatform(_context, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); + for(int i = 0; customerOrder.getOrderAttachmentList() != null && i < customerOrder.getOrderAttachmentList().size(); i++){ + OrderAttachment orderAttachment = customerOrder.getOrderAttachmentList().get(i); + new OrderAttachmentChecker().checkAndFix(_context, orderAttachment, newLocation(_parentLocation, "order_attachment_list", i)); + } + } + + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, commercePlatform); + if((commercePlatform == null)){ + return; + } + new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..4ec32fd79 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformExpression; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public CommercePlatformExpression getCommercePlatform(){ + return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", CustomerOrder::getCommercePlatform)); + } + + public CustomerOrderExpression updateCommercePlatform(CommercePlatform commercePlatform){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCommercePlatform(commercePlatform)); + } + + public OrderAttachmentListExpression getOrderAttachmentList(){ + return new OrderAttachmentListExpression(loaded("order_attachment_list", "getOrderAttachmentList", CustomerOrder::getOrderAttachmentList)); + } + public CustomerOrderExpression addOrderAttachment(OrderAttachment orderAttachment){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderAttachment(orderAttachment)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..7975ccd86 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..962b95968 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,900 @@ + +package com.teaql.orderattachmentservice.customerorder; + +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; +import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; +import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectOrderNumber().selectCommercePlatformIdOnly().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectOrderNumber().selectCommercePlatform().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + selectOrderAttachmentList(); + return selectId().selectOrderNumber().selectCommercePlatform().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectCommercePlatformIdOnly(){ + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCommercePlatform(){ + return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ + selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCommercePlatform(){ + unselectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderAttachmentList(){ + return selectOrderAttachmentListWith(Q.orderAttachments().selectSelf()); + } + + public CustomerOrderRequest selectOrderAttachmentListWith(OrderAttachmentRequest orderAttachmentList){ + enhanceRelation(CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, orderAttachmentList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderAttachmentListWith", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ + if (commercePlatform == null || commercePlatform.length == 0) { + throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); + } + return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); + } + + public CustomerOrderRequest withCommercePlatform(Operator operator, Object... values){ + return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); + } + + public CustomerOrderRequest withCommercePlatformIsUnknown(){ + return withCommercePlatform(Operator.IS_NULL); + } + + public CustomerOrderRequest withCommercePlatformIsKnown(){ + return withCommercePlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCommercePlatform(Long commercePlatform){ + if(commercePlatform == null){ + return this; + } + return withCommercePlatform(Operator.EQUAL, commercePlatform); + } + public CustomerOrderRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerOrderRequest withOrderAttachmentListMatching(OrderAttachmentRequest orderAttachmentRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderAttachmentRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); + } + + public CustomerOrderRequest withoutOrderAttachmentListMatching(OrderAttachmentRequest orderAttachmentRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderAttachmentRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY))); + } + + public CustomerOrderRequest haveOrderAttachments(){ + return withOrderAttachmentListMatching(Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest haveNoOrderAttachments(){ + return withoutOrderAttachmentListMatching(Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest groupByCommercePlatformWithDetails(){ + return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); + } + + public CustomerOrderRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ + aggregate(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest); + return this; + } + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCommercePlatform(){ + return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); + } + + public CustomerOrderRequest countDistinctCommercePlatformAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + public CustomerOrderRequest groupByOrderAttachmentsWithDetails(OrderAttachmentRequest subRequest){ + aggregate(CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); + return this; + } + public CustomerOrderRequest groupByCommercePlatform(){ + groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformAs(String retName){ + groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByCommercePlatformAscending(){ + addOrderByAscending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCommercePlatformDescending(){ + addOrderByDescending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest statsFromOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + return statsFromOrderAttachmentsAs(name, subRequest, false); + } + + public CustomerOrderRequest statsFromOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest statsFromOrderAttachments(OrderAttachmentRequest subRequest){ + return statsFromOrderAttachmentsAs(REFINEMENTS, subRequest); + } + public CommercePlatformRequest rollUpToCommercePlatform(){ + CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); + this.internalRollUpTo("commerce_platform", commercePlatform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); + return commercePlatform; + } + + + public CustomerOrderRequest countOrderAttachments(){ + addRelationCount("Count", Q.orderAttachments().unlimited(), OrderAttachment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderAttachmentsAs(String name){ + addRelationCount(name, Q.orderAttachments().unlimited(), OrderAttachment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest countOrderAttachmentsWith(String name, OrderAttachmentRequest subRequest){ + addRelationCount(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachmentsWith", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest minContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("minContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest minContentLengthOfOrderAttachmentsAs(String name){ + return minContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest minContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest maxContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("maxContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest maxContentLengthOfOrderAttachmentsAs(String name){ + return maxContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest maxContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sumContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("sumContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sumContentLengthOfOrderAttachmentsAs(String name){ + return sumContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest sumContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest avgContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("avgContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest avgContentLengthOfOrderAttachmentsAs(String name){ + return avgContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest avgContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("stdDevContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachmentsAs(String name){ + return standardDeviationContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("stdDevPopContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(String name){ + return squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("varSampContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachmentsAs(String name){ + return sampleVarianceContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachments(){ + addRelationScalarAggregate("varPopContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), + OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachmentsAs(String name){ + return samplePopulationVarianceContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); + } + + public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, + OrderAttachment.CONTENT_LENGTH_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); + return this; + } + + public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ + return facetByCommercePlatformAs(facetName, commercePlatform, true); + } + + public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java new file mode 100644 index 000000000..4f1fcae88 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java @@ -0,0 +1,211 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderAttachment extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderAttachment"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "1b7e0fc32cc094c60c46058779d5933a02527a724ffa64e3e722a9670f3883aa"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("file_name", 2), java.util.Map.entry("content_type", 3), java.util.Map.entry("content_length", 4), java.util.Map.entry("content_sha256", 5), java.util.Map.entry("object_key", 6), java.util.Map.entry("version", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("file_name", java.util.List.of("fileName", "file_name")), java.util.Map.entry("content_type", java.util.List.of("contentType", "content_type")), java.util.Map.entry("content_length", java.util.List.of("contentLength", "content_length")), java.util.Map.entry("content_sha256", java.util.List.of("contentSha256", "content_sha256")), java.util.Map.entry("object_key", java.util.List.of("objectKey", "object_key")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderAttachment.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; + public static final String FILE_NAME_PROPERTY = "file_name"; + public static final String CONTENT_TYPE_PROPERTY = "content_type"; + public static final String CONTENT_LENGTH_PROPERTY = "content_length"; + public static final String CONTENT_SHA256_PROPERTY = "content_sha256"; + public static final String OBJECT_KEY_PROPERTY = "object_key"; + private CustomerOrder customerOrder; + + private String fileName; + + private String contentType; + + private Integer contentLength; + + private String contentSha256; + + private String objectKey; + + + public CustomerOrder getCustomerOrder(){ + return this.customerOrder; + } + + public String getFileName(){ + return this.fileName; + } + + public String getContentType(){ + return this.contentType; + } + + public Integer getContentLength(){ + return this.contentLength; + } + + public String getContentSha256(){ + return this.contentSha256; + } + + public String getObjectKey(){ + return this.objectKey; + } + + public OrderAttachment updateCustomerOrder(CustomerOrder customerOrder){ + if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ + return this; + } + handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); + this.customerOrder = customerOrder; + return this; + } + + public OrderAttachment updateFileName(String fileName){ + fileName = (fileName == null ? null : fileName.trim()); + if(isPropertyLoaded(FILE_NAME_PROPERTY) && Objects.equals(this.fileName, fileName)){ + return this; + } + handleUpdate(FILE_NAME_PROPERTY, getFileName(), fileName); + this.fileName = fileName; + return this; + } + + public OrderAttachment updateContentType(String contentType){ + contentType = (contentType == null ? null : contentType.trim()); + if(isPropertyLoaded(CONTENT_TYPE_PROPERTY) && Objects.equals(this.contentType, contentType)){ + return this; + } + handleUpdate(CONTENT_TYPE_PROPERTY, getContentType(), contentType); + this.contentType = contentType; + return this; + } + + public OrderAttachment updateContentLength(Integer contentLength){ + if(isPropertyLoaded(CONTENT_LENGTH_PROPERTY) && Objects.equals(this.contentLength, contentLength)){ + return this; + } + handleUpdate(CONTENT_LENGTH_PROPERTY, getContentLength(), contentLength); + this.contentLength = contentLength; + return this; + } + + public OrderAttachment updateContentSha256(String contentSha256){ + contentSha256 = (contentSha256 == null ? null : contentSha256.trim()); + if(isPropertyLoaded(CONTENT_SHA256_PROPERTY) && Objects.equals(this.contentSha256, contentSha256)){ + return this; + } + handleUpdate(CONTENT_SHA256_PROPERTY, getContentSha256(), contentSha256); + this.contentSha256 = contentSha256; + return this; + } + + public OrderAttachment updateObjectKey(String objectKey){ + objectKey = (objectKey == null ? null : objectKey.trim()); + if(isPropertyLoaded(OBJECT_KEY_PROPERTY) && Objects.equals(this.objectKey, objectKey)){ + return this; + } + handleUpdate(OBJECT_KEY_PROPERTY, getObjectKey(), objectKey); + this.objectKey = objectKey; + return this; + } + + + public static OrderAttachment refer(Long id){ + OrderAttachment refer = new OrderAttachment(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderAttachment comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "customer_order": this.customerOrder = (CustomerOrder) value; break; + + case "file_name": this.fileName = (value == null ? null : ((String)value).trim()); break; + + case "content_type": this.contentType = (value == null ? null : ((String)value).trim()); break; + + case "content_length": this.contentLength = (Integer) value; break; + + case "content_sha256": this.contentSha256 = (value == null ? null : ((String)value).trim()); break; + + case "object_key": this.objectKey = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "customer_order": return this.customerOrder; + case "file_name": return this.fileName; + case "content_type": return this.contentType; + case "content_length": return this.contentLength; + case "content_sha256": return this.contentSha256; + case "object_key": return this.objectKey; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "customerOrder": return this.customerOrder; + case "fileName": return this.fileName; + case "contentType": return this.contentType; + case "contentLength": return this.contentLength; + case "contentSha256": return this.contentSha256; + case "objectKey": return this.objectKey; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java new file mode 100644 index 000000000..48b076160 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java @@ -0,0 +1,105 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class OrderAttachmentChecker implements Checker{ + + public String type(){ + return OrderAttachment.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderAttachment orderAttachment, ObjectLocation _parentLocation){ + if(needCheck(_context, orderAttachment)){ + markAsChecked(_context, orderAttachment); + doCheck(_context, orderAttachment, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderAttachment orderAttachment, ObjectLocation _parentLocation){ + if((orderAttachment == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderAttachment); + if(orderAttachment.needPersist()){ + } + if(orderAttachment.newItem()){ + }else if(orderAttachment.updateItem()){ + if(!orderAttachment.isPropertyLoaded("customer_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("file_name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "file_name"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("content_type")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "content_type"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("content_length")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "content_length"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("content_sha256")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "content_sha256"), "Mutation requires a fully loaded entity"); + } + if(!orderAttachment.isPropertyLoaded("object_key")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "object_key"), "Mutation requires a fully loaded entity"); + } + + } + checkCustomerOrder(_context, orderAttachment.getProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); + checkFileName(_context, orderAttachment.getProperty(OrderAttachment.FILE_NAME_PROPERTY), newLocation(_parentLocation, "file_name")); + checkContentType(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_TYPE_PROPERTY), newLocation(_parentLocation, "content_type")); + checkContentLength(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY), newLocation(_parentLocation, "content_length")); + checkContentSha256(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_SHA256_PROPERTY), newLocation(_parentLocation, "content_sha256")); + checkObjectKey(_context, orderAttachment.getProperty(OrderAttachment.OBJECT_KEY_PROPERTY), newLocation(_parentLocation, "object_key")); + } + + public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerOrder); + if((customerOrder == null)){ + return; + } + new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); + } + public void checkFileName(UserContext _context, String fileName, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, fileName); + if((fileName == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, fileName); + + } + public void checkContentType(UserContext _context, String contentType, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contentType); + if((contentType == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, contentType); + + } + public void checkContentLength(UserContext _context, Integer contentLength, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contentLength); + if((contentLength == null)){ + return; + } + } + public void checkContentSha256(UserContext _context, String contentSha256, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, contentSha256); + if((contentSha256 == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, contentSha256); + + } + public void checkObjectKey(UserContext _context, String objectKey, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, objectKey); + if((objectKey == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, objectKey); + + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java new file mode 100644 index 000000000..8ae231192 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java @@ -0,0 +1,81 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class OrderAttachmentExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderAttachmentExpression(Expression expression){ + super(expression); + } + + public OrderAttachmentExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderAttachmentExpression updateId(Long id){ + return new OrderAttachmentExpression(this, $it -> {((OrderAttachment)$it).__internalSet("id", id); return this;}); + } + + public OrderAttachmentExpression save(UserContext userContext){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderAttachmentExpression save(String intent, UserContext userContext){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public CustomerOrderExpression getCustomerOrder(){ + return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderAttachment::getCustomerOrder)); + } + + public OrderAttachmentExpression updateCustomerOrder(CustomerOrder customerOrder){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateCustomerOrder(customerOrder)); + } + + public Expression getFileName(){ + return loaded("file_name", "getFileName", OrderAttachment::getFileName); + } + public OrderAttachmentExpression updateFileName(String fileName){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateFileName(fileName)); + } + + public Expression getContentType(){ + return loaded("content_type", "getContentType", OrderAttachment::getContentType); + } + public OrderAttachmentExpression updateContentType(String contentType){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentType(contentType)); + } + + public Expression getContentLength(){ + return loaded("content_length", "getContentLength", OrderAttachment::getContentLength); + } + public OrderAttachmentExpression updateContentLength(Integer contentLength){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentLength(contentLength)); + } + + public Expression getContentSha256(){ + return loaded("content_sha256", "getContentSha256", OrderAttachment::getContentSha256); + } + public OrderAttachmentExpression updateContentSha256(String contentSha256){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentSha256(contentSha256)); + } + + public Expression getObjectKey(){ + return loaded("object_key", "getObjectKey", OrderAttachment::getObjectKey); + } + public OrderAttachmentExpression updateObjectKey(String objectKey){ + return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateObjectKey(objectKey)); + } + +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java new file mode 100644 index 000000000..bcdb7e29e --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderAttachmentListExpression extends SmartListExpression { + public OrderAttachmentListExpression(Expression> expression){ + super(expression); + } + + public OrderAttachmentListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderAttachmentExpression first() { + return new OrderAttachmentExpression(super.first()); + } + + public OrderAttachmentExpression get(int index) { + return new OrderAttachmentExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java new file mode 100644 index 000000000..ebb47f9cf --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java @@ -0,0 +1,1315 @@ + +package com.teaql.orderattachmentservice.orderattachment; + +import com.teaql.orderattachmentservice.Q; +import com.teaql.orderattachmentservice.customerorder.CustomerOrder; +import com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class OrderAttachmentRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderAttachmentRequest(Class returnType){ + this(returnType, () -> (T) new OrderAttachment()); + } + + protected OrderAttachmentRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderAttachmentRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderAttachmentRequest copy(){ + return (OrderAttachmentRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderAttachmentRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderAttachmentRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderAttachmentRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderAttachmentRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderAttachmentRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderAttachmentRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderAttachmentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderAttachmentRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderAttachmentRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderAttachmentRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderAttachmentRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderAttachmentRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderAttachmentRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderAttachmentRequest matchingAnyOf(OrderAttachmentRequest orderAttachment){ + super.internalMatchAny(orderAttachment); + return this; + } + + public OrderAttachmentRequest matchingIdsOf(OrderAttachmentRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderAttachment.ID_PROPERTY, request, OrderAttachment.ID_PROPERTY)); + } + + public OrderAttachmentRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderAttachmentRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderAttachmentRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderAttachmentRequest selectSelf(){ + super.selectSelf(); + return selectId().selectCustomerOrderIdOnly().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); + } + + public OrderAttachmentRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderAttachmentRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderAttachment.ID_PROPERTY); + selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + selectProperty(OrderAttachment.FILE_NAME_PROPERTY); + selectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); + selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); + selectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); + selectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); + selectProperty(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest selectAll(){ + super.selectAll(); + return selectId().selectCustomerOrder().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); + } + + public OrderAttachmentRequest selectChildren(){ + super.selectAny(); + return selectId().selectCustomerOrder().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); + } + + + public OrderAttachmentRequest selectId(){ + selectProperty(OrderAttachment.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectId(){ + unselectProperty(OrderAttachment.ID_PROPERTY); + return this; + } + public OrderAttachmentRequest selectCustomerOrderIdOnly(){ + selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest selectCustomerOrder(){ + return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); + } + + public OrderAttachmentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ + selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + enhanceRelation(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + public OrderAttachmentRequest unselectCustomerOrder(){ + unselectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderAttachmentRequest selectFileName(){ + selectProperty(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + /** + * fill the fileName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS fileName) to fetch fileName property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectFileName(){ + unselectProperty(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest selectContentType(){ + selectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + /** + * fill the contentType with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentType) to fetch contentType property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectContentType(){ + unselectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest selectContentLength(){ + selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + /** + * fill the contentLength with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentLength) to fetch contentLength property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the contentLength with customized aggrFunction, TEAQL uses ({aggrFunction}(contentLength) AS contentLength to fetch contentLength property. + * @param aggrFunction aggrFunction + */ + public OrderAttachmentRequest selectContentLength(AggrFunction aggrFunction){ + selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY, aggrFunction); + return this; + } + + + public OrderAttachmentRequest unselectContentLength(){ + unselectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest selectContentSha256(){ + selectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + /** + * fill the contentSha256 with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentSha256) to fetch contentSha256 property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectContentSha256(){ + unselectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest selectObjectKey(){ + selectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + /** + * fill the objectKey with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS objectKey) to fetch objectKey property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectObjectKey(){ + unselectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest selectVersion(){ + selectProperty(OrderAttachment.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderAttachmentRequest unselectVersion(){ + unselectProperty(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.ID_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderAttachmentRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderAttachmentRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderAttachmentRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderAttachmentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ + if (customerOrder == null || customerOrder.length == 0) { + throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); + } + return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); + } + + public OrderAttachmentRequest withCustomerOrder(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); + } + + public OrderAttachmentRequest withCustomerOrderIsUnknown(){ + return withCustomerOrder(Operator.IS_NULL); + } + + public OrderAttachmentRequest withCustomerOrderIsKnown(){ + return withCustomerOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, operator, values); + } + + public OrderAttachmentRequest filterByCustomerOrder(Long customerOrder){ + if(customerOrder == null){ + return this; + } + return withCustomerOrder(Operator.EQUAL, customerOrder); + } + public OrderAttachmentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); + } + + public OrderAttachmentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); + } + + public OrderAttachmentRequest filterByFileName(String... fileName){ + if (fileName == null || fileName.length == 0) { + throw new IllegalArgumentException("filterByFileName parameter fileName cannot be empty"); + } + return appendSearchCriteria(createFileNameCriteria(Operator.EQUAL, (Object[])fileName)); + } + + public OrderAttachmentRequest withFileName(Operator operator, Object... values){ + return appendSearchCriteria(createFileNameCriteria(operator, values)); + } + + public OrderAttachmentRequest withFileNameIsUnknown(){ + return withFileName(Operator.IS_NULL); + } + + public OrderAttachmentRequest withFileNameIsKnown(){ + return withFileName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createFileNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.FILE_NAME_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withFileNameIsNot(String fileName){ + return withFileName(Operator.NOT_EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameIn(String... fileName){ + return withFileName(Operator.IN, (Object[])fileName); + } + + public OrderAttachmentRequest withFileNameNotIn(String... fileName){ + return withFileName(Operator.NOT_IN, (Object[])fileName); + } + public OrderAttachmentRequest withFileNameGreaterThan(String fileName){ + return withFileName(Operator.GREATER_THAN, fileName); + } + + public OrderAttachmentRequest withFileNameGreaterThanOrEqualTo(String fileName){ + return withFileName(Operator.GREATER_THAN_OR_EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameLessThan(String fileName){ + return withFileName(Operator.LESS_THAN, fileName); + } + + public OrderAttachmentRequest withFileNameLessThanOrEqualTo(String fileName){ + return withFileName(Operator.LESS_THAN_OR_EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameBetween(String startOfFileName, String endOfFileName){ + return withFileName(Operator.BETWEEN, startOfFileName, endOfFileName); + } + public OrderAttachmentRequest withFileNameStartingWith(String fileName){ + return withFileName(Operator.BEGIN_WITH, fileName); + } + public OrderAttachmentRequest withFileNameContaining(String fileName){ + return withFileName(Operator.CONTAIN, fileName); + } + + public OrderAttachmentRequest withFileNameNotContaining(String fileName){ + return withFileName(Operator.NOT_CONTAIN, fileName); + } + + public OrderAttachmentRequest withFileNameNotStartingWith(String fileName){ + return withFileName(Operator.NOT_BEGIN_WITH, fileName); + } + + public OrderAttachmentRequest withFileNameEndingWith(String fileName){ + return withFileName(Operator.END_WITH, fileName); + } + + public OrderAttachmentRequest withFileNameNotEndingWith(String fileName){ + return withFileName(Operator.NOT_END_WITH, fileName); + } + + public OrderAttachmentRequest withFileNameIs(String fileName){ + return withFileName(Operator.EQUAL, fileName); + } + + public OrderAttachmentRequest withFileNameSoundingLike(String fileName){ + return withFileName(Operator.SOUNDS_LIKE, fileName); + } + + + + public OrderAttachmentRequest filterByContentType(String... contentType){ + if (contentType == null || contentType.length == 0) { + throw new IllegalArgumentException("filterByContentType parameter contentType cannot be empty"); + } + return appendSearchCriteria(createContentTypeCriteria(Operator.EQUAL, (Object[])contentType)); + } + + public OrderAttachmentRequest withContentType(Operator operator, Object... values){ + return appendSearchCriteria(createContentTypeCriteria(operator, values)); + } + + public OrderAttachmentRequest withContentTypeIsUnknown(){ + return withContentType(Operator.IS_NULL); + } + + public OrderAttachmentRequest withContentTypeIsKnown(){ + return withContentType(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContentTypeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CONTENT_TYPE_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withContentTypeIsNot(String contentType){ + return withContentType(Operator.NOT_EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeIn(String... contentType){ + return withContentType(Operator.IN, (Object[])contentType); + } + + public OrderAttachmentRequest withContentTypeNotIn(String... contentType){ + return withContentType(Operator.NOT_IN, (Object[])contentType); + } + public OrderAttachmentRequest withContentTypeGreaterThan(String contentType){ + return withContentType(Operator.GREATER_THAN, contentType); + } + + public OrderAttachmentRequest withContentTypeGreaterThanOrEqualTo(String contentType){ + return withContentType(Operator.GREATER_THAN_OR_EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeLessThan(String contentType){ + return withContentType(Operator.LESS_THAN, contentType); + } + + public OrderAttachmentRequest withContentTypeLessThanOrEqualTo(String contentType){ + return withContentType(Operator.LESS_THAN_OR_EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeBetween(String startOfContentType, String endOfContentType){ + return withContentType(Operator.BETWEEN, startOfContentType, endOfContentType); + } + public OrderAttachmentRequest withContentTypeStartingWith(String contentType){ + return withContentType(Operator.BEGIN_WITH, contentType); + } + public OrderAttachmentRequest withContentTypeContaining(String contentType){ + return withContentType(Operator.CONTAIN, contentType); + } + + public OrderAttachmentRequest withContentTypeNotContaining(String contentType){ + return withContentType(Operator.NOT_CONTAIN, contentType); + } + + public OrderAttachmentRequest withContentTypeNotStartingWith(String contentType){ + return withContentType(Operator.NOT_BEGIN_WITH, contentType); + } + + public OrderAttachmentRequest withContentTypeEndingWith(String contentType){ + return withContentType(Operator.END_WITH, contentType); + } + + public OrderAttachmentRequest withContentTypeNotEndingWith(String contentType){ + return withContentType(Operator.NOT_END_WITH, contentType); + } + + public OrderAttachmentRequest withContentTypeIs(String contentType){ + return withContentType(Operator.EQUAL, contentType); + } + + public OrderAttachmentRequest withContentTypeSoundingLike(String contentType){ + return withContentType(Operator.SOUNDS_LIKE, contentType); + } + + + + public OrderAttachmentRequest filterByContentLength(Integer... contentLength){ + if (contentLength == null || contentLength.length == 0) { + throw new IllegalArgumentException("filterByContentLength parameter contentLength cannot be empty"); + } + return appendSearchCriteria(createContentLengthCriteria(Operator.EQUAL, (Object[])contentLength)); + } + + public OrderAttachmentRequest withContentLength(Operator operator, Object... values){ + return appendSearchCriteria(createContentLengthCriteria(operator, values)); + } + + public OrderAttachmentRequest withContentLengthIsUnknown(){ + return withContentLength(Operator.IS_NULL); + } + + public OrderAttachmentRequest withContentLengthIsKnown(){ + return withContentLength(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContentLengthCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CONTENT_LENGTH_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withContentLengthIs(Integer contentLength){ + return withContentLength(Operator.EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthIsNot(Integer contentLength){ + return withContentLength(Operator.NOT_EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthIn(Integer... contentLength){ + return withContentLength(Operator.IN, (Object[])contentLength); + } + + public OrderAttachmentRequest withContentLengthNotIn(Integer... contentLength){ + return withContentLength(Operator.NOT_IN, (Object[])contentLength); + } + public OrderAttachmentRequest withContentLengthGreaterThan(Integer contentLength){ + return withContentLength(Operator.GREATER_THAN, contentLength); + } + + public OrderAttachmentRequest withContentLengthGreaterThanOrEqualTo(Integer contentLength){ + return withContentLength(Operator.GREATER_THAN_OR_EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthLessThan(Integer contentLength){ + return withContentLength(Operator.LESS_THAN, contentLength); + } + + public OrderAttachmentRequest withContentLengthLessThanOrEqualTo(Integer contentLength){ + return withContentLength(Operator.LESS_THAN_OR_EQUAL, contentLength); + } + + public OrderAttachmentRequest withContentLengthBetween(Integer startOfContentLength, Integer endOfContentLength){ + return withContentLength(Operator.BETWEEN, startOfContentLength, endOfContentLength); + } + + + + public OrderAttachmentRequest filterByContentSha256(String... contentSha256){ + if (contentSha256 == null || contentSha256.length == 0) { + throw new IllegalArgumentException("filterByContentSha256 parameter contentSha256 cannot be empty"); + } + return appendSearchCriteria(createContentSha256Criteria(Operator.EQUAL, (Object[])contentSha256)); + } + + public OrderAttachmentRequest withContentSha256(Operator operator, Object... values){ + return appendSearchCriteria(createContentSha256Criteria(operator, values)); + } + + public OrderAttachmentRequest withContentSha256IsUnknown(){ + return withContentSha256(Operator.IS_NULL); + } + + public OrderAttachmentRequest withContentSha256IsKnown(){ + return withContentSha256(Operator.IS_NOT_NULL); + } + + public SearchCriteria createContentSha256Criteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.CONTENT_SHA256_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withContentSha256IsNot(String contentSha256){ + return withContentSha256(Operator.NOT_EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256In(String... contentSha256){ + return withContentSha256(Operator.IN, (Object[])contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotIn(String... contentSha256){ + return withContentSha256(Operator.NOT_IN, (Object[])contentSha256); + } + public OrderAttachmentRequest withContentSha256GreaterThan(String contentSha256){ + return withContentSha256(Operator.GREATER_THAN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256GreaterThanOrEqualTo(String contentSha256){ + return withContentSha256(Operator.GREATER_THAN_OR_EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256LessThan(String contentSha256){ + return withContentSha256(Operator.LESS_THAN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256LessThanOrEqualTo(String contentSha256){ + return withContentSha256(Operator.LESS_THAN_OR_EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256Between(String startOfContentSha256, String endOfContentSha256){ + return withContentSha256(Operator.BETWEEN, startOfContentSha256, endOfContentSha256); + } + public OrderAttachmentRequest withContentSha256StartingWith(String contentSha256){ + return withContentSha256(Operator.BEGIN_WITH, contentSha256); + } + public OrderAttachmentRequest withContentSha256Containing(String contentSha256){ + return withContentSha256(Operator.CONTAIN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotContaining(String contentSha256){ + return withContentSha256(Operator.NOT_CONTAIN, contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotStartingWith(String contentSha256){ + return withContentSha256(Operator.NOT_BEGIN_WITH, contentSha256); + } + + public OrderAttachmentRequest withContentSha256EndingWith(String contentSha256){ + return withContentSha256(Operator.END_WITH, contentSha256); + } + + public OrderAttachmentRequest withContentSha256NotEndingWith(String contentSha256){ + return withContentSha256(Operator.NOT_END_WITH, contentSha256); + } + + public OrderAttachmentRequest withContentSha256Is(String contentSha256){ + return withContentSha256(Operator.EQUAL, contentSha256); + } + + public OrderAttachmentRequest withContentSha256SoundingLike(String contentSha256){ + return withContentSha256(Operator.SOUNDS_LIKE, contentSha256); + } + + + + public OrderAttachmentRequest filterByObjectKey(String... objectKey){ + if (objectKey == null || objectKey.length == 0) { + throw new IllegalArgumentException("filterByObjectKey parameter objectKey cannot be empty"); + } + return appendSearchCriteria(createObjectKeyCriteria(Operator.EQUAL, (Object[])objectKey)); + } + + public OrderAttachmentRequest withObjectKey(Operator operator, Object... values){ + return appendSearchCriteria(createObjectKeyCriteria(operator, values)); + } + + public OrderAttachmentRequest withObjectKeyIsUnknown(){ + return withObjectKey(Operator.IS_NULL); + } + + public OrderAttachmentRequest withObjectKeyIsKnown(){ + return withObjectKey(Operator.IS_NOT_NULL); + } + + public SearchCriteria createObjectKeyCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.OBJECT_KEY_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withObjectKeyIsNot(String objectKey){ + return withObjectKey(Operator.NOT_EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeyIn(String... objectKey){ + return withObjectKey(Operator.IN, (Object[])objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotIn(String... objectKey){ + return withObjectKey(Operator.NOT_IN, (Object[])objectKey); + } + public OrderAttachmentRequest withObjectKeyGreaterThan(String objectKey){ + return withObjectKey(Operator.GREATER_THAN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyGreaterThanOrEqualTo(String objectKey){ + return withObjectKey(Operator.GREATER_THAN_OR_EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeyLessThan(String objectKey){ + return withObjectKey(Operator.LESS_THAN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyLessThanOrEqualTo(String objectKey){ + return withObjectKey(Operator.LESS_THAN_OR_EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeyBetween(String startOfObjectKey, String endOfObjectKey){ + return withObjectKey(Operator.BETWEEN, startOfObjectKey, endOfObjectKey); + } + public OrderAttachmentRequest withObjectKeyStartingWith(String objectKey){ + return withObjectKey(Operator.BEGIN_WITH, objectKey); + } + public OrderAttachmentRequest withObjectKeyContaining(String objectKey){ + return withObjectKey(Operator.CONTAIN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotContaining(String objectKey){ + return withObjectKey(Operator.NOT_CONTAIN, objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotStartingWith(String objectKey){ + return withObjectKey(Operator.NOT_BEGIN_WITH, objectKey); + } + + public OrderAttachmentRequest withObjectKeyEndingWith(String objectKey){ + return withObjectKey(Operator.END_WITH, objectKey); + } + + public OrderAttachmentRequest withObjectKeyNotEndingWith(String objectKey){ + return withObjectKey(Operator.NOT_END_WITH, objectKey); + } + + public OrderAttachmentRequest withObjectKeyIs(String objectKey){ + return withObjectKey(Operator.EQUAL, objectKey); + } + + public OrderAttachmentRequest withObjectKeySoundingLike(String objectKey){ + return withObjectKey(Operator.SOUNDS_LIKE, objectKey); + } + + + + public OrderAttachmentRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderAttachmentRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderAttachmentRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderAttachmentRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderAttachment.VERSION_PROPERTY, operator, values); + } + + public OrderAttachmentRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderAttachmentRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderAttachmentRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderAttachmentRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderAttachmentRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderAttachmentRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderAttachmentRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderAttachmentRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderAttachmentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderAttachmentRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderAttachmentRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderAttachmentRequest minContentLength(){ + return minContentLengthAs(prefix("minOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest minContentLengthAs(String retName){ + super.min(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest maxContentLength(){ + return maxContentLengthAs(prefix("maxOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest maxContentLengthAs(String retName){ + super.max(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest sumContentLength(){ + return sumContentLengthAs(prefix("sumOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest sumContentLengthAs(String retName){ + super.sum(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest avgContentLength(){ + return avgContentLengthAs(prefix("avgOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest avgContentLengthAs(String retName){ + super.avg(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest standardDeviationContentLength(){ + return standardDeviationContentLengthAs(prefix("standardDeviationOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest standardDeviationContentLengthAs(String retName){ + super.standardDeviation(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest squareRootOfPopulationStandardDeviationContentLength(){ + return squareRootOfPopulationStandardDeviationContentLengthAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest squareRootOfPopulationStandardDeviationContentLengthAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest sampleVarianceContentLength(){ + return sampleVarianceContentLengthAs(prefix("sampleVarianceOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest sampleVarianceContentLengthAs(String retName){ + super.sampleVariance(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest samplePopulationVarianceContentLength(){ + return samplePopulationVarianceContentLengthAs(prefix("samplePopulationVarianceOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); + } + + public OrderAttachmentRequest samplePopulationVarianceContentLengthAs(String retName){ + super.samplePopulationVariance(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest groupByCustomerOrderWithDetails(){ + return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); + } + + public OrderAttachmentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ + aggregate(OrderAttachment.CUSTOMER_ORDER_PROPERTY, subRequest); + return this; + } + + + + + + + + public OrderAttachmentRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderAttachmentRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.ID_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctCustomerOrder(){ + return countDistinctCustomerOrderAs("customer_order_distinct_count"); + } + + public OrderAttachmentRequest countDistinctCustomerOrderAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctFileName(){ + return countDistinctFileNameAs("file_name_distinct_count"); + } + + public OrderAttachmentRequest countDistinctFileNameAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctContentType(){ + return countDistinctContentTypeAs("content_type_distinct_count"); + } + + public OrderAttachmentRequest countDistinctContentTypeAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctContentLength(){ + return countDistinctContentLengthAs("content_length_distinct_count"); + } + + public OrderAttachmentRequest countDistinctContentLengthAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctContentSha256(){ + return countDistinctContentSha256As("content_sha256_distinct_count"); + } + + public OrderAttachmentRequest countDistinctContentSha256As(String alias){ + super.countDistinctProperty(alias, OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctObjectKey(){ + return countDistinctObjectKeyAs("object_key_distinct_count"); + } + + public OrderAttachmentRequest countDistinctObjectKeyAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderAttachmentRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupById(){ + groupBy(OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByIdAs(String retName){ + groupBy(retName, OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.ID_PROPERTY, function); + return this; + } + public OrderAttachmentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ + groupBy(OrderAttachment.CUSTOMER_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); + return this; + } + public OrderAttachmentRequest groupByCustomerOrder(){ + groupBy(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByCustomerOrderAs(String retName){ + groupBy(retName, OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CUSTOMER_ORDER_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByFileName(){ + groupBy(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByFileNameAs(String retName){ + groupBy(retName, OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByFileNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.FILE_NAME_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByContentType(){ + groupBy(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentTypeAs(String retName){ + groupBy(retName, OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentTypeWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CONTENT_TYPE_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByContentLength(){ + groupBy(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentLengthAs(String retName){ + groupBy(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentLengthWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByContentSha256(){ + groupBy(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentSha256As(String retName){ + groupBy(retName, OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByContentSha256WithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.CONTENT_SHA256_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByObjectKey(){ + groupBy(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByObjectKeyAs(String retName){ + groupBy(retName, OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByObjectKeyWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.OBJECT_KEY_PROPERTY, function); + return this; + } + + public OrderAttachmentRequest groupByVersion(){ + groupBy(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByVersionAs(String retName){ + groupBy(retName, OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderAttachment.VERSION_PROPERTY, function); + return this; + } + + + + public OrderAttachmentRequest orderByIdAscending(){ + addOrderByAscending(OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByIdDescending(){ + addOrderByDescending(OrderAttachment.ID_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByCustomerOrderAscending(){ + addOrderByAscending(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByCustomerOrderDescending(){ + addOrderByDescending(OrderAttachment.CUSTOMER_ORDER_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByFileNameAscending(){ + addOrderByAscending(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByFileNameDescending(){ + addOrderByDescending(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByFileNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByFileNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.FILE_NAME_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentTypeAscending(){ + addOrderByAscending(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentTypeDescending(){ + addOrderByDescending(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentTypeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentTypeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.CONTENT_TYPE_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentLengthAscending(){ + addOrderByAscending(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentLengthDescending(){ + addOrderByDescending(OrderAttachment.CONTENT_LENGTH_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentSha256Ascending(){ + addOrderByAscending(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentSha256Descending(){ + addOrderByDescending(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByContentSha256AscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByContentSha256DescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.CONTENT_SHA256_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByObjectKeyAscending(){ + addOrderByAscending(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByObjectKeyDescending(){ + addOrderByDescending(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByObjectKeyAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByObjectKeyDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderAttachment.OBJECT_KEY_PROPERTY); + return this; + } + public OrderAttachmentRequest orderByVersionAscending(){ + addOrderByAscending(OrderAttachment.VERSION_PROPERTY); + return this; + } + + public OrderAttachmentRequest orderByVersionDescending(){ + addOrderByDescending(OrderAttachment.VERSION_PROPERTY); + return this; + } + + + public CustomerOrderRequest rollUpToCustomerOrder(){ + CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); + this.internalRollUpTo("customer_order", customerOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); + return customerOrder; + } + + + + + + + + + public OrderAttachmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ + return facetByCustomerOrderAs(facetName, customerOrder, true); + } + + public OrderAttachmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ + addFacet(facetName, OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderAttachmentRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderAttachmentRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderAttachmentRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderAttachmentRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderAttachmentRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderAttachmentRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java b/examples/object-storage/java-lib-core/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/object-storage/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/object-storage/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..09a7e0e70 --- /dev/null +++ b/examples/object-storage/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.orderattachmentservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/teaql/checker-model.json b/examples/object-storage/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..8e70b24cf --- /dev/null +++ b/examples/object-storage/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:f6fb4b9ca6d876325850fdce5a0d2ab5c57f19c74af6bbffb2b494779e9c27b9","entities":{"CommercePlatform":{"labels":{"en":"commerce platform"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerOrder":{"labels":{"en":"customer order"},"fields":[{"name":"commerce_platform","targetType":"CommercePlatform","labels":{"en":"commerce platform"},"aliases":["CommercePlatform","commercePlatform"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"order_attachment_list","targetType":"OrderAttachment","labels":{"en":"order attachment"},"aliases":["OrderAttachmentList","orderAttachmentList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderAttachment":{"labels":{"en":"order attachment"},"fields":[{"name":"content_length","labels":{"en":"content length"},"aliases":["ContentLength","contentLength"]},{"name":"content_sha256","labels":{"en":"content sha256"},"aliases":["ContentSha256","contentSha256"]},{"name":"content_type","labels":{"en":"content type"},"aliases":["ContentType","contentType"]},{"name":"customer_order","targetType":"CustomerOrder","labels":{"en":"customer order"},"aliases":["CustomerOrder","customerOrder"]},{"name":"file_name","labels":{"en":"file name"},"aliases":["FileName","fileName"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"object_key","labels":{"en":"object key"},"aliases":["ObjectKey","objectKey"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/object-storage/java-lib-core/teaql/model-provenance.json b/examples/object-storage/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..06554042f --- /dev/null +++ b/examples/object-storage/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:08f94683ccf143a5f5b1e9d39d647b338b410f1ebf18918b9832ca7a75ebbc12","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/object-storage/model.xml b/examples/object-storage/model.xml new file mode 100644 index 000000000..b318a5bea --- /dev/null +++ b/examples/object-storage/model.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/examples/object-storage/showcase.json b/examples/object-storage/showcase.json new file mode 100644 index 000000000..472cd0e39 --- /dev/null +++ b/examples/object-storage/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/object-storage", + "library": { + "generatedFilesManifestSHA256": "a9250638eaf44bfdbe5e919b85df3e5b7fd3bdff22884cd1bd06e732868adae3", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "1e35ffb88509f292b75620d82996bbc50868c61fd34716f8be010dff7280eafc" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-attachment-generation/receipt.json", + "receiptSHA256": "715bd8f8f61f6ecd96611db1121cb54ce40d72f533b23289c5919e92de0cd95e" + }, + "scene": "Store and retrieve an order receipt through a trusted provider", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/object-storage/verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/main/java/com/teaql/orderattachmentservice/App.java" + ], + "generatedFilesManifestSHA256": "9b50d62f8a83f6cd23192b8ea0e03758ad109fb6a1692ef2ab090bc1ce278b9f", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/object-storage/verify.sh b/examples/object-storage/verify.sh index 8290ad8bc..4c3dadb0e 100644 --- a/examples/object-storage/verify.sh +++ b/examples/object-storage/verify.sh @@ -1,11 +1,45 @@ #!/usr/bin/env bash set -euo pipefail -repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" : "${TEAQL_S3_ENDPOINT:?dedicated local test endpoint required}" : "${TEAQL_S3_BUCKET:?dedicated test bucket required}" : "${TEAQL_S3_ACCESS_KEY:?test access key required}" : "${TEAQL_S3_SECRET_KEY:?test secret key required}" +: "${TEAQL_MAVEN_DEPENDENCY_CACHE:?Use the documented isolated Maven qualifier}" +if [[ -n "${TEAQL_ORDER_ATTACHMENT_EVIDENCE_DIR:-}" ]]; then + evidence="$TEAQL_ORDER_ATTACHMENT_EVIDENCE_DIR" + mkdir -p "$(dirname "$evidence")" + mkdir "$evidence" +else + evidence="$(mktemp -d -t teaql-java-order-attachment.XXXXXXXX)" +fi +evidence="$(cd "$evidence" && pwd)" +scratch="$(mktemp -d -t teaql-java-order-attachment-build.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +trap 'exit 130' INT +trap 'exit 143' TERM +fingerprint() { + (cd "$example" && find workspace-pom.xml java-lib-core java-app-console -type f -not -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) +} +fingerprint > "$evidence/source-before.sha256" cd "$repo" -mvn -B -pl examples/object-storage -am -Dteaql.s3.live=true -Dteaql.s3.iterations="${TEAQL_S3_ITERATIONS:-1}" \ +mvn -o -B -pl examples/object-storage,teaql-sqlite,teaql-provider-jdbc -am -Dteaql.s3.live=true \ + -Dteaql.s3.iterations="${TEAQL_S3_ITERATIONS:-1}" \ -Dtest=ObjectStorageExampleTest,ObjectStorageContractTest,S3ObjectStorageTest \ - -Dsurefire.failIfNoSpecifiedTests=false test + -Dsurefire.failIfNoSpecifiedTests=false install 2>&1 | tee "$evidence/s3-calibration.log" +cp "$example/workspace-pom.xml" "$scratch/pom.xml" +cp -R "$example/java-lib-core" "$example/java-app-console" "$scratch/" +mvn -o -f "$scratch/pom.xml" -DskipTests install > "$evidence/workspace-build.log" 2>&1 +jar="$scratch/java-lib-core/lib/target/order-attachment-service-core-0.0.1-SNAPSHOT.jar" +installed="$TEAQL_MAVEN_DEPENDENCY_CACHE/com/teaql/order-attachment-service-core/0.0.1-SNAPSHOT/${jar##*/}" +cmp "$jar" "$installed" +sha256sum "$installed" > "$evidence/domain-artifact.sha256" +for round in 1 2; do + TEAQL_ATTACHMENT_DB="$evidence/orders.sqlite" TEAQL_ATTACHMENT_DOWNLOAD="$evidence/receipt-$round.txt" TEAQL_ATTACHMENT_ROUND="$round" \ + mvn -o -f "$scratch/pom.xml" -pl java-app-console exec:java 2>&1 | tee "$evidence/run-$round.log" +done +rg '^(ATTACHMENT_ORIGIN|S3_PROVIDER_ORIGIN) ' "$evidence/run-1.log" > "$evidence/origins.log" +fingerprint > "$evidence/source-after.sha256" +cmp "$evidence/source-before.sha256" "$evidence/source-after.sha256" +printf 'Order attachment evidence retained at %s\n' "$evidence" diff --git a/examples/object-storage/workspace-pom.xml b/examples/object-storage/workspace-pom.xml new file mode 100644 index 000000000..00fe897ff --- /dev/null +++ b/examples/object-storage/workspace-pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + com.teaql.examples + order-attachment-workspace + 1.0.0 + pom + + java-lib-core/lib + java-app-console + + From 95c097603a716b8888df2b60fad0b7846291c132 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:34:28 +0800 Subject: [PATCH 44/71] Use the source S3 provider namespace in the Java order workspace --- .../src/main/java/com/teaql/orderattachmentservice/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java index 1bf17cc71..cefb1eae4 100644 --- a/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java +++ b/examples/object-storage/java-app-console/src/main/java/com/teaql/orderattachmentservice/App.java @@ -15,7 +15,7 @@ import io.teaql.core.storage.ObjectStorageObserver; import io.teaql.core.storage.ObjectStorageProvider; import io.teaql.core.storage.StorageException; -import io.teaql.objectstorage.s3.S3ObjectStorage; +import io.teaql.storage.s3.S3ObjectStorage; import io.teaql.provider.jdbc.JdbcSqlExecutor; import io.teaql.runtime.AppAuditEventSink; import io.teaql.runtime.SafeAuditEvent; From efd0e02feff32f775f0ef0d31c802fae3deb923d Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:37:39 +0800 Subject: [PATCH 45/71] Record focused java examples/object-storage business qualification --- examples/object-storage/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/object-storage/showcase.json b/examples/object-storage/showcase.json index 472cd0e39..57ad45751 100644 --- a/examples/object-storage/showcase.json +++ b/examples/object-storage/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-attachment-generation/receipt.json", "receiptSHA256": "715bd8f8f61f6ecd96611db1121cb54ce40d72f533b23289c5919e92de0cd95e" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-order-attachment-native/runtime/object-storage/receipt.json", + "businessReceiptSHA256": "4b04ef3ceb8cce64a18e0cfb820815b4e0c357fc570ab64ff511834f38514fe9", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-order-attachment-native/receipt.json", + "nativeReceiptSHA256": "4496c243fc3ca8a532ce08fdc9583be683bfb8c6f71aebf3454bc8e8b8dce0e9", + "remainingFullRuntimeInventory": true, + "sourceCommit": "95c097603a716b8888df2b60fad0b7846291c132" + }, "scene": "Store and retrieve an order receipt through a trusted provider", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/object-storage/verify.sh" From dcee3867ecd6cdca28ca7dde647f8fd01f759778 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:38:08 +0800 Subject: [PATCH 46/71] Document the order receipt workspace and failure checks --- examples/object-storage/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/examples/object-storage/README.md b/examples/object-storage/README.md index 54a0a1dd7..adb1b9f68 100644 --- a/examples/object-storage/README.md +++ b/examples/object-storage/README.md @@ -1,5 +1,26 @@ # Context owned object storage example +## File an order receipt + +`model.xml` defines the commerce platform, order and attachment. The +`java-app-console` consumes the generated domain library and installs the S3 +provider in trusted Context setup. It uploads a receipt, saves its order +association through the generated mutation API, then uses generated Q and E +to recover the reference and verify the downloaded content. + +Run `bash examples/object-storage/verify.sh` with the dedicated test fixture. +The verifier preserves the original S3 tests and runs the business scenario +twice on one SQLite database. A create-only conflict and an undersized read +leave the downloaded content intact. The workspace deletes its own test object +and confirms a fresh read reports missing while the association remains. +Set `TEAQL_ORDER_ATTACHMENT_EVIDENCE_DIR` to retain the fresh logs, database and +downloaded fixture bytes in a chosen directory. + +Run the verifier through the isolated offline Maven source qualifier so the library +and runtime projects resolve from its task-owned local repository. + +## Provider setup + Tracking: [Java #211](https://github.com/teaql/teaql-java/issues/211), [shared contract #122](https://github.com/teaql/teaql-conformance/issues/122). From b4dcf30729c055a940dd0aba367cd68a554a2aab Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:55:31 +0800 Subject: [PATCH 47/71] Run academy inheritance in its model and application workspace --- .../inheritance-save/generated-files.json | 2 +- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 70 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 33 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 164 +++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../inheritancematchingservice/Checkers.java | 0 .../inheritancematchingservice/Constants.java | 0 .../example/inheritancematchingservice/E.java | 0 .../EntityMetaRegistry.java | 0 .../GeneratedRuntimeModule.java | 0 ...InheritanceMatchingServiceUserContext.java | 0 .../example/inheritancematchingservice/Q.java | 0 .../Repositories.java | 0 .../academy/Academy.java | 0 .../academy/AcademyChecker.java | 0 .../academy/AcademyExpression.java | 0 .../academy/AcademyListExpression.java | 0 .../academy/AcademyRequest.java | 0 .../college/College.java | 0 .../college/CollegeChecker.java | 0 .../college/CollegeExpression.java | 0 .../college/CollegeListExpression.java | 0 .../college/CollegeRequest.java | 0 .../platform/Platform.java | 0 .../platform/PlatformChecker.java | 0 .../platform/PlatformExpression.java | 0 .../platform/PlatformListExpression.java | 0 .../platform/PlatformRequest.java | 0 .../sampledata/SampleDataService.java | 0 .../school/School.java | 0 .../school/SchoolChecker.java | 0 .../school/SchoolExpression.java | 0 .../school/SchoolListExpression.java | 0 .../school/SchoolRequest.java | 0 .../schooltype/SchoolType.java | 0 .../schooltype/SchoolTypeChecker.java | 0 .../schooltype/SchoolTypeExpression.java | 0 .../schooltype/SchoolTypeListExpression.java | 0 .../schooltype/SchoolTypeRequest.java | 0 .../trainingacademy/TrainingAcademy.java | 0 .../TrainingAcademyChecker.java | 0 .../TrainingAcademyExpression.java | 0 .../TrainingAcademyListExpression.java | 0 .../TrainingAcademyRequest.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 0 .../{ => java-app-console}/pom.xml | 4 +- .../inheritancematchingservice/App.java | 99 ++ .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../inheritance/GraphRollbackProbe.java | 0 .../InheritanceLifecycleExampleTest.java | 0 .../java-app-console/teaql-i18n.json | 123 ++ .../teaql/checker-model.json | 0 .../teaql/model-provenance.json | 2 +- .../{ => java-lib-core}/lib/pom.xml | 0 .../BaseServiceConfiguration.java | 0 .../inheritancematchingservice/Checkers.java | 0 .../inheritancematchingservice/Constants.java | 13 + .../example/inheritancematchingservice/E.java | 38 + .../EntityMetaRegistry.java | 777 ++++++++++++ .../GeneratedRuntimeModule.java | 74 ++ ...InheritanceMatchingServiceUserContext.java | 10 + .../example/inheritancematchingservice/Q.java | 78 ++ .../Repositories.java | 0 .../academy/Academy.java | 132 +++ .../academy/AcademyChecker.java | 49 + .../academy/AcademyExpression.java | 43 + .../academy/AcademyListExpression.java | 25 + .../academy/AcademyRequest.java | 970 +++++++++++++++ .../college/College.java | 132 +++ .../college/CollegeChecker.java | 49 + .../college/CollegeExpression.java | 43 + .../college/CollegeListExpression.java | 25 + .../college/CollegeRequest.java | 939 +++++++++++++++ .../platform/Platform.java | 173 +++ .../platform/PlatformChecker.java | 70 ++ .../platform/PlatformExpression.java | 66 ++ .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 980 +++++++++++++++ .../sampledata/SampleDataService.java | 0 .../school/School.java | 184 +++ .../school/SchoolChecker.java | 82 ++ .../school/SchoolExpression.java | 73 ++ .../school/SchoolListExpression.java | 25 + .../school/SchoolRequest.java | 1046 ++++++++++++++++ .../schooltype/SchoolType.java | 172 +++ .../schooltype/SchoolTypeChecker.java | 77 ++ .../schooltype/SchoolTypeExpression.java | 68 ++ .../schooltype/SchoolTypeListExpression.java | 25 + .../schooltype/SchoolTypeRequest.java | 1052 +++++++++++++++++ .../trainingacademy/TrainingAcademy.java | 137 +++ .../TrainingAcademyChecker.java | 49 + .../TrainingAcademyExpression.java | 43 + .../TrainingAcademyListExpression.java | 25 + .../TrainingAcademyRequest.java | 1024 ++++++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/inheritance-save/showcase.json | 39 + examples/inheritance-save/verify.cjs | 19 +- 107 files changed, 9731 insertions(+), 12 deletions(-) create mode 100644 examples/inheritance-save/java-app-console/.gitignore create mode 100644 examples/inheritance-save/java-app-console/AGENTS.md create mode 100644 examples/inheritance-save/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/inheritance-save/java-app-console/Makefile create mode 100644 examples/inheritance-save/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/inheritance-save/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/inheritance-save/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/inheritance-save/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/inheritance-save/java-app-console/lib/pom.xml rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/Constants.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/E.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/Q.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/college/College.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/school/School.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java (100%) rename examples/inheritance-save/{ => java-app-console}/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler (100%) rename examples/inheritance-save/{ => java-app-console}/pom.xml (78%) create mode 100644 examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/App.java create mode 100644 examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/CustomUserContext.java create mode 100644 examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/inheritance-save/java-app-console/src/main/resources/application.properties rename examples/inheritance-save/{ => java-app-console}/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java (100%) rename examples/inheritance-save/{ => java-app-console}/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java (100%) create mode 100644 examples/inheritance-save/java-app-console/teaql-i18n.json rename examples/inheritance-save/{ => java-app-console}/teaql/checker-model.json (100%) rename examples/inheritance-save/{ => java-app-console}/teaql/model-provenance.json (82%) rename examples/inheritance-save/{ => java-lib-core}/lib/pom.xml (100%) create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Constants.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/E.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Q.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/College.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/School.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java create mode 100644 examples/inheritance-save/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/inheritance-save/java-lib-core/teaql/checker-model.json create mode 100644 examples/inheritance-save/java-lib-core/teaql/model-provenance.json create mode 100644 examples/inheritance-save/showcase.json diff --git a/examples/inheritance-save/generated-files.json b/examples/inheritance-save/generated-files.json index 537e775cb..fb06e7ad8 100644 --- a/examples/inheritance-save/generated-files.json +++ b/examples/inheritance-save/generated-files.json @@ -42,5 +42,5 @@ "lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java": "8b08986eae115dcb26476f4550b4debe70ce826aaf87baa5cf2796bc3f6a2ac7", "lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler": "b4712d25600d9aa37c887c75b81ae8cc95c291f91c0d8604d5e6dbec21e926e7", "teaql/checker-model.json": "369def38a021b04fca5a8c8d7f68b7f495a0781b816e28b917729217bd6dc242", - "teaql/model-provenance.json": "1390be549b4b3dfb23404f36479839defc69fdf6b1b0bfa44a31d434d0a50e9d" + "teaql/model-provenance.json": "d081d05dee1e0e62b54c7c7750b147c1465cfa9f61fc7a5420f1b1de0f4664a8" } diff --git a/examples/inheritance-save/java-app-console/.gitignore b/examples/inheritance-save/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/inheritance-save/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/AGENTS.md b/examples/inheritance-save/java-app-console/AGENTS.md new file mode 100644 index 000000000..f2715b15e --- /dev/null +++ b/examples/inheritance-save/java-app-console/AGENTS.md @@ -0,0 +1,70 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| school_type | School Type | +| school | School | +| academy | Academy | +| training_academy | Training Academy | +| college | College | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/inheritance-save/java-app-console/DOMAIN_API_GUIDE.md b/examples/inheritance-save/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..81b9c9d25 --- /dev/null +++ b/examples/inheritance-save/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,33 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/inheritance-matching-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | Platform | +| school_type | School Type | +| school | School | +| academy | Academy | +| training_academy | Training Academy | +| college | College | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/Makefile b/examples/inheritance-save/java-app-console/Makefile new file mode 100644 index 000000000..c866d2733 --- /dev/null +++ b/examples/inheritance-save/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/inheritance-matching-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/inheritance-matching-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/inheritance-save/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..6bed0e218 --- /dev/null +++ b/examples/inheritance-save/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/inheritance-matching-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/STANDARD_TELEMETRY.md b/examples/inheritance-save/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/inheritance-save/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/inheritance-save/java-app-console/TOOL_API_GUIDE.md b/examples/inheritance-save/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..b9998618f --- /dev/null +++ b/examples/inheritance-save/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/inheritance-matching-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/inheritance-matching-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/inheritance-matching-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/inheritance-matching-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/inheritance-matching-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/inheritance-matching-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/docs/teaql-java-crud-guide.md b/examples/inheritance-save/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..b1175c9c6 --- /dev/null +++ b/examples/inheritance-save/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,164 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.inheritancematchingservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.inheritancematchingservice.Q; +import com.example.inheritancematchingservice.InheritanceMatchingServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectSchoolTypeListWith(Q.schoolTypes().selectSelf()) + .comment("load with schoolTypeList") + .purpose("fetch child schoolTypeList") + .executeForList(userContext); +``` + +```java +var list = Q.platforms() + .selectSchoolListWith(Q.schools().selectSelf()) + .comment("load with schoolList") + .purpose("fetch child schoolList") + .executeForList(userContext); +``` + +```java +var list = Q.schoolTypes() + .selectPlatformWith(Q.platforms().selectSelf()) + .comment("load with platform") + .purpose("fetch associated platform") + .executeForList(userContext); +``` + + + + +```java +var list = Q.schoolTypes() + .selectSchoolListWith(Q.schools().selectSelf()) + .comment("load with schoolList") + .purpose("fetch child schoolList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `2`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.example.inheritancematchingservice.platform.PlatformRequest` +- `SchoolType`: reverse relations `1`, query `Q.schoolTypes()`, save `new SchoolType().auditAs("comment").save(userContext)`, request `com.example.inheritancematchingservice.schooltype.SchoolTypeRequest` \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/pom.xml b/examples/inheritance-save/java-app-console/lib/pom.xml new file mode 100644 index 000000000..317b64c83 --- /dev/null +++ b/examples/inheritance-save/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + inheritance-matching-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Constants.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Constants.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Constants.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Constants.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/E.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/E.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/E.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/E.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Q.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Q.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Q.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Q.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/College.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/College.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/College.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/College.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/School.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/School.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/School.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/School.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java diff --git a/examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java similarity index 100% rename from examples/inheritance-save/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java rename to examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java diff --git a/examples/inheritance-save/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/inheritance-save/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler similarity index 100% rename from examples/inheritance-save/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler rename to examples/inheritance-save/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/inheritance-save/pom.xml b/examples/inheritance-save/java-app-console/pom.xml similarity index 78% rename from examples/inheritance-save/pom.xml rename to examples/inheritance-save/java-app-console/pom.xml index 88c7c5c1d..bab7d2567 100644 --- a/examples/inheritance-save/pom.xml +++ b/examples/inheritance-save/java-app-console/pom.xml @@ -1,8 +1,10 @@ 4.0.0 - io.teaqlteaql-java-parent6.3.0../../pom.xml + io.teaqlteaql-java-parent6.3.0../../../pom.xml io.teaql.examplesinherited-save-example + io.teaqlteaql-provider-jdbc${teaql.version} + com.zaxxerHikariCP6.3.0 com.exampleinheritance-matching-service-core0.0.1-SNAPSHOT io.teaqlteaql-runtime${teaql.version} io.teaqlteaql-sqlite${teaql.version} diff --git a/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/App.java b/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/App.java new file mode 100644 index 000000000..9e1fc5fb7 --- /dev/null +++ b/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/App.java @@ -0,0 +1,99 @@ + +package com.example.inheritancematchingservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/CustomUserContext.java b/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/CustomUserContext.java new file mode 100644 index 000000000..45fc3e06d --- /dev/null +++ b/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.inheritancematchingservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements InheritanceMatchingServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/WorkspaceTeaQLDatabase.java b/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..cb1461859 --- /dev/null +++ b/examples/inheritance-save/java-app-console/src/main/java/com/example/inheritancematchingservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.inheritancematchingservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/src/main/resources/application.properties b/examples/inheritance-save/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..4b43884d8 --- /dev/null +++ b/examples/inheritance-save/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:inheritancematchingservice.db diff --git a/examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java b/examples/inheritance-save/java-app-console/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java similarity index 100% rename from examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java rename to examples/inheritance-save/java-app-console/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java diff --git a/examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java b/examples/inheritance-save/java-app-console/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java similarity index 100% rename from examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java rename to examples/inheritance-save/java-app-console/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java diff --git a/examples/inheritance-save/java-app-console/teaql-i18n.json b/examples/inheritance-save/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..6f75d2d41 --- /dev/null +++ b/examples/inheritance-save/java-app-console/teaql-i18n.json @@ -0,0 +1,123 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "entity.academy": "Academy", + "property.trainingAcademy.specialty": "Specialty", + "entity.college": "College", + "property.academy.id": "Id", + "property.school.platform": "Platform", + "property.school.id": "Id", + "property.schoolType.version": "Version", + "property.academy.campusCode": "Campus Code", + "property.schoolType.code": "Code", + "property.school.studentCapacity": "Student Capacity", + "property.school.schoolType": "School Type", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.schoolType.id": "Id", + "entity.school": "School", + "entity.trainingAcademy": "Training Academy", + "property.college.id": "Id", + "property.school.name": "Name", + "property.college.degreeLevel": "Degree Level", + "property.trainingAcademy.id": "Id", + "entity.schoolType": "School Type", + "property.platform.baseUrl": "Base Url", + "property.platform.version": "Version", + "property.schoolType.platform": "Platform", + "property.school.version": "Version", + "property.schoolType.name": "Name" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/inheritance-save/teaql/checker-model.json b/examples/inheritance-save/java-app-console/teaql/checker-model.json similarity index 100% rename from examples/inheritance-save/teaql/checker-model.json rename to examples/inheritance-save/java-app-console/teaql/checker-model.json diff --git a/examples/inheritance-save/teaql/model-provenance.json b/examples/inheritance-save/java-app-console/teaql/model-provenance.json similarity index 82% rename from examples/inheritance-save/teaql/model-provenance.json rename to examples/inheritance-save/java-app-console/teaql/model-provenance.json index 532504d89..12c24f68e 100644 --- a/examples/inheritance-save/teaql/model-provenance.json +++ b/examples/inheritance-save/java-app-console/teaql/model-provenance.json @@ -1 +1 @@ -{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"021b1ed8"} \ No newline at end of file +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/inheritance-save/lib/pom.xml b/examples/inheritance-save/java-lib-core/lib/pom.xml similarity index 100% rename from examples/inheritance-save/lib/pom.xml rename to examples/inheritance-save/java-lib-core/lib/pom.xml diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Constants.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Constants.java new file mode 100644 index 000000000..f49fc64d6 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Constants.java @@ -0,0 +1,13 @@ + +package com.example.inheritancematchingservice; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.schooltype.SchoolType; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); + public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; + public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; + public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/E.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/E.java new file mode 100644 index 000000000..d60a64aec --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/E.java @@ -0,0 +1,38 @@ + +package com.example.inheritancematchingservice; + +import com.example.inheritancematchingservice.academy.Academy; +import com.example.inheritancematchingservice.academy.AcademyExpression; +import com.example.inheritancematchingservice.college.College; +import com.example.inheritancematchingservice.college.CollegeExpression; +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformExpression; +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolExpression; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeExpression; +import com.example.inheritancematchingservice.trainingacademy.TrainingAcademy; +import com.example.inheritancematchingservice.trainingacademy.TrainingAcademyExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static SchoolTypeExpression schoolType(SchoolType schoolType){ + return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); + } + public static SchoolExpression school(School school){ + return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); + } + public static AcademyExpression academy(Academy academy){ + return new AcademyExpression(new ValueExpression(academy, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.academy()")); + } + public static TrainingAcademyExpression trainingAcademy(TrainingAcademy trainingAcademy){ + return new TrainingAcademyExpression(new ValueExpression(trainingAcademy, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.trainingAcademy()")); + } + public static CollegeExpression college(College college){ + return new CollegeExpression(new ValueExpression(college, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.college()")); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java new file mode 100644 index 000000000..bb71dcdbf --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java @@ -0,0 +1,777 @@ + +package com.example.inheritancematchingservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerSchoolType(); + registerSchool(); + registerAcademy(); + registerTrainingAcademy(); + registerCollege(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.inheritancematchingservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.inheritancematchingservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.inheritancematchingservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.platform.Platform::new); + entityDescriptor.with("name", "Platform") + + .with("module", "Organization") + + .with("module_key", "organization") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor baseUrl = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.BASE_URL_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Inheritance Campus") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "https://inheritance.example.com") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchoolType() { + FieldLayout.installGenerated(com.example.inheritancematchingservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.inheritancematchingservice.schooltype.SchoolType.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.inheritancematchingservice.schooltype.SchoolType.class); + entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.schooltype.SchoolType::new); + entityDescriptor.with("name", "School Type") + + .with("module", "Academics") + + .with("module_key", "academics") + + .with("constant", "true") + + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.inheritancematchingservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.inheritancematchingservice.platform.Platform.INTERNAL_TYPE, com.example.inheritancematchingservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.inheritancematchingservice.platform.Platform.class) + ; + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.NAME_PROPERTY, String.class) + ; + PropertyDescriptor code = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.CODE_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("candidates", "1001,1002") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Primary,Secondary") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") + + .with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "PRIMARY,SECONDARY") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchool() { + FieldLayout.installGenerated(com.example.inheritancematchingservice.school.School.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.inheritancematchingservice.school.School.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.inheritancematchingservice.school.School.class); + entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.school.School::new); + entityDescriptor.with("name", "School") + + .with("module", "Academics") + + .with("module_key", "academics") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.inheritancematchingservice.school.School.PLATFORM_PROPERTY, com.example.inheritancematchingservice.platform.Platform.INTERNAL_TYPE, com.example.inheritancematchingservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.inheritancematchingservice.platform.Platform.class) + ; + PropertyDescriptor schoolType = + entityDescriptor.addObjectProperty($factory, com.example.inheritancematchingservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.inheritancematchingservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.inheritancematchingservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.inheritancematchingservice.schooltype.SchoolType.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.NAME_PROPERTY, String.class) + ; + PropertyDescriptor studentCapacity = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerAcademy() { + FieldLayout.installGenerated(com.example.inheritancematchingservice.academy.Academy.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.inheritancematchingservice.academy.Academy.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.inheritancematchingservice.academy.Academy.class); + entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.academy.Academy::new); + entityDescriptor.with("name", "Academy") + + .with("module", "Academics") + + .with("module_key", "academics") + + .with("parent", "school") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.academy.Academy.ID_PROPERTY, Long.class) + ; + PropertyDescriptor campusCode = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.academy.Academy.CAMPUS_CODE_PROPERTY, String.class) + ; + entityDescriptor.setParent($factory.resolveEntityDescriptor(com.example.inheritancematchingservice.school.School.INTERNAL_TYPE)); + entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.CAMPUS_CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.CAMPUS_CODE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerTrainingAcademy() { + FieldLayout.installGenerated(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class); + entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy::new); + entityDescriptor.with("name", "Training Academy") + + .with("module", "Academics") + + .with("module_key", "academics") + + .with("parent", "academy") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.ID_PROPERTY, Long.class) + ; + PropertyDescriptor specialty = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.SPECIALTY_PROPERTY, String.class) + ; + entityDescriptor.setParent($factory.resolveEntityDescriptor(com.example.inheritancematchingservice.academy.Academy.INTERNAL_TYPE)); + entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.SPECIALTY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.SPECIALTY_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCollege() { + FieldLayout.installGenerated(com.example.inheritancematchingservice.college.College.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.inheritancematchingservice.college.College.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.inheritancematchingservice.college.College.class); + entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.college.College::new); + entityDescriptor.with("name", "College") + + .with("module", "Academics") + + .with("module_key", "academics") + + .with("parent", "school") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.college.College.ID_PROPERTY, Long.class) + ; + PropertyDescriptor degreeLevel = + entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.college.College.DEGREE_LEVEL_PROPERTY, String.class) + ; + entityDescriptor.setParent($factory.resolveEntityDescriptor(com.example.inheritancematchingservice.school.School.INTERNAL_TYPE)); + entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.DEGREE_LEVEL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.DEGREE_LEVEL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..b7a4cb471 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java @@ -0,0 +1,74 @@ +package com.example.inheritancematchingservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.inheritancematchingservice.platform.PlatformChecker(), new com.example.inheritancematchingservice.schooltype.SchoolTypeChecker(), new com.example.inheritancematchingservice.school.SchoolChecker(), new com.example.inheritancematchingservice.academy.AcademyChecker(), new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyChecker(), new com.example.inheritancematchingservice.college.CollegeChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:43a0ab45b8baa27dfb7d9eccaf6f8ac33e36491d16f13a7817729d8673c0b53a\",\"entities\":{\"Academy\":{\"labels\":{\"en\":\"Academy\"},\"fields\":[{\"name\":\"campus_code\",\"labels\":{\"en\":\"campus code\"},\"aliases\":[\"CampusCode\",\"campusCode\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]}]},\"College\":{\"labels\":{\"en\":\"College\"},\"fields\":[{\"name\":\"degree_level\",\"labels\":{\"en\":\"degree level\"},\"aliases\":[\"DegreeLevel\",\"degreeLevel\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"School\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"School Type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"TrainingAcademy\":{\"labels\":{\"en\":\"Training Academy\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"specialty\",\"labels\":{\"en\":\"specialty\"},\"aliases\":[\"Specialty\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("Academy", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("campus_code", "campusCode"))), + java.util.Map.entry("TrainingAcademy", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("specialty", "specialty"))), + java.util.Map.entry("College", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("degree_level", "degreeLevel"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.inheritancematchingservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.inheritancematchingservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Inheritance Campus"); + domainRoot.updateBaseUrl("https://inheritance.example.com"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1001Rows.isEmpty()) { + com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1001 = new com.example.inheritancematchingservice.schooltype.SchoolType(); + constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); + constantSchoolType1001.updatePlatform(domainRoot); + constantSchoolType1001.updateName("Primary"); + constantSchoolType1001.updateCode("PRIMARY"); + constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); + } else { + com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } + if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); + } + var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1002Rows.isEmpty()) { + com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1002 = new com.example.inheritancematchingservice.schooltype.SchoolType(); + constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); + constantSchoolType1002.updatePlatform(domainRoot); + constantSchoolType1002.updateName("Secondary"); + constantSchoolType1002.updateCode("SECONDARY"); + constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); + } else { + com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } + if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); + } + } +} diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java new file mode 100644 index 000000000..4a92c7681 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.inheritancematchingservice; + +import io.teaql.core.UserContext; +public interface InheritanceMatchingServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Q.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Q.java new file mode 100644 index 000000000..879107e45 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Q.java @@ -0,0 +1,78 @@ + +package com.example.inheritancematchingservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.inheritancematchingservice.platform.PlatformRequest platforms(){ + return new com.example.inheritancematchingservice.platform.PlatformRequest(com.example.inheritancematchingservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.inheritancematchingservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.inheritancematchingservice.platform.PlatformRequest(com.example.inheritancematchingservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.inheritancematchingservice.schooltype.SchoolTypeRequest schoolTypes(){ + return new com.example.inheritancematchingservice.schooltype.SchoolTypeRequest(com.example.inheritancematchingservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.inheritancematchingservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ + return new com.example.inheritancematchingservice.schooltype.SchoolTypeRequest(com.example.inheritancematchingservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.inheritancematchingservice.school.SchoolRequest schools(){ + return new com.example.inheritancematchingservice.school.SchoolRequest(com.example.inheritancematchingservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.inheritancematchingservice.school.SchoolRequest schoolsWithMinimalFields(){ + return new com.example.inheritancematchingservice.school.SchoolRequest(com.example.inheritancematchingservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + public static com.example.inheritancematchingservice.school.SchoolRequest schoolsWithChildren(){ + com.example.inheritancematchingservice.school.SchoolRequest school = new com.example.inheritancematchingservice.school.SchoolRequest(com.example.inheritancematchingservice.school.School.class).unselectVersion().unlimited().selectSelfFields(); + school.enhanceChild( + academiesWithChildren() + ); + school.enhanceChild( + new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).unselectVersion().unlimited().selectSelfFields() + ); + return school; + } + + public static com.example.inheritancematchingservice.academy.AcademyRequest academies(){ + return new com.example.inheritancematchingservice.academy.AcademyRequest(com.example.inheritancematchingservice.academy.Academy.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.inheritancematchingservice.academy.AcademyRequest academiesWithMinimalFields(){ + return new com.example.inheritancematchingservice.academy.AcademyRequest(com.example.inheritancematchingservice.academy.Academy.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + public static com.example.inheritancematchingservice.academy.AcademyRequest academiesWithChildren(){ + com.example.inheritancematchingservice.academy.AcademyRequest academy = new com.example.inheritancematchingservice.academy.AcademyRequest(com.example.inheritancematchingservice.academy.Academy.class).unselectVersion().unlimited().selectSelfFields(); + academy.enhanceChild( + new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).unselectVersion().unlimited().selectSelfFields() + ); + return academy; + } + + public static com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest trainingAcademies(){ + return new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest trainingAcademiesWithMinimalFields(){ + return new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.inheritancematchingservice.college.CollegeRequest colleges(){ + return new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.inheritancematchingservice.college.CollegeRequest collegesWithMinimalFields(){ + return new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java new file mode 100644 index 000000000..4113fda2b --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java @@ -0,0 +1,132 @@ + +package com.example.inheritancematchingservice.academy; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.school.School; +import io.teaql.core.Audited; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Academy extends School implements RemoteInput { + public static String INTERNAL_TYPE = "Academy"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "042b18ec3ea3b22c05808e3810639d71dca129f54216d83d86b7b5b85841cc0f"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("campus_code", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "campus_code"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Academy.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String CAMPUS_CODE_PROPERTY = "campus_code"; + private String campusCode; + + + public String getCampusCode(){ + return this.campusCode; + } + + public Academy updateCampusCode(String campusCode){ + campusCode = (campusCode == null ? null : campusCode.trim()); + if(isPropertyLoaded(CAMPUS_CODE_PROPERTY) && Objects.equals(this.campusCode, campusCode)){ + return this; + } + handleUpdate(CAMPUS_CODE_PROPERTY, getCampusCode(), campusCode); + this.campusCode = campusCode; + return this; + } + + public Academy updatePlatform(Platform platform){ + super.updatePlatform(platform); + return this; + } + + public Academy updateSchoolTypeToPrimary(){ + super.updateSchoolTypeToPrimary(); + return this; + } + public Academy updateSchoolTypeToSecondary(){ + super.updateSchoolTypeToSecondary(); + return this; + } + + public Academy updateName(String name){ + super.updateName(name); + return this; + } + + public Academy updateStudentCapacity(Integer studentCapacity){ + super.updateStudentCapacity(studentCapacity); + return this; + } + + + public static Academy refer(Long id){ + Academy refer = new Academy(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Academy comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "campus_code": this.campusCode = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "campus_code": return this.campusCode; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "campusCode": return this.campusCode; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java new file mode 100644 index 000000000..e25259399 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java @@ -0,0 +1,49 @@ + +package com.example.inheritancematchingservice.academy; + +import com.example.inheritancematchingservice.school.SchoolChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class AcademyChecker implements Checker{ + + public String type(){ + return Academy.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Academy academy, ObjectLocation _parentLocation){ + if(needCheck(_context, academy)){ + markAsChecked(_context, academy); + new SchoolChecker().doCheck(_context, academy, _parentLocation); + + doCheck(_context, academy, _parentLocation); + } + } + + public void doCheck(UserContext _context, Academy academy, ObjectLocation _parentLocation){ + if((academy == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, academy); + if(academy.needPersist()){ + } + if(academy.newItem()){ + }else if(academy.updateItem()){ + if(!academy.isPropertyLoaded("campus_code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "campus_code"), "Mutation requires a fully loaded entity"); + } + + } + checkCampusCode(_context, academy.getProperty(Academy.CAMPUS_CODE_PROPERTY), newLocation(_parentLocation, "campus_code")); + } + + public void checkCampusCode(UserContext _context, String campusCode, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, campusCode); + if((campusCode == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, campusCode); + + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java new file mode 100644 index 000000000..e96e73ae3 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java @@ -0,0 +1,43 @@ + +package com.example.inheritancematchingservice.academy; + +import com.example.inheritancematchingservice.school.SchoolExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import java.util.function.Function; + +public class AcademyExpression extends SchoolExpression implements BaseEntityExpression { + public AcademyExpression(Expression expression){ + super(expression); + } + + public AcademyExpression(Expression expression, Function function){ + super(expression, function); + } + + public AcademyExpression updateId(Long id){ + return new AcademyExpression(this, $it -> {((Academy)$it).__internalSet("id", id); return this;}); + } + + public AcademyExpression save(UserContext userContext){ + return new AcademyExpression(this, $it -> ((Academy)$it).auditAs("Saved by Expression").save(userContext)); + } + + public AcademyExpression save(String intent, UserContext userContext){ + return new AcademyExpression(this, $it -> ((Academy)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getCampusCode(){ + return loaded("campus_code", "getCampusCode", Academy::getCampusCode); + } + public AcademyExpression updateCampusCode(String campusCode){ + return new AcademyExpression(this, $it -> ((Academy)$it).updateCampusCode(campusCode)); + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java new file mode 100644 index 000000000..0f349aa3f --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java @@ -0,0 +1,25 @@ + +package com.example.inheritancematchingservice.academy; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class AcademyListExpression extends SmartListExpression { + public AcademyListExpression(Expression> expression){ + super(expression); + } + + public AcademyListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public AcademyExpression first() { + return new AcademyExpression(super.first()); + } + + public AcademyExpression get(int index) { + return new AcademyExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java new file mode 100644 index 000000000..57d1b0d78 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java @@ -0,0 +1,970 @@ + +package com.example.inheritancematchingservice.academy; + +import cn.hutool.core.util.ObjectUtil; +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformRequest; +import com.example.inheritancematchingservice.school.SchoolRequest; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; +import com.example.inheritancematchingservice.trainingacademy.TrainingAcademy; +import io.teaql.core.AggrFunction; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class AcademyRequest extends SchoolRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public AcademyRequest(Class returnType){ + this(returnType, () -> (T) new Academy()); + } + + protected AcademyRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public AcademyRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public AcademyRequest copy(){ + return (AcademyRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new AcademyRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public AcademyRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public AcademyRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public AcademyRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public AcademyRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public AcademyRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public AcademyRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public AcademyRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public AcademyRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public AcademyRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public AcademyRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (AcademyRequest)super.appendSearchCriteria(searchCriteria); + } + + public AcademyRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public AcademyRequest matchingAnyOf(AcademyRequest... academies){ + if(ObjectUtil.isEmpty(academies)){ + return this; + } + List l = new ArrayList(); + for(AcademyRequest academy:academies){ + l.add(new SubQuerySearchCriteria(Academy.ID_PROPERTY, academy, Academy.ID_PROPERTY)); + } + return appendSearchCriteria(SearchCriteria.or(l.toArray(new SearchCriteria[l.size()]))); + } + + public AcademyRequest enhanceChild(AcademyRequest academy){ + super.enhanceSelf(academy); + return this; + } + public AcademyRequest matchingIdsOf(AcademyRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Academy.ID_PROPERTY, request, Academy.ID_PROPERTY)); + } + + public AcademyRequest enhanceChildrenIfNeeded(){ + this.enhanceChild( +new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).unlimited().selectSelfWithoutParent() +); + return this; + } + + public AcademyRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public AcademyRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public AcademyRequest selectSelf(){ + super.selectSelf(); + return selectCampusCode(); + } + + public AcademyRequest selectSelfFields(){ + return selectSelf(); + } + + public AcademyRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + + public AcademyRequest selectAll(){ + super.selectAll(); + return selectCampusCode(); + } + + public AcademyRequest selectChildren(){ + super.selectAny(); + return selectCampusCode(); + } + + + public AcademyRequest selectCampusCode(){ + selectProperty(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + + /** + * fill the campusCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS campusCode) to fetch campusCode property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public AcademyRequest unselectCampusCode(){ + unselectProperty(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + public AcademyRequest selectPlatformIdOnly(){ + super.selectPlatformIdOnly(); + return this; + } + + public AcademyRequest selectPlatform(){ + super.selectPlatform(); + return this; + } + + public AcademyRequest selectPlatformWith(PlatformRequest platform){ + super.selectPlatformWith(platform); + return this; + } + + public AcademyRequest unselectPlatform(){ + super.unselectPlatform(); + return this; + } + public AcademyRequest selectSchoolTypeIdOnly(){ + super.selectSchoolTypeIdOnly(); + return this; + } + + public AcademyRequest selectSchoolType(){ + super.selectSchoolType(); + return this; + } + + public AcademyRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + super.selectSchoolTypeWith(schoolType); + return this; + } + + public AcademyRequest unselectSchoolType(){ + super.unselectSchoolType(); + return this; + } + public AcademyRequest selectName(){ + super.selectName(); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public AcademyRequest unselectName(){ + super.unselectName(); + return this; + } + public AcademyRequest selectStudentCapacity(){ + super.selectStudentCapacity(); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public AcademyRequest selectStudentCapacity(AggrFunction aggrFunction){ + super.selectStudentCapacity(aggrFunction); + return this; + } + + + public AcademyRequest unselectStudentCapacity(){ + super.unselectStudentCapacity(); + return this; + } + public AcademyRequest selectVersion(){ + super.selectVersion(); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public AcademyRequest unselectVersion(){ + super.unselectVersion(); + return this; + } + public AcademyRequest selectId(){ + super.selectId(); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public AcademyRequest unselectId(){ + super.unselectId(); + return this; + } + + public AcademyRequest isTrainingAcademy(){ + return matchTypes(TrainingAcademy.INTERNAL_TYPE); + } + + public AcademyRequest matchTypes(String... types){ + super.matchType(types); + return this; + } + + public AcademyRequest withTypeGroup(){ + super.withTypeGroup(); + return this; + } + + public AcademyRequest filterByCampusCode(String... campusCode){ + if (campusCode == null || campusCode.length == 0) { + throw new IllegalArgumentException("filterByCampusCode parameter campusCode cannot be empty"); + } + return appendSearchCriteria(createCampusCodeCriteria(Operator.EQUAL, (Object[])campusCode)); + } + + public AcademyRequest withCampusCode(Operator operator, Object... values){ + return appendSearchCriteria(createCampusCodeCriteria(operator, values)); + } + + public AcademyRequest withCampusCodeIsUnknown(){ + return withCampusCode(Operator.IS_NULL); + } + + public AcademyRequest withCampusCodeIsKnown(){ + return withCampusCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCampusCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Academy.CAMPUS_CODE_PROPERTY, operator, values); + } + + public AcademyRequest withCampusCodeIsNot(String campusCode){ + return withCampusCode(Operator.NOT_EQUAL, campusCode); + } + + public AcademyRequest withCampusCodeIn(String... campusCode){ + return withCampusCode(Operator.IN, (Object[])campusCode); + } + + public AcademyRequest withCampusCodeNotIn(String... campusCode){ + return withCampusCode(Operator.NOT_IN, (Object[])campusCode); + } + public AcademyRequest withCampusCodeGreaterThan(String campusCode){ + return withCampusCode(Operator.GREATER_THAN, campusCode); + } + + public AcademyRequest withCampusCodeGreaterThanOrEqualTo(String campusCode){ + return withCampusCode(Operator.GREATER_THAN_OR_EQUAL, campusCode); + } + + public AcademyRequest withCampusCodeLessThan(String campusCode){ + return withCampusCode(Operator.LESS_THAN, campusCode); + } + + public AcademyRequest withCampusCodeLessThanOrEqualTo(String campusCode){ + return withCampusCode(Operator.LESS_THAN_OR_EQUAL, campusCode); + } + + public AcademyRequest withCampusCodeBetween(String startOfCampusCode, String endOfCampusCode){ + return withCampusCode(Operator.BETWEEN, startOfCampusCode, endOfCampusCode); + } + public AcademyRequest withCampusCodeStartingWith(String campusCode){ + return withCampusCode(Operator.BEGIN_WITH, campusCode); + } + public AcademyRequest withCampusCodeContaining(String campusCode){ + return withCampusCode(Operator.CONTAIN, campusCode); + } + + public AcademyRequest withCampusCodeNotContaining(String campusCode){ + return withCampusCode(Operator.NOT_CONTAIN, campusCode); + } + + public AcademyRequest withCampusCodeNotStartingWith(String campusCode){ + return withCampusCode(Operator.NOT_BEGIN_WITH, campusCode); + } + + public AcademyRequest withCampusCodeEndingWith(String campusCode){ + return withCampusCode(Operator.END_WITH, campusCode); + } + + public AcademyRequest withCampusCodeNotEndingWith(String campusCode){ + return withCampusCode(Operator.NOT_END_WITH, campusCode); + } + + public AcademyRequest withCampusCodeIs(String campusCode){ + return withCampusCode(Operator.EQUAL, campusCode); + } + + public AcademyRequest withCampusCodeSoundingLike(String campusCode){ + return withCampusCode(Operator.SOUNDS_LIKE, campusCode); + } + + + + public AcademyRequest filterByPlatform(Platform platform){ + return (AcademyRequest)super.filterByPlatform(platform); + } + + public AcademyRequest withPlatform(Operator operator, Object... values){ + return (AcademyRequest)super.withPlatform(operator, values); + } + + public AcademyRequest withPlatformIsUnknown(){ + return (AcademyRequest)super.withPlatformIsUnknown(); + } + + public AcademyRequest withPlatformIsKnown(){ + return (AcademyRequest)super.withPlatformIsKnown(); + } + + public AcademyRequest filterByPlatform(Long platform){ + return (AcademyRequest)super.filterByPlatform(platform); + } + + public AcademyRequest withPlatformMatching(PlatformRequest platform){ + return (AcademyRequest)super.withPlatformMatching(platform); + } + + public AcademyRequest filterBySchoolType(SchoolType schoolType){ + return (AcademyRequest)super.filterBySchoolType(schoolType); + } + + public AcademyRequest withSchoolType(Operator operator, Object... values){ + return (AcademyRequest)super.withSchoolType(operator, values); + } + + public AcademyRequest withSchoolTypeIsUnknown(){ + return (AcademyRequest)super.withSchoolTypeIsUnknown(); + } + + public AcademyRequest withSchoolTypeIsKnown(){ + return (AcademyRequest)super.withSchoolTypeIsKnown(); + } + + public AcademyRequest filterBySchoolType(Long schoolType){ + return (AcademyRequest)super.filterBySchoolType(schoolType); + } + + public AcademyRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return (AcademyRequest)super.withSchoolTypeMatching(schoolType); + } + + public AcademyRequest filterByName(String name){ + return (AcademyRequest)super.filterByName(name); + } + + public AcademyRequest withName(Operator operator, Object... values){ + return (AcademyRequest)super.withName(operator, values); + } + + public AcademyRequest withNameIsUnknown(){ + return (AcademyRequest)super.withNameIsUnknown(); + } + + public AcademyRequest withNameIsKnown(){ + return (AcademyRequest)super.withNameIsKnown(); + } + + public AcademyRequest withNameStartingWith(String Name){ + return (AcademyRequest)super.withNameStartingWith(Name); + } + public AcademyRequest withNameContaining(String Name){ + return (AcademyRequest)super.withNameContaining(Name); + } + + public AcademyRequest withNameEndingWith(String Name){ + return (AcademyRequest)super.withNameEndingWith(Name); + } + + + public AcademyRequest filterByStudentCapacity(Integer studentCapacity){ + return (AcademyRequest)super.filterByStudentCapacity(studentCapacity); + } + + public AcademyRequest withStudentCapacity(Operator operator, Object... values){ + return (AcademyRequest)super.withStudentCapacity(operator, values); + } + + public AcademyRequest withStudentCapacityIsUnknown(){ + return (AcademyRequest)super.withStudentCapacityIsUnknown(); + } + + public AcademyRequest withStudentCapacityIsKnown(){ + return (AcademyRequest)super.withStudentCapacityIsKnown(); + } + + public AcademyRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return (AcademyRequest)super.withStudentCapacityGreaterThan(studentCapacity); + } + + public AcademyRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return (AcademyRequest)super.withStudentCapacityGreaterThanOrEqualTo(studentCapacity); + } + + public AcademyRequest withStudentCapacityLessThan(Integer studentCapacity){ + return (AcademyRequest)super.withStudentCapacityLessThan(studentCapacity); + } + + public AcademyRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return (AcademyRequest)super.withStudentCapacityLessThanOrEqualTo(studentCapacity); + } + + public AcademyRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return (AcademyRequest)super.withStudentCapacityBetween(startOfStudentCapacity, endOfStudentCapacity); + } + + + public AcademyRequest filterByVersion(Long version){ + return (AcademyRequest)super.filterByVersion(version); + } + + public AcademyRequest withVersion(Operator operator, Object... values){ + return (AcademyRequest)super.withVersion(operator, values); + } + + public AcademyRequest withVersionIsUnknown(){ + return (AcademyRequest)super.withVersionIsUnknown(); + } + + public AcademyRequest withVersionIsKnown(){ + return (AcademyRequest)super.withVersionIsKnown(); + } + + + public AcademyRequest withIdIs(Long value){ + return (AcademyRequest)super.withIdIs(value); + } + + public AcademyRequest withId(Operator operator, Object... values){ + return (AcademyRequest)super.withId(operator, values); + } + + + public AcademyRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public AcademyRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public AcademyRequest minStudentCapacity(){ + super.minStudentCapacity(); + return this; + } + + public AcademyRequest minStudentCapacityAs(String retName){ + super.minStudentCapacityAs(retName); + return this; + } + public AcademyRequest maxStudentCapacity(){ + super.maxStudentCapacity(); + return this; + } + + public AcademyRequest maxStudentCapacityAs(String retName){ + super.maxStudentCapacityAs(retName); + return this; + } + public AcademyRequest sumStudentCapacity(){ + super.sumStudentCapacity(); + return this; + } + + public AcademyRequest sumStudentCapacityAs(String retName){ + super.sumStudentCapacityAs(retName); + return this; + } + public AcademyRequest avgStudentCapacity(){ + super.avgStudentCapacity(); + return this; + } + + public AcademyRequest avgStudentCapacityAs(String retName){ + super.avgStudentCapacityAs(retName); + return this; + } + public AcademyRequest stddevStudentCapacity(){ + super.standardDeviationStudentCapacity(); + return this; + } + + public AcademyRequest stddevStudentCapacityAs(String retName){ + super.standardDeviationStudentCapacityAs(retName); + return this; + } + public AcademyRequest stddev_popStudentCapacity(){ + super.squareRootOfPopulationStandardDeviationStudentCapacity(); + return this; + } + + public AcademyRequest stddev_popStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviationStudentCapacityAs(retName); + return this; + } + public AcademyRequest var_sampStudentCapacity(){ + super.sampleVarianceStudentCapacity(); + return this; + } + + public AcademyRequest var_sampStudentCapacityAs(String retName){ + super.sampleVarianceStudentCapacityAs(retName); + return this; + } + public AcademyRequest var_popStudentCapacity(){ + super.samplePopulationVarianceStudentCapacity(); + return this; + } + + public AcademyRequest var_popStudentCapacityAs(String retName){ + super.samplePopulationVarianceStudentCapacityAs(retName); + return this; + } + public AcademyRequest groupByPlatformWithDetails(){ + super.groupByPlatformWithDetails(); + return this; + } + + public AcademyRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + super.groupByPlatformWithDetails(subRequest); + return this; + } + + public AcademyRequest groupBySchoolTypeWithDetails(){ + super.groupBySchoolTypeWithDetails(); + return this; + } + + public AcademyRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + super.groupBySchoolTypeWithDetails(subRequest); + return this; + } + + + + + + public AcademyRequest countDistinctCampusCode(){ + return countDistinctCampusCodeAs("campus_code_distinct_count"); + } + + public AcademyRequest countDistinctCampusCodeAs(String alias){ + super.countDistinctProperty(alias, Academy.CAMPUS_CODE_PROPERTY); + return this; + } + public AcademyRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public AcademyRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, Academy.PLATFORM_PROPERTY); + return this; + } + public AcademyRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public AcademyRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, Academy.SCHOOL_TYPE_PROPERTY); + return this; + } + public AcademyRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public AcademyRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Academy.NAME_PROPERTY); + return this; + } + public AcademyRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public AcademyRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, Academy.STUDENT_CAPACITY_PROPERTY); + return this; + } + public AcademyRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public AcademyRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Academy.VERSION_PROPERTY); + return this; + } + public AcademyRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public AcademyRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Academy.ID_PROPERTY); + return this; + } + + public AcademyRequest groupByCampusCode(){ + groupBy(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + + public AcademyRequest groupByCampusCodeAs(String retName){ + groupBy(retName, Academy.CAMPUS_CODE_PROPERTY); + return this; + } + + public AcademyRequest groupByCampusCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Academy.CAMPUS_CODE_PROPERTY, function); + return this; + } + + + public AcademyRequest groupByPlatformWith(PlatformRequest subRequest){ + super.groupByPlatformWith(subRequest); + return this; + } + public AcademyRequest groupByPlatform(){ + super.groupByPlatform(); + return this; + } + + public AcademyRequest groupByPlatformAs(String retName){ + super.groupByPlatformAs(retName); + return this; + } + + public AcademyRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + super.groupByPlatformWithFunction(retName, function); + return this; + } + public AcademyRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + super.groupBySchoolTypeWith(subRequest); + return this; + } + public AcademyRequest groupBySchoolType(){ + super.groupBySchoolType(); + return this; + } + + public AcademyRequest groupBySchoolTypeAs(String retName){ + super.groupBySchoolTypeAs(retName); + return this; + } + + public AcademyRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + super.groupBySchoolTypeWithFunction(retName, function); + return this; + } + + public AcademyRequest groupByName(){ + super.groupByName(); + return this; + } + + public AcademyRequest groupByNameAs(String retName){ + super.groupByNameAs(retName); + return this; + } + + public AcademyRequest groupByNameWithFunction(String retName, AggrFunction function){ + super.groupByNameWithFunction(retName, function); + return this; + } + + public AcademyRequest groupByStudentCapacity(){ + super.groupByStudentCapacity(); + return this; + } + + public AcademyRequest groupByStudentCapacityAs(String retName){ + super.groupByStudentCapacityAs(retName); + return this; + } + + public AcademyRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + super.groupByStudentCapacityWithFunction(retName, function); + return this; + } + + public AcademyRequest groupByVersion(){ + super.groupByVersion(); + return this; + } + + public AcademyRequest groupByVersionAs(String retName){ + super.groupByVersionAs(retName); + return this; + } + + public AcademyRequest groupByVersionWithFunction(String retName, AggrFunction function){ + super.groupByVersionWithFunction(retName, function); + return this; + } + + public AcademyRequest groupById(){ + super.groupById(); + return this; + } + + public AcademyRequest groupByIdAs(String retName){ + super.groupByIdAs(retName); + return this; + } + + public AcademyRequest groupByIdWithFunction(String retName, AggrFunction function){ + super.groupByIdWithFunction(retName, function); + return this; + } + + public AcademyRequest orderByCampusCodeAscending(){ + addOrderByAscending(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + + public AcademyRequest orderByCampusCodeDescending(){ + addOrderByDescending(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + public AcademyRequest orderByCampusCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + + public AcademyRequest orderByCampusCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Academy.CAMPUS_CODE_PROPERTY); + return this; + } + public AcademyRequest orderByPlatformAscending(){ + super.orderByPlatformAscending(); + return this; + } + + public AcademyRequest orderByPlatformDescending(){ + super.orderByPlatformDescending(); + return this; + } + + public AcademyRequest orderBySchoolTypeAscending(){ + super.orderBySchoolTypeAscending(); + return this; + } + + public AcademyRequest orderBySchoolTypeDescending(){ + super.orderBySchoolTypeDescending(); + return this; + } + + public AcademyRequest orderByNameAscending(){ + super.orderByNameAscending(); + return this; + } + + public AcademyRequest orderByNameDescending(){ + super.orderByNameDescending(); + return this; + } + public AcademyRequest orderByNameAscendingUsingGBK(){ + super.orderByNameAscendingUsingGBK(); + return this; + } + + public AcademyRequest orderByNameDescendingUsingGBK(){ + super.orderByNameDescendingUsingGBK(); + return this; + } + public AcademyRequest orderByStudentCapacityAscending(){ + super.orderByStudentCapacityAscending(); + return this; + } + + public AcademyRequest orderByStudentCapacityDescending(){ + super.orderByStudentCapacityDescending(); + return this; + } + + public AcademyRequest orderByVersionAscending(){ + super.orderByVersionAscending(); + return this; + } + + public AcademyRequest orderByVersionDescending(){ + super.orderByVersionDescending(); + return this; + } + + public AcademyRequest orderByIdAscending(){ + super.orderByIdAscending(); + return this; + } + + public AcademyRequest orderByIdDescending(){ + super.orderByIdDescending(); + return this; + } + + + + + + /** + * get topN records + * @param topN records number + */ + public AcademyRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public AcademyRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public AcademyRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public AcademyRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public AcademyRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public AcademyRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/College.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/College.java new file mode 100644 index 000000000..e00f1ef19 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/College.java @@ -0,0 +1,132 @@ + +package com.example.inheritancematchingservice.college; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.school.School; +import io.teaql.core.Audited; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class College extends School implements RemoteInput { + public static String INTERNAL_TYPE = "College"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "992021f4267b1280cc0bfbc2f71330457b7b5f1549e06205c85c0db79c2ac489"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("degree_level", 6)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("degree_level", java.util.List.of("degreeLevel", "degree_level"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + College.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String DEGREE_LEVEL_PROPERTY = "degree_level"; + private String degreeLevel; + + + public String getDegreeLevel(){ + return this.degreeLevel; + } + + public College updateDegreeLevel(String degreeLevel){ + degreeLevel = (degreeLevel == null ? null : degreeLevel.trim()); + if(isPropertyLoaded(DEGREE_LEVEL_PROPERTY) && Objects.equals(this.degreeLevel, degreeLevel)){ + return this; + } + handleUpdate(DEGREE_LEVEL_PROPERTY, getDegreeLevel(), degreeLevel); + this.degreeLevel = degreeLevel; + return this; + } + + public College updatePlatform(Platform platform){ + super.updatePlatform(platform); + return this; + } + + public College updateSchoolTypeToPrimary(){ + super.updateSchoolTypeToPrimary(); + return this; + } + public College updateSchoolTypeToSecondary(){ + super.updateSchoolTypeToSecondary(); + return this; + } + + public College updateName(String name){ + super.updateName(name); + return this; + } + + public College updateStudentCapacity(Integer studentCapacity){ + super.updateStudentCapacity(studentCapacity); + return this; + } + + + public static College refer(Long id){ + College refer = new College(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public College comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "degree_level": this.degreeLevel = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "degree_level": return this.degreeLevel; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "degreeLevel": return this.degreeLevel; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java new file mode 100644 index 000000000..83d57ae45 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java @@ -0,0 +1,49 @@ + +package com.example.inheritancematchingservice.college; + +import com.example.inheritancematchingservice.school.SchoolChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CollegeChecker implements Checker{ + + public String type(){ + return College.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, College college, ObjectLocation _parentLocation){ + if(needCheck(_context, college)){ + markAsChecked(_context, college); + new SchoolChecker().doCheck(_context, college, _parentLocation); + + doCheck(_context, college, _parentLocation); + } + } + + public void doCheck(UserContext _context, College college, ObjectLocation _parentLocation){ + if((college == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, college); + if(college.needPersist()){ + } + if(college.newItem()){ + }else if(college.updateItem()){ + if(!college.isPropertyLoaded("degree_level")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "degree_level"), "Mutation requires a fully loaded entity"); + } + + } + checkDegreeLevel(_context, college.getProperty(College.DEGREE_LEVEL_PROPERTY), newLocation(_parentLocation, "degree_level")); + } + + public void checkDegreeLevel(UserContext _context, String degreeLevel, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, degreeLevel); + if((degreeLevel == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, degreeLevel); + + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java new file mode 100644 index 000000000..2df72960d --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java @@ -0,0 +1,43 @@ + +package com.example.inheritancematchingservice.college; + +import com.example.inheritancematchingservice.school.SchoolExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import java.util.function.Function; + +public class CollegeExpression extends SchoolExpression implements BaseEntityExpression { + public CollegeExpression(Expression expression){ + super(expression); + } + + public CollegeExpression(Expression expression, Function function){ + super(expression, function); + } + + public CollegeExpression updateId(Long id){ + return new CollegeExpression(this, $it -> {((College)$it).__internalSet("id", id); return this;}); + } + + public CollegeExpression save(UserContext userContext){ + return new CollegeExpression(this, $it -> ((College)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CollegeExpression save(String intent, UserContext userContext){ + return new CollegeExpression(this, $it -> ((College)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getDegreeLevel(){ + return loaded("degree_level", "getDegreeLevel", College::getDegreeLevel); + } + public CollegeExpression updateDegreeLevel(String degreeLevel){ + return new CollegeExpression(this, $it -> ((College)$it).updateDegreeLevel(degreeLevel)); + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java new file mode 100644 index 000000000..a4442c5b7 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.inheritancematchingservice.college; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CollegeListExpression extends SmartListExpression { + public CollegeListExpression(Expression> expression){ + super(expression); + } + + public CollegeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CollegeExpression first() { + return new CollegeExpression(super.first()); + } + + public CollegeExpression get(int index) { + return new CollegeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java new file mode 100644 index 000000000..fd542aff0 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java @@ -0,0 +1,939 @@ + +package com.example.inheritancematchingservice.college; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformRequest; +import com.example.inheritancematchingservice.school.SchoolRequest; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CollegeRequest extends SchoolRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CollegeRequest(Class returnType){ + this(returnType, () -> (T) new College()); + } + + protected CollegeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CollegeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CollegeRequest copy(){ + return (CollegeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CollegeRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CollegeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CollegeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CollegeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CollegeRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CollegeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CollegeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CollegeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CollegeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CollegeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CollegeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CollegeRequest)super.appendSearchCriteria(searchCriteria); + } + + public CollegeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CollegeRequest matchingAnyOf(CollegeRequest college){ + super.internalMatchAny(college); + return this; + } + + public CollegeRequest matchingIdsOf(CollegeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + College.ID_PROPERTY, request, College.ID_PROPERTY)); + } + + public CollegeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CollegeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CollegeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CollegeRequest selectSelf(){ + super.selectSelf(); + return selectDegreeLevel(); + } + + public CollegeRequest selectSelfFields(){ + return selectSelf(); + } + + public CollegeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(College.DEGREE_LEVEL_PROPERTY); + return this; + } + + public CollegeRequest selectAll(){ + super.selectAll(); + return selectDegreeLevel(); + } + + public CollegeRequest selectChildren(){ + super.selectAny(); + return selectDegreeLevel(); + } + + + public CollegeRequest selectDegreeLevel(){ + selectProperty(College.DEGREE_LEVEL_PROPERTY); + return this; + } + + /** + * fill the degreeLevel with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS degreeLevel) to fetch degreeLevel property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CollegeRequest unselectDegreeLevel(){ + unselectProperty(College.DEGREE_LEVEL_PROPERTY); + return this; + } + public CollegeRequest selectPlatformIdOnly(){ + super.selectPlatformIdOnly(); + return this; + } + + public CollegeRequest selectPlatform(){ + super.selectPlatform(); + return this; + } + + public CollegeRequest selectPlatformWith(PlatformRequest platform){ + super.selectPlatformWith(platform); + return this; + } + + public CollegeRequest unselectPlatform(){ + super.unselectPlatform(); + return this; + } + public CollegeRequest selectSchoolTypeIdOnly(){ + super.selectSchoolTypeIdOnly(); + return this; + } + + public CollegeRequest selectSchoolType(){ + super.selectSchoolType(); + return this; + } + + public CollegeRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + super.selectSchoolTypeWith(schoolType); + return this; + } + + public CollegeRequest unselectSchoolType(){ + super.unselectSchoolType(); + return this; + } + public CollegeRequest selectName(){ + super.selectName(); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CollegeRequest unselectName(){ + super.unselectName(); + return this; + } + public CollegeRequest selectStudentCapacity(){ + super.selectStudentCapacity(); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public CollegeRequest selectStudentCapacity(AggrFunction aggrFunction){ + super.selectStudentCapacity(aggrFunction); + return this; + } + + + public CollegeRequest unselectStudentCapacity(){ + super.unselectStudentCapacity(); + return this; + } + public CollegeRequest selectVersion(){ + super.selectVersion(); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CollegeRequest unselectVersion(){ + super.unselectVersion(); + return this; + } + public CollegeRequest selectId(){ + super.selectId(); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CollegeRequest unselectId(){ + super.unselectId(); + return this; + } + + public CollegeRequest filterByDegreeLevel(String... degreeLevel){ + if (degreeLevel == null || degreeLevel.length == 0) { + throw new IllegalArgumentException("filterByDegreeLevel parameter degreeLevel cannot be empty"); + } + return appendSearchCriteria(createDegreeLevelCriteria(Operator.EQUAL, (Object[])degreeLevel)); + } + + public CollegeRequest withDegreeLevel(Operator operator, Object... values){ + return appendSearchCriteria(createDegreeLevelCriteria(operator, values)); + } + + public CollegeRequest withDegreeLevelIsUnknown(){ + return withDegreeLevel(Operator.IS_NULL); + } + + public CollegeRequest withDegreeLevelIsKnown(){ + return withDegreeLevel(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDegreeLevelCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(College.DEGREE_LEVEL_PROPERTY, operator, values); + } + + public CollegeRequest withDegreeLevelIsNot(String degreeLevel){ + return withDegreeLevel(Operator.NOT_EQUAL, degreeLevel); + } + + public CollegeRequest withDegreeLevelIn(String... degreeLevel){ + return withDegreeLevel(Operator.IN, (Object[])degreeLevel); + } + + public CollegeRequest withDegreeLevelNotIn(String... degreeLevel){ + return withDegreeLevel(Operator.NOT_IN, (Object[])degreeLevel); + } + public CollegeRequest withDegreeLevelGreaterThan(String degreeLevel){ + return withDegreeLevel(Operator.GREATER_THAN, degreeLevel); + } + + public CollegeRequest withDegreeLevelGreaterThanOrEqualTo(String degreeLevel){ + return withDegreeLevel(Operator.GREATER_THAN_OR_EQUAL, degreeLevel); + } + + public CollegeRequest withDegreeLevelLessThan(String degreeLevel){ + return withDegreeLevel(Operator.LESS_THAN, degreeLevel); + } + + public CollegeRequest withDegreeLevelLessThanOrEqualTo(String degreeLevel){ + return withDegreeLevel(Operator.LESS_THAN_OR_EQUAL, degreeLevel); + } + + public CollegeRequest withDegreeLevelBetween(String startOfDegreeLevel, String endOfDegreeLevel){ + return withDegreeLevel(Operator.BETWEEN, startOfDegreeLevel, endOfDegreeLevel); + } + public CollegeRequest withDegreeLevelStartingWith(String degreeLevel){ + return withDegreeLevel(Operator.BEGIN_WITH, degreeLevel); + } + public CollegeRequest withDegreeLevelContaining(String degreeLevel){ + return withDegreeLevel(Operator.CONTAIN, degreeLevel); + } + + public CollegeRequest withDegreeLevelNotContaining(String degreeLevel){ + return withDegreeLevel(Operator.NOT_CONTAIN, degreeLevel); + } + + public CollegeRequest withDegreeLevelNotStartingWith(String degreeLevel){ + return withDegreeLevel(Operator.NOT_BEGIN_WITH, degreeLevel); + } + + public CollegeRequest withDegreeLevelEndingWith(String degreeLevel){ + return withDegreeLevel(Operator.END_WITH, degreeLevel); + } + + public CollegeRequest withDegreeLevelNotEndingWith(String degreeLevel){ + return withDegreeLevel(Operator.NOT_END_WITH, degreeLevel); + } + + public CollegeRequest withDegreeLevelIs(String degreeLevel){ + return withDegreeLevel(Operator.EQUAL, degreeLevel); + } + + public CollegeRequest withDegreeLevelSoundingLike(String degreeLevel){ + return withDegreeLevel(Operator.SOUNDS_LIKE, degreeLevel); + } + + + + public CollegeRequest filterByPlatform(Platform platform){ + return (CollegeRequest)super.filterByPlatform(platform); + } + + public CollegeRequest withPlatform(Operator operator, Object... values){ + return (CollegeRequest)super.withPlatform(operator, values); + } + + public CollegeRequest withPlatformIsUnknown(){ + return (CollegeRequest)super.withPlatformIsUnknown(); + } + + public CollegeRequest withPlatformIsKnown(){ + return (CollegeRequest)super.withPlatformIsKnown(); + } + + public CollegeRequest filterByPlatform(Long platform){ + return (CollegeRequest)super.filterByPlatform(platform); + } + + public CollegeRequest withPlatformMatching(PlatformRequest platform){ + return (CollegeRequest)super.withPlatformMatching(platform); + } + + public CollegeRequest filterBySchoolType(SchoolType schoolType){ + return (CollegeRequest)super.filterBySchoolType(schoolType); + } + + public CollegeRequest withSchoolType(Operator operator, Object... values){ + return (CollegeRequest)super.withSchoolType(operator, values); + } + + public CollegeRequest withSchoolTypeIsUnknown(){ + return (CollegeRequest)super.withSchoolTypeIsUnknown(); + } + + public CollegeRequest withSchoolTypeIsKnown(){ + return (CollegeRequest)super.withSchoolTypeIsKnown(); + } + + public CollegeRequest filterBySchoolType(Long schoolType){ + return (CollegeRequest)super.filterBySchoolType(schoolType); + } + + public CollegeRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return (CollegeRequest)super.withSchoolTypeMatching(schoolType); + } + + public CollegeRequest filterByName(String name){ + return (CollegeRequest)super.filterByName(name); + } + + public CollegeRequest withName(Operator operator, Object... values){ + return (CollegeRequest)super.withName(operator, values); + } + + public CollegeRequest withNameIsUnknown(){ + return (CollegeRequest)super.withNameIsUnknown(); + } + + public CollegeRequest withNameIsKnown(){ + return (CollegeRequest)super.withNameIsKnown(); + } + + public CollegeRequest withNameStartingWith(String Name){ + return (CollegeRequest)super.withNameStartingWith(Name); + } + public CollegeRequest withNameContaining(String Name){ + return (CollegeRequest)super.withNameContaining(Name); + } + + public CollegeRequest withNameEndingWith(String Name){ + return (CollegeRequest)super.withNameEndingWith(Name); + } + + + public CollegeRequest filterByStudentCapacity(Integer studentCapacity){ + return (CollegeRequest)super.filterByStudentCapacity(studentCapacity); + } + + public CollegeRequest withStudentCapacity(Operator operator, Object... values){ + return (CollegeRequest)super.withStudentCapacity(operator, values); + } + + public CollegeRequest withStudentCapacityIsUnknown(){ + return (CollegeRequest)super.withStudentCapacityIsUnknown(); + } + + public CollegeRequest withStudentCapacityIsKnown(){ + return (CollegeRequest)super.withStudentCapacityIsKnown(); + } + + public CollegeRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return (CollegeRequest)super.withStudentCapacityGreaterThan(studentCapacity); + } + + public CollegeRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return (CollegeRequest)super.withStudentCapacityGreaterThanOrEqualTo(studentCapacity); + } + + public CollegeRequest withStudentCapacityLessThan(Integer studentCapacity){ + return (CollegeRequest)super.withStudentCapacityLessThan(studentCapacity); + } + + public CollegeRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return (CollegeRequest)super.withStudentCapacityLessThanOrEqualTo(studentCapacity); + } + + public CollegeRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return (CollegeRequest)super.withStudentCapacityBetween(startOfStudentCapacity, endOfStudentCapacity); + } + + + public CollegeRequest filterByVersion(Long version){ + return (CollegeRequest)super.filterByVersion(version); + } + + public CollegeRequest withVersion(Operator operator, Object... values){ + return (CollegeRequest)super.withVersion(operator, values); + } + + public CollegeRequest withVersionIsUnknown(){ + return (CollegeRequest)super.withVersionIsUnknown(); + } + + public CollegeRequest withVersionIsKnown(){ + return (CollegeRequest)super.withVersionIsKnown(); + } + + + public CollegeRequest withIdIs(Long value){ + return (CollegeRequest)super.withIdIs(value); + } + + public CollegeRequest withId(Operator operator, Object... values){ + return (CollegeRequest)super.withId(operator, values); + } + + + public CollegeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CollegeRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CollegeRequest minStudentCapacity(){ + super.minStudentCapacity(); + return this; + } + + public CollegeRequest minStudentCapacityAs(String retName){ + super.minStudentCapacityAs(retName); + return this; + } + public CollegeRequest maxStudentCapacity(){ + super.maxStudentCapacity(); + return this; + } + + public CollegeRequest maxStudentCapacityAs(String retName){ + super.maxStudentCapacityAs(retName); + return this; + } + public CollegeRequest sumStudentCapacity(){ + super.sumStudentCapacity(); + return this; + } + + public CollegeRequest sumStudentCapacityAs(String retName){ + super.sumStudentCapacityAs(retName); + return this; + } + public CollegeRequest avgStudentCapacity(){ + super.avgStudentCapacity(); + return this; + } + + public CollegeRequest avgStudentCapacityAs(String retName){ + super.avgStudentCapacityAs(retName); + return this; + } + public CollegeRequest stddevStudentCapacity(){ + super.standardDeviationStudentCapacity(); + return this; + } + + public CollegeRequest stddevStudentCapacityAs(String retName){ + super.standardDeviationStudentCapacityAs(retName); + return this; + } + public CollegeRequest stddev_popStudentCapacity(){ + super.squareRootOfPopulationStandardDeviationStudentCapacity(); + return this; + } + + public CollegeRequest stddev_popStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviationStudentCapacityAs(retName); + return this; + } + public CollegeRequest var_sampStudentCapacity(){ + super.sampleVarianceStudentCapacity(); + return this; + } + + public CollegeRequest var_sampStudentCapacityAs(String retName){ + super.sampleVarianceStudentCapacityAs(retName); + return this; + } + public CollegeRequest var_popStudentCapacity(){ + super.samplePopulationVarianceStudentCapacity(); + return this; + } + + public CollegeRequest var_popStudentCapacityAs(String retName){ + super.samplePopulationVarianceStudentCapacityAs(retName); + return this; + } + public CollegeRequest groupByPlatformWithDetails(){ + super.groupByPlatformWithDetails(); + return this; + } + + public CollegeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + super.groupByPlatformWithDetails(subRequest); + return this; + } + + public CollegeRequest groupBySchoolTypeWithDetails(){ + super.groupBySchoolTypeWithDetails(); + return this; + } + + public CollegeRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + super.groupBySchoolTypeWithDetails(subRequest); + return this; + } + + + + + + public CollegeRequest countDistinctDegreeLevel(){ + return countDistinctDegreeLevelAs("degree_level_distinct_count"); + } + + public CollegeRequest countDistinctDegreeLevelAs(String alias){ + super.countDistinctProperty(alias, College.DEGREE_LEVEL_PROPERTY); + return this; + } + public CollegeRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public CollegeRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, College.PLATFORM_PROPERTY); + return this; + } + public CollegeRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public CollegeRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, College.SCHOOL_TYPE_PROPERTY); + return this; + } + public CollegeRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public CollegeRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, College.NAME_PROPERTY); + return this; + } + public CollegeRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public CollegeRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, College.STUDENT_CAPACITY_PROPERTY); + return this; + } + public CollegeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CollegeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, College.VERSION_PROPERTY); + return this; + } + public CollegeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CollegeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, College.ID_PROPERTY); + return this; + } + + public CollegeRequest groupByDegreeLevel(){ + groupBy(College.DEGREE_LEVEL_PROPERTY); + return this; + } + + public CollegeRequest groupByDegreeLevelAs(String retName){ + groupBy(retName, College.DEGREE_LEVEL_PROPERTY); + return this; + } + + public CollegeRequest groupByDegreeLevelWithFunction(String retName, AggrFunction function){ + groupBy(retName, College.DEGREE_LEVEL_PROPERTY, function); + return this; + } + + + public CollegeRequest groupByPlatformWith(PlatformRequest subRequest){ + super.groupByPlatformWith(subRequest); + return this; + } + public CollegeRequest groupByPlatform(){ + super.groupByPlatform(); + return this; + } + + public CollegeRequest groupByPlatformAs(String retName){ + super.groupByPlatformAs(retName); + return this; + } + + public CollegeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + super.groupByPlatformWithFunction(retName, function); + return this; + } + public CollegeRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + super.groupBySchoolTypeWith(subRequest); + return this; + } + public CollegeRequest groupBySchoolType(){ + super.groupBySchoolType(); + return this; + } + + public CollegeRequest groupBySchoolTypeAs(String retName){ + super.groupBySchoolTypeAs(retName); + return this; + } + + public CollegeRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + super.groupBySchoolTypeWithFunction(retName, function); + return this; + } + + public CollegeRequest groupByName(){ + super.groupByName(); + return this; + } + + public CollegeRequest groupByNameAs(String retName){ + super.groupByNameAs(retName); + return this; + } + + public CollegeRequest groupByNameWithFunction(String retName, AggrFunction function){ + super.groupByNameWithFunction(retName, function); + return this; + } + + public CollegeRequest groupByStudentCapacity(){ + super.groupByStudentCapacity(); + return this; + } + + public CollegeRequest groupByStudentCapacityAs(String retName){ + super.groupByStudentCapacityAs(retName); + return this; + } + + public CollegeRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + super.groupByStudentCapacityWithFunction(retName, function); + return this; + } + + public CollegeRequest groupByVersion(){ + super.groupByVersion(); + return this; + } + + public CollegeRequest groupByVersionAs(String retName){ + super.groupByVersionAs(retName); + return this; + } + + public CollegeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + super.groupByVersionWithFunction(retName, function); + return this; + } + + public CollegeRequest groupById(){ + super.groupById(); + return this; + } + + public CollegeRequest groupByIdAs(String retName){ + super.groupByIdAs(retName); + return this; + } + + public CollegeRequest groupByIdWithFunction(String retName, AggrFunction function){ + super.groupByIdWithFunction(retName, function); + return this; + } + + public CollegeRequest orderByDegreeLevelAscending(){ + addOrderByAscending(College.DEGREE_LEVEL_PROPERTY); + return this; + } + + public CollegeRequest orderByDegreeLevelDescending(){ + addOrderByDescending(College.DEGREE_LEVEL_PROPERTY); + return this; + } + public CollegeRequest orderByDegreeLevelAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(College.DEGREE_LEVEL_PROPERTY); + return this; + } + + public CollegeRequest orderByDegreeLevelDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(College.DEGREE_LEVEL_PROPERTY); + return this; + } + public CollegeRequest orderByPlatformAscending(){ + super.orderByPlatformAscending(); + return this; + } + + public CollegeRequest orderByPlatformDescending(){ + super.orderByPlatformDescending(); + return this; + } + + public CollegeRequest orderBySchoolTypeAscending(){ + super.orderBySchoolTypeAscending(); + return this; + } + + public CollegeRequest orderBySchoolTypeDescending(){ + super.orderBySchoolTypeDescending(); + return this; + } + + public CollegeRequest orderByNameAscending(){ + super.orderByNameAscending(); + return this; + } + + public CollegeRequest orderByNameDescending(){ + super.orderByNameDescending(); + return this; + } + public CollegeRequest orderByNameAscendingUsingGBK(){ + super.orderByNameAscendingUsingGBK(); + return this; + } + + public CollegeRequest orderByNameDescendingUsingGBK(){ + super.orderByNameDescendingUsingGBK(); + return this; + } + public CollegeRequest orderByStudentCapacityAscending(){ + super.orderByStudentCapacityAscending(); + return this; + } + + public CollegeRequest orderByStudentCapacityDescending(){ + super.orderByStudentCapacityDescending(); + return this; + } + + public CollegeRequest orderByVersionAscending(){ + super.orderByVersionAscending(); + return this; + } + + public CollegeRequest orderByVersionDescending(){ + super.orderByVersionDescending(); + return this; + } + + public CollegeRequest orderByIdAscending(){ + super.orderByIdAscending(); + return this; + } + + public CollegeRequest orderByIdDescending(){ + super.orderByIdDescending(); + return this; + } + + + + + + /** + * get topN records + * @param topN records number + */ + public CollegeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CollegeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CollegeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CollegeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CollegeRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CollegeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java new file mode 100644 index 000000000..db2a9a7ca --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java @@ -0,0 +1,173 @@ + +package com.example.inheritancematchingservice.platform; + +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "fb6f885aa255ea9a640abdacbfd75ce6a8def1126fdd5125a9de45c533c26d44"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_type_list", "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String BASE_URL_PROPERTY = "base_url"; + public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + private String name; + + private String baseUrl; + + private SmartList schoolTypeList; + private SmartList schoolList; + + public String getName(){ + return this.name; + } + + public String getBaseUrl(){ + return this.baseUrl; + } + + public SmartList getSchoolTypeList(){ + return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; + } + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform updateBaseUrl(String baseUrl){ + baseUrl = (baseUrl == null ? null : baseUrl.trim()); + if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ + return this; + } + handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); + this.baseUrl = baseUrl; + return this; + } + + public Platform addSchoolType(SchoolType schoolType){ + if (schoolType == null){ + return this; + } + + if(null == this.schoolTypeList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolTypeList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolTypeList.add(schoolType); + schoolType.updatePlatform(this); + return this; + } + public Platform addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; + + case "school_type_list": this.schoolTypeList = (SmartList) value; break; + case "school_list": this.schoolList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "base_url": return this.baseUrl; + case "school_type_list": return this.schoolTypeList; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "baseUrl": return this.baseUrl; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java new file mode 100644 index 000000000..da7313686 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java @@ -0,0 +1,70 @@ + +package com.example.inheritancematchingservice.platform; + +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolChecker; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + }else if(platform.updateItem()){ + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("base_url")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); + for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ + SchoolType schoolType = platform.getSchoolTypeList().get(i); + new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); + } + for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ + School school = platform.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, baseUrl); + if((baseUrl == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, baseUrl); + + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java new file mode 100644 index 000000000..739be6bf5 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java @@ -0,0 +1,66 @@ + +package com.example.inheritancematchingservice.platform; + +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolListExpression; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public Expression getBaseUrl(){ + return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); + } + public PlatformExpression updateBaseUrl(String baseUrl){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); + } + + public SchoolTypeListExpression getSchoolTypeList(){ + return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); + } + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); + } + public PlatformExpression addSchoolType(SchoolType schoolType){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); + } + public PlatformExpression addSchool(School school){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..7722b7b89 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.inheritancematchingservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java new file mode 100644 index 000000000..97090dd96 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java @@ -0,0 +1,980 @@ + +package com.example.inheritancematchingservice.platform; + +import com.example.inheritancematchingservice.Q; +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolRequest; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectBaseUrl().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.BASE_URL_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectBaseUrl().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectSchoolTypeList().selectSchoolList(); + return selectId().selectName().selectBaseUrl().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectBaseUrl(){ + selectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + + /** + * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectBaseUrl(){ + unselectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectSchoolTypeList(){ + return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); + } + + public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ + enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByBaseUrl(String... baseUrl){ + if (baseUrl == null || baseUrl.length == 0) { + throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); + } + return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); + } + + public PlatformRequest withBaseUrl(Operator operator, Object... values){ + return appendSearchCriteria(createBaseUrlCriteria(operator, values)); + } + + public PlatformRequest withBaseUrlIsUnknown(){ + return withBaseUrl(Operator.IS_NULL); + } + + public PlatformRequest withBaseUrlIsKnown(){ + return withBaseUrl(Operator.IS_NOT_NULL); + } + + public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); + } + + public PlatformRequest withBaseUrlIsNot(String baseUrl){ + return withBaseUrl(Operator.NOT_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlIn(String... baseUrl){ + return withBaseUrl(Operator.IN, (Object[])baseUrl); + } + + public PlatformRequest withBaseUrlNotIn(String... baseUrl){ + return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); + } + public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlLessThan(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ + return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); + } + public PlatformRequest withBaseUrlStartingWith(String baseUrl){ + return withBaseUrl(Operator.BEGIN_WITH, baseUrl); + } + public PlatformRequest withBaseUrlContaining(String baseUrl){ + return withBaseUrl(Operator.CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotContaining(String baseUrl){ + return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlEndingWith(String baseUrl){ + return withBaseUrl(Operator.END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlIs(String baseUrl){ + return withBaseUrl(Operator.EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ + return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); + } + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchoolTypes(){ + return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + + public PlatformRequest haveNoSchoolTypes(){ + return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public PlatformRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctBaseUrl(){ + return countDistinctBaseUrlAs("base_url_distinct_count"); + } + + public PlatformRequest countDistinctBaseUrlAs(String alias){ + super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ + aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByBaseUrl(){ + groupBy(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlAs(String retName){ + groupBy(retName, Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.BASE_URL_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscending(){ + addOrderByAscending(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescending(){ + addOrderByDescending(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest countSchoolTypes(){ + addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesAs(String name){ + addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ + addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/School.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/School.java new file mode 100644 index 000000000..9d4e5bdcc --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/School.java @@ -0,0 +1,184 @@ + +package com.example.inheritancematchingservice.school; + +import com.example.inheritancematchingservice.Constants; +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class School extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "School"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "23ce18d8c80d8d15fa2363ed814bde7c8f04861a2547ac0a722514c1626da577"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + School.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String SCHOOL_TYPE_PROPERTY = "school_type"; + public static final String NAME_PROPERTY = "name"; + public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; + private Platform platform; + + private SchoolType schoolType; + + private String name; + + private Integer studentCapacity; + + + public Platform getPlatform(){ + return this.platform; + } + + public SchoolType getSchoolType(){ + return this.schoolType; + } + + public String getName(){ + return this.name; + } + + public Integer getStudentCapacity(){ + return this.studentCapacity; + } + + public School updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + protected School updateSchoolType(SchoolType schoolType){ + if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ + return this; + } + handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); + this.schoolType = schoolType; + return this; + } + + public School updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public School updateStudentCapacity(Integer studentCapacity){ + if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ + return this; + } + handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); + this.studentCapacity = studentCapacity; + return this; + } + + public boolean isSchoolTypePrimary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); + } + + public School updateSchoolTypeToPrimary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); + } + public boolean isSchoolTypeSecondary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); + } + + public School updateSchoolTypeToSecondary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); + } + + public static School refer(Long id){ + School refer = new School(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public School comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "school_type": this.schoolType = (SchoolType) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "student_capacity": this.studentCapacity = (Integer) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "school_type": return this.schoolType; + case "name": return this.name; + case "student_capacity": return this.studentCapacity; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "schoolType": return this.schoolType; + case "name": return this.name; + case "studentCapacity": return this.studentCapacity; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java new file mode 100644 index 000000000..a78eb9f31 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java @@ -0,0 +1,82 @@ + +package com.example.inheritancematchingservice.school; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformChecker; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SchoolChecker implements Checker{ + + public String type(){ + return School.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ + if(needCheck(_context, school)){ + markAsChecked(_context, school); + doCheck(_context, school, _parentLocation); + } + } + + public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ + if((school == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, school); + if(school.needPersist()){ + } + if(school.newItem()){ + }else if(school.updateItem()){ + if(!school.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("school_type")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("student_capacity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); + checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, schoolType); + if((schoolType == null)){ + return; + } + new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, studentCapacity); + if((studentCapacity == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java new file mode 100644 index 000000000..a61cc398d --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java @@ -0,0 +1,73 @@ + +package com.example.inheritancematchingservice.school; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformExpression; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolExpression(Expression expression){ + super(expression); + } + + public SchoolExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolExpression updateId(Long id){ + return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); + } + + public SchoolExpression save(UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolExpression save(String intent, UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); + } + + public SchoolExpression updatePlatform(Platform platform){ + return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); + } + + public SchoolTypeExpression getSchoolType(){ + return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); + } + + public SchoolExpression updateSchoolTypeToPrimary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); + } + public SchoolExpression updateSchoolTypeToSecondary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); + } + + public Expression getName(){ + return loaded("name", "getName", School::getName); + } + public SchoolExpression updateName(String name){ + return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); + } + + public Expression getStudentCapacity(){ + return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); + } + public SchoolExpression updateStudentCapacity(Integer studentCapacity){ + return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java new file mode 100644 index 000000000..0756f9a1c --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java @@ -0,0 +1,25 @@ + +package com.example.inheritancematchingservice.school; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolListExpression extends SmartListExpression { + public SchoolListExpression(Expression> expression){ + super(expression); + } + + public SchoolListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolExpression first() { + return new SchoolExpression(super.first()); + } + + public SchoolExpression get(int index) { + return new SchoolExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java new file mode 100644 index 000000000..689122a2a --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java @@ -0,0 +1,1046 @@ + +package com.example.inheritancematchingservice.school; + +import cn.hutool.core.util.ObjectUtil; +import com.example.inheritancematchingservice.Q; +import com.example.inheritancematchingservice.academy.Academy; +import com.example.inheritancematchingservice.college.College; +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformRequest; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +public class SchoolRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolRequest(Class returnType){ + this(returnType, () -> (T) new School()); + } + + protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolRequest copy(){ + return (SchoolRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolRequest matchingAnyOf(SchoolRequest... schools){ + if(ObjectUtil.isEmpty(schools)){ + return this; + } + List l = new ArrayList(); + for(SchoolRequest school:schools){ + l.add(new SubQuerySearchCriteria(School.ID_PROPERTY, school, School.ID_PROPERTY)); + } + return appendSearchCriteria(SearchCriteria.or(l.toArray(new SearchCriteria[l.size()]))); + } + + public SchoolRequest enhanceChild(SchoolRequest school){ + super.enhanceSelf(school); + return this; + } + public SchoolRequest matchingIdsOf(SchoolRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + School.ID_PROPERTY, request, School.ID_PROPERTY)); + } + + public SchoolRequest enhanceChildrenIfNeeded(){ + this.enhanceChild( +Q.academiesWithChildren() +).enhanceChild( +new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).unlimited().selectSelfWithoutParent() +); + return this; + } + + public SchoolRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectStudentCapacity().selectVersion(); + } + + public SchoolRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(School.ID_PROPERTY); + selectProperty(School.PLATFORM_PROPERTY); + selectProperty(School.SCHOOL_TYPE_PROPERTY); + selectProperty(School.NAME_PROPERTY); + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + selectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectSchoolType().selectName().selectStudentCapacity().selectVersion(); + } + + public SchoolRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectSchoolType().selectName().selectStudentCapacity().selectVersion(); + } + + + public SchoolRequest selectId(){ + selectProperty(School.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectId(){ + unselectProperty(School.ID_PROPERTY); + return this; + } + public SchoolRequest selectPlatformIdOnly(){ + selectProperty(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(School.PLATFORM_PROPERTY); + enhanceRelation(School.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); + return this; + } + + public SchoolRequest unselectPlatform(){ + unselectProperty(School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest selectSchoolTypeIdOnly(){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest selectSchoolType(){ + return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); + } + + public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + public SchoolRequest unselectSchoolType(){ + unselectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest selectName(){ + selectProperty(School.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectName(){ + unselectProperty(School.NAME_PROPERTY); + return this; + } + public SchoolRequest selectStudentCapacity(){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); + return this; + } + + + public SchoolRequest unselectStudentCapacity(){ + unselectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest selectVersion(){ + selectProperty(School.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectVersion(){ + unselectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest isAcademy(){ + return matchTypes(Academy.INTERNAL_TYPE); + } + public SchoolRequest isCollege(){ + return matchTypes(College.INTERNAL_TYPE); + } + + public SchoolRequest matchTypes(String... types){ + super.matchType(types); + return this; + } + + public SchoolRequest withTypeGroup(){ + super.withTypeGroup(); + return this; + } + + public SchoolRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); + } + + public SchoolRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); + } + + public SchoolRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolRequest filterBySchoolType(SchoolType... schoolType){ + if (schoolType == null || schoolType.length == 0) { + throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); + } + return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); + } + + public SchoolRequest withSchoolType(Operator operator, Object... values){ + return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); + } + + public SchoolRequest withSchoolTypeIsUnknown(){ + return withSchoolType(Operator.IS_NULL); + } + + public SchoolRequest withSchoolTypeIsKnown(){ + return withSchoolType(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); + } + + public SchoolRequest filterBySchoolType(Long schoolType){ + if(schoolType == null){ + return this; + } + return withSchoolType(Operator.EQUAL, schoolType); + } + public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); + } + + public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); + } + + public SchoolRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); + } + + public SchoolRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ + if (studentCapacity == null || studentCapacity.length == 0) { + throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); + } + return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); + } + + public SchoolRequest withStudentCapacity(Operator operator, Object... values){ + return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); + } + + public SchoolRequest withStudentCapacityIsUnknown(){ + return withStudentCapacity(Operator.IS_NULL); + } + + public SchoolRequest withStudentCapacityIsKnown(){ + return withStudentCapacity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); + } + + public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ + return withStudentCapacity(Operator.EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ + return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.IN, (Object[])studentCapacity); + } + + public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); + } + public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); + } + + + + public SchoolRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); + } + + public SchoolRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SchoolRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolRequest minStudentCapacity(){ + return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest minStudentCapacityAs(String retName){ + super.min(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest maxStudentCapacity(){ + return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest maxStudentCapacityAs(String retName){ + super.max(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sumStudentCapacity(){ + return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sumStudentCapacityAs(String retName){ + super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest avgStudentCapacity(){ + return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest avgStudentCapacityAs(String retName){ + super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest standardDeviationStudentCapacity(){ + return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest standardDeviationStudentCapacityAs(String retName){ + super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ + return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sampleVarianceStudentCapacity(){ + return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ + super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest samplePopulationVarianceStudentCapacity(){ + return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ + super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(School.PLATFORM_PROPERTY, subRequest); + return this; + } + + public SchoolRequest groupBySchoolTypeWithDetails(){ + return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); + } + + public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); + return this; + } + + + + + public SchoolRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, School.ID_PROPERTY); + return this; + } + public SchoolRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public SchoolRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, School.NAME_PROPERTY); + return this; + } + public SchoolRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public SchoolRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupById(){ + groupBy(School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdAs(String retName){ + groupBy(retName, School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ID_PROPERTY, function); + return this; + } + public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(School.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolRequest groupByPlatform(){ + groupBy(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformAs(String retName){ + groupBy(retName, School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.PLATFORM_PROPERTY, function); + return this; + } + public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); + return this; + } + public SchoolRequest groupBySchoolType(){ + groupBy(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeAs(String retName){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByName(){ + groupBy(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameAs(String retName){ + groupBy(retName, School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.NAME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByStudentCapacity(){ + groupBy(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityAs(String retName){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); + return this; + } + + public SchoolRequest groupByVersion(){ + groupBy(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionAs(String retName){ + groupBy(retName, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.VERSION_PROPERTY, function); + return this; + } + + public SchoolRequest withSchoolTypeIsPrimary(){ + filterBySchoolType(com.example.inheritancematchingservice.Constants.SCHOOL_TYPE_PRIMARY); + return this; + } + + + public SchoolRequest withSchoolTypeIsSecondary(){ + filterBySchoolType(com.example.inheritancematchingservice.Constants.SCHOOL_TYPE_SECONDARY); + return this; + } + + + + + public SchoolRequest orderByIdAscending(){ + addOrderByAscending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByIdDescending(){ + addOrderByDescending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformAscending(){ + addOrderByAscending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformDescending(){ + addOrderByDescending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeAscending(){ + addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeDescending(){ + addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderByNameAscending(){ + addOrderByAscending(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescending(){ + addOrderByDescending(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByStudentCapacityAscending(){ + addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityDescending(){ + addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionAscending(){ + addOrderByAscending(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionDescending(){ + addOrderByDescending(School.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + public SchoolTypeRequest rollUpToSchoolType(){ + SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); + this.internalRollUpTo("school_type", schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); + return schoolType; + } + + + + + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); + return this; + } + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ + return facetBySchoolTypeAs(facetName, schoolType, true); + } + + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ + addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java new file mode 100644 index 000000000..87ead0675 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java @@ -0,0 +1,172 @@ + +package com.example.inheritancematchingservice.schooltype; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.school.School; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SchoolType extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SchoolType"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "595b434cfd28e9e4b60604e6092f6b709bf97fbb85753ad9f93443a203ae2e25"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String CODE_PROPERTY = "code"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + private Platform platform; + + private String name; + + private String code; + + private SmartList schoolList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public String getCode(){ + return this.code; + } + + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public SchoolType updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public SchoolType updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public SchoolType updateCode(String code){ + code = (code == null ? null : code.trim()); + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ + return this; + } + handleUpdate(CODE_PROPERTY, getCode(), code); + this.code = code; + return this; + } + + public SchoolType addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); + return this; + } + + public static SchoolType refer(Long id){ + SchoolType refer = new SchoolType(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SchoolType comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "code": this.code = (value == null ? null : ((String)value).trim()); break; + + case "school_list": this.schoolList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java new file mode 100644 index 000000000..96466d7ed --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java @@ -0,0 +1,77 @@ + +package com.example.inheritancematchingservice.schooltype; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformChecker; +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SchoolTypeChecker implements Checker{ + + public String type(){ + return SchoolType.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if(needCheck(_context, schoolType)){ + markAsChecked(_context, schoolType); + doCheck(_context, schoolType, _parentLocation); + } + } + + public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if((schoolType == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, schoolType); + if(schoolType.needPersist()){ + } + if(schoolType.newItem()){ + }else if(schoolType.updateItem()){ + if(!schoolType.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); + for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ + School school = schoolType.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); + if((code == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, code); + + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java new file mode 100644 index 000000000..493934427 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java @@ -0,0 +1,68 @@ + +package com.example.inheritancematchingservice.schooltype; + +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformExpression; +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolTypeExpression(Expression expression){ + super(expression); + } + + public SchoolTypeExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolTypeExpression updateId(Long id){ + return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); + } + + public SchoolTypeExpression save(UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolTypeExpression save(String intent, UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); + } + + public SchoolTypeExpression updatePlatform(Platform platform){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", SchoolType::getName); + } + public SchoolTypeExpression updateName(String name){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); + } + + public Expression getCode(){ + return loaded("code", "getCode", SchoolType::getCode); + } + public SchoolTypeExpression updateCode(String code){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); + } + + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); + } + public SchoolTypeExpression addSchool(School school){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java new file mode 100644 index 000000000..1d5de85df --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.inheritancematchingservice.schooltype; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolTypeListExpression extends SmartListExpression { + public SchoolTypeListExpression(Expression> expression){ + super(expression); + } + + public SchoolTypeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolTypeExpression first() { + return new SchoolTypeExpression(super.first()); + } + + public SchoolTypeExpression get(int index) { + return new SchoolTypeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java new file mode 100644 index 000000000..82c7b7e0f --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java @@ -0,0 +1,1052 @@ + +package com.example.inheritancematchingservice.schooltype; + +import com.example.inheritancematchingservice.Q; +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformRequest; +import com.example.inheritancematchingservice.school.School; +import com.example.inheritancematchingservice.school.SchoolRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SchoolTypeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolTypeRequest(Class returnType){ + this(returnType, () -> (T) new SchoolType()); + } + + protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolTypeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolTypeRequest copy(){ + return (SchoolTypeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolTypeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolTypeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolTypeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolTypeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolTypeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ + super.internalMatchAny(schoolType); + return this; + } + + public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); + } + + public SchoolTypeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolTypeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolTypeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolTypeRequest selectSelf(){ + super.selectSelf(); + return selectPlatformIdOnly().selectId().selectName().selectCode().selectVersion(); + } + + public SchoolTypeRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolTypeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolType.PLATFORM_PROPERTY); + selectProperty(SchoolType.ID_PROPERTY); + selectProperty(SchoolType.NAME_PROPERTY); + selectProperty(SchoolType.CODE_PROPERTY); + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest selectAll(){ + super.selectAll(); + return selectPlatform().selectId().selectName().selectCode().selectVersion(); + } + + public SchoolTypeRequest selectChildren(){ + super.selectAny(); + selectSchoolList(); + return selectPlatform().selectId().selectName().selectCode().selectVersion(); + } + + + public SchoolTypeRequest selectPlatformIdOnly(){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + public SchoolTypeRequest unselectPlatform(){ + unselectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest selectId(){ + selectProperty(SchoolType.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectId(){ + unselectProperty(SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest selectName(){ + selectProperty(SchoolType.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectName(){ + unselectProperty(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest selectCode(){ + selectProperty(SchoolType.CODE_PROPERTY); + return this; + } + + /** + * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectCode(){ + unselectProperty(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest selectVersion(){ + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectVersion(){ + unselectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolTypeRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolTypeRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolTypeRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); + } + + public SchoolTypeRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolTypeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); + } + + public SchoolTypeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolTypeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolTypeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolTypeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolTypeRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolTypeRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolTypeRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolTypeRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); + } + + public SchoolTypeRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolTypeRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolTypeRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolTypeRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolTypeRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolTypeRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolTypeRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolTypeRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolTypeRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolTypeRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolTypeRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolTypeRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolTypeRequest filterByCode(String... code){ + if (code == null || code.length == 0) { + throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); + } + return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); + } + + public SchoolTypeRequest withCode(Operator operator, Object... values){ + return appendSearchCriteria(createCodeCriteria(operator, values)); + } + + public SchoolTypeRequest withCodeIsUnknown(){ + return withCode(Operator.IS_NULL); + } + + public SchoolTypeRequest withCodeIsKnown(){ + return withCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); + } + + public SchoolTypeRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public SchoolTypeRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public SchoolTypeRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } + public SchoolTypeRequest withCodeGreaterThan(String code){ + return withCode(Operator.GREATER_THAN, code); + } + + public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ + return withCode(Operator.GREATER_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeLessThan(String code){ + return withCode(Operator.LESS_THAN, code); + } + + public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ + return withCode(Operator.LESS_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ + return withCode(Operator.BETWEEN, startOfCode, endOfCode); + } + public SchoolTypeRequest withCodeStartingWith(String code){ + return withCode(Operator.BEGIN_WITH, code); + } + public SchoolTypeRequest withCodeContaining(String code){ + return withCode(Operator.CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + + public SchoolTypeRequest withCodeEndingWith(String code){ + return withCode(Operator.END_WITH, code); + } + + public SchoolTypeRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + + public SchoolTypeRequest withCodeIs(String code){ + return withCode(Operator.EQUAL, code); + } + + public SchoolTypeRequest withCodeSoundingLike(String code){ + return withCode(Operator.SOUNDS_LIKE, code); + } + + + + public SchoolTypeRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolTypeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolTypeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolTypeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); + } + + public SchoolTypeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolTypeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolTypeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolTypeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolTypeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); + } + + public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); + } + + public SchoolTypeRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolTypeRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolTypeRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + public SchoolTypeRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolTypeRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolTypeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolTypeRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public SchoolTypeRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolTypeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + + public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolTypeRequest groupByPlatform(){ + groupBy(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformAs(String retName){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupById(){ + groupBy(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdAs(String retName){ + groupBy(retName, SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.ID_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByName(){ + groupBy(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameAs(String retName){ + groupBy(retName, SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.NAME_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByCode(){ + groupBy(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeAs(String retName){ + groupBy(retName, SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.CODE_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByVersion(){ + groupBy(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionAs(String retName){ + groupBy(retName, SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.VERSION_PROPERTY, function); + return this; + } + + + + public SchoolTypeRequest orderByPlatformAscending(){ + addOrderByAscending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByPlatformDescending(){ + addOrderByDescending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdAscending(){ + addOrderByAscending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdDescending(){ + addOrderByDescending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameAscending(){ + addOrderByAscending(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescending(){ + addOrderByDescending(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscending(){ + addOrderByAscending(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescending(){ + addOrderByDescending(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByVersionAscending(){ + addOrderByAscending(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionDescending(){ + addOrderByDescending(SchoolType.VERSION_PROPERTY); + return this; + } + + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + public SchoolTypeRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolTypeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolTypeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolTypeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolTypeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolTypeRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolTypeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java new file mode 100644 index 000000000..cab9db2a2 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java @@ -0,0 +1,137 @@ + +package com.example.inheritancematchingservice.trainingacademy; + +import com.example.inheritancematchingservice.academy.Academy; +import com.example.inheritancematchingservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class TrainingAcademy extends Academy implements RemoteInput { + public static String INTERNAL_TYPE = "TrainingAcademy"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "d5c47f287adcf434556be4564044800fdadd56e6914079eb97fedf380ef46cc2"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("campus_code", 6), java.util.Map.entry("specialty", 7)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "campus_code")), java.util.Map.entry("specialty", java.util.List.of("specialty", "specialty"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + TrainingAcademy.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String SPECIALTY_PROPERTY = "specialty"; + private String specialty; + + + public String getSpecialty(){ + return this.specialty; + } + + public TrainingAcademy updateSpecialty(String specialty){ + specialty = (specialty == null ? null : specialty.trim()); + if(isPropertyLoaded(SPECIALTY_PROPERTY) && Objects.equals(this.specialty, specialty)){ + return this; + } + handleUpdate(SPECIALTY_PROPERTY, getSpecialty(), specialty); + this.specialty = specialty; + return this; + } + + public TrainingAcademy updateCampusCode(String campusCode){ + super.updateCampusCode(campusCode); + return this; + } + + public TrainingAcademy updatePlatform(Platform platform){ + super.updatePlatform(platform); + return this; + } + + public TrainingAcademy updateSchoolTypeToPrimary(){ + super.updateSchoolTypeToPrimary(); + return this; + } + public TrainingAcademy updateSchoolTypeToSecondary(){ + super.updateSchoolTypeToSecondary(); + return this; + } + + public TrainingAcademy updateName(String name){ + super.updateName(name); + return this; + } + + public TrainingAcademy updateStudentCapacity(Integer studentCapacity){ + super.updateStudentCapacity(studentCapacity); + return this; + } + + + public static TrainingAcademy refer(Long id){ + TrainingAcademy refer = new TrainingAcademy(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public TrainingAcademy comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "specialty": this.specialty = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "specialty": return this.specialty; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "specialty": return this.specialty; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java new file mode 100644 index 000000000..bc8629f7a --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java @@ -0,0 +1,49 @@ + +package com.example.inheritancematchingservice.trainingacademy; + +import com.example.inheritancematchingservice.academy.AcademyChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class TrainingAcademyChecker implements Checker{ + + public String type(){ + return TrainingAcademy.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, TrainingAcademy trainingAcademy, ObjectLocation _parentLocation){ + if(needCheck(_context, trainingAcademy)){ + markAsChecked(_context, trainingAcademy); + new AcademyChecker().doCheck(_context, trainingAcademy, _parentLocation); + + doCheck(_context, trainingAcademy, _parentLocation); + } + } + + public void doCheck(UserContext _context, TrainingAcademy trainingAcademy, ObjectLocation _parentLocation){ + if((trainingAcademy == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, trainingAcademy); + if(trainingAcademy.needPersist()){ + } + if(trainingAcademy.newItem()){ + }else if(trainingAcademy.updateItem()){ + if(!trainingAcademy.isPropertyLoaded("specialty")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "specialty"), "Mutation requires a fully loaded entity"); + } + + } + checkSpecialty(_context, trainingAcademy.getProperty(TrainingAcademy.SPECIALTY_PROPERTY), newLocation(_parentLocation, "specialty")); + } + + public void checkSpecialty(UserContext _context, String specialty, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, specialty); + if((specialty == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, specialty); + + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java new file mode 100644 index 000000000..2a61e8419 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java @@ -0,0 +1,43 @@ + +package com.example.inheritancematchingservice.trainingacademy; + +import com.example.inheritancematchingservice.academy.AcademyExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import java.util.function.Function; + +public class TrainingAcademyExpression extends AcademyExpression implements BaseEntityExpression { + public TrainingAcademyExpression(Expression expression){ + super(expression); + } + + public TrainingAcademyExpression(Expression expression, Function function){ + super(expression, function); + } + + public TrainingAcademyExpression updateId(Long id){ + return new TrainingAcademyExpression(this, $it -> {((TrainingAcademy)$it).__internalSet("id", id); return this;}); + } + + public TrainingAcademyExpression save(UserContext userContext){ + return new TrainingAcademyExpression(this, $it -> ((TrainingAcademy)$it).auditAs("Saved by Expression").save(userContext)); + } + + public TrainingAcademyExpression save(String intent, UserContext userContext){ + return new TrainingAcademyExpression(this, $it -> ((TrainingAcademy)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getSpecialty(){ + return loaded("specialty", "getSpecialty", TrainingAcademy::getSpecialty); + } + public TrainingAcademyExpression updateSpecialty(String specialty){ + return new TrainingAcademyExpression(this, $it -> ((TrainingAcademy)$it).updateSpecialty(specialty)); + } + +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java new file mode 100644 index 000000000..f96108cb3 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java @@ -0,0 +1,25 @@ + +package com.example.inheritancematchingservice.trainingacademy; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class TrainingAcademyListExpression extends SmartListExpression { + public TrainingAcademyListExpression(Expression> expression){ + super(expression); + } + + public TrainingAcademyListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public TrainingAcademyExpression first() { + return new TrainingAcademyExpression(super.first()); + } + + public TrainingAcademyExpression get(int index) { + return new TrainingAcademyExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java new file mode 100644 index 000000000..511589548 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java @@ -0,0 +1,1024 @@ + +package com.example.inheritancematchingservice.trainingacademy; + +import com.example.inheritancematchingservice.academy.AcademyRequest; +import com.example.inheritancematchingservice.platform.Platform; +import com.example.inheritancematchingservice.platform.PlatformRequest; +import com.example.inheritancematchingservice.schooltype.SchoolType; +import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class TrainingAcademyRequest extends AcademyRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public TrainingAcademyRequest(Class returnType){ + this(returnType, () -> (T) new TrainingAcademy()); + } + + protected TrainingAcademyRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public TrainingAcademyRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public TrainingAcademyRequest copy(){ + return (TrainingAcademyRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new TrainingAcademyRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public TrainingAcademyRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public TrainingAcademyRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public TrainingAcademyRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public TrainingAcademyRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public TrainingAcademyRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public TrainingAcademyRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public TrainingAcademyRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public TrainingAcademyRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public TrainingAcademyRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public TrainingAcademyRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (TrainingAcademyRequest)super.appendSearchCriteria(searchCriteria); + } + + public TrainingAcademyRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public TrainingAcademyRequest matchingAnyOf(TrainingAcademyRequest trainingAcademy){ + super.internalMatchAny(trainingAcademy); + return this; + } + + public TrainingAcademyRequest matchingIdsOf(TrainingAcademyRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + TrainingAcademy.ID_PROPERTY, request, TrainingAcademy.ID_PROPERTY)); + } + + public TrainingAcademyRequest enhanceChildrenIfNeeded(){ + return this; + } + + public TrainingAcademyRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public TrainingAcademyRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public TrainingAcademyRequest selectSelf(){ + super.selectSelf(); + return selectSpecialty(); + } + + public TrainingAcademyRequest selectSelfFields(){ + return selectSelf(); + } + + public TrainingAcademyRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + + public TrainingAcademyRequest selectAll(){ + super.selectAll(); + return selectSpecialty(); + } + + public TrainingAcademyRequest selectChildren(){ + super.selectAny(); + return selectSpecialty(); + } + + + public TrainingAcademyRequest selectSpecialty(){ + selectProperty(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + + /** + * fill the specialty with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS specialty) to fetch specialty property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TrainingAcademyRequest unselectSpecialty(){ + unselectProperty(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + public TrainingAcademyRequest selectCampusCode(){ + super.selectCampusCode(); + return this; + } + + /** + * fill the campusCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS campusCode) to fetch campusCode property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TrainingAcademyRequest unselectCampusCode(){ + super.unselectCampusCode(); + return this; + } + public TrainingAcademyRequest selectPlatformIdOnly(){ + super.selectPlatformIdOnly(); + return this; + } + + public TrainingAcademyRequest selectPlatform(){ + super.selectPlatform(); + return this; + } + + public TrainingAcademyRequest selectPlatformWith(PlatformRequest platform){ + super.selectPlatformWith(platform); + return this; + } + + public TrainingAcademyRequest unselectPlatform(){ + super.unselectPlatform(); + return this; + } + public TrainingAcademyRequest selectSchoolTypeIdOnly(){ + super.selectSchoolTypeIdOnly(); + return this; + } + + public TrainingAcademyRequest selectSchoolType(){ + super.selectSchoolType(); + return this; + } + + public TrainingAcademyRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + super.selectSchoolTypeWith(schoolType); + return this; + } + + public TrainingAcademyRequest unselectSchoolType(){ + super.unselectSchoolType(); + return this; + } + public TrainingAcademyRequest selectName(){ + super.selectName(); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TrainingAcademyRequest unselectName(){ + super.unselectName(); + return this; + } + public TrainingAcademyRequest selectStudentCapacity(){ + super.selectStudentCapacity(); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public TrainingAcademyRequest selectStudentCapacity(AggrFunction aggrFunction){ + super.selectStudentCapacity(aggrFunction); + return this; + } + + + public TrainingAcademyRequest unselectStudentCapacity(){ + super.unselectStudentCapacity(); + return this; + } + public TrainingAcademyRequest selectVersion(){ + super.selectVersion(); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TrainingAcademyRequest unselectVersion(){ + super.unselectVersion(); + return this; + } + public TrainingAcademyRequest selectId(){ + super.selectId(); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public TrainingAcademyRequest unselectId(){ + super.unselectId(); + return this; + } + + public TrainingAcademyRequest filterBySpecialty(String... specialty){ + if (specialty == null || specialty.length == 0) { + throw new IllegalArgumentException("filterBySpecialty parameter specialty cannot be empty"); + } + return appendSearchCriteria(createSpecialtyCriteria(Operator.EQUAL, (Object[])specialty)); + } + + public TrainingAcademyRequest withSpecialty(Operator operator, Object... values){ + return appendSearchCriteria(createSpecialtyCriteria(operator, values)); + } + + public TrainingAcademyRequest withSpecialtyIsUnknown(){ + return withSpecialty(Operator.IS_NULL); + } + + public TrainingAcademyRequest withSpecialtyIsKnown(){ + return withSpecialty(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSpecialtyCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(TrainingAcademy.SPECIALTY_PROPERTY, operator, values); + } + + public TrainingAcademyRequest withSpecialtyIsNot(String specialty){ + return withSpecialty(Operator.NOT_EQUAL, specialty); + } + + public TrainingAcademyRequest withSpecialtyIn(String... specialty){ + return withSpecialty(Operator.IN, (Object[])specialty); + } + + public TrainingAcademyRequest withSpecialtyNotIn(String... specialty){ + return withSpecialty(Operator.NOT_IN, (Object[])specialty); + } + public TrainingAcademyRequest withSpecialtyGreaterThan(String specialty){ + return withSpecialty(Operator.GREATER_THAN, specialty); + } + + public TrainingAcademyRequest withSpecialtyGreaterThanOrEqualTo(String specialty){ + return withSpecialty(Operator.GREATER_THAN_OR_EQUAL, specialty); + } + + public TrainingAcademyRequest withSpecialtyLessThan(String specialty){ + return withSpecialty(Operator.LESS_THAN, specialty); + } + + public TrainingAcademyRequest withSpecialtyLessThanOrEqualTo(String specialty){ + return withSpecialty(Operator.LESS_THAN_OR_EQUAL, specialty); + } + + public TrainingAcademyRequest withSpecialtyBetween(String startOfSpecialty, String endOfSpecialty){ + return withSpecialty(Operator.BETWEEN, startOfSpecialty, endOfSpecialty); + } + public TrainingAcademyRequest withSpecialtyStartingWith(String specialty){ + return withSpecialty(Operator.BEGIN_WITH, specialty); + } + public TrainingAcademyRequest withSpecialtyContaining(String specialty){ + return withSpecialty(Operator.CONTAIN, specialty); + } + + public TrainingAcademyRequest withSpecialtyNotContaining(String specialty){ + return withSpecialty(Operator.NOT_CONTAIN, specialty); + } + + public TrainingAcademyRequest withSpecialtyNotStartingWith(String specialty){ + return withSpecialty(Operator.NOT_BEGIN_WITH, specialty); + } + + public TrainingAcademyRequest withSpecialtyEndingWith(String specialty){ + return withSpecialty(Operator.END_WITH, specialty); + } + + public TrainingAcademyRequest withSpecialtyNotEndingWith(String specialty){ + return withSpecialty(Operator.NOT_END_WITH, specialty); + } + + public TrainingAcademyRequest withSpecialtyIs(String specialty){ + return withSpecialty(Operator.EQUAL, specialty); + } + + public TrainingAcademyRequest withSpecialtySoundingLike(String specialty){ + return withSpecialty(Operator.SOUNDS_LIKE, specialty); + } + + + + public TrainingAcademyRequest filterByCampusCode(String campusCode){ + return (TrainingAcademyRequest)super.filterByCampusCode(campusCode); + } + + public TrainingAcademyRequest withCampusCode(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withCampusCode(operator, values); + } + + public TrainingAcademyRequest withCampusCodeIsUnknown(){ + return (TrainingAcademyRequest)super.withCampusCodeIsUnknown(); + } + + public TrainingAcademyRequest withCampusCodeIsKnown(){ + return (TrainingAcademyRequest)super.withCampusCodeIsKnown(); + } + + public TrainingAcademyRequest withCampusCodeStartingWith(String CampusCode){ + return (TrainingAcademyRequest)super.withCampusCodeStartingWith(CampusCode); + } + public TrainingAcademyRequest withCampusCodeContaining(String CampusCode){ + return (TrainingAcademyRequest)super.withCampusCodeContaining(CampusCode); + } + + public TrainingAcademyRequest withCampusCodeEndingWith(String CampusCode){ + return (TrainingAcademyRequest)super.withCampusCodeEndingWith(CampusCode); + } + + + public TrainingAcademyRequest filterByPlatform(Platform platform){ + return (TrainingAcademyRequest)super.filterByPlatform(platform); + } + + public TrainingAcademyRequest withPlatform(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withPlatform(operator, values); + } + + public TrainingAcademyRequest withPlatformIsUnknown(){ + return (TrainingAcademyRequest)super.withPlatformIsUnknown(); + } + + public TrainingAcademyRequest withPlatformIsKnown(){ + return (TrainingAcademyRequest)super.withPlatformIsKnown(); + } + + public TrainingAcademyRequest filterByPlatform(Long platform){ + return (TrainingAcademyRequest)super.filterByPlatform(platform); + } + + public TrainingAcademyRequest withPlatformMatching(PlatformRequest platform){ + return (TrainingAcademyRequest)super.withPlatformMatching(platform); + } + + public TrainingAcademyRequest filterBySchoolType(SchoolType schoolType){ + return (TrainingAcademyRequest)super.filterBySchoolType(schoolType); + } + + public TrainingAcademyRequest withSchoolType(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withSchoolType(operator, values); + } + + public TrainingAcademyRequest withSchoolTypeIsUnknown(){ + return (TrainingAcademyRequest)super.withSchoolTypeIsUnknown(); + } + + public TrainingAcademyRequest withSchoolTypeIsKnown(){ + return (TrainingAcademyRequest)super.withSchoolTypeIsKnown(); + } + + public TrainingAcademyRequest filterBySchoolType(Long schoolType){ + return (TrainingAcademyRequest)super.filterBySchoolType(schoolType); + } + + public TrainingAcademyRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return (TrainingAcademyRequest)super.withSchoolTypeMatching(schoolType); + } + + public TrainingAcademyRequest filterByName(String name){ + return (TrainingAcademyRequest)super.filterByName(name); + } + + public TrainingAcademyRequest withName(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withName(operator, values); + } + + public TrainingAcademyRequest withNameIsUnknown(){ + return (TrainingAcademyRequest)super.withNameIsUnknown(); + } + + public TrainingAcademyRequest withNameIsKnown(){ + return (TrainingAcademyRequest)super.withNameIsKnown(); + } + + public TrainingAcademyRequest withNameStartingWith(String Name){ + return (TrainingAcademyRequest)super.withNameStartingWith(Name); + } + public TrainingAcademyRequest withNameContaining(String Name){ + return (TrainingAcademyRequest)super.withNameContaining(Name); + } + + public TrainingAcademyRequest withNameEndingWith(String Name){ + return (TrainingAcademyRequest)super.withNameEndingWith(Name); + } + + + public TrainingAcademyRequest filterByStudentCapacity(Integer studentCapacity){ + return (TrainingAcademyRequest)super.filterByStudentCapacity(studentCapacity); + } + + public TrainingAcademyRequest withStudentCapacity(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withStudentCapacity(operator, values); + } + + public TrainingAcademyRequest withStudentCapacityIsUnknown(){ + return (TrainingAcademyRequest)super.withStudentCapacityIsUnknown(); + } + + public TrainingAcademyRequest withStudentCapacityIsKnown(){ + return (TrainingAcademyRequest)super.withStudentCapacityIsKnown(); + } + + public TrainingAcademyRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return (TrainingAcademyRequest)super.withStudentCapacityGreaterThan(studentCapacity); + } + + public TrainingAcademyRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return (TrainingAcademyRequest)super.withStudentCapacityGreaterThanOrEqualTo(studentCapacity); + } + + public TrainingAcademyRequest withStudentCapacityLessThan(Integer studentCapacity){ + return (TrainingAcademyRequest)super.withStudentCapacityLessThan(studentCapacity); + } + + public TrainingAcademyRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return (TrainingAcademyRequest)super.withStudentCapacityLessThanOrEqualTo(studentCapacity); + } + + public TrainingAcademyRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return (TrainingAcademyRequest)super.withStudentCapacityBetween(startOfStudentCapacity, endOfStudentCapacity); + } + + + public TrainingAcademyRequest filterByVersion(Long version){ + return (TrainingAcademyRequest)super.filterByVersion(version); + } + + public TrainingAcademyRequest withVersion(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withVersion(operator, values); + } + + public TrainingAcademyRequest withVersionIsUnknown(){ + return (TrainingAcademyRequest)super.withVersionIsUnknown(); + } + + public TrainingAcademyRequest withVersionIsKnown(){ + return (TrainingAcademyRequest)super.withVersionIsKnown(); + } + + + public TrainingAcademyRequest withIdIs(Long value){ + return (TrainingAcademyRequest)super.withIdIs(value); + } + + public TrainingAcademyRequest withId(Operator operator, Object... values){ + return (TrainingAcademyRequest)super.withId(operator, values); + } + + + public TrainingAcademyRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public TrainingAcademyRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public TrainingAcademyRequest minStudentCapacity(){ + super.minStudentCapacity(); + return this; + } + + public TrainingAcademyRequest minStudentCapacityAs(String retName){ + super.minStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest maxStudentCapacity(){ + super.maxStudentCapacity(); + return this; + } + + public TrainingAcademyRequest maxStudentCapacityAs(String retName){ + super.maxStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest sumStudentCapacity(){ + super.sumStudentCapacity(); + return this; + } + + public TrainingAcademyRequest sumStudentCapacityAs(String retName){ + super.sumStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest avgStudentCapacity(){ + super.avgStudentCapacity(); + return this; + } + + public TrainingAcademyRequest avgStudentCapacityAs(String retName){ + super.avgStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest stddevStudentCapacity(){ + super.standardDeviationStudentCapacity(); + return this; + } + + public TrainingAcademyRequest stddevStudentCapacityAs(String retName){ + super.standardDeviationStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest stddev_popStudentCapacity(){ + super.squareRootOfPopulationStandardDeviationStudentCapacity(); + return this; + } + + public TrainingAcademyRequest stddev_popStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviationStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest var_sampStudentCapacity(){ + super.sampleVarianceStudentCapacity(); + return this; + } + + public TrainingAcademyRequest var_sampStudentCapacityAs(String retName){ + super.sampleVarianceStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest var_popStudentCapacity(){ + super.samplePopulationVarianceStudentCapacity(); + return this; + } + + public TrainingAcademyRequest var_popStudentCapacityAs(String retName){ + super.samplePopulationVarianceStudentCapacityAs(retName); + return this; + } + public TrainingAcademyRequest groupByPlatformWithDetails(){ + super.groupByPlatformWithDetails(); + return this; + } + + public TrainingAcademyRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + super.groupByPlatformWithDetails(subRequest); + return this; + } + + public TrainingAcademyRequest groupBySchoolTypeWithDetails(){ + super.groupBySchoolTypeWithDetails(); + return this; + } + + public TrainingAcademyRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + super.groupBySchoolTypeWithDetails(subRequest); + return this; + } + + + + + + public TrainingAcademyRequest countDistinctSpecialty(){ + return countDistinctSpecialtyAs("specialty_distinct_count"); + } + + public TrainingAcademyRequest countDistinctSpecialtyAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctCampusCode(){ + return countDistinctCampusCodeAs("campus_code_distinct_count"); + } + + public TrainingAcademyRequest countDistinctCampusCodeAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.CAMPUS_CODE_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public TrainingAcademyRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.PLATFORM_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public TrainingAcademyRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.SCHOOL_TYPE_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public TrainingAcademyRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.NAME_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public TrainingAcademyRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.STUDENT_CAPACITY_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public TrainingAcademyRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.VERSION_PROPERTY); + return this; + } + public TrainingAcademyRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public TrainingAcademyRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, TrainingAcademy.ID_PROPERTY); + return this; + } + + public TrainingAcademyRequest groupBySpecialty(){ + groupBy(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + + public TrainingAcademyRequest groupBySpecialtyAs(String retName){ + groupBy(retName, TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + + public TrainingAcademyRequest groupBySpecialtyWithFunction(String retName, AggrFunction function){ + groupBy(retName, TrainingAcademy.SPECIALTY_PROPERTY, function); + return this; + } + + + public TrainingAcademyRequest groupByCampusCode(){ + super.groupByCampusCode(); + return this; + } + + public TrainingAcademyRequest groupByCampusCodeAs(String retName){ + super.groupByCampusCodeAs(retName); + return this; + } + + public TrainingAcademyRequest groupByCampusCodeWithFunction(String retName, AggrFunction function){ + super.groupByCampusCodeWithFunction(retName, function); + return this; + } + public TrainingAcademyRequest groupByPlatformWith(PlatformRequest subRequest){ + super.groupByPlatformWith(subRequest); + return this; + } + public TrainingAcademyRequest groupByPlatform(){ + super.groupByPlatform(); + return this; + } + + public TrainingAcademyRequest groupByPlatformAs(String retName){ + super.groupByPlatformAs(retName); + return this; + } + + public TrainingAcademyRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + super.groupByPlatformWithFunction(retName, function); + return this; + } + public TrainingAcademyRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + super.groupBySchoolTypeWith(subRequest); + return this; + } + public TrainingAcademyRequest groupBySchoolType(){ + super.groupBySchoolType(); + return this; + } + + public TrainingAcademyRequest groupBySchoolTypeAs(String retName){ + super.groupBySchoolTypeAs(retName); + return this; + } + + public TrainingAcademyRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + super.groupBySchoolTypeWithFunction(retName, function); + return this; + } + + public TrainingAcademyRequest groupByName(){ + super.groupByName(); + return this; + } + + public TrainingAcademyRequest groupByNameAs(String retName){ + super.groupByNameAs(retName); + return this; + } + + public TrainingAcademyRequest groupByNameWithFunction(String retName, AggrFunction function){ + super.groupByNameWithFunction(retName, function); + return this; + } + + public TrainingAcademyRequest groupByStudentCapacity(){ + super.groupByStudentCapacity(); + return this; + } + + public TrainingAcademyRequest groupByStudentCapacityAs(String retName){ + super.groupByStudentCapacityAs(retName); + return this; + } + + public TrainingAcademyRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + super.groupByStudentCapacityWithFunction(retName, function); + return this; + } + + public TrainingAcademyRequest groupByVersion(){ + super.groupByVersion(); + return this; + } + + public TrainingAcademyRequest groupByVersionAs(String retName){ + super.groupByVersionAs(retName); + return this; + } + + public TrainingAcademyRequest groupByVersionWithFunction(String retName, AggrFunction function){ + super.groupByVersionWithFunction(retName, function); + return this; + } + + public TrainingAcademyRequest groupById(){ + super.groupById(); + return this; + } + + public TrainingAcademyRequest groupByIdAs(String retName){ + super.groupByIdAs(retName); + return this; + } + + public TrainingAcademyRequest groupByIdWithFunction(String retName, AggrFunction function){ + super.groupByIdWithFunction(retName, function); + return this; + } + + public TrainingAcademyRequest orderBySpecialtyAscending(){ + addOrderByAscending(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + + public TrainingAcademyRequest orderBySpecialtyDescending(){ + addOrderByDescending(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + public TrainingAcademyRequest orderBySpecialtyAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + + public TrainingAcademyRequest orderBySpecialtyDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(TrainingAcademy.SPECIALTY_PROPERTY); + return this; + } + public TrainingAcademyRequest orderByCampusCodeAscending(){ + super.orderByCampusCodeAscending(); + return this; + } + + public TrainingAcademyRequest orderByCampusCodeDescending(){ + super.orderByCampusCodeDescending(); + return this; + } + public TrainingAcademyRequest orderByCampusCodeAscendingUsingGBK(){ + super.orderByCampusCodeAscendingUsingGBK(); + return this; + } + + public TrainingAcademyRequest orderByCampusCodeDescendingUsingGBK(){ + super.orderByCampusCodeDescendingUsingGBK(); + return this; + } + public TrainingAcademyRequest orderByPlatformAscending(){ + super.orderByPlatformAscending(); + return this; + } + + public TrainingAcademyRequest orderByPlatformDescending(){ + super.orderByPlatformDescending(); + return this; + } + + public TrainingAcademyRequest orderBySchoolTypeAscending(){ + super.orderBySchoolTypeAscending(); + return this; + } + + public TrainingAcademyRequest orderBySchoolTypeDescending(){ + super.orderBySchoolTypeDescending(); + return this; + } + + public TrainingAcademyRequest orderByNameAscending(){ + super.orderByNameAscending(); + return this; + } + + public TrainingAcademyRequest orderByNameDescending(){ + super.orderByNameDescending(); + return this; + } + public TrainingAcademyRequest orderByNameAscendingUsingGBK(){ + super.orderByNameAscendingUsingGBK(); + return this; + } + + public TrainingAcademyRequest orderByNameDescendingUsingGBK(){ + super.orderByNameDescendingUsingGBK(); + return this; + } + public TrainingAcademyRequest orderByStudentCapacityAscending(){ + super.orderByStudentCapacityAscending(); + return this; + } + + public TrainingAcademyRequest orderByStudentCapacityDescending(){ + super.orderByStudentCapacityDescending(); + return this; + } + + public TrainingAcademyRequest orderByVersionAscending(){ + super.orderByVersionAscending(); + return this; + } + + public TrainingAcademyRequest orderByVersionDescending(){ + super.orderByVersionDescending(); + return this; + } + + public TrainingAcademyRequest orderByIdAscending(){ + super.orderByIdAscending(); + return this; + } + + public TrainingAcademyRequest orderByIdDescending(){ + super.orderByIdDescending(); + return this; + } + + + + + + /** + * get topN records + * @param topN records number + */ + public TrainingAcademyRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public TrainingAcademyRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public TrainingAcademyRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public TrainingAcademyRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public TrainingAcademyRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public TrainingAcademyRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/inheritance-save/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..7ff0f1b51 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.inheritancematchingservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/teaql/checker-model.json b/examples/inheritance-save/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..4903f3d90 --- /dev/null +++ b/examples/inheritance-save/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:43a0ab45b8baa27dfb7d9eccaf6f8ac33e36491d16f13a7817729d8673c0b53a","entities":{"Academy":{"labels":{"en":"Academy"},"fields":[{"name":"campus_code","labels":{"en":"campus code"},"aliases":["CampusCode","campusCode"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]}]},"College":{"labels":{"en":"College"},"fields":[{"name":"degree_level","labels":{"en":"degree level"},"aliases":["DegreeLevel","degreeLevel"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]}]},"Platform":{"labels":{"en":"Platform"},"fields":[{"name":"base_url","labels":{"en":"base url"},"aliases":["BaseUrl","baseUrl"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"school_list","targetType":"School","labels":{"en":"School"},"aliases":["SchoolList","schoolList"]},{"name":"school_type_list","targetType":"SchoolType","labels":{"en":"School Type"},"aliases":["SchoolTypeList","schoolTypeList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"School":{"labels":{"en":"School"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"school_type","targetType":"SchoolType","labels":{"en":"School Type"},"aliases":["SchoolType","schoolType"]},{"name":"student_capacity","labels":{"en":"student capacity"},"aliases":["StudentCapacity","studentCapacity"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolType":{"labels":{"en":"School Type"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"Platform"},"aliases":["Platform"]},{"name":"school_list","targetType":"School","labels":{"en":"School"},"aliases":["SchoolList","schoolList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"TrainingAcademy":{"labels":{"en":"Training Academy"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"specialty","labels":{"en":"specialty"},"aliases":["Specialty"]}]}}} \ No newline at end of file diff --git a/examples/inheritance-save/java-lib-core/teaql/model-provenance.json b/examples/inheritance-save/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..12c24f68e --- /dev/null +++ b/examples/inheritance-save/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:682221db2df129051e636ce950e4a27b270f71aed10b84d987c46c432332cac4","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/inheritance-save/showcase.json b/examples/inheritance-save/showcase.json new file mode 100644 index 000000000..91e54d374 --- /dev/null +++ b/examples/inheritance-save/showcase.json @@ -0,0 +1,39 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/inheritance-save", + "library": { + "generatedFilesManifestSHA256": "ed0fd10f89d7b6dd9fad3c833d68811536d2fabd7981605bb8a09383c2a1ee99", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "9ed75f14ac524f18ccaba59be8c7261da203d2472bbe5d1f88dfc16d8b203d01" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/school-inheritance-and-partial-views-generation/receipt.json", + "receiptSHA256": "7c8fb5f6c6619d7165638972cdbbe267d68e50cadf33d70065b45a52c68cf84f" + }, + "scene": "Edit inherited school and academy fields through the same identity", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "node", + "examples/inheritance-save/verify.cjs" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml" + ], + "generatedFilesManifestSHA256": "c3cf5b1379d400f885c7926a1d849c3459bfdda20933cf97d4bbaab79babbb13", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/inheritance-save/verify.cjs b/examples/inheritance-save/verify.cjs index d96979aca..c1e1f5cef 100644 --- a/examples/inheritance-save/verify.cjs +++ b/examples/inheritance-save/verify.cjs @@ -4,12 +4,13 @@ const crypto=require('node:crypto'),assert=require('node:assert/strict'); const {createOwnedRunner,ownedBytes}=require('../fix-e-alignment/owned-command.cjs'); const sha=bytes=>crypto.createHash('sha256').update(bytes).digest('hex'); const repo=path.resolve(__dirname,'../..'); +const app=path.join(__dirname,'java-app-console'), library=path.join(__dirname,'java-lib-core/lib'); async function main(){ const args={};for(let i=2;ifs.existsSync(path.join(repo,name,'pom.xml'))).map(name=>path.join(repo,name,'target')); - targets.push(path.join(__dirname,'target'),path.join(__dirname,'lib/target')); + targets.push(path.join(app,'target'),path.join(library,'target')); assert(targets.every(file=>!fs.existsSync(file)),'Use an isolated target-free runtime checkout'); assert(fs.statfsSync(repo).bavail*fs.statfsSync(repo).bsize>4*1024**3); fs.mkdirSync(output,{recursive:true});const runner=createOwnedRunner();let scratch,owned=false; @@ -17,7 +18,7 @@ async function main(){ try{ scratch=fs.mkdtempSync(path.join(os.tmpdir(),'teaql-java-inheritance-'));owned=true; const generated=JSON.parse(fs.readFileSync(path.join(__dirname,'generated-files.json'))); - const inventory=()=>Object.fromEntries(Object.keys(generated).map(name=>[name,sha(fs.readFileSync(path.join(__dirname,name)))])); + const inventory=()=>Object.fromEntries(Object.keys(generated).map(name=>[name,sha(fs.readFileSync(path.join(__dirname,'java-lib-core',name)))])); assert.deepEqual(inventory(),generated);receipt.generatedFileHashes=generated; receipt.sourceCommit=cp.execFileSync('git',['rev-parse','HEAD'],{cwd:repo,encoding:'utf8'}).trim(); const sources=['pom.xml','teaql-core/src/main/java/io/teaql/core/Entity.java','teaql-core/src/main/java/io/teaql/core/Audited.java', @@ -25,9 +26,9 @@ async function main(){ 'teaql-core/src/main/java/io/teaql/core/EntityStatus.java','teaql-core/src/test/java/io/teaql/core/EntityMutationLedgerTest.java', 'teaql-runtime/src/main/java/io/teaql/runtime/TeaQLRuntime.java','teaql-runtime/src/test/java/io/teaql/runtime/TeaQLRuntimeTest.java', 'teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLRepository.java','teaql-sql-portable/src/main/java/io/teaql/core/sql/SqlAstCompiler.java', - 'examples/fix-e-alignment/owned-command.cjs','examples/inheritance-save/pom.xml','examples/inheritance-save/verify.cjs', - 'examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java']; - sources.push('examples/inheritance-save/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java'); + 'examples/fix-e-alignment/owned-command.cjs','examples/inheritance-save/java-app-console/pom.xml','examples/inheritance-save/verify.cjs', + 'examples/inheritance-save/java-app-console/src/test/java/io/teaql/examples/inheritance/InheritanceLifecycleExampleTest.java']; + sources.push('examples/inheritance-save/java-app-console/src/test/java/io/teaql/examples/inheritance/GraphRollbackProbe.java'); sources.push('teaql-sql-portable/src/main/java/io/teaql/core/sql/portable/PortableSQLDataService.java', 'teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/VersionLifecyclePortableSQLTest.java', 'teaql-sql-portable/src/test/java/io/teaql/core/sql/portable/SqlParameterPropagationTest.java', @@ -39,7 +40,7 @@ async function main(){ receipt.localSourceVersionOverride=version; const escape=value=>value.replaceAll('&','&').replaceAll('<','<').replaceAll('"','"'); const reactor='4.0.0io.teaql.testinherited-save-reactor0.0.0pom' - +[repo,path.join(__dirname,'lib'),__dirname].map(dir=>''+escape(path.relative(scratch,dir))+'').join('')+''; + +[repo,library,app].map(dir=>''+escape(path.relative(scratch,dir))+'').join('')+''; fs.writeFileSync(path.join(scratch,'pom.xml'),reactor);fs.writeFileSync(path.join(output,'reactor-pom.xml'),reactor); const env={...process.env,TEAQL_TELEMETRY_ENABLED:'false'}; async function run(command,log){const fd=fs.openSync(path.join(output,log),'wx');let result; @@ -63,7 +64,7 @@ async function main(){ for(const round of [1,2]){ const log=await run([process.env.MAVEN||'mvn','-o','-B','-ntp','-f',path.join(scratch,'pom.xml'),'-pl',':inherited-save-example','-am', '-Dteaql.version='+version,'-Dtest=InheritanceLifecycleExampleTest','-Dsurefire.failIfNoSpecifiedTests=false', - '-Dteaql.expected.runtime.root='+repo,'-Dteaql.expected.inheritance.root='+path.join(__dirname,'lib'), + '-Dteaql.expected.runtime.root='+repo,'-Dteaql.expected.inheritance.root='+library, '-Dteaql.inheritance.provider='+provider,'-Dteaql.inheritance.round='+round, '-Dteaql.inheritance.database='+path.join(output,'inheritance.sqlite'),'test'],'round-'+round+'.log'); const lines=log.split('\n').filter(line=>line.startsWith('INHERITED_SAVE_PARITY='));assert.equal(lines.length,1); @@ -78,7 +79,7 @@ async function main(){ ['Academy','TrainingAcademy','TrainingAcademy'],['TrainingAcademy','TrainingAcademy','TrainingAcademy'], ['School','College','College'],['School','School','School']]); receipt.rounds.push(proof); - const report=path.join(__dirname,'target/surefire-reports/TEST-io.teaql.examples.inheritance.InheritanceLifecycleExampleTest.xml'); + const report=path.join(app,'target/surefire-reports/TEST-io.teaql.examples.inheritance.InheritanceLifecycleExampleTest.xml'); const xml=fs.readFileSync(report,'utf8');for(const key of ['failures','errors','skipped'])assert.equal(Number(xml.match(new RegExp('\\b'+key+'="(\\d+)"'))[1]),0); fs.copyFileSync(report,path.join(output,'junit-'+round+'.xml')); } @@ -119,7 +120,7 @@ async function main(){ assert.deepEqual(inventory(),generated);receipt.generatedLibraryUnchanged=true;assert.deepEqual(sourceHashes(),receipt.sourceHashes);receipt.sameDatabase=true;receipt.passed=true; }catch(error){receipt.error=String(error);process.exitCode=1;} finally{ - if(owned&&runner.safeToClean){const reports=path.join(__dirname,'target/surefire-reports');if(fs.existsSync(reports)){ + if(owned&&runner.safeToClean){const reports=path.join(app,'target/surefire-reports');if(fs.existsSync(reports)){ fs.mkdirSync(path.join(output,'last-junit'),{recursive:true}); for(const file of fs.readdirSync(reports))if(/\.(xml|txt)$/.test(file))fs.copyFileSync(path.join(reports,file),path.join(output,'last-junit',file)); }} From 26d4aaadb7c5f57b6986be9384773b220eb2749d Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:55:31 +0800 Subject: [PATCH 48/71] Wire school record projection to generated native scopes --- .../shared-load-state/benchmark-mainstream.sh | 30 +- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 68 + .../java-app-console/DOMAIN_API_GUIDE.md | 31 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 173 ++ .../java-app-console/lib/pom.xml | 102 + .../BaseServiceConfiguration.java | 0 .../schoolmanagementservice/Checkers.java | 0 .../schoolmanagementservice/Constants.java | 13 + .../example/schoolmanagementservice/E.java | 28 + .../EntityMetaRegistry.java | 988 +++++++++ .../GeneratedRuntimeModule.java | 76 + .../example/schoolmanagementservice/Q.java | 43 + .../schoolmanagementservice/Repositories.java | 0 .../SchoolManagementServiceUserContext.java | 10 + .../platform/Platform.java | 236 +++ .../platform/PlatformChecker.java | 120 ++ .../platform/PlatformExpression.java | 89 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 1760 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../school/School.java | 287 +++ .../school/SchoolChecker.java | 159 ++ .../school/SchoolExpression.java | 110 ++ .../school/SchoolListExpression.java | 25 + .../school/SchoolRequest.java | 1643 +++++++++++++++ .../SchoolCapacitySummary.java | 168 ++ .../SchoolCapacitySummaryChecker.java | 79 + .../SchoolCapacitySummaryExpression.java | 67 + .../SchoolCapacitySummaryListExpression.java | 25 + .../SchoolCapacitySummaryRequest.java | 1059 ++++++++++ .../schooltype/SchoolType.java | 193 ++ .../schooltype/SchoolTypeChecker.java | 87 + .../schooltype/SchoolTypeExpression.java | 76 + .../schooltype/SchoolTypeListExpression.java | 25 + .../schooltype/SchoolTypeRequest.java | 1238 ++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-app-console/pom.xml | 24 + .../example/schoolmanagementservice/App.java | 99 + .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 + .../src/main/resources/application.properties | 2 + .../java-app-console/teaql-i18n.json | 129 ++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../java-lib-core/lib/pom.xml | 142 ++ .../BaseServiceConfiguration.java | 0 .../schoolmanagementservice/Checkers.java | 0 .../schoolmanagementservice/Constants.java | 13 + .../example/schoolmanagementservice/E.java | 28 + .../EntityMetaRegistry.java | 988 +++++++++ .../GeneratedRuntimeModule.java | 76 + .../example/schoolmanagementservice/Q.java | 43 + .../schoolmanagementservice/Repositories.java | 0 .../SchoolManagementServiceUserContext.java | 10 + .../platform/Platform.java | 236 +++ .../platform/PlatformChecker.java | 120 ++ .../platform/PlatformExpression.java | 89 + .../platform/PlatformListExpression.java | 25 + .../platform/PlatformRequest.java | 1760 +++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../school/School.java | 287 +++ .../school/SchoolChecker.java | 159 ++ .../school/SchoolExpression.java | 110 ++ .../school/SchoolListExpression.java | 25 + .../school/SchoolRequest.java | 1643 +++++++++++++++ .../SchoolCapacitySummary.java | 168 ++ .../SchoolCapacitySummaryChecker.java | 79 + .../SchoolCapacitySummaryExpression.java | 67 + .../SchoolCapacitySummaryListExpression.java | 25 + .../SchoolCapacitySummaryRequest.java | 1059 ++++++++++ .../schooltype/SchoolType.java | 193 ++ .../schooltype/SchoolTypeChecker.java | 87 + .../schooltype/SchoolTypeExpression.java | 76 + .../schooltype/SchoolTypeListExpression.java | 25 + .../schooltype/SchoolTypeRequest.java | 1238 ++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/shared-load-state/showcase.json | 40 + examples/shared-load-state/verify.sh | 48 +- .../shared-load-state/workspace-reactor.sh | 24 + 86 files changed, 18448 insertions(+), 17 deletions(-) create mode 100644 examples/shared-load-state/java-app-console/.gitignore create mode 100644 examples/shared-load-state/java-app-console/AGENTS.md create mode 100644 examples/shared-load-state/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/shared-load-state/java-app-console/Makefile create mode 100644 examples/shared-load-state/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/shared-load-state/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/shared-load-state/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/shared-load-state/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/shared-load-state/java-app-console/lib/pom.xml create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java create mode 100644 examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/shared-load-state/java-app-console/pom.xml create mode 100644 examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/App.java create mode 100644 examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java create mode 100644 examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/shared-load-state/java-app-console/src/main/resources/application.properties create mode 100644 examples/shared-load-state/java-app-console/teaql-i18n.json create mode 100644 examples/shared-load-state/java-app-console/teaql/checker-model.json create mode 100644 examples/shared-load-state/java-app-console/teaql/model-provenance.json create mode 100644 examples/shared-load-state/java-lib-core/lib/pom.xml create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java create mode 100644 examples/shared-load-state/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/shared-load-state/java-lib-core/teaql/checker-model.json create mode 100644 examples/shared-load-state/java-lib-core/teaql/model-provenance.json create mode 100644 examples/shared-load-state/showcase.json create mode 100644 examples/shared-load-state/workspace-reactor.sh diff --git a/examples/shared-load-state/benchmark-mainstream.sh b/examples/shared-load-state/benchmark-mainstream.sh index 38cae64e3..f93ff52bf 100644 --- a/examples/shared-load-state/benchmark-mainstream.sh +++ b/examples/shared-load-state/benchmark-mainstream.sh @@ -1,18 +1,36 @@ #!/usr/bin/env bash set -euo pipefail -(( $# == 0 )) || { printf 'Usage: bash benchmark-mainstream.sh\n' >&2; exit 2; } -runtime_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" -run_dir="$(mktemp -d -t teaql-java-mainstream.XXXXXXXX)" +workspace=false +if [[ "${1:-}" == --workspace ]]; then + workspace=true + shift +fi +(( $# == 0 )) || { printf 'Usage: bash benchmark-mainstream.sh [--workspace]\n' >&2; exit 2; } +example_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +runtime_dir="$(cd "$example_dir/../.." && pwd)" +reactor=(mvn -q -Pshared-load-state-example -pl examples/shared-load-state -am) +target="$example_dir/target" +if [[ "$workspace" == true ]]; then + reactor=(bash "$example_dir/workspace-reactor.sh") + target="$example_dir/java-app-console/target" +fi +if [[ -n "${TEAQL_MAINSTREAM_EVIDENCE_DIR:-}" ]]; then + run_dir="$TEAQL_MAINSTREAM_EVIDENCE_DIR" + [[ "$run_dir" == /* ]] + mkdir -- "$run_dir" +else + run_dir="$(mktemp -d -t teaql-java-mainstream.XXXXXXXX)" +fi printf 'Mainstream benchmark evidence: %s\n' "$run_dir" cd "$runtime_dir" git diff HEAD --exit-code -- examples/shared-load-state teaql-core teaql-runtime teaql-sql-portable teaql-provider-jdbc teaql-sqlite git rev-parse HEAD >"$run_dir/base-commit.txt" java -version >"$run_dir/toolchain.txt" 2>&1 sha256sum examples/shared-load-state/src/test/java/com/example/schoolmanagementservice/{MainstreamMapperBenchmarkTest,DriverQueryBenchmarkTest,HydrationAllocationTest}.java examples/shared-load-state/pom.xml >"$run_dir/source.sha256" -/usr/bin/time -v -o "$run_dir/cpu.txt" mvn -q -Pshared-load-state-example \ - -pl examples/shared-load-state -am -Dtest=MainstreamMapperBenchmarkTest \ +/usr/bin/time -v -o "$run_dir/cpu.txt" "${reactor[@]}" \ + -Dtest=MainstreamMapperBenchmarkTest \ -Dsurefire.failIfNoSpecifiedTests=false -Dteaql.ormBenchmark=true -Dteaql.ormSamples=31 test \ >"$run_dir/results.log" 2>&1 rg -F 'PASS mainstream MyBatis and TeaQL bounded typed results with independent version and prefix filters' "$run_dir/results.log" -cp examples/shared-load-state/target/surefire-reports/TEST-com.example.schoolmanagementservice.MainstreamMapperBenchmarkTest.xml "$run_dir/test-result.xml" +cp "$target/surefire-reports/TEST-com.example.schoolmanagementservice.MainstreamMapperBenchmarkTest.xml" "$run_dir/test-result.xml" sha256sum --check --quiet "$run_dir/source.sha256" diff --git a/examples/shared-load-state/java-app-console/.gitignore b/examples/shared-load-state/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/shared-load-state/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/AGENTS.md b/examples/shared-load-state/java-app-console/AGENTS.md new file mode 100644 index 000000000..42cea1bf3 --- /dev/null +++ b/examples/shared-load-state/java-app-console/AGENTS.md @@ -0,0 +1,68 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| platform | platform | +| school_type | school_type | +| school | school | +| school_capacity_summary | School Capacity Summary | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/shared-load-state/java-app-console/DOMAIN_API_GUIDE.md b/examples/shared-load-state/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..8c98c5cdc --- /dev/null +++ b/examples/shared-load-state/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,31 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/school-management-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| platform | platform | +| school_type | school_type | +| school | school | +| school_capacity_summary | School Capacity Summary | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/Makefile b/examples/shared-load-state/java-app-console/Makefile new file mode 100644 index 000000000..c47aac570 --- /dev/null +++ b/examples/shared-load-state/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/school-management-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/school-management-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/shared-load-state/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..93dad43c5 --- /dev/null +++ b/examples/shared-load-state/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/school-management-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/STANDARD_TELEMETRY.md b/examples/shared-load-state/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/shared-load-state/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/shared-load-state/java-app-console/TOOL_API_GUIDE.md b/examples/shared-load-state/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..f49eea7e2 --- /dev/null +++ b/examples/shared-load-state/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/school-management-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/school-management-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/school-management-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/docs/teaql-java-crud-guide.md b/examples/shared-load-state/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..fcfdb5d25 --- /dev/null +++ b/examples/shared-load-state/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,173 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.example.schoolmanagementservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.SchoolManagementServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.platforms() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Platform(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.platforms() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.platforms() + .selectSchoolTypeListWith(Q.schoolTypes().selectSelf()) + .comment("load with schoolTypeList") + .purpose("fetch child schoolTypeList") + .executeForList(userContext); +``` + +```java +var list = Q.platforms() + .selectSchoolListWith(Q.schools().selectSelf()) + .comment("load with schoolList") + .purpose("fetch child schoolList") + .executeForList(userContext); +``` + +```java +var list = Q.platforms() + .selectSchoolCapacitySummaryListWith(Q.schoolCapacitySummaries().selectSelf()) + .comment("load with schoolCapacitySummaryList") + .purpose("fetch child schoolCapacitySummaryList") + .executeForList(userContext); +``` + +```java +var list = Q.schoolTypes() + .selectPlatformWith(Q.platforms().selectSelf()) + .comment("load with platform") + .purpose("fetch associated platform") + .executeForList(userContext); +``` + + + + + +```java +var list = Q.schoolTypes() + .selectSchoolListWith(Q.schools().selectSelf()) + .comment("load with schoolList") + .purpose("fetch child schoolList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Platform`: reverse relations `3`, query `Q.platforms()`, save `new Platform().auditAs("comment").save(userContext)`, request `com.example.schoolmanagementservice.platform.PlatformRequest` +- `SchoolType`: reverse relations `1`, query `Q.schoolTypes()`, save `new SchoolType().auditAs("comment").save(userContext)`, request `com.example.schoolmanagementservice.schooltype.SchoolTypeRequest` \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/pom.xml b/examples/shared-load-state/java-app-console/lib/pom.xml new file mode 100644 index 000000000..2031c7204 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.example + school-management-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java new file mode 100644 index 000000000..bdacf16bf --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java @@ -0,0 +1,13 @@ + +package com.example.schoolmanagementservice; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.schooltype.SchoolType; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); + public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; + public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; + public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java new file mode 100644 index 000000000..6a54ceb3f --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java @@ -0,0 +1,28 @@ + +package com.example.schoolmanagementservice; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolExpression; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static SchoolTypeExpression schoolType(SchoolType schoolType){ + return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); + } + public static SchoolExpression school(School school){ + return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); + } + public static SchoolCapacitySummaryExpression schoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ + return new SchoolCapacitySummaryExpression(new ValueExpression(schoolCapacitySummary, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolCapacitySummary()")); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java new file mode 100644 index 000000000..f5fdbff85 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java @@ -0,0 +1,988 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerSchoolType(); + registerSchool(); + registerSchoolCapacitySummary(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.platform.Platform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor baseUrl = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Campus Learning Platform") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "https://campus.example.com") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "createTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "updateTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchoolType() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.schooltype.SchoolType.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schooltype.SchoolType::new); + entityDescriptor.with("constant", "true") + + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY, String.class) + ; + PropertyDescriptor code = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY, String.class) + ; + PropertyDescriptor displayOrder = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("candidates", "1001,1002") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Primary,Secondary") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") + + .with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "PRIMARY,SECONDARY") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("candidates", "1,2") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchool() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.school.School.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.school.School.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.school.School.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.school.School::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor schoolType = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.schoolmanagementservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY, String.class) + ; + PropertyDescriptor address = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY, String.class) + ; + PropertyDescriptor establishedDate = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor studentCapacity = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) + ; + PropertyDescriptor active = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY, Boolean.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(1)") + + .with("javaType", "java.lang.Boolean") + + .with("sqlType", "BOOLEAN") + + .with("isId", "false") + + .with("isBool", "true") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "bit") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Boolean") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchoolCapacitySummary() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary::new); + entityDescriptor.with("name", "School Capacity Summary") + + .with("module", "Reporting") + + .with("module_key", "reporting") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY, String.class) + ; + PropertyDescriptor totalCapacity = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, Integer.class) + ; + PropertyDescriptor schoolCount = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, Integer.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..2c1d24ac8 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java @@ -0,0 +1,76 @@ +package com.example.schoolmanagementservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.schoolmanagementservice.platform.PlatformChecker(), new com.example.schoolmanagementservice.schooltype.SchoolTypeChecker(), new com.example.schoolmanagementservice.school.SchoolChecker(), new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:d36b1e0d50365a8a5a3654777b969de3e9e0de9673b6997e9522858ac7239249\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_capacity_summary_list\",\"targetType\":\"SchoolCapacitySummary\",\"labels\":{\"en\":\"School Capacity Summary\"},\"aliases\":[\"SchoolCapacitySummaryList\",\"schoolCapacitySummaryList\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"school\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"school type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"school\"},\"fields\":[{\"name\":\"active\",\"labels\":{\"en\":\"active\"},\"aliases\":[\"Active\"]},{\"name\":\"address\",\"labels\":{\"en\":\"address\"},\"aliases\":[\"Address\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"established_date\",\"labels\":{\"en\":\"established date\"},\"aliases\":[\"EstablishedDate\",\"establishedDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"school type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolCapacitySummary\":{\"labels\":{\"en\":\"School Capacity Summary\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_count\",\"labels\":{\"en\":\"school count\"},\"aliases\":[\"SchoolCount\",\"schoolCount\"]},{\"name\":\"total_capacity\",\"labels\":{\"en\":\"total capacity\"},\"aliases\":[\"TotalCapacity\",\"totalCapacity\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"school type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"school\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("address", "address"), java.util.Map.entry("established_date", "establishedDate"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("active", "active"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolCapacitySummary", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("name", "name"), java.util.Map.entry("total_capacity", "totalCapacity"), java.util.Map.entry("school_count", "schoolCount"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.schoolmanagementservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.schoolmanagementservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Campus Learning Platform"); + domainRoot.updateBaseUrl("https://campus.example.com"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1001Rows.isEmpty()) { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = new com.example.schoolmanagementservice.schooltype.SchoolType(); + constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); + constantSchoolType1001.updatePlatform(domainRoot); + constantSchoolType1001.updateName("Primary"); + constantSchoolType1001.updateCode("PRIMARY"); + constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); + constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); + } else { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } + if (!((constantSchoolType1001.getDisplayOrder() != null && constantSchoolType1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } + if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); + } + var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1002Rows.isEmpty()) { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = new com.example.schoolmanagementservice.schooltype.SchoolType(); + constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); + constantSchoolType1002.updatePlatform(domainRoot); + constantSchoolType1002.updateName("Secondary"); + constantSchoolType1002.updateCode("SECONDARY"); + constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); + constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); + } else { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } + if (!((constantSchoolType1002.getDisplayOrder() != null && constantSchoolType1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } + if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); + } + } +} diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java new file mode 100644 index 000000000..f65b1fb8b --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java @@ -0,0 +1,43 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.schoolmanagementservice.platform.PlatformRequest platforms(){ + return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypes(){ + return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ + return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.school.SchoolRequest schools(){ + return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.school.SchoolRequest schoolsWithMinimalFields(){ + return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest schoolCapacitySummaries(){ + return new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest schoolCapacitySummariesWithMinimalFields(){ + return new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java new file mode 100644 index 000000000..e53bf00a7 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.UserContext; +public interface SchoolManagementServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java new file mode 100644 index 000000000..f82474eb2 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java @@ -0,0 +1,236 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e1da6639feab09f3d1ed370802410798c759f6bf13f85e0a93374c42d1646603"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_type_list", "school_list", "school_capacity_summary_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String BASE_URL_PROPERTY = "base_url"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + public static final String SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY = "school_capacity_summary_list"; + private String name; + + private String baseUrl; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList schoolTypeList; + private SmartList schoolList; + private SmartList schoolCapacitySummaryList; + + public String getName(){ + return this.name; + } + + public String getBaseUrl(){ + return this.baseUrl; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getSchoolTypeList(){ + return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; + } + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public SmartList getSchoolCapacitySummaryList(){ + return this.schoolCapacitySummaryList == null ? SmartList.unloaded() : this.schoolCapacitySummaryList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform updateBaseUrl(String baseUrl){ + baseUrl = (baseUrl == null ? null : baseUrl.trim()); + if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ + return this; + } + handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); + this.baseUrl = baseUrl; + return this; + } + + public Platform updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public Platform updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public Platform addSchoolType(SchoolType schoolType){ + if (schoolType == null){ + return this; + } + + if(null == this.schoolTypeList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolTypeList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolTypeList.add(schoolType); + schoolType.updatePlatform(this); + return this; + } + public Platform addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updatePlatform(this); + return this; + } + public Platform addSchoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ + if (schoolCapacitySummary == null){ + return this; + } + + if(null == this.schoolCapacitySummaryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolCapacitySummaryList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolCapacitySummaryList.add(schoolCapacitySummary); + schoolCapacitySummary.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "school_type_list": this.schoolTypeList = (SmartList) value; break; + case "school_list": this.schoolList = (SmartList) value; break; + case "school_capacity_summary_list": this.schoolCapacitySummaryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "base_url": return this.baseUrl; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "school_type_list": return this.schoolTypeList; + case "school_list": return this.schoolList; + case "school_capacity_summary_list": return this.schoolCapacitySummaryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "baseUrl": return this.baseUrl; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java new file mode 100644 index 000000000..21ee416f3 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java @@ -0,0 +1,120 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolChecker; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryChecker; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + platform.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(platform.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("base_url")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); + checkCreateTime(_context, platform.getProperty(Platform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, platform.getProperty(Platform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ + SchoolType schoolType = platform.getSchoolTypeList().get(i); + new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); + } + for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ + School school = platform.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + for(int i = 0; platform.getSchoolCapacitySummaryList() != null && i < platform.getSchoolCapacitySummaryList().size(); i++){ + SchoolCapacitySummary schoolCapacitySummary = platform.getSchoolCapacitySummaryList().get(i); + new SchoolCapacitySummaryChecker().checkAndFix(_context, schoolCapacitySummary, newLocation(_parentLocation, "school_capacity_summary_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, baseUrl); + if((baseUrl == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, baseUrl); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java new file mode 100644 index 000000000..c3533c97b --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java @@ -0,0 +1,89 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolListExpression; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryListExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public Expression getBaseUrl(){ + return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); + } + public PlatformExpression updateBaseUrl(String baseUrl){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", Platform::getCreateTime); + } + public PlatformExpression updateCreateTime(LocalDateTime createTime){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", Platform::getUpdateTime); + } + public PlatformExpression updateUpdateTime(LocalDateTime updateTime){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateUpdateTime(updateTime)); + } + + public SchoolTypeListExpression getSchoolTypeList(){ + return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); + } + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); + } + public SchoolCapacitySummaryListExpression getSchoolCapacitySummaryList(){ + return new SchoolCapacitySummaryListExpression(loaded("school_capacity_summary_list", "getSchoolCapacitySummaryList", Platform::getSchoolCapacitySummaryList)); + } + public PlatformExpression addSchoolType(SchoolType schoolType){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); + } + public PlatformExpression addSchool(School school){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); + } + public PlatformExpression addSchoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolCapacitySummary(schoolCapacitySummary)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..14e4a4c13 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java new file mode 100644 index 000000000..3e9c17602 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java @@ -0,0 +1,1760 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolRequest; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.BASE_URL_PROPERTY); + selectProperty(Platform.CREATE_TIME_PROPERTY); + selectProperty(Platform.UPDATE_TIME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectSchoolTypeList().selectSchoolList().selectSchoolCapacitySummaryList(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectBaseUrl(){ + selectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + + /** + * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectBaseUrl(){ + unselectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest selectCreateTime(){ + selectProperty(Platform.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectCreateTime(){ + unselectProperty(Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest selectUpdateTime(){ + selectProperty(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectUpdateTime(){ + unselectProperty(Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectSchoolTypeList(){ + return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); + } + + public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ + enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectSchoolCapacitySummaryList(){ + return selectSchoolCapacitySummaryListWith(Q.schoolCapacitySummaries().selectSelf()); + } + + public PlatformRequest selectSchoolCapacitySummaryListWith(SchoolCapacitySummaryRequest schoolCapacitySummaryList){ + enhanceRelation(Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, schoolCapacitySummaryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolCapacitySummaryListWith", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByBaseUrl(String... baseUrl){ + if (baseUrl == null || baseUrl.length == 0) { + throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); + } + return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); + } + + public PlatformRequest withBaseUrl(Operator operator, Object... values){ + return appendSearchCriteria(createBaseUrlCriteria(operator, values)); + } + + public PlatformRequest withBaseUrlIsUnknown(){ + return withBaseUrl(Operator.IS_NULL); + } + + public PlatformRequest withBaseUrlIsKnown(){ + return withBaseUrl(Operator.IS_NOT_NULL); + } + + public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); + } + + public PlatformRequest withBaseUrlIsNot(String baseUrl){ + return withBaseUrl(Operator.NOT_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlIn(String... baseUrl){ + return withBaseUrl(Operator.IN, (Object[])baseUrl); + } + + public PlatformRequest withBaseUrlNotIn(String... baseUrl){ + return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); + } + public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlLessThan(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ + return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); + } + public PlatformRequest withBaseUrlStartingWith(String baseUrl){ + return withBaseUrl(Operator.BEGIN_WITH, baseUrl); + } + public PlatformRequest withBaseUrlContaining(String baseUrl){ + return withBaseUrl(Operator.CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotContaining(String baseUrl){ + return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlEndingWith(String baseUrl){ + return withBaseUrl(Operator.END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlIs(String baseUrl){ + return withBaseUrl(Operator.EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ + return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); + } + + + + public PlatformRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public PlatformRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public PlatformRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public PlatformRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.CREATE_TIME_PROPERTY, operator, values); + } + + public PlatformRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public PlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public PlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public PlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public PlatformRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public PlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public PlatformRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public PlatformRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public PlatformRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.UPDATE_TIME_PROPERTY, operator, values); + } + + public PlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public PlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public PlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public PlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchoolTypes(){ + return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + + public PlatformRequest haveNoSchoolTypes(){ + return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public PlatformRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + public PlatformRequest withSchoolCapacitySummaryListMatching(SchoolCapacitySummaryRequest schoolCapacitySummaryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolCapacitySummaryRequest, SchoolCapacitySummary.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolCapacitySummaryListMatching(SchoolCapacitySummaryRequest schoolCapacitySummaryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolCapacitySummaryRequest, SchoolCapacitySummary.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchoolCapacitySummaries(){ + return withSchoolCapacitySummaryListMatching(Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest haveNoSchoolCapacitySummaries(){ + return withoutSchoolCapacitySummaryListMatching(Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctBaseUrl(){ + return countDistinctBaseUrlAs("base_url_distinct_count"); + } + + public PlatformRequest countDistinctBaseUrlAs(String alias){ + super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public PlatformRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public PlatformRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ + aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupBySchoolCapacitySummariesWithDetails(SchoolCapacitySummaryRequest subRequest){ + aggregate(Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByBaseUrl(){ + groupBy(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlAs(String retName){ + groupBy(retName, Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.BASE_URL_PROPERTY, function); + return this; + } + + public PlatformRequest groupByCreateTime(){ + groupBy(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByCreateTimeAs(String retName){ + groupBy(retName, Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.CREATE_TIME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByUpdateTime(){ + groupBy(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.UPDATE_TIME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscending(){ + addOrderByAscending(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescending(){ + addOrderByDescending(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByCreateTimeAscending(){ + addOrderByAscending(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByCreateTimeDescending(){ + addOrderByDescending(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByUpdateTimeAscending(){ + addOrderByAscending(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByUpdateTimeDescending(){ + addOrderByDescending(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + return statsFromSchoolCapacitySummariesAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchoolCapacitySummaries(SchoolCapacitySummaryRequest subRequest){ + return statsFromSchoolCapacitySummariesAs(REFINEMENTS, subRequest); + } + public PlatformRequest countSchoolTypes(){ + addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesAs(String name){ + addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ + addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest countSchoolCapacitySummaries(){ + addRelationCount("Count", Q.schoolCapacitySummaries().unlimited(), SchoolCapacitySummary.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolCapacitySummariesAs(String name){ + addRelationCount(name, Q.schoolCapacitySummaries().unlimited(), SchoolCapacitySummary.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolCapacitySummariesWith(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationCount(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummariesWith", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest minDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("minDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ + return minDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("maxDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ + return maxDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("sumDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ + return sumDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("avgDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ + return avgDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("stdDevDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name){ + return standardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("stdDevPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name){ + return squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("varSampDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name){ + return sampleVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("varPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name){ + return samplePopulationVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest minTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("minTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return minTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest minTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("maxTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return maxTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest maxTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("sumTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return sumTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sumTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("avgTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return avgTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest avgTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevPopTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varSampTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varPopTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest minSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("minSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minSchoolCountOfSchoolCapacitySummariesAs(String name){ + return minSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest minSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("maxSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxSchoolCountOfSchoolCapacitySummariesAs(String name){ + return maxSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest maxSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("sumSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumSchoolCountOfSchoolCapacitySummariesAs(String name){ + return sumSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sumSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("avgSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgSchoolCountOfSchoolCapacitySummariesAs(String name){ + return avgSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest avgSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name){ + return standardDeviationSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevPopSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name){ + return squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varSampSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(String name){ + return sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varPopSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(String name){ + return samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java new file mode 100644 index 000000000..3923b042c --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java @@ -0,0 +1,287 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.Constants; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class School extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "School"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "14b4bfbb4cda258779665e3bc38ab991040fe75793a416d29eddd06f8fa8f586"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("address", 4), java.util.Map.entry("established_date", 5), java.util.Map.entry("student_capacity", 6), java.util.Map.entry("active", 7), java.util.Map.entry("create_time", 8), java.util.Map.entry("update_time", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("address", java.util.List.of("address", "address")), java.util.Map.entry("established_date", java.util.List.of("establishedDate", "established_date")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("active", java.util.List.of("active", "active")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + School.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String SCHOOL_TYPE_PROPERTY = "school_type"; + public static final String NAME_PROPERTY = "name"; + public static final String ADDRESS_PROPERTY = "address"; + public static final String ESTABLISHED_DATE_PROPERTY = "established_date"; + public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; + public static final String ACTIVE_PROPERTY = "active"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private Platform platform; + + private SchoolType schoolType; + + private String name; + + private String address; + + private LocalDate establishedDate; + + private Integer studentCapacity; + + private Boolean active; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public Platform getPlatform(){ + return this.platform; + } + + public SchoolType getSchoolType(){ + return this.schoolType; + } + + public String getName(){ + return this.name; + } + + public String getAddress(){ + return this.address; + } + + public LocalDate getEstablishedDate(){ + return this.establishedDate; + } + + public Integer getStudentCapacity(){ + return this.studentCapacity; + } + + public Boolean isActive(){ + return this.active; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public School updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + protected School updateSchoolType(SchoolType schoolType){ + if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ + return this; + } + handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); + this.schoolType = schoolType; + return this; + } + + public School updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public School updateAddress(String address){ + address = (address == null ? null : address.trim()); + if(isPropertyLoaded(ADDRESS_PROPERTY) && Objects.equals(this.address, address)){ + return this; + } + handleUpdate(ADDRESS_PROPERTY, getAddress(), address); + this.address = address; + return this; + } + + public School updateEstablishedDate(LocalDate establishedDate){ + if(isPropertyLoaded(ESTABLISHED_DATE_PROPERTY) && Objects.equals(this.establishedDate, establishedDate)){ + return this; + } + handleUpdate(ESTABLISHED_DATE_PROPERTY, getEstablishedDate(), establishedDate); + this.establishedDate = establishedDate; + return this; + } + + public School updateStudentCapacity(Integer studentCapacity){ + if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ + return this; + } + handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); + this.studentCapacity = studentCapacity; + return this; + } + + public School updateActive(Boolean active){ + if(isPropertyLoaded(ACTIVE_PROPERTY) && Objects.equals(this.active, active)){ + return this; + } + handleUpdate(ACTIVE_PROPERTY, isActive(), active); + this.active = active; + return this; + } + + public School updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public School updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public boolean isSchoolTypePrimary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); + } + + public School updateSchoolTypeToPrimary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); + } + public boolean isSchoolTypeSecondary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); + } + + public School updateSchoolTypeToSecondary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); + } + + public static School refer(Long id){ + School refer = new School(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public School comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "school_type": this.schoolType = (SchoolType) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "address": this.address = (value == null ? null : ((String)value).trim()); break; + + case "established_date": this.establishedDate = (LocalDate) value; break; + + case "student_capacity": this.studentCapacity = (Integer) value; break; + + case "active": this.active = (Boolean) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "school_type": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "established_date": return this.establishedDate; + case "student_capacity": return this.studentCapacity; + case "active": return this.active; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "schoolType": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "establishedDate": return this.establishedDate; + case "studentCapacity": return this.studentCapacity; + case "active": return this.active; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java new file mode 100644 index 000000000..df8d0faa3 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java @@ -0,0 +1,159 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class SchoolChecker implements Checker{ + + public String type(){ + return School.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ + if(needCheck(_context, school)){ + markAsChecked(_context, school); + doCheck(_context, school, _parentLocation); + } + } + + public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ + if((school == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, school); + if(school.needPersist()){ + } + if(school.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + school.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(school.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!school.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("school_type")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("address")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "address"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("established_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "established_date"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("student_capacity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("active")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "active"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); + checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkAddress(_context, school.getProperty(School.ADDRESS_PROPERTY), newLocation(_parentLocation, "address")); + checkEstablishedDate(_context, school.getProperty(School.ESTABLISHED_DATE_PROPERTY), newLocation(_parentLocation, "established_date")); + checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); + checkActive(_context, school.getProperty(School.ACTIVE_PROPERTY), newLocation(_parentLocation, "active")); + checkCreateTime(_context, school.getProperty(School.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, school.getProperty(School.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, schoolType); + if((schoolType == null)){ + return; + } + new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkAddress(UserContext _context, String address, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, address); + if((address == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, address); + + } + public void checkEstablishedDate(UserContext _context, LocalDate establishedDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, establishedDate); + if((establishedDate == null)){ + return; + } + } + public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, studentCapacity); + if((studentCapacity == null)){ + return; + } + } + public void checkActive(UserContext _context, Boolean active, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, active); + if((active == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java new file mode 100644 index 000000000..381a4e119 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java @@ -0,0 +1,110 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolExpression(Expression expression){ + super(expression); + } + + public SchoolExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolExpression updateId(Long id){ + return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); + } + + public SchoolExpression save(UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolExpression save(String intent, UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); + } + + public SchoolExpression updatePlatform(Platform platform){ + return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); + } + + public SchoolTypeExpression getSchoolType(){ + return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); + } + + public SchoolExpression updateSchoolTypeToPrimary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); + } + public SchoolExpression updateSchoolTypeToSecondary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); + } + + public Expression getName(){ + return loaded("name", "getName", School::getName); + } + public SchoolExpression updateName(String name){ + return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); + } + + public Expression getAddress(){ + return loaded("address", "getAddress", School::getAddress); + } + public SchoolExpression updateAddress(String address){ + return new SchoolExpression(this, $it -> ((School)$it).updateAddress(address)); + } + + public Expression getEstablishedDate(){ + return loaded("established_date", "getEstablishedDate", School::getEstablishedDate); + } + public SchoolExpression updateEstablishedDate(LocalDate establishedDate){ + return new SchoolExpression(this, $it -> ((School)$it).updateEstablishedDate(establishedDate)); + } + + public Expression getStudentCapacity(){ + return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); + } + public SchoolExpression updateStudentCapacity(Integer studentCapacity){ + return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); + } + + public Expression isActive(){ + return loaded("active", "isActive", School::isActive); + } + public SchoolExpression updateActive(Boolean active){ + return new SchoolExpression(this, $it -> ((School)$it).updateActive(active)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", School::getCreateTime); + } + public SchoolExpression updateCreateTime(LocalDateTime createTime){ + return new SchoolExpression(this, $it -> ((School)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", School::getUpdateTime); + } + public SchoolExpression updateUpdateTime(LocalDateTime updateTime){ + return new SchoolExpression(this, $it -> ((School)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java new file mode 100644 index 000000000..c41793f7b --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.school; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolListExpression extends SmartListExpression { + public SchoolListExpression(Expression> expression){ + super(expression); + } + + public SchoolListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolExpression first() { + return new SchoolExpression(super.first()); + } + + public SchoolExpression get(int index) { + return new SchoolExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java new file mode 100644 index 000000000..c5ad3c9c4 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java @@ -0,0 +1,1643 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class SchoolRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolRequest(Class returnType){ + this(returnType, () -> (T) new School()); + } + + protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolRequest copy(){ + return (SchoolRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolRequest matchingAnyOf(SchoolRequest school){ + super.internalMatchAny(school); + return this; + } + + public SchoolRequest matchingIdsOf(SchoolRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + School.ID_PROPERTY, request, School.ID_PROPERTY)); + } + + public SchoolRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public SchoolRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(School.ID_PROPERTY); + selectProperty(School.PLATFORM_PROPERTY); + selectProperty(School.SCHOOL_TYPE_PROPERTY); + selectProperty(School.NAME_PROPERTY); + selectProperty(School.ADDRESS_PROPERTY); + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + selectProperty(School.ACTIVE_PROPERTY); + selectProperty(School.CREATE_TIME_PROPERTY); + selectProperty(School.UPDATE_TIME_PROPERTY); + selectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public SchoolRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public SchoolRequest selectId(){ + selectProperty(School.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectId(){ + unselectProperty(School.ID_PROPERTY); + return this; + } + public SchoolRequest selectPlatformIdOnly(){ + selectProperty(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(School.PLATFORM_PROPERTY); + enhanceRelation(School.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); + return this; + } + + public SchoolRequest unselectPlatform(){ + unselectProperty(School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest selectSchoolTypeIdOnly(){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest selectSchoolType(){ + return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); + } + + public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + public SchoolRequest unselectSchoolType(){ + unselectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest selectName(){ + selectProperty(School.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectName(){ + unselectProperty(School.NAME_PROPERTY); + return this; + } + public SchoolRequest selectAddress(){ + selectProperty(School.ADDRESS_PROPERTY); + return this; + } + + /** + * fill the address with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS address) to fetch address property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectAddress(){ + unselectProperty(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest selectEstablishedDate(){ + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + /** + * fill the establishedDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS establishedDate) to fetch establishedDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectEstablishedDate(){ + unselectProperty(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest selectStudentCapacity(){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); + return this; + } + + + public SchoolRequest unselectStudentCapacity(){ + unselectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest selectActive(){ + selectProperty(School.ACTIVE_PROPERTY); + return this; + } + + /** + * fill the active with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS active) to fetch active property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectActive(){ + unselectProperty(School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest selectCreateTime(){ + selectProperty(School.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectCreateTime(){ + unselectProperty(School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest selectUpdateTime(){ + selectProperty(School.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectUpdateTime(){ + unselectProperty(School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest selectVersion(){ + selectProperty(School.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectVersion(){ + unselectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); + } + + public SchoolRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); + } + + public SchoolRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolRequest filterBySchoolType(SchoolType... schoolType){ + if (schoolType == null || schoolType.length == 0) { + throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); + } + return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); + } + + public SchoolRequest withSchoolType(Operator operator, Object... values){ + return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); + } + + public SchoolRequest withSchoolTypeIsUnknown(){ + return withSchoolType(Operator.IS_NULL); + } + + public SchoolRequest withSchoolTypeIsKnown(){ + return withSchoolType(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); + } + + public SchoolRequest filterBySchoolType(Long schoolType){ + if(schoolType == null){ + return this; + } + return withSchoolType(Operator.EQUAL, schoolType); + } + public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); + } + + public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); + } + + public SchoolRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); + } + + public SchoolRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolRequest filterByAddress(String... address){ + if (address == null || address.length == 0) { + throw new IllegalArgumentException("filterByAddress parameter address cannot be empty"); + } + return appendSearchCriteria(createAddressCriteria(Operator.EQUAL, (Object[])address)); + } + + public SchoolRequest withAddress(Operator operator, Object... values){ + return appendSearchCriteria(createAddressCriteria(operator, values)); + } + + public SchoolRequest withAddressIsUnknown(){ + return withAddress(Operator.IS_NULL); + } + + public SchoolRequest withAddressIsKnown(){ + return withAddress(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAddressCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ADDRESS_PROPERTY, operator, values); + } + + public SchoolRequest withAddressIsNot(String address){ + return withAddress(Operator.NOT_EQUAL, address); + } + + public SchoolRequest withAddressIn(String... address){ + return withAddress(Operator.IN, (Object[])address); + } + + public SchoolRequest withAddressNotIn(String... address){ + return withAddress(Operator.NOT_IN, (Object[])address); + } + public SchoolRequest withAddressGreaterThan(String address){ + return withAddress(Operator.GREATER_THAN, address); + } + + public SchoolRequest withAddressGreaterThanOrEqualTo(String address){ + return withAddress(Operator.GREATER_THAN_OR_EQUAL, address); + } + + public SchoolRequest withAddressLessThan(String address){ + return withAddress(Operator.LESS_THAN, address); + } + + public SchoolRequest withAddressLessThanOrEqualTo(String address){ + return withAddress(Operator.LESS_THAN_OR_EQUAL, address); + } + + public SchoolRequest withAddressBetween(String startOfAddress, String endOfAddress){ + return withAddress(Operator.BETWEEN, startOfAddress, endOfAddress); + } + public SchoolRequest withAddressStartingWith(String address){ + return withAddress(Operator.BEGIN_WITH, address); + } + public SchoolRequest withAddressContaining(String address){ + return withAddress(Operator.CONTAIN, address); + } + + public SchoolRequest withAddressNotContaining(String address){ + return withAddress(Operator.NOT_CONTAIN, address); + } + + public SchoolRequest withAddressNotStartingWith(String address){ + return withAddress(Operator.NOT_BEGIN_WITH, address); + } + + public SchoolRequest withAddressEndingWith(String address){ + return withAddress(Operator.END_WITH, address); + } + + public SchoolRequest withAddressNotEndingWith(String address){ + return withAddress(Operator.NOT_END_WITH, address); + } + + public SchoolRequest withAddressIs(String address){ + return withAddress(Operator.EQUAL, address); + } + + public SchoolRequest withAddressSoundingLike(String address){ + return withAddress(Operator.SOUNDS_LIKE, address); + } + + + + public SchoolRequest filterByEstablishedDate(LocalDate... establishedDate){ + if (establishedDate == null || establishedDate.length == 0) { + throw new IllegalArgumentException("filterByEstablishedDate parameter establishedDate cannot be empty"); + } + return appendSearchCriteria(createEstablishedDateCriteria(Operator.EQUAL, (Object[])establishedDate)); + } + + public SchoolRequest withEstablishedDate(Operator operator, Object... values){ + return appendSearchCriteria(createEstablishedDateCriteria(operator, values)); + } + + public SchoolRequest withEstablishedDateIsUnknown(){ + return withEstablishedDate(Operator.IS_NULL); + } + + public SchoolRequest withEstablishedDateIsKnown(){ + return withEstablishedDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createEstablishedDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ESTABLISHED_DATE_PROPERTY, operator, values); + } + + public SchoolRequest withEstablishedDateIs(LocalDate establishedDate){ + return withEstablishedDate(Operator.EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateIsNot(LocalDate establishedDate){ + return withEstablishedDate(Operator.NOT_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateIn(LocalDate... establishedDate){ + return withEstablishedDate(Operator.IN, (Object[])establishedDate); + } + + public SchoolRequest withEstablishedDateNotIn(LocalDate... establishedDate){ + return withEstablishedDate(Operator.NOT_IN, (Object[])establishedDate); + } + public SchoolRequest withEstablishedDateGreaterThan(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateGreaterThanOrEqualTo(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN_OR_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateLessThan(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateLessThanOrEqualTo(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN_OR_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateBetween(LocalDate startOfEstablishedDate, LocalDate endOfEstablishedDate){ + return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); + } + public SchoolRequest withEstablishedDateBefore(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateBefore(Date establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateAfter(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateAfter(Date establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateBetween(Date startOfEstablishedDate, Date endOfEstablishedDate){ + return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); + } + + + + + public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ + if (studentCapacity == null || studentCapacity.length == 0) { + throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); + } + return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); + } + + public SchoolRequest withStudentCapacity(Operator operator, Object... values){ + return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); + } + + public SchoolRequest withStudentCapacityIsUnknown(){ + return withStudentCapacity(Operator.IS_NULL); + } + + public SchoolRequest withStudentCapacityIsKnown(){ + return withStudentCapacity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); + } + + public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ + return withStudentCapacity(Operator.EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ + return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.IN, (Object[])studentCapacity); + } + + public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); + } + public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); + } + + + + public SchoolRequest filterByActive(Boolean... active){ + if (active == null || active.length == 0) { + throw new IllegalArgumentException("filterByActive parameter active cannot be empty"); + } + return appendSearchCriteria(createActiveCriteria(Operator.EQUAL, (Object[])active)); + } + + public SchoolRequest withActive(Operator operator, Object... values){ + return appendSearchCriteria(createActiveCriteria(operator, values)); + } + + public SchoolRequest withActiveIsUnknown(){ + return withActive(Operator.IS_NULL); + } + + public SchoolRequest withActiveIsKnown(){ + return withActive(Operator.IS_NOT_NULL); + } + + public SearchCriteria createActiveCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ACTIVE_PROPERTY, operator, values); + } + + public SchoolRequest whichAreActive(){ + return withActive(Operator.EQUAL, true); + } + + public SchoolRequest whichAreNotActive(){ + return withActive(Operator.EQUAL, false); + } + + + public SchoolRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public SchoolRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public SchoolRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public SchoolRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.CREATE_TIME_PROPERTY, operator, values); + } + + public SchoolRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public SchoolRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public SchoolRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public SchoolRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public SchoolRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public SchoolRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public SchoolRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public SchoolRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public SchoolRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.UPDATE_TIME_PROPERTY, operator, values); + } + + public SchoolRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public SchoolRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public SchoolRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public SchoolRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public SchoolRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); + } + + public SchoolRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SchoolRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolRequest minStudentCapacity(){ + return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest minStudentCapacityAs(String retName){ + super.min(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest maxStudentCapacity(){ + return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest maxStudentCapacityAs(String retName){ + super.max(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sumStudentCapacity(){ + return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sumStudentCapacityAs(String retName){ + super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest avgStudentCapacity(){ + return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest avgStudentCapacityAs(String retName){ + super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest standardDeviationStudentCapacity(){ + return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest standardDeviationStudentCapacityAs(String retName){ + super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ + return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sampleVarianceStudentCapacity(){ + return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ + super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest samplePopulationVarianceStudentCapacity(){ + return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ + super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(School.PLATFORM_PROPERTY, subRequest); + return this; + } + + public SchoolRequest groupBySchoolTypeWithDetails(){ + return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); + } + + public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); + return this; + } + + + + + + + + + + public SchoolRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, School.ID_PROPERTY); + return this; + } + public SchoolRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public SchoolRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, School.NAME_PROPERTY); + return this; + } + public SchoolRequest countDistinctAddress(){ + return countDistinctAddressAs("address_distinct_count"); + } + + public SchoolRequest countDistinctAddressAs(String alias){ + super.countDistinctProperty(alias, School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest countDistinctEstablishedDate(){ + return countDistinctEstablishedDateAs("established_date_distinct_count"); + } + + public SchoolRequest countDistinctEstablishedDateAs(String alias){ + super.countDistinctProperty(alias, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public SchoolRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest countDistinctActive(){ + return countDistinctActiveAs("active_distinct_count"); + } + + public SchoolRequest countDistinctActiveAs(String alias){ + super.countDistinctProperty(alias, School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public SchoolRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public SchoolRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupById(){ + groupBy(School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdAs(String retName){ + groupBy(retName, School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ID_PROPERTY, function); + return this; + } + public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(School.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolRequest groupByPlatform(){ + groupBy(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformAs(String retName){ + groupBy(retName, School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.PLATFORM_PROPERTY, function); + return this; + } + public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); + return this; + } + public SchoolRequest groupBySchoolType(){ + groupBy(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeAs(String retName){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByName(){ + groupBy(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameAs(String retName){ + groupBy(retName, School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.NAME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByAddress(){ + groupBy(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest groupByAddressAs(String retName){ + groupBy(retName, School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest groupByAddressWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ADDRESS_PROPERTY, function); + return this; + } + + public SchoolRequest groupByEstablishedDate(){ + groupBy(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest groupByEstablishedDateAs(String retName){ + groupBy(retName, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest groupByEstablishedDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ESTABLISHED_DATE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByStudentCapacity(){ + groupBy(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityAs(String retName){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); + return this; + } + + public SchoolRequest groupByActive(){ + groupBy(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest groupByActiveAs(String retName){ + groupBy(retName, School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest groupByActiveWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ACTIVE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByCreateTime(){ + groupBy(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByCreateTimeAs(String retName){ + groupBy(retName, School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.CREATE_TIME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByUpdateTime(){ + groupBy(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.UPDATE_TIME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByVersion(){ + groupBy(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionAs(String retName){ + groupBy(retName, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.VERSION_PROPERTY, function); + return this; + } + + public SchoolRequest withSchoolTypeIsPrimary(){ + filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_PRIMARY); + return this; + } + + + public SchoolRequest withSchoolTypeIsSecondary(){ + filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_SECONDARY); + return this; + } + + + + + public SchoolRequest orderByIdAscending(){ + addOrderByAscending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByIdDescending(){ + addOrderByDescending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformAscending(){ + addOrderByAscending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformDescending(){ + addOrderByDescending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeAscending(){ + addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeDescending(){ + addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderByNameAscending(){ + addOrderByAscending(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescending(){ + addOrderByDescending(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByAddressAscending(){ + addOrderByAscending(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest orderByAddressDescending(){ + addOrderByDescending(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest orderByAddressAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest orderByAddressDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest orderByEstablishedDateAscending(){ + addOrderByAscending(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest orderByEstablishedDateDescending(){ + addOrderByDescending(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityAscending(){ + addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityDescending(){ + addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByActiveAscending(){ + addOrderByAscending(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest orderByActiveDescending(){ + addOrderByDescending(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest orderByCreateTimeAscending(){ + addOrderByAscending(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByCreateTimeDescending(){ + addOrderByDescending(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByUpdateTimeAscending(){ + addOrderByAscending(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByUpdateTimeDescending(){ + addOrderByDescending(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionAscending(){ + addOrderByAscending(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionDescending(){ + addOrderByDescending(School.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + public SchoolTypeRequest rollUpToSchoolType(){ + SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); + this.internalRollUpTo("school_type", schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); + return schoolType; + } + + + + + + + + + + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); + return this; + } + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ + return facetBySchoolTypeAs(facetName, schoolType, true); + } + + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ + addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java new file mode 100644 index 000000000..5cf69e771 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java @@ -0,0 +1,168 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SchoolCapacitySummary extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SchoolCapacitySummary"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f571f4dcc37bd33fc29f0aa97e881485bf74a0130eef2c5230fe6c7e15c257f4"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("name", 2), java.util.Map.entry("total_capacity", 3), java.util.Map.entry("school_count", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("total_capacity", java.util.List.of("totalCapacity", "total_capacity")), java.util.Map.entry("school_count", java.util.List.of("schoolCount", "school_count")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolCapacitySummary.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String TOTAL_CAPACITY_PROPERTY = "total_capacity"; + public static final String SCHOOL_COUNT_PROPERTY = "school_count"; + private Platform platform; + + private String name; + + private Integer totalCapacity; + + private Integer schoolCount; + + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public Integer getTotalCapacity(){ + return this.totalCapacity; + } + + public Integer getSchoolCount(){ + return this.schoolCount; + } + + public SchoolCapacitySummary updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public SchoolCapacitySummary updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public SchoolCapacitySummary updateTotalCapacity(Integer totalCapacity){ + if(isPropertyLoaded(TOTAL_CAPACITY_PROPERTY) && Objects.equals(this.totalCapacity, totalCapacity)){ + return this; + } + handleUpdate(TOTAL_CAPACITY_PROPERTY, getTotalCapacity(), totalCapacity); + this.totalCapacity = totalCapacity; + return this; + } + + public SchoolCapacitySummary updateSchoolCount(Integer schoolCount){ + if(isPropertyLoaded(SCHOOL_COUNT_PROPERTY) && Objects.equals(this.schoolCount, schoolCount)){ + return this; + } + handleUpdate(SCHOOL_COUNT_PROPERTY, getSchoolCount(), schoolCount); + this.schoolCount = schoolCount; + return this; + } + + + public static SchoolCapacitySummary refer(Long id){ + SchoolCapacitySummary refer = new SchoolCapacitySummary(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SchoolCapacitySummary comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "total_capacity": this.totalCapacity = (Integer) value; break; + + case "school_count": this.schoolCount = (Integer) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "total_capacity": return this.totalCapacity; + case "school_count": return this.schoolCount; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "totalCapacity": return this.totalCapacity; + case "schoolCount": return this.schoolCount; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java new file mode 100644 index 000000000..f7a93a383 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java @@ -0,0 +1,79 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SchoolCapacitySummaryChecker implements Checker{ + + public String type(){ + return SchoolCapacitySummary.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SchoolCapacitySummary schoolCapacitySummary, ObjectLocation _parentLocation){ + if(needCheck(_context, schoolCapacitySummary)){ + markAsChecked(_context, schoolCapacitySummary); + doCheck(_context, schoolCapacitySummary, _parentLocation); + } + } + + public void doCheck(UserContext _context, SchoolCapacitySummary schoolCapacitySummary, ObjectLocation _parentLocation){ + if((schoolCapacitySummary == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, schoolCapacitySummary); + if(schoolCapacitySummary.needPersist()){ + } + if(schoolCapacitySummary.newItem()){ + }else if(schoolCapacitySummary.updateItem()){ + if(!schoolCapacitySummary.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!schoolCapacitySummary.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!schoolCapacitySummary.isPropertyLoaded("total_capacity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "total_capacity"), "Mutation requires a fully loaded entity"); + } + if(!schoolCapacitySummary.isPropertyLoaded("school_count")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "school_count"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkTotalCapacity(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY), newLocation(_parentLocation, "total_capacity")); + checkSchoolCount(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY), newLocation(_parentLocation, "school_count")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkTotalCapacity(UserContext _context, Integer totalCapacity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, totalCapacity); + if((totalCapacity == null)){ + return; + } + } + public void checkSchoolCount(UserContext _context, Integer schoolCount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, schoolCount); + if((schoolCount == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java new file mode 100644 index 000000000..349f2c3c7 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java @@ -0,0 +1,67 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SchoolCapacitySummaryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolCapacitySummaryExpression(Expression expression){ + super(expression); + } + + public SchoolCapacitySummaryExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolCapacitySummaryExpression updateId(Long id){ + return new SchoolCapacitySummaryExpression(this, $it -> {((SchoolCapacitySummary)$it).__internalSet("id", id); return this;}); + } + + public SchoolCapacitySummaryExpression save(UserContext userContext){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolCapacitySummaryExpression save(String intent, UserContext userContext){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", SchoolCapacitySummary::getPlatform)); + } + + public SchoolCapacitySummaryExpression updatePlatform(Platform platform){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", SchoolCapacitySummary::getName); + } + public SchoolCapacitySummaryExpression updateName(String name){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateName(name)); + } + + public Expression getTotalCapacity(){ + return loaded("total_capacity", "getTotalCapacity", SchoolCapacitySummary::getTotalCapacity); + } + public SchoolCapacitySummaryExpression updateTotalCapacity(Integer totalCapacity){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateTotalCapacity(totalCapacity)); + } + + public Expression getSchoolCount(){ + return loaded("school_count", "getSchoolCount", SchoolCapacitySummary::getSchoolCount); + } + public SchoolCapacitySummaryExpression updateSchoolCount(Integer schoolCount){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateSchoolCount(schoolCount)); + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java new file mode 100644 index 000000000..6c88d14c5 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolCapacitySummaryListExpression extends SmartListExpression { + public SchoolCapacitySummaryListExpression(Expression> expression){ + super(expression); + } + + public SchoolCapacitySummaryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolCapacitySummaryExpression first() { + return new SchoolCapacitySummaryExpression(super.first()); + } + + public SchoolCapacitySummaryExpression get(int index) { + return new SchoolCapacitySummaryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java new file mode 100644 index 000000000..a0a8e7086 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java @@ -0,0 +1,1059 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SchoolCapacitySummaryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolCapacitySummaryRequest(Class returnType){ + this(returnType, () -> (T) new SchoolCapacitySummary()); + } + + protected SchoolCapacitySummaryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolCapacitySummaryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolCapacitySummaryRequest copy(){ + return (SchoolCapacitySummaryRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolCapacitySummaryRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolCapacitySummaryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolCapacitySummaryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolCapacitySummaryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolCapacitySummaryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolCapacitySummaryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolCapacitySummaryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolCapacitySummaryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolCapacitySummaryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolCapacitySummaryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolCapacitySummaryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolCapacitySummaryRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolCapacitySummaryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolCapacitySummaryRequest matchingAnyOf(SchoolCapacitySummaryRequest schoolCapacitySummary){ + super.internalMatchAny(schoolCapacitySummary); + return this; + } + + public SchoolCapacitySummaryRequest matchingIdsOf(SchoolCapacitySummaryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolCapacitySummary.ID_PROPERTY, request, SchoolCapacitySummary.ID_PROPERTY)); + } + + public SchoolCapacitySummaryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolCapacitySummaryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolCapacitySummaryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolCapacitySummaryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); + } + + public SchoolCapacitySummaryRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolCapacitySummaryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolCapacitySummary.ID_PROPERTY); + selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + selectProperty(SchoolCapacitySummary.NAME_PROPERTY); + selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + selectProperty(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); + } + + public SchoolCapacitySummaryRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); + } + + + public SchoolCapacitySummaryRequest selectId(){ + selectProperty(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolCapacitySummaryRequest unselectId(){ + unselectProperty(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectPlatformIdOnly(){ + selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolCapacitySummaryRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + enhanceRelation(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolCapacitySummary.PLATFORM_PROPERTY)); + return this; + } + + public SchoolCapacitySummaryRequest unselectPlatform(){ + unselectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectName(){ + selectProperty(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolCapacitySummaryRequest unselectName(){ + unselectProperty(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectTotalCapacity(){ + selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + /** + * fill the totalCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalCapacity) to fetch totalCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the totalCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(totalCapacity) AS totalCapacity to fetch totalCapacity property. + * @param aggrFunction aggrFunction + */ + public SchoolCapacitySummaryRequest selectTotalCapacity(AggrFunction aggrFunction){ + selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, aggrFunction); + return this; + } + + + public SchoolCapacitySummaryRequest unselectTotalCapacity(){ + unselectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectSchoolCount(){ + selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + /** + * fill the schoolCount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS schoolCount) to fetch schoolCount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the schoolCount with customized aggrFunction, TEAQL uses ({aggrFunction}(schoolCount) AS schoolCount to fetch schoolCount property. + * @param aggrFunction aggrFunction + */ + public SchoolCapacitySummaryRequest selectSchoolCount(AggrFunction aggrFunction){ + selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, aggrFunction); + return this; + } + + + public SchoolCapacitySummaryRequest unselectSchoolCount(){ + unselectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectVersion(){ + selectProperty(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolCapacitySummaryRequest unselectVersion(){ + unselectProperty(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.ID_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolCapacitySummaryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolCapacitySummaryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolCapacitySummaryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolCapacitySummaryRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolCapacitySummaryRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolCapacitySummaryRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolCapacitySummaryRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolCapacitySummaryRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolCapacitySummaryRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.NAME_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolCapacitySummaryRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolCapacitySummaryRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolCapacitySummaryRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolCapacitySummaryRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolCapacitySummaryRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolCapacitySummaryRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolCapacitySummaryRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolCapacitySummaryRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolCapacitySummaryRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolCapacitySummaryRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolCapacitySummaryRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolCapacitySummaryRequest filterByTotalCapacity(Integer... totalCapacity){ + if (totalCapacity == null || totalCapacity.length == 0) { + throw new IllegalArgumentException("filterByTotalCapacity parameter totalCapacity cannot be empty"); + } + return appendSearchCriteria(createTotalCapacityCriteria(Operator.EQUAL, (Object[])totalCapacity)); + } + + public SchoolCapacitySummaryRequest withTotalCapacity(Operator operator, Object... values){ + return appendSearchCriteria(createTotalCapacityCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIsUnknown(){ + return withTotalCapacity(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIsKnown(){ + return withTotalCapacity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTotalCapacityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIs(Integer totalCapacity){ + return withTotalCapacity(Operator.EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIsNot(Integer totalCapacity){ + return withTotalCapacity(Operator.NOT_EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIn(Integer... totalCapacity){ + return withTotalCapacity(Operator.IN, (Object[])totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityNotIn(Integer... totalCapacity){ + return withTotalCapacity(Operator.NOT_IN, (Object[])totalCapacity); + } + public SchoolCapacitySummaryRequest withTotalCapacityGreaterThan(Integer totalCapacity){ + return withTotalCapacity(Operator.GREATER_THAN, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityGreaterThanOrEqualTo(Integer totalCapacity){ + return withTotalCapacity(Operator.GREATER_THAN_OR_EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityLessThan(Integer totalCapacity){ + return withTotalCapacity(Operator.LESS_THAN, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityLessThanOrEqualTo(Integer totalCapacity){ + return withTotalCapacity(Operator.LESS_THAN_OR_EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityBetween(Integer startOfTotalCapacity, Integer endOfTotalCapacity){ + return withTotalCapacity(Operator.BETWEEN, startOfTotalCapacity, endOfTotalCapacity); + } + + + + public SchoolCapacitySummaryRequest filterBySchoolCount(Integer... schoolCount){ + if (schoolCount == null || schoolCount.length == 0) { + throw new IllegalArgumentException("filterBySchoolCount parameter schoolCount cannot be empty"); + } + return appendSearchCriteria(createSchoolCountCriteria(Operator.EQUAL, (Object[])schoolCount)); + } + + public SchoolCapacitySummaryRequest withSchoolCount(Operator operator, Object... values){ + return appendSearchCriteria(createSchoolCountCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withSchoolCountIsUnknown(){ + return withSchoolCount(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withSchoolCountIsKnown(){ + return withSchoolCount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSchoolCountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withSchoolCountIs(Integer schoolCount){ + return withSchoolCount(Operator.EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountIsNot(Integer schoolCount){ + return withSchoolCount(Operator.NOT_EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountIn(Integer... schoolCount){ + return withSchoolCount(Operator.IN, (Object[])schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountNotIn(Integer... schoolCount){ + return withSchoolCount(Operator.NOT_IN, (Object[])schoolCount); + } + public SchoolCapacitySummaryRequest withSchoolCountGreaterThan(Integer schoolCount){ + return withSchoolCount(Operator.GREATER_THAN, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountGreaterThanOrEqualTo(Integer schoolCount){ + return withSchoolCount(Operator.GREATER_THAN_OR_EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountLessThan(Integer schoolCount){ + return withSchoolCount(Operator.LESS_THAN, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountLessThanOrEqualTo(Integer schoolCount){ + return withSchoolCount(Operator.LESS_THAN_OR_EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountBetween(Integer startOfSchoolCount, Integer endOfSchoolCount){ + return withSchoolCount(Operator.BETWEEN, startOfSchoolCount, endOfSchoolCount); + } + + + + public SchoolCapacitySummaryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolCapacitySummaryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.VERSION_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolCapacitySummaryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolCapacitySummaryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolCapacitySummaryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolCapacitySummaryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SchoolCapacitySummaryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolCapacitySummaryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolCapacitySummaryRequest minTotalCapacity(){ + return minTotalCapacityAs(prefix("minOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest minTotalCapacityAs(String retName){ + super.min(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest maxTotalCapacity(){ + return maxTotalCapacityAs(prefix("maxOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest maxTotalCapacityAs(String retName){ + super.max(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sumTotalCapacity(){ + return sumTotalCapacityAs(prefix("sumOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sumTotalCapacityAs(String retName){ + super.sum(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest avgTotalCapacity(){ + return avgTotalCapacityAs(prefix("avgOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest avgTotalCapacityAs(String retName){ + super.avg(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest standardDeviationTotalCapacity(){ + return standardDeviationTotalCapacityAs(prefix("standardDeviationOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest standardDeviationTotalCapacityAs(String retName){ + super.standardDeviation(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationTotalCapacity(){ + return squareRootOfPopulationStandardDeviationTotalCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationTotalCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sampleVarianceTotalCapacity(){ + return sampleVarianceTotalCapacityAs(prefix("sampleVarianceOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sampleVarianceTotalCapacityAs(String retName){ + super.sampleVariance(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest samplePopulationVarianceTotalCapacity(){ + return samplePopulationVarianceTotalCapacityAs(prefix("samplePopulationVarianceOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest samplePopulationVarianceTotalCapacityAs(String retName){ + super.samplePopulationVariance(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest minSchoolCount(){ + return minSchoolCountAs(prefix("minOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest minSchoolCountAs(String retName){ + super.min(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest maxSchoolCount(){ + return maxSchoolCountAs(prefix("maxOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest maxSchoolCountAs(String retName){ + super.max(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sumSchoolCount(){ + return sumSchoolCountAs(prefix("sumOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sumSchoolCountAs(String retName){ + super.sum(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest avgSchoolCount(){ + return avgSchoolCountAs(prefix("avgOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest avgSchoolCountAs(String retName){ + super.avg(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest standardDeviationSchoolCount(){ + return standardDeviationSchoolCountAs(prefix("standardDeviationOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest standardDeviationSchoolCountAs(String retName){ + super.standardDeviation(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationSchoolCount(){ + return squareRootOfPopulationStandardDeviationSchoolCountAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationSchoolCountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sampleVarianceSchoolCount(){ + return sampleVarianceSchoolCountAs(prefix("sampleVarianceOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sampleVarianceSchoolCountAs(String retName){ + super.sampleVariance(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest samplePopulationVarianceSchoolCount(){ + return samplePopulationVarianceSchoolCountAs(prefix("samplePopulationVarianceOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest samplePopulationVarianceSchoolCountAs(String retName){ + super.samplePopulationVariance(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolCapacitySummaryRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(SchoolCapacitySummary.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + public SchoolCapacitySummaryRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.ID_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctTotalCapacity(){ + return countDistinctTotalCapacityAs("total_capacity_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctTotalCapacityAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctSchoolCount(){ + return countDistinctSchoolCountAs("school_count_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctSchoolCountAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupById(){ + groupBy(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByIdAs(String retName){ + groupBy(retName, SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.ID_PROPERTY, function); + return this; + } + public SchoolCapacitySummaryRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(SchoolCapacitySummary.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolCapacitySummaryRequest groupByPlatform(){ + groupBy(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByPlatformAs(String retName){ + groupBy(retName, SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.PLATFORM_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupByName(){ + groupBy(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByNameAs(String retName){ + groupBy(retName, SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.NAME_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupByTotalCapacity(){ + groupBy(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByTotalCapacityAs(String retName){ + groupBy(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByTotalCapacityWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupBySchoolCount(){ + groupBy(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupBySchoolCountAs(String retName){ + groupBy(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupBySchoolCountWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupByVersion(){ + groupBy(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByVersionAs(String retName){ + groupBy(retName, SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.VERSION_PROPERTY, function); + return this; + } + + + + public SchoolCapacitySummaryRequest orderByIdAscending(){ + addOrderByAscending(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByIdDescending(){ + addOrderByDescending(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByPlatformAscending(){ + addOrderByAscending(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByPlatformDescending(){ + addOrderByDescending(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByNameAscending(){ + addOrderByAscending(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByNameDescending(){ + addOrderByDescending(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest orderByTotalCapacityAscending(){ + addOrderByAscending(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByTotalCapacityDescending(){ + addOrderByDescending(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderBySchoolCountAscending(){ + addOrderByAscending(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderBySchoolCountDescending(){ + addOrderByDescending(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByVersionAscending(){ + addOrderByAscending(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByVersionDescending(){ + addOrderByDescending(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + public SchoolCapacitySummaryRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolCapacitySummaryRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, SchoolCapacitySummary.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolCapacitySummary.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolCapacitySummaryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolCapacitySummaryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolCapacitySummaryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolCapacitySummaryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolCapacitySummaryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolCapacitySummaryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java new file mode 100644 index 000000000..082e03793 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java @@ -0,0 +1,193 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.school.School; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SchoolType extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SchoolType"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "36f5b35e840d2f9ef89c6ee13c7d936fa10abc12a139d7f0373f9acabc9eac12"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String CODE_PROPERTY = "code"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + private Platform platform; + + private String name; + + private String code; + + private BigDecimal displayOrder; + + private SmartList schoolList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public String getCode(){ + return this.code; + } + + public BigDecimal getDisplayOrder(){ + return this.displayOrder; + } + + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public SchoolType updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public SchoolType updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public SchoolType updateCode(String code){ + code = (code == null ? null : code.trim()); + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ + return this; + } + handleUpdate(CODE_PROPERTY, getCode(), code); + this.code = code; + return this; + } + + public SchoolType updateDisplayOrder(BigDecimal displayOrder){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ + return this; + } + handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); + this.displayOrder = displayOrder; + return this; + } + + public SchoolType addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); + return this; + } + + public static SchoolType refer(Long id){ + SchoolType refer = new SchoolType(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SchoolType comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "code": this.code = (value == null ? null : ((String)value).trim()); break; + + case "display_order": this.displayOrder = (BigDecimal) value; break; + + case "school_list": this.schoolList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "display_order": return this.displayOrder; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "displayOrder": return this.displayOrder; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java new file mode 100644 index 000000000..daffc14d5 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java @@ -0,0 +1,87 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class SchoolTypeChecker implements Checker{ + + public String type(){ + return SchoolType.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if(needCheck(_context, schoolType)){ + markAsChecked(_context, schoolType); + doCheck(_context, schoolType, _parentLocation); + } + } + + public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if((schoolType == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, schoolType); + if(schoolType.needPersist()){ + } + if(schoolType.newItem()){ + }else if(schoolType.updateItem()){ + if(!schoolType.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("display_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); + checkDisplayOrder(_context, schoolType.getProperty(SchoolType.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); + for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ + School school = schoolType.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); + if((code == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, code); + + } + public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ + if((displayOrder == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java new file mode 100644 index 000000000..f77c8c705 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java @@ -0,0 +1,76 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolTypeExpression(Expression expression){ + super(expression); + } + + public SchoolTypeExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolTypeExpression updateId(Long id){ + return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); + } + + public SchoolTypeExpression save(UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolTypeExpression save(String intent, UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); + } + + public SchoolTypeExpression updatePlatform(Platform platform){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", SchoolType::getName); + } + public SchoolTypeExpression updateName(String name){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); + } + + public Expression getCode(){ + return loaded("code", "getCode", SchoolType::getCode); + } + public SchoolTypeExpression updateCode(String code){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); + } + + public Expression getDisplayOrder(){ + return loaded("display_order", "getDisplayOrder", SchoolType::getDisplayOrder); + } + public SchoolTypeExpression updateDisplayOrder(BigDecimal displayOrder){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateDisplayOrder(displayOrder)); + } + + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); + } + public SchoolTypeExpression addSchool(School school){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java new file mode 100644 index 000000000..55fdae628 --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.schooltype; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolTypeListExpression extends SmartListExpression { + public SchoolTypeListExpression(Expression> expression){ + super(expression); + } + + public SchoolTypeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolTypeExpression first() { + return new SchoolTypeExpression(super.first()); + } + + public SchoolTypeExpression get(int index) { + return new SchoolTypeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java new file mode 100644 index 000000000..1b91f030f --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java @@ -0,0 +1,1238 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class SchoolTypeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolTypeRequest(Class returnType){ + this(returnType, () -> (T) new SchoolType()); + } + + protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolTypeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolTypeRequest copy(){ + return (SchoolTypeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolTypeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolTypeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolTypeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolTypeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolTypeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ + super.internalMatchAny(schoolType); + return this; + } + + public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); + } + + public SchoolTypeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolTypeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolTypeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolTypeRequest selectSelf(){ + super.selectSelf(); + return selectPlatformIdOnly().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + public SchoolTypeRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolTypeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolType.PLATFORM_PROPERTY); + selectProperty(SchoolType.ID_PROPERTY); + selectProperty(SchoolType.NAME_PROPERTY); + selectProperty(SchoolType.CODE_PROPERTY); + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest selectAll(){ + super.selectAll(); + return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + public SchoolTypeRequest selectChildren(){ + super.selectAny(); + selectSchoolList(); + return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + + public SchoolTypeRequest selectPlatformIdOnly(){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + public SchoolTypeRequest unselectPlatform(){ + unselectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest selectId(){ + selectProperty(SchoolType.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectId(){ + unselectProperty(SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest selectName(){ + selectProperty(SchoolType.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectName(){ + unselectProperty(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest selectCode(){ + selectProperty(SchoolType.CODE_PROPERTY); + return this; + } + + /** + * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectCode(){ + unselectProperty(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest selectDisplayOrder(){ + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + /** + * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. + * @param aggrFunction aggrFunction + */ + public SchoolTypeRequest selectDisplayOrder(AggrFunction aggrFunction){ + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY, aggrFunction); + return this; + } + + + public SchoolTypeRequest unselectDisplayOrder(){ + unselectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest selectVersion(){ + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectVersion(){ + unselectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolTypeRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolTypeRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolTypeRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); + } + + public SchoolTypeRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolTypeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); + } + + public SchoolTypeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolTypeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolTypeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolTypeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolTypeRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolTypeRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolTypeRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolTypeRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); + } + + public SchoolTypeRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolTypeRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolTypeRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolTypeRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolTypeRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolTypeRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolTypeRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolTypeRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolTypeRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolTypeRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolTypeRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolTypeRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolTypeRequest filterByCode(String... code){ + if (code == null || code.length == 0) { + throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); + } + return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); + } + + public SchoolTypeRequest withCode(Operator operator, Object... values){ + return appendSearchCriteria(createCodeCriteria(operator, values)); + } + + public SchoolTypeRequest withCodeIsUnknown(){ + return withCode(Operator.IS_NULL); + } + + public SchoolTypeRequest withCodeIsKnown(){ + return withCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); + } + + public SchoolTypeRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public SchoolTypeRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public SchoolTypeRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } + public SchoolTypeRequest withCodeGreaterThan(String code){ + return withCode(Operator.GREATER_THAN, code); + } + + public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ + return withCode(Operator.GREATER_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeLessThan(String code){ + return withCode(Operator.LESS_THAN, code); + } + + public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ + return withCode(Operator.LESS_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ + return withCode(Operator.BETWEEN, startOfCode, endOfCode); + } + public SchoolTypeRequest withCodeStartingWith(String code){ + return withCode(Operator.BEGIN_WITH, code); + } + public SchoolTypeRequest withCodeContaining(String code){ + return withCode(Operator.CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + + public SchoolTypeRequest withCodeEndingWith(String code){ + return withCode(Operator.END_WITH, code); + } + + public SchoolTypeRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + + public SchoolTypeRequest withCodeIs(String code){ + return withCode(Operator.EQUAL, code); + } + + public SchoolTypeRequest withCodeSoundingLike(String code){ + return withCode(Operator.SOUNDS_LIKE, code); + } + + + + public SchoolTypeRequest filterByDisplayOrder(BigDecimal... displayOrder){ + if (displayOrder == null || displayOrder.length == 0) { + throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); + } + return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); + } + + public SchoolTypeRequest withDisplayOrder(Operator operator, Object... values){ + return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); + } + + public SchoolTypeRequest withDisplayOrderIsUnknown(){ + return withDisplayOrder(Operator.IS_NULL); + } + + public SchoolTypeRequest withDisplayOrderIsKnown(){ + return withDisplayOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.DISPLAY_ORDER_PROPERTY, operator, values); + } + + public SchoolTypeRequest withDisplayOrderIs(BigDecimal displayOrder){ + return withDisplayOrder(Operator.EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderIsNot(BigDecimal displayOrder){ + return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.IN, (Object[])displayOrder); + } + + public SchoolTypeRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); + } + public SchoolTypeRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderLessThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ + return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); + } + + + + public SchoolTypeRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolTypeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolTypeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolTypeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); + } + + public SchoolTypeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolTypeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolTypeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolTypeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolTypeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); + } + + public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); + } + + public SchoolTypeRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolTypeRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolTypeRequest minDisplayOrder(){ + return minDisplayOrderAs(prefix("minOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest minDisplayOrderAs(String retName){ + super.min(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest maxDisplayOrder(){ + return maxDisplayOrderAs(prefix("maxOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest maxDisplayOrderAs(String retName){ + super.max(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest sumDisplayOrder(){ + return sumDisplayOrderAs(prefix("sumOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest sumDisplayOrderAs(String retName){ + super.sum(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest avgDisplayOrder(){ + return avgDisplayOrderAs(prefix("avgOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest avgDisplayOrderAs(String retName){ + super.avg(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest standardDeviationDisplayOrder(){ + return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest standardDeviationDisplayOrderAs(String retName){ + super.standardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ + return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest sampleVarianceDisplayOrder(){ + return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest sampleVarianceDisplayOrderAs(String retName){ + super.sampleVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest samplePopulationVarianceDisplayOrder(){ + return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest samplePopulationVarianceDisplayOrderAs(String retName){ + super.samplePopulationVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + public SchoolTypeRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolTypeRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolTypeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolTypeRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public SchoolTypeRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public SchoolTypeRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolTypeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + + public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolTypeRequest groupByPlatform(){ + groupBy(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformAs(String retName){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupById(){ + groupBy(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdAs(String retName){ + groupBy(retName, SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.ID_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByName(){ + groupBy(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameAs(String retName){ + groupBy(retName, SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.NAME_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByCode(){ + groupBy(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeAs(String retName){ + groupBy(retName, SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.CODE_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByDisplayOrder(){ + groupBy(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByDisplayOrderAs(String retName){ + groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByVersion(){ + groupBy(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionAs(String retName){ + groupBy(retName, SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.VERSION_PROPERTY, function); + return this; + } + + + + public SchoolTypeRequest orderByPlatformAscending(){ + addOrderByAscending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByPlatformDescending(){ + addOrderByDescending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdAscending(){ + addOrderByAscending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdDescending(){ + addOrderByDescending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameAscending(){ + addOrderByAscending(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescending(){ + addOrderByDescending(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscending(){ + addOrderByAscending(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescending(){ + addOrderByDescending(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByDisplayOrderAscending(){ + addOrderByAscending(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByDisplayOrderDescending(){ + addOrderByDescending(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionAscending(){ + addOrderByAscending(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionDescending(){ + addOrderByDescending(SchoolType.VERSION_PROPERTY); + return this; + } + + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + public SchoolTypeRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolTypeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolTypeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolTypeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolTypeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolTypeRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolTypeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..29fd0dd7c --- /dev/null +++ b/examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.schoolmanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/pom.xml b/examples/shared-load-state/java-app-console/pom.xml new file mode 100644 index 000000000..069ea7365 --- /dev/null +++ b/examples/shared-load-state/java-app-console/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + io.teaqlteaql-java-parent6.3.0 + ../../../pom.xml + + school-record-projection-workspace + 21 + + com.exampleschool-management-service-core0.0.1-SNAPSHOT + io.teaqlteaql-sqlite${project.version} + io.teaqlteaql-provider-jdbc${project.version} + io.teaqlteaql-dynamic-fields-jdbc${project.version} + io.teaqlteaql-jackson${project.version} + com.fasterxml.jackson.datatypejackson-datatype-jsr310test + org.xerialsqlite-jdbc3.53.2.1 + org.junit.jupiterjunit-jupitertest + org.mybatismybatis3.5.19test + com.zaxxerHikariCP6.3.0 + + ../src/test/java + diff --git a/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/App.java b/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/App.java new file mode 100644 index 000000000..d047fc537 --- /dev/null +++ b/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/App.java @@ -0,0 +1,99 @@ + +package com.example.schoolmanagementservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java b/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java new file mode 100644 index 000000000..85bcac867 --- /dev/null +++ b/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.example.schoolmanagementservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements SchoolManagementServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java b/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..6c73732a4 --- /dev/null +++ b/examples/shared-load-state/java-app-console/src/main/java/com/example/schoolmanagementservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.example.schoolmanagementservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/src/main/resources/application.properties b/examples/shared-load-state/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..cb4cd9a7b --- /dev/null +++ b/examples/shared-load-state/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:schoolmanagementservice.db diff --git a/examples/shared-load-state/java-app-console/teaql-i18n.json b/examples/shared-load-state/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..977f00f4a --- /dev/null +++ b/examples/shared-load-state/java-app-console/teaql-i18n.json @@ -0,0 +1,129 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.platform.name": "Name", + "property.platform.createTime": "Create Time", + "property.schoolCapacitySummary.id": "Id", + "property.platform.updateTime": "Update Time", + "property.school.platform": "Platform", + "property.school.id": "Id", + "property.schoolType.version": "Version", + "property.school.establishedDate": "Established Date", + "property.schoolType.code": "Code", + "property.school.studentCapacity": "Student Capacity", + "property.school.active": "Active", + "property.schoolCapacitySummary.name": "Name", + "property.school.schoolType": "School Type", + "property.schoolCapacitySummary.totalCapacity": "Total Capacity", + "entity.platform": "Platform", + "property.platform.id": "Id", + "property.schoolType.displayOrder": "Display Order", + "property.schoolType.id": "Id", + "entity.school": "School", + "property.schoolCapacitySummary.platform": "Platform", + "property.schoolCapacitySummary.schoolCount": "School Count", + "property.school.name": "Name", + "property.school.createTime": "Create Time", + "property.school.updateTime": "Update Time", + "entity.schoolType": "School Type", + "property.platform.baseUrl": "Base Url", + "property.platform.version": "Version", + "property.schoolType.platform": "Platform", + "property.school.version": "Version", + "property.schoolCapacitySummary.version": "Version", + "property.school.address": "Address", + "property.schoolType.name": "Name", + "entity.schoolCapacitySummary": "School Capacity Summary" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/teaql/checker-model.json b/examples/shared-load-state/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..0b9363882 --- /dev/null +++ b/examples/shared-load-state/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:d36b1e0d50365a8a5a3654777b969de3e9e0de9673b6997e9522858ac7239249","entities":{"Platform":{"labels":{"en":"platform"},"fields":[{"name":"base_url","labels":{"en":"base url"},"aliases":["BaseUrl","baseUrl"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"school_capacity_summary_list","targetType":"SchoolCapacitySummary","labels":{"en":"School Capacity Summary"},"aliases":["SchoolCapacitySummaryList","schoolCapacitySummaryList"]},{"name":"school_list","targetType":"School","labels":{"en":"school"},"aliases":["SchoolList","schoolList"]},{"name":"school_type_list","targetType":"SchoolType","labels":{"en":"school type"},"aliases":["SchoolTypeList","schoolTypeList"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"School":{"labels":{"en":"school"},"fields":[{"name":"active","labels":{"en":"active"},"aliases":["Active"]},{"name":"address","labels":{"en":"address"},"aliases":["Address"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"established_date","labels":{"en":"established date"},"aliases":["EstablishedDate","establishedDate"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"school_type","targetType":"SchoolType","labels":{"en":"school type"},"aliases":["SchoolType","schoolType"]},{"name":"student_capacity","labels":{"en":"student capacity"},"aliases":["StudentCapacity","studentCapacity"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolCapacitySummary":{"labels":{"en":"School Capacity Summary"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"school_count","labels":{"en":"school count"},"aliases":["SchoolCount","schoolCount"]},{"name":"total_capacity","labels":{"en":"total capacity"},"aliases":["TotalCapacity","totalCapacity"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolType":{"labels":{"en":"school type"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"school_list","targetType":"School","labels":{"en":"school"},"aliases":["SchoolList","schoolList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/teaql/model-provenance.json b/examples/shared-load-state/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..fbe565ea3 --- /dev/null +++ b/examples/shared-load-state/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:534f826bdc0ae660139ce4e39651bf9594ffcea9c9cdccaa1533b358bd6f89dc","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/pom.xml b/examples/shared-load-state/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..ca269438a --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.example + school-management-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java new file mode 100644 index 000000000..bdacf16bf --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Constants.java @@ -0,0 +1,13 @@ + +package com.example.schoolmanagementservice; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.schooltype.SchoolType; + +public interface Constants { + public static final long PLATFORM_ID = 1l; + public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); + public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; + public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; + public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java new file mode 100644 index 000000000..6a54ceb3f --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/E.java @@ -0,0 +1,28 @@ + +package com.example.schoolmanagementservice; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolExpression; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static PlatformExpression platform(Platform platform){ + return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); + } + public static SchoolTypeExpression schoolType(SchoolType schoolType){ + return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); + } + public static SchoolExpression school(School school){ + return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); + } + public static SchoolCapacitySummaryExpression schoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ + return new SchoolCapacitySummaryExpression(new ValueExpression(schoolCapacitySummary, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolCapacitySummary()")); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java new file mode 100644 index 000000000..f5fdbff85 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java @@ -0,0 +1,988 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerPlatform(); + registerSchoolType(); + registerSchool(); + registerSchoolCapacitySummary(); + } + private void registerPlatform() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.platform.Platform.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.platform.Platform.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.platform.Platform::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY, String.class) + ; + PropertyDescriptor baseUrl = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY, String.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Campus Learning Platform") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "https://campus.example.com") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "createTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("candidates", "updateTime()") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchoolType() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.schooltype.SchoolType.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schooltype.SchoolType::new); + entityDescriptor.with("constant", "true") + + .with("identifier", "code") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY, String.class) + ; + PropertyDescriptor code = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY, String.class) + ; + PropertyDescriptor displayOrder = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY, BigDecimal.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("candidates", "1001,1002") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Primary,Secondary") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") + + .with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "PRIMARY,SECONDARY") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("optional", "true") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.math.BigDecimal") + + .with("candidates", "1,2") + + .with("sqlType", "NUMERIC(19,7)") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "BigDecimal") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchool() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.school.School.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.school.School.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.school.School.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.school.School::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor schoolType = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.schoolmanagementservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY, String.class) + ; + PropertyDescriptor address = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY, String.class) + ; + PropertyDescriptor establishedDate = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY, LocalDate.class) + ; + PropertyDescriptor studentCapacity = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) + ; + PropertyDescriptor active = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY, Boolean.class) + ; + PropertyDescriptor createTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor updateTime = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY, LocalDateTime.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDate") + + .with("sqlType", "DATE") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "Date") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(1)") + + .with("javaType", "java.lang.Boolean") + + .with("sqlType", "BOOLEAN") + + .with("isId", "false") + + .with("isBool", "true") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "bit") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Boolean") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("updateFunction", "now") + + .with("javaType", "java.time.LocalDateTime") + + .with("sqlType", "TIMESTAMP") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("mssql_sqlType", "dateTime") + + .with("isDateTime", "true") + + .with("createFunction", "now") + + .with("isDate", "true") + + .with("isString", "false") + + .with("graphqlType", "LocalTime") + + .with("isTime", "true") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSchoolCapacitySummary() { + FieldLayout.installGenerated(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class); + entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary::new); + entityDescriptor.with("name", "School Capacity Summary") + + .with("module", "Reporting") + + .with("module_key", "reporting") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY, Long.class) + ; + PropertyDescriptor platform = + entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY, String.class) + ; + PropertyDescriptor totalCapacity = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, Integer.class) + ; + PropertyDescriptor schoolCount = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, Integer.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.PLATFORM_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..2c1d24ac8 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java @@ -0,0 +1,76 @@ +package com.example.schoolmanagementservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.example.schoolmanagementservice.platform.PlatformChecker(), new com.example.schoolmanagementservice.schooltype.SchoolTypeChecker(), new com.example.schoolmanagementservice.school.SchoolChecker(), new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:d36b1e0d50365a8a5a3654777b969de3e9e0de9673b6997e9522858ac7239249\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_capacity_summary_list\",\"targetType\":\"SchoolCapacitySummary\",\"labels\":{\"en\":\"School Capacity Summary\"},\"aliases\":[\"SchoolCapacitySummaryList\",\"schoolCapacitySummaryList\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"school\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"school type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"school\"},\"fields\":[{\"name\":\"active\",\"labels\":{\"en\":\"active\"},\"aliases\":[\"Active\"]},{\"name\":\"address\",\"labels\":{\"en\":\"address\"},\"aliases\":[\"Address\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"established_date\",\"labels\":{\"en\":\"established date\"},\"aliases\":[\"EstablishedDate\",\"establishedDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"school type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolCapacitySummary\":{\"labels\":{\"en\":\"School Capacity Summary\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_count\",\"labels\":{\"en\":\"school count\"},\"aliases\":[\"SchoolCount\",\"schoolCount\"]},{\"name\":\"total_capacity\",\"labels\":{\"en\":\"total capacity\"},\"aliases\":[\"TotalCapacity\",\"totalCapacity\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"school type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"school\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("address", "address"), java.util.Map.entry("established_date", "establishedDate"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("active", "active"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SchoolCapacitySummary", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("name", "name"), java.util.Map.entry("total_capacity", "totalCapacity"), java.util.Map.entry("school_count", "schoolCount"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.example.schoolmanagementservice.platform.Platform domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.example.schoolmanagementservice.platform.Platform(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Campus Learning Platform"); + domainRoot.updateBaseUrl("https://campus.example.com"); + domainRoot.auditAs("create generated Domain Root Platform").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); + var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1001Rows.isEmpty()) { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = new com.example.schoolmanagementservice.schooltype.SchoolType(); + constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); + constantSchoolType1001.updatePlatform(domainRoot); + constantSchoolType1001.updateName("Primary"); + constantSchoolType1001.updateCode("PRIMARY"); + constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); + constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); + } else { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } + if (!((constantSchoolType1001.getDisplayOrder() != null && constantSchoolType1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } + if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); + } + var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); + if (constantSchoolType1002Rows.isEmpty()) { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = new com.example.schoolmanagementservice.schooltype.SchoolType(); + constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); + constantSchoolType1002.updatePlatform(domainRoot); + constantSchoolType1002.updateName("Secondary"); + constantSchoolType1002.updateCode("SECONDARY"); + constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); + constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); + } else { + com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); + boolean changed = false; + if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } + if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } + if (!((constantSchoolType1002.getDisplayOrder() != null && constantSchoolType1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } + if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); + } + } +} diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java new file mode 100644 index 000000000..f65b1fb8b --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Q.java @@ -0,0 +1,43 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.example.schoolmanagementservice.platform.PlatformRequest platforms(){ + return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.platform.PlatformRequest platformsWithMinimalFields(){ + return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypes(){ + return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ + return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.school.SchoolRequest schools(){ + return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.school.SchoolRequest schoolsWithMinimalFields(){ + return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest schoolCapacitySummaries(){ + return new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest schoolCapacitySummariesWithMinimalFields(){ + return new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java new file mode 100644 index 000000000..e53bf00a7 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.example.schoolmanagementservice; + +import io.teaql.core.UserContext; +public interface SchoolManagementServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java new file mode 100644 index 000000000..f82474eb2 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java @@ -0,0 +1,236 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Platform extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Platform"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e1da6639feab09f3d1ed370802410798c759f6bf13f85e0a93374c42d1646603"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_type_list", "school_list", "school_capacity_summary_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String BASE_URL_PROPERTY = "base_url"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + public static final String SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY = "school_capacity_summary_list"; + private String name; + + private String baseUrl; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + private SmartList schoolTypeList; + private SmartList schoolList; + private SmartList schoolCapacitySummaryList; + + public String getName(){ + return this.name; + } + + public String getBaseUrl(){ + return this.baseUrl; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public SmartList getSchoolTypeList(){ + return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; + } + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public SmartList getSchoolCapacitySummaryList(){ + return this.schoolCapacitySummaryList == null ? SmartList.unloaded() : this.schoolCapacitySummaryList; + } + public Platform updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Platform updateBaseUrl(String baseUrl){ + baseUrl = (baseUrl == null ? null : baseUrl.trim()); + if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ + return this; + } + handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); + this.baseUrl = baseUrl; + return this; + } + + public Platform updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public Platform updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public Platform addSchoolType(SchoolType schoolType){ + if (schoolType == null){ + return this; + } + + if(null == this.schoolTypeList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolTypeList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolTypeList.add(schoolType); + schoolType.updatePlatform(this); + return this; + } + public Platform addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updatePlatform(this); + return this; + } + public Platform addSchoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ + if (schoolCapacitySummary == null){ + return this; + } + + if(null == this.schoolCapacitySummaryList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolCapacitySummaryList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolCapacitySummaryList.add(schoolCapacitySummary); + schoolCapacitySummary.updatePlatform(this); + return this; + } + + public static Platform refer(Long id){ + Platform refer = new Platform(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Platform comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + case "school_type_list": this.schoolTypeList = (SmartList) value; break; + case "school_list": this.schoolList = (SmartList) value; break; + case "school_capacity_summary_list": this.schoolCapacitySummaryList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "base_url": return this.baseUrl; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + case "school_type_list": return this.schoolTypeList; + case "school_list": return this.schoolList; + case "school_capacity_summary_list": return this.schoolCapacitySummaryList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + case "baseUrl": return this.baseUrl; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java new file mode 100644 index 000000000..21ee416f3 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java @@ -0,0 +1,120 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolChecker; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryChecker; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDateTime; + +public class PlatformChecker implements Checker{ + + public String type(){ + return Platform.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if(needCheck(_context, platform)){ + markAsChecked(_context, platform); + doCheck(_context, platform, _parentLocation); + } + } + + public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + if((platform == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, platform); + if(platform.needPersist()){ + } + if(platform.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + platform.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(platform.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + platform.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!platform.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("base_url")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!platform.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); + checkCreateTime(_context, platform.getProperty(Platform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, platform.getProperty(Platform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ + SchoolType schoolType = platform.getSchoolTypeList().get(i); + new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); + } + for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ + School school = platform.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + for(int i = 0; platform.getSchoolCapacitySummaryList() != null && i < platform.getSchoolCapacitySummaryList().size(); i++){ + SchoolCapacitySummary schoolCapacitySummary = platform.getSchoolCapacitySummaryList().get(i); + new SchoolCapacitySummaryChecker().checkAndFix(_context, schoolCapacitySummary, newLocation(_parentLocation, "school_capacity_summary_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, baseUrl); + if((baseUrl == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, baseUrl); + + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java new file mode 100644 index 000000000..c3533c97b --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java @@ -0,0 +1,89 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolListExpression; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryListExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { + public PlatformExpression(Expression expression){ + super(expression); + } + + public PlatformExpression(Expression expression, Function function){ + super(expression, function); + } + + public PlatformExpression updateId(Long id){ + return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); + } + + public PlatformExpression save(UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); + } + + public PlatformExpression save(String intent, UserContext userContext){ + return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Platform::getName); + } + public PlatformExpression updateName(String name){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); + } + + public Expression getBaseUrl(){ + return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); + } + public PlatformExpression updateBaseUrl(String baseUrl){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", Platform::getCreateTime); + } + public PlatformExpression updateCreateTime(LocalDateTime createTime){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", Platform::getUpdateTime); + } + public PlatformExpression updateUpdateTime(LocalDateTime updateTime){ + return new PlatformExpression(this, $it -> ((Platform)$it).updateUpdateTime(updateTime)); + } + + public SchoolTypeListExpression getSchoolTypeList(){ + return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); + } + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); + } + public SchoolCapacitySummaryListExpression getSchoolCapacitySummaryList(){ + return new SchoolCapacitySummaryListExpression(loaded("school_capacity_summary_list", "getSchoolCapacitySummaryList", Platform::getSchoolCapacitySummaryList)); + } + public PlatformExpression addSchoolType(SchoolType schoolType){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); + } + public PlatformExpression addSchool(School school){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); + } + public PlatformExpression addSchoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ + return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolCapacitySummary(schoolCapacitySummary)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java new file mode 100644 index 000000000..14e4a4c13 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.platform; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class PlatformListExpression extends SmartListExpression { + public PlatformListExpression(Expression> expression){ + super(expression); + } + + public PlatformListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public PlatformExpression first() { + return new PlatformExpression(super.first()); + } + + public PlatformExpression get(int index) { + return new PlatformExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java new file mode 100644 index 000000000..3e9c17602 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java @@ -0,0 +1,1760 @@ + +package com.example.schoolmanagementservice.platform; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolRequest; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; +import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class PlatformRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public PlatformRequest(Class returnType){ + this(returnType, () -> (T) new Platform()); + } + + protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public PlatformRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public PlatformRequest copy(){ + return (PlatformRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public PlatformRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public PlatformRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public PlatformRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public PlatformRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public PlatformRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (PlatformRequest)super.appendSearchCriteria(searchCriteria); + } + + public PlatformRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public PlatformRequest matchingAnyOf(PlatformRequest platform){ + super.internalMatchAny(platform); + return this; + } + + public PlatformRequest matchingIdsOf(PlatformRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); + } + + public PlatformRequest enhanceChildrenIfNeeded(){ + return this; + } + + public PlatformRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public PlatformRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public PlatformRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PlatformRequest selectSelfFields(){ + return selectSelf(); + } + + public PlatformRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Platform.ID_PROPERTY); + selectProperty(Platform.NAME_PROPERTY); + selectProperty(Platform.BASE_URL_PROPERTY); + selectProperty(Platform.CREATE_TIME_PROPERTY); + selectProperty(Platform.UPDATE_TIME_PROPERTY); + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public PlatformRequest selectChildren(){ + super.selectAny(); + selectSchoolTypeList().selectSchoolList().selectSchoolCapacitySummaryList(); + return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public PlatformRequest selectId(){ + selectProperty(Platform.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectId(){ + unselectProperty(Platform.ID_PROPERTY); + return this; + } + public PlatformRequest selectName(){ + selectProperty(Platform.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectName(){ + unselectProperty(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest selectBaseUrl(){ + selectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + + /** + * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectBaseUrl(){ + unselectProperty(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest selectCreateTime(){ + selectProperty(Platform.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectCreateTime(){ + unselectProperty(Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest selectUpdateTime(){ + selectProperty(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectUpdateTime(){ + unselectProperty(Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest selectVersion(){ + selectProperty(Platform.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public PlatformRequest unselectVersion(){ + unselectProperty(Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest selectSchoolTypeList(){ + return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); + } + + public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ + enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest selectSchoolCapacitySummaryList(){ + return selectSchoolCapacitySummaryListWith(Q.schoolCapacitySummaries().selectSelf()); + } + + public PlatformRequest selectSchoolCapacitySummaryListWith(SchoolCapacitySummaryRequest schoolCapacitySummaryList){ + enhanceRelation(Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, schoolCapacitySummaryList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolCapacitySummaryListWith", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); + } + + public PlatformRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public PlatformRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public PlatformRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public PlatformRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public PlatformRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public PlatformRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public PlatformRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public PlatformRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); + } + + public PlatformRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public PlatformRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public PlatformRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public PlatformRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public PlatformRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public PlatformRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public PlatformRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public PlatformRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public PlatformRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public PlatformRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public PlatformRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public PlatformRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public PlatformRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public PlatformRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public PlatformRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public PlatformRequest filterByBaseUrl(String... baseUrl){ + if (baseUrl == null || baseUrl.length == 0) { + throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); + } + return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); + } + + public PlatformRequest withBaseUrl(Operator operator, Object... values){ + return appendSearchCriteria(createBaseUrlCriteria(operator, values)); + } + + public PlatformRequest withBaseUrlIsUnknown(){ + return withBaseUrl(Operator.IS_NULL); + } + + public PlatformRequest withBaseUrlIsKnown(){ + return withBaseUrl(Operator.IS_NOT_NULL); + } + + public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); + } + + public PlatformRequest withBaseUrlIsNot(String baseUrl){ + return withBaseUrl(Operator.NOT_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlIn(String... baseUrl){ + return withBaseUrl(Operator.IN, (Object[])baseUrl); + } + + public PlatformRequest withBaseUrlNotIn(String... baseUrl){ + return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); + } + public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlLessThan(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN, baseUrl); + } + + public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ + return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ + return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); + } + public PlatformRequest withBaseUrlStartingWith(String baseUrl){ + return withBaseUrl(Operator.BEGIN_WITH, baseUrl); + } + public PlatformRequest withBaseUrlContaining(String baseUrl){ + return withBaseUrl(Operator.CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotContaining(String baseUrl){ + return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); + } + + public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlEndingWith(String baseUrl){ + return withBaseUrl(Operator.END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ + return withBaseUrl(Operator.NOT_END_WITH, baseUrl); + } + + public PlatformRequest withBaseUrlIs(String baseUrl){ + return withBaseUrl(Operator.EQUAL, baseUrl); + } + + public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ + return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); + } + + + + public PlatformRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public PlatformRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public PlatformRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public PlatformRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.CREATE_TIME_PROPERTY, operator, values); + } + + public PlatformRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public PlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public PlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public PlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public PlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public PlatformRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public PlatformRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public PlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public PlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public PlatformRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public PlatformRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public PlatformRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.UPDATE_TIME_PROPERTY, operator, values); + } + + public PlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public PlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public PlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public PlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public PlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public PlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public PlatformRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public PlatformRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public PlatformRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public PlatformRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); + } + + public PlatformRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public PlatformRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public PlatformRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public PlatformRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public PlatformRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public PlatformRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchoolTypes(){ + return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + + public PlatformRequest haveNoSchoolTypes(){ + return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); + } + public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public PlatformRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + public PlatformRequest withSchoolCapacitySummaryListMatching(SchoolCapacitySummaryRequest schoolCapacitySummaryRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolCapacitySummaryRequest, SchoolCapacitySummary.PLATFORM_PROPERTY)); + } + + public PlatformRequest withoutSchoolCapacitySummaryListMatching(SchoolCapacitySummaryRequest schoolCapacitySummaryRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolCapacitySummaryRequest, SchoolCapacitySummary.PLATFORM_PROPERTY))); + } + + public PlatformRequest haveSchoolCapacitySummaries(){ + return withSchoolCapacitySummaryListMatching(Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest haveNoSchoolCapacitySummaries(){ + return withoutSchoolCapacitySummaryListMatching(Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public PlatformRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public PlatformRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public PlatformRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Platform.ID_PROPERTY); + return this; + } + public PlatformRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public PlatformRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest countDistinctBaseUrl(){ + return countDistinctBaseUrlAs("base_url_distinct_count"); + } + + public PlatformRequest countDistinctBaseUrlAs(String alias){ + super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public PlatformRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.CREATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public PlatformRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, Platform.UPDATE_TIME_PROPERTY); + return this; + } + public PlatformRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public PlatformRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); + return this; + } + public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ + aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + public PlatformRequest groupBySchoolCapacitySummariesWithDetails(SchoolCapacitySummaryRequest subRequest){ + aggregate(Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, subRequest); + return this; + } + + public PlatformRequest groupById(){ + groupBy(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdAs(String retName){ + groupBy(retName, Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.ID_PROPERTY, function); + return this; + } + + public PlatformRequest groupByName(){ + groupBy(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameAs(String retName){ + groupBy(retName, Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.NAME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByBaseUrl(){ + groupBy(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlAs(String retName){ + groupBy(retName, Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.BASE_URL_PROPERTY, function); + return this; + } + + public PlatformRequest groupByCreateTime(){ + groupBy(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByCreateTimeAs(String retName){ + groupBy(retName, Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.CREATE_TIME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByUpdateTime(){ + groupBy(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.UPDATE_TIME_PROPERTY, function); + return this; + } + + public PlatformRequest groupByVersion(){ + groupBy(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionAs(String retName){ + groupBy(retName, Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Platform.VERSION_PROPERTY, function); + return this; + } + + + + public PlatformRequest orderByIdAscending(){ + addOrderByAscending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByIdDescending(){ + addOrderByDescending(Platform.ID_PROPERTY); + return this; + } + + public PlatformRequest orderByNameAscending(){ + addOrderByAscending(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescending(){ + addOrderByDescending(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + + public PlatformRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscending(){ + addOrderByAscending(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescending(){ + addOrderByDescending(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + + public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); + return this; + } + public PlatformRequest orderByCreateTimeAscending(){ + addOrderByAscending(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByCreateTimeDescending(){ + addOrderByDescending(Platform.CREATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByUpdateTimeAscending(){ + addOrderByAscending(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByUpdateTimeDescending(){ + addOrderByDescending(Platform.UPDATE_TIME_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionAscending(){ + addOrderByAscending(Platform.VERSION_PROPERTY); + return this; + } + + public PlatformRequest orderByVersionDescending(){ + addOrderByDescending(Platform.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ + return statsFromSchoolTypesAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest statsFromSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + return statsFromSchoolCapacitySummariesAs(name, subRequest, false); + } + + public PlatformRequest statsFromSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest statsFromSchoolCapacitySummaries(SchoolCapacitySummaryRequest subRequest){ + return statsFromSchoolCapacitySummariesAs(REFINEMENTS, subRequest); + } + public PlatformRequest countSchoolTypes(){ + addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesAs(String name){ + addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ + addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest countSchoolCapacitySummaries(){ + addRelationCount("Count", Q.schoolCapacitySummaries().unlimited(), SchoolCapacitySummary.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolCapacitySummariesAs(String name){ + addRelationCount(name, Q.schoolCapacitySummaries().unlimited(), SchoolCapacitySummary.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest countSchoolCapacitySummariesWith(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationCount(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummariesWith", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest minDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("minDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ + return minDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("maxDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ + return maxDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("sumDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ + return sumDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("avgDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ + return avgDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("stdDevDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name){ + return standardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("stdDevPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name){ + return squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("varSampDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name){ + return sampleVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypes(){ + addRelationScalarAggregate("varPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), + SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name){ + return samplePopulationVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); + } + + public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, + SchoolType.DISPLAY_ORDER_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); + return this; + } + public PlatformRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); + return this; + } + public PlatformRequest minTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("minTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return minTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest minTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("maxTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return maxTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest maxTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("sumTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return sumTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sumTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("avgTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return avgTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest avgTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevPopTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varSampTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varPopTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name){ + return samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest minSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("minSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest minSchoolCountOfSchoolCapacitySummariesAs(String name){ + return minSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest minSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest maxSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("maxSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest maxSchoolCountOfSchoolCapacitySummariesAs(String name){ + return maxSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest maxSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sumSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("sumSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sumSchoolCountOfSchoolCapacitySummariesAs(String name){ + return sumSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sumSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest avgSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("avgSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest avgSchoolCountOfSchoolCapacitySummariesAs(String name){ + return avgSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest avgSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name){ + return standardDeviationSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("stdDevPopSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name){ + return squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varSampSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(String name){ + return sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummaries(){ + addRelationScalarAggregate("varPopSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), + SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(String name){ + return samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); + } + + public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ + addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, + SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public PlatformRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public PlatformRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public PlatformRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public PlatformRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public PlatformRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public PlatformRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java new file mode 100644 index 000000000..3923b042c --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/School.java @@ -0,0 +1,287 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.Constants; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class School extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "School"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "14b4bfbb4cda258779665e3bc38ab991040fe75793a416d29eddd06f8fa8f586"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("address", 4), java.util.Map.entry("established_date", 5), java.util.Map.entry("student_capacity", 6), java.util.Map.entry("active", 7), java.util.Map.entry("create_time", 8), java.util.Map.entry("update_time", 9), java.util.Map.entry("version", 10)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("address", java.util.List.of("address", "address")), java.util.Map.entry("established_date", java.util.List.of("establishedDate", "established_date")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("active", java.util.List.of("active", "active")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + School.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String SCHOOL_TYPE_PROPERTY = "school_type"; + public static final String NAME_PROPERTY = "name"; + public static final String ADDRESS_PROPERTY = "address"; + public static final String ESTABLISHED_DATE_PROPERTY = "established_date"; + public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; + public static final String ACTIVE_PROPERTY = "active"; + public static final String CREATE_TIME_PROPERTY = "create_time"; + public static final String UPDATE_TIME_PROPERTY = "update_time"; + private Platform platform; + + private SchoolType schoolType; + + private String name; + + private String address; + + private LocalDate establishedDate; + + private Integer studentCapacity; + + private Boolean active; + + private LocalDateTime createTime; + + private LocalDateTime updateTime; + + + public Platform getPlatform(){ + return this.platform; + } + + public SchoolType getSchoolType(){ + return this.schoolType; + } + + public String getName(){ + return this.name; + } + + public String getAddress(){ + return this.address; + } + + public LocalDate getEstablishedDate(){ + return this.establishedDate; + } + + public Integer getStudentCapacity(){ + return this.studentCapacity; + } + + public Boolean isActive(){ + return this.active; + } + + public LocalDateTime getCreateTime(){ + return this.createTime; + } + + public LocalDateTime getUpdateTime(){ + return this.updateTime; + } + + public School updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + protected School updateSchoolType(SchoolType schoolType){ + if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ + return this; + } + handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); + this.schoolType = schoolType; + return this; + } + + public School updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public School updateAddress(String address){ + address = (address == null ? null : address.trim()); + if(isPropertyLoaded(ADDRESS_PROPERTY) && Objects.equals(this.address, address)){ + return this; + } + handleUpdate(ADDRESS_PROPERTY, getAddress(), address); + this.address = address; + return this; + } + + public School updateEstablishedDate(LocalDate establishedDate){ + if(isPropertyLoaded(ESTABLISHED_DATE_PROPERTY) && Objects.equals(this.establishedDate, establishedDate)){ + return this; + } + handleUpdate(ESTABLISHED_DATE_PROPERTY, getEstablishedDate(), establishedDate); + this.establishedDate = establishedDate; + return this; + } + + public School updateStudentCapacity(Integer studentCapacity){ + if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ + return this; + } + handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); + this.studentCapacity = studentCapacity; + return this; + } + + public School updateActive(Boolean active){ + if(isPropertyLoaded(ACTIVE_PROPERTY) && Objects.equals(this.active, active)){ + return this; + } + handleUpdate(ACTIVE_PROPERTY, isActive(), active); + this.active = active; + return this; + } + + public School updateCreateTime(LocalDateTime createTime){ + if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ + return this; + } + handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); + this.createTime = createTime; + return this; + } + + public School updateUpdateTime(LocalDateTime updateTime){ + if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ + return this; + } + handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); + this.updateTime = updateTime; + return this; + } + + public boolean isSchoolTypePrimary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); + } + + public School updateSchoolTypeToPrimary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); + } + public boolean isSchoolTypeSecondary(){ + return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); + } + + public School updateSchoolTypeToSecondary(){ + return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); + } + + public static School refer(Long id){ + School refer = new School(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public School comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "school_type": this.schoolType = (SchoolType) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "address": this.address = (value == null ? null : ((String)value).trim()); break; + + case "established_date": this.establishedDate = (LocalDate) value; break; + + case "student_capacity": this.studentCapacity = (Integer) value; break; + + case "active": this.active = (Boolean) value; break; + + case "create_time": this.createTime = (LocalDateTime) value; break; + + case "update_time": this.updateTime = (LocalDateTime) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "school_type": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "established_date": return this.establishedDate; + case "student_capacity": return this.studentCapacity; + case "active": return this.active; + case "create_time": return this.createTime; + case "update_time": return this.updateTime; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "schoolType": return this.schoolType; + case "name": return this.name; + case "address": return this.address; + case "establishedDate": return this.establishedDate; + case "studentCapacity": return this.studentCapacity; + case "active": return this.active; + case "createTime": return this.createTime; + case "updateTime": return this.updateTime; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java new file mode 100644 index 000000000..df8d0faa3 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java @@ -0,0 +1,159 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class SchoolChecker implements Checker{ + + public String type(){ + return School.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ + if(needCheck(_context, school)){ + markAsChecked(_context, school); + doCheck(_context, school, _parentLocation); + } + } + + public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ + if((school == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, school); + if(school.needPersist()){ + } + if(school.newItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { + school.updateCreateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + }if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + }else if(school.updateItem()){ + if(_contextFixEligible){ + applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { + school.updateUpdateTime(_context.evaluate("now")); + _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", + "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, + "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); + }); + } + if(!school.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("school_type")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("address")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "address"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("established_date")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "established_date"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("student_capacity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("active")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "active"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("create_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); + } + if(!school.isPropertyLoaded("update_time")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); + checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkAddress(_context, school.getProperty(School.ADDRESS_PROPERTY), newLocation(_parentLocation, "address")); + checkEstablishedDate(_context, school.getProperty(School.ESTABLISHED_DATE_PROPERTY), newLocation(_parentLocation, "established_date")); + checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); + checkActive(_context, school.getProperty(School.ACTIVE_PROPERTY), newLocation(_parentLocation, "active")); + checkCreateTime(_context, school.getProperty(School.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); + checkUpdateTime(_context, school.getProperty(School.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, schoolType); + if((schoolType == null)){ + return; + } + new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkAddress(UserContext _context, String address, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, address); + if((address == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, address); + + } + public void checkEstablishedDate(UserContext _context, LocalDate establishedDate, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, establishedDate); + if((establishedDate == null)){ + return; + } + } + public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, studentCapacity); + if((studentCapacity == null)){ + return; + } + } + public void checkActive(UserContext _context, Boolean active, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, active); + if((active == null)){ + return; + } + } + public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, createTime); + if((createTime == null)){ + return; + } + } + public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, updateTime); + if((updateTime == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java new file mode 100644 index 000000000..381a4e119 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java @@ -0,0 +1,110 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.function.Function; + +public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolExpression(Expression expression){ + super(expression); + } + + public SchoolExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolExpression updateId(Long id){ + return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); + } + + public SchoolExpression save(UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolExpression save(String intent, UserContext userContext){ + return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); + } + + public SchoolExpression updatePlatform(Platform platform){ + return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); + } + + public SchoolTypeExpression getSchoolType(){ + return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); + } + + public SchoolExpression updateSchoolTypeToPrimary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); + } + public SchoolExpression updateSchoolTypeToSecondary(){ + return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); + } + + public Expression getName(){ + return loaded("name", "getName", School::getName); + } + public SchoolExpression updateName(String name){ + return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); + } + + public Expression getAddress(){ + return loaded("address", "getAddress", School::getAddress); + } + public SchoolExpression updateAddress(String address){ + return new SchoolExpression(this, $it -> ((School)$it).updateAddress(address)); + } + + public Expression getEstablishedDate(){ + return loaded("established_date", "getEstablishedDate", School::getEstablishedDate); + } + public SchoolExpression updateEstablishedDate(LocalDate establishedDate){ + return new SchoolExpression(this, $it -> ((School)$it).updateEstablishedDate(establishedDate)); + } + + public Expression getStudentCapacity(){ + return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); + } + public SchoolExpression updateStudentCapacity(Integer studentCapacity){ + return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); + } + + public Expression isActive(){ + return loaded("active", "isActive", School::isActive); + } + public SchoolExpression updateActive(Boolean active){ + return new SchoolExpression(this, $it -> ((School)$it).updateActive(active)); + } + + public Expression getCreateTime(){ + return loaded("create_time", "getCreateTime", School::getCreateTime); + } + public SchoolExpression updateCreateTime(LocalDateTime createTime){ + return new SchoolExpression(this, $it -> ((School)$it).updateCreateTime(createTime)); + } + + public Expression getUpdateTime(){ + return loaded("update_time", "getUpdateTime", School::getUpdateTime); + } + public SchoolExpression updateUpdateTime(LocalDateTime updateTime){ + return new SchoolExpression(this, $it -> ((School)$it).updateUpdateTime(updateTime)); + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java new file mode 100644 index 000000000..c41793f7b --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.school; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolListExpression extends SmartListExpression { + public SchoolListExpression(Expression> expression){ + super(expression); + } + + public SchoolListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolExpression first() { + return new SchoolExpression(super.first()); + } + + public SchoolExpression get(int index) { + return new SchoolExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java new file mode 100644 index 000000000..c5ad3c9c4 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java @@ -0,0 +1,1643 @@ + +package com.example.schoolmanagementservice.school; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import com.example.schoolmanagementservice.schooltype.SchoolType; +import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.Objects; + +public class SchoolRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolRequest(Class returnType){ + this(returnType, () -> (T) new School()); + } + + protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolRequest copy(){ + return (SchoolRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolRequest matchingAnyOf(SchoolRequest school){ + super.internalMatchAny(school); + return this; + } + + public SchoolRequest matchingIdsOf(SchoolRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + School.ID_PROPERTY, request, School.ID_PROPERTY)); + } + + public SchoolRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public SchoolRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(School.ID_PROPERTY); + selectProperty(School.PLATFORM_PROPERTY); + selectProperty(School.SCHOOL_TYPE_PROPERTY); + selectProperty(School.NAME_PROPERTY); + selectProperty(School.ADDRESS_PROPERTY); + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + selectProperty(School.ACTIVE_PROPERTY); + selectProperty(School.CREATE_TIME_PROPERTY); + selectProperty(School.UPDATE_TIME_PROPERTY); + selectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + public SchoolRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); + } + + + public SchoolRequest selectId(){ + selectProperty(School.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectId(){ + unselectProperty(School.ID_PROPERTY); + return this; + } + public SchoolRequest selectPlatformIdOnly(){ + selectProperty(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(School.PLATFORM_PROPERTY); + enhanceRelation(School.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); + return this; + } + + public SchoolRequest unselectPlatform(){ + unselectProperty(School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest selectSchoolTypeIdOnly(){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest selectSchoolType(){ + return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); + } + + public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ + selectProperty(School.SCHOOL_TYPE_PROPERTY); + enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + public SchoolRequest unselectSchoolType(){ + unselectProperty(School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest selectName(){ + selectProperty(School.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectName(){ + unselectProperty(School.NAME_PROPERTY); + return this; + } + public SchoolRequest selectAddress(){ + selectProperty(School.ADDRESS_PROPERTY); + return this; + } + + /** + * fill the address with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS address) to fetch address property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectAddress(){ + unselectProperty(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest selectEstablishedDate(){ + selectProperty(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + /** + * fill the establishedDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS establishedDate) to fetch establishedDate property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectEstablishedDate(){ + unselectProperty(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest selectStudentCapacity(){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + /** + * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. + * @param aggrFunction aggrFunction + */ + public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ + selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); + return this; + } + + + public SchoolRequest unselectStudentCapacity(){ + unselectProperty(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest selectActive(){ + selectProperty(School.ACTIVE_PROPERTY); + return this; + } + + /** + * fill the active with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS active) to fetch active property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectActive(){ + unselectProperty(School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest selectCreateTime(){ + selectProperty(School.CREATE_TIME_PROPERTY); + return this; + } + + /** + * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectCreateTime(){ + unselectProperty(School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest selectUpdateTime(){ + selectProperty(School.UPDATE_TIME_PROPERTY); + return this; + } + + /** + * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectUpdateTime(){ + unselectProperty(School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest selectVersion(){ + selectProperty(School.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolRequest unselectVersion(){ + unselectProperty(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); + } + + public SchoolRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); + } + + public SchoolRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolRequest filterBySchoolType(SchoolType... schoolType){ + if (schoolType == null || schoolType.length == 0) { + throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); + } + return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); + } + + public SchoolRequest withSchoolType(Operator operator, Object... values){ + return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); + } + + public SchoolRequest withSchoolTypeIsUnknown(){ + return withSchoolType(Operator.IS_NULL); + } + + public SchoolRequest withSchoolTypeIsKnown(){ + return withSchoolType(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); + } + + public SchoolRequest filterBySchoolType(Long schoolType){ + if(schoolType == null){ + return this; + } + return withSchoolType(Operator.EQUAL, schoolType); + } + public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); + } + + public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); + } + + public SchoolRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); + } + + public SchoolRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolRequest filterByAddress(String... address){ + if (address == null || address.length == 0) { + throw new IllegalArgumentException("filterByAddress parameter address cannot be empty"); + } + return appendSearchCriteria(createAddressCriteria(Operator.EQUAL, (Object[])address)); + } + + public SchoolRequest withAddress(Operator operator, Object... values){ + return appendSearchCriteria(createAddressCriteria(operator, values)); + } + + public SchoolRequest withAddressIsUnknown(){ + return withAddress(Operator.IS_NULL); + } + + public SchoolRequest withAddressIsKnown(){ + return withAddress(Operator.IS_NOT_NULL); + } + + public SearchCriteria createAddressCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ADDRESS_PROPERTY, operator, values); + } + + public SchoolRequest withAddressIsNot(String address){ + return withAddress(Operator.NOT_EQUAL, address); + } + + public SchoolRequest withAddressIn(String... address){ + return withAddress(Operator.IN, (Object[])address); + } + + public SchoolRequest withAddressNotIn(String... address){ + return withAddress(Operator.NOT_IN, (Object[])address); + } + public SchoolRequest withAddressGreaterThan(String address){ + return withAddress(Operator.GREATER_THAN, address); + } + + public SchoolRequest withAddressGreaterThanOrEqualTo(String address){ + return withAddress(Operator.GREATER_THAN_OR_EQUAL, address); + } + + public SchoolRequest withAddressLessThan(String address){ + return withAddress(Operator.LESS_THAN, address); + } + + public SchoolRequest withAddressLessThanOrEqualTo(String address){ + return withAddress(Operator.LESS_THAN_OR_EQUAL, address); + } + + public SchoolRequest withAddressBetween(String startOfAddress, String endOfAddress){ + return withAddress(Operator.BETWEEN, startOfAddress, endOfAddress); + } + public SchoolRequest withAddressStartingWith(String address){ + return withAddress(Operator.BEGIN_WITH, address); + } + public SchoolRequest withAddressContaining(String address){ + return withAddress(Operator.CONTAIN, address); + } + + public SchoolRequest withAddressNotContaining(String address){ + return withAddress(Operator.NOT_CONTAIN, address); + } + + public SchoolRequest withAddressNotStartingWith(String address){ + return withAddress(Operator.NOT_BEGIN_WITH, address); + } + + public SchoolRequest withAddressEndingWith(String address){ + return withAddress(Operator.END_WITH, address); + } + + public SchoolRequest withAddressNotEndingWith(String address){ + return withAddress(Operator.NOT_END_WITH, address); + } + + public SchoolRequest withAddressIs(String address){ + return withAddress(Operator.EQUAL, address); + } + + public SchoolRequest withAddressSoundingLike(String address){ + return withAddress(Operator.SOUNDS_LIKE, address); + } + + + + public SchoolRequest filterByEstablishedDate(LocalDate... establishedDate){ + if (establishedDate == null || establishedDate.length == 0) { + throw new IllegalArgumentException("filterByEstablishedDate parameter establishedDate cannot be empty"); + } + return appendSearchCriteria(createEstablishedDateCriteria(Operator.EQUAL, (Object[])establishedDate)); + } + + public SchoolRequest withEstablishedDate(Operator operator, Object... values){ + return appendSearchCriteria(createEstablishedDateCriteria(operator, values)); + } + + public SchoolRequest withEstablishedDateIsUnknown(){ + return withEstablishedDate(Operator.IS_NULL); + } + + public SchoolRequest withEstablishedDateIsKnown(){ + return withEstablishedDate(Operator.IS_NOT_NULL); + } + + public SearchCriteria createEstablishedDateCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ESTABLISHED_DATE_PROPERTY, operator, values); + } + + public SchoolRequest withEstablishedDateIs(LocalDate establishedDate){ + return withEstablishedDate(Operator.EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateIsNot(LocalDate establishedDate){ + return withEstablishedDate(Operator.NOT_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateIn(LocalDate... establishedDate){ + return withEstablishedDate(Operator.IN, (Object[])establishedDate); + } + + public SchoolRequest withEstablishedDateNotIn(LocalDate... establishedDate){ + return withEstablishedDate(Operator.NOT_IN, (Object[])establishedDate); + } + public SchoolRequest withEstablishedDateGreaterThan(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateGreaterThanOrEqualTo(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN_OR_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateLessThan(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateLessThanOrEqualTo(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN_OR_EQUAL, establishedDate); + } + + public SchoolRequest withEstablishedDateBetween(LocalDate startOfEstablishedDate, LocalDate endOfEstablishedDate){ + return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); + } + public SchoolRequest withEstablishedDateBefore(LocalDate establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateBefore(Date establishedDate){ + return withEstablishedDate(Operator.LESS_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateAfter(LocalDate establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateAfter(Date establishedDate){ + return withEstablishedDate(Operator.GREATER_THAN, establishedDate); + } + + public SchoolRequest withEstablishedDateBetween(Date startOfEstablishedDate, Date endOfEstablishedDate){ + return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); + } + + + + + public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ + if (studentCapacity == null || studentCapacity.length == 0) { + throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); + } + return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); + } + + public SchoolRequest withStudentCapacity(Operator operator, Object... values){ + return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); + } + + public SchoolRequest withStudentCapacityIsUnknown(){ + return withStudentCapacity(Operator.IS_NULL); + } + + public SchoolRequest withStudentCapacityIsKnown(){ + return withStudentCapacity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); + } + + public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ + return withStudentCapacity(Operator.EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ + return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.IN, (Object[])studentCapacity); + } + + public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ + return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); + } + public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN, studentCapacity); + } + + public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ + return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); + } + + public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ + return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); + } + + + + public SchoolRequest filterByActive(Boolean... active){ + if (active == null || active.length == 0) { + throw new IllegalArgumentException("filterByActive parameter active cannot be empty"); + } + return appendSearchCriteria(createActiveCriteria(Operator.EQUAL, (Object[])active)); + } + + public SchoolRequest withActive(Operator operator, Object... values){ + return appendSearchCriteria(createActiveCriteria(operator, values)); + } + + public SchoolRequest withActiveIsUnknown(){ + return withActive(Operator.IS_NULL); + } + + public SchoolRequest withActiveIsKnown(){ + return withActive(Operator.IS_NOT_NULL); + } + + public SearchCriteria createActiveCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.ACTIVE_PROPERTY, operator, values); + } + + public SchoolRequest whichAreActive(){ + return withActive(Operator.EQUAL, true); + } + + public SchoolRequest whichAreNotActive(){ + return withActive(Operator.EQUAL, false); + } + + + public SchoolRequest filterByCreateTime(LocalDateTime... createTime){ + if (createTime == null || createTime.length == 0) { + throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); + } + return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); + } + + public SchoolRequest withCreateTime(Operator operator, Object... values){ + return appendSearchCriteria(createCreateTimeCriteria(operator, values)); + } + + public SchoolRequest withCreateTimeIsUnknown(){ + return withCreateTime(Operator.IS_NULL); + } + + public SchoolRequest withCreateTimeIsKnown(){ + return withCreateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.CREATE_TIME_PROPERTY, operator, values); + } + + public SchoolRequest withCreateTimeIs(LocalDateTime createTime){ + return withCreateTime(Operator.EQUAL, createTime); + } + + public SchoolRequest withCreateTimeIsNot(LocalDateTime createTime){ + return withCreateTime(Operator.NOT_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeIn(LocalDateTime... createTime){ + return withCreateTime(Operator.IN, (Object[])createTime); + } + + public SchoolRequest withCreateTimeNotIn(LocalDateTime... createTime){ + return withCreateTime(Operator.NOT_IN, (Object[])createTime); + } + public SchoolRequest withCreateTimeGreaterThan(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeLessThan(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); + } + + public SchoolRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + public SchoolRequest withCreateTimeBefore(LocalDateTime createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeBefore(Date createTime){ + return withCreateTime(Operator.LESS_THAN, createTime); + } + + public SchoolRequest withCreateTimeAfter(LocalDateTime createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeAfter(Date createTime){ + return withCreateTime(Operator.GREATER_THAN, createTime); + } + + public SchoolRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ + return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); + } + + + + + public SchoolRequest filterByUpdateTime(LocalDateTime... updateTime){ + if (updateTime == null || updateTime.length == 0) { + throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); + } + return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); + } + + public SchoolRequest withUpdateTime(Operator operator, Object... values){ + return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); + } + + public SchoolRequest withUpdateTimeIsUnknown(){ + return withUpdateTime(Operator.IS_NULL); + } + + public SchoolRequest withUpdateTimeIsKnown(){ + return withUpdateTime(Operator.IS_NOT_NULL); + } + + public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.UPDATE_TIME_PROPERTY, operator, values); + } + + public SchoolRequest withUpdateTimeIs(LocalDateTime updateTime){ + return withUpdateTime(Operator.EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeIsNot(LocalDateTime updateTime){ + return withUpdateTime(Operator.NOT_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.IN, (Object[])updateTime); + } + + public SchoolRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ + return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); + } + public SchoolRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeLessThan(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); + } + + public SchoolRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + public SchoolRequest withUpdateTimeBefore(LocalDateTime updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeBefore(Date updateTime){ + return withUpdateTime(Operator.LESS_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeAfter(LocalDateTime updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeAfter(Date updateTime){ + return withUpdateTime(Operator.GREATER_THAN, updateTime); + } + + public SchoolRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ + return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); + } + + + + + public SchoolRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); + } + + public SchoolRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SchoolRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolRequest minStudentCapacity(){ + return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest minStudentCapacityAs(String retName){ + super.min(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest maxStudentCapacity(){ + return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest maxStudentCapacityAs(String retName){ + super.max(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sumStudentCapacity(){ + return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sumStudentCapacityAs(String retName){ + super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest avgStudentCapacity(){ + return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest avgStudentCapacityAs(String retName){ + super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest standardDeviationStudentCapacity(){ + return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest standardDeviationStudentCapacityAs(String retName){ + super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ + return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest sampleVarianceStudentCapacity(){ + return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ + super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest samplePopulationVarianceStudentCapacity(){ + return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); + } + + public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ + super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(School.PLATFORM_PROPERTY, subRequest); + return this; + } + + public SchoolRequest groupBySchoolTypeWithDetails(){ + return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); + } + + public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ + aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); + return this; + } + + + + + + + + + + public SchoolRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, School.ID_PROPERTY); + return this; + } + public SchoolRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); + return this; + } + public SchoolRequest countDistinctSchoolType(){ + return countDistinctSchoolTypeAs("school_type_distinct_count"); + } + + public SchoolRequest countDistinctSchoolTypeAs(String alias){ + super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); + return this; + } + public SchoolRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, School.NAME_PROPERTY); + return this; + } + public SchoolRequest countDistinctAddress(){ + return countDistinctAddressAs("address_distinct_count"); + } + + public SchoolRequest countDistinctAddressAs(String alias){ + super.countDistinctProperty(alias, School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest countDistinctEstablishedDate(){ + return countDistinctEstablishedDateAs("established_date_distinct_count"); + } + + public SchoolRequest countDistinctEstablishedDateAs(String alias){ + super.countDistinctProperty(alias, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + public SchoolRequest countDistinctStudentCapacity(){ + return countDistinctStudentCapacityAs("student_capacity_distinct_count"); + } + + public SchoolRequest countDistinctStudentCapacityAs(String alias){ + super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + public SchoolRequest countDistinctActive(){ + return countDistinctActiveAs("active_distinct_count"); + } + + public SchoolRequest countDistinctActiveAs(String alias){ + super.countDistinctProperty(alias, School.ACTIVE_PROPERTY); + return this; + } + public SchoolRequest countDistinctCreateTime(){ + return countDistinctCreateTimeAs("create_time_distinct_count"); + } + + public SchoolRequest countDistinctCreateTimeAs(String alias){ + super.countDistinctProperty(alias, School.CREATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctUpdateTime(){ + return countDistinctUpdateTimeAs("update_time_distinct_count"); + } + + public SchoolRequest countDistinctUpdateTimeAs(String alias){ + super.countDistinctProperty(alias, School.UPDATE_TIME_PROPERTY); + return this; + } + public SchoolRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupById(){ + groupBy(School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdAs(String retName){ + groupBy(retName, School.ID_PROPERTY); + return this; + } + + public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ID_PROPERTY, function); + return this; + } + public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(School.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolRequest groupByPlatform(){ + groupBy(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformAs(String retName){ + groupBy(retName, School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.PLATFORM_PROPERTY, function); + return this; + } + public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ + groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); + return this; + } + public SchoolRequest groupBySchoolType(){ + groupBy(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeAs(String retName){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByName(){ + groupBy(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameAs(String retName){ + groupBy(retName, School.NAME_PROPERTY); + return this; + } + + public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.NAME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByAddress(){ + groupBy(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest groupByAddressAs(String retName){ + groupBy(retName, School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest groupByAddressWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ADDRESS_PROPERTY, function); + return this; + } + + public SchoolRequest groupByEstablishedDate(){ + groupBy(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest groupByEstablishedDateAs(String retName){ + groupBy(retName, School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest groupByEstablishedDateWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ESTABLISHED_DATE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByStudentCapacity(){ + groupBy(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityAs(String retName){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); + return this; + } + + public SchoolRequest groupByActive(){ + groupBy(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest groupByActiveAs(String retName){ + groupBy(retName, School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest groupByActiveWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.ACTIVE_PROPERTY, function); + return this; + } + + public SchoolRequest groupByCreateTime(){ + groupBy(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByCreateTimeAs(String retName){ + groupBy(retName, School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.CREATE_TIME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByUpdateTime(){ + groupBy(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByUpdateTimeAs(String retName){ + groupBy(retName, School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.UPDATE_TIME_PROPERTY, function); + return this; + } + + public SchoolRequest groupByVersion(){ + groupBy(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionAs(String retName){ + groupBy(retName, School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, School.VERSION_PROPERTY, function); + return this; + } + + public SchoolRequest withSchoolTypeIsPrimary(){ + filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_PRIMARY); + return this; + } + + + public SchoolRequest withSchoolTypeIsSecondary(){ + filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_SECONDARY); + return this; + } + + + + + public SchoolRequest orderByIdAscending(){ + addOrderByAscending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByIdDescending(){ + addOrderByDescending(School.ID_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformAscending(){ + addOrderByAscending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderByPlatformDescending(){ + addOrderByDescending(School.PLATFORM_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeAscending(){ + addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderBySchoolTypeDescending(){ + addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); + return this; + } + + public SchoolRequest orderByNameAscending(){ + addOrderByAscending(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescending(){ + addOrderByDescending(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.NAME_PROPERTY); + return this; + } + + public SchoolRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.NAME_PROPERTY); + return this; + } + public SchoolRequest orderByAddressAscending(){ + addOrderByAscending(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest orderByAddressDescending(){ + addOrderByDescending(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest orderByAddressAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(School.ADDRESS_PROPERTY); + return this; + } + + public SchoolRequest orderByAddressDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(School.ADDRESS_PROPERTY); + return this; + } + public SchoolRequest orderByEstablishedDateAscending(){ + addOrderByAscending(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest orderByEstablishedDateDescending(){ + addOrderByDescending(School.ESTABLISHED_DATE_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityAscending(){ + addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByStudentCapacityDescending(){ + addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); + return this; + } + + public SchoolRequest orderByActiveAscending(){ + addOrderByAscending(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest orderByActiveDescending(){ + addOrderByDescending(School.ACTIVE_PROPERTY); + return this; + } + + public SchoolRequest orderByCreateTimeAscending(){ + addOrderByAscending(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByCreateTimeDescending(){ + addOrderByDescending(School.CREATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByUpdateTimeAscending(){ + addOrderByAscending(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByUpdateTimeDescending(){ + addOrderByDescending(School.UPDATE_TIME_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionAscending(){ + addOrderByAscending(School.VERSION_PROPERTY); + return this; + } + + public SchoolRequest orderByVersionDescending(){ + addOrderByDescending(School.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + public SchoolTypeRequest rollUpToSchoolType(){ + SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); + this.internalRollUpTo("school_type", schoolType, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); + return schoolType; + } + + + + + + + + + + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); + return this; + } + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ + return facetBySchoolTypeAs(facetName, schoolType, true); + } + + public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ + addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java new file mode 100644 index 000000000..5cf69e771 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java @@ -0,0 +1,168 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.platform.Platform; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SchoolCapacitySummary extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SchoolCapacitySummary"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f571f4dcc37bd33fc29f0aa97e881485bf74a0130eef2c5230fe6c7e15c257f4"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("name", 2), java.util.Map.entry("total_capacity", 3), java.util.Map.entry("school_count", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("total_capacity", java.util.List.of("totalCapacity", "total_capacity")), java.util.Map.entry("school_count", java.util.List.of("schoolCount", "school_count")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolCapacitySummary.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String TOTAL_CAPACITY_PROPERTY = "total_capacity"; + public static final String SCHOOL_COUNT_PROPERTY = "school_count"; + private Platform platform; + + private String name; + + private Integer totalCapacity; + + private Integer schoolCount; + + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public Integer getTotalCapacity(){ + return this.totalCapacity; + } + + public Integer getSchoolCount(){ + return this.schoolCount; + } + + public SchoolCapacitySummary updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public SchoolCapacitySummary updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public SchoolCapacitySummary updateTotalCapacity(Integer totalCapacity){ + if(isPropertyLoaded(TOTAL_CAPACITY_PROPERTY) && Objects.equals(this.totalCapacity, totalCapacity)){ + return this; + } + handleUpdate(TOTAL_CAPACITY_PROPERTY, getTotalCapacity(), totalCapacity); + this.totalCapacity = totalCapacity; + return this; + } + + public SchoolCapacitySummary updateSchoolCount(Integer schoolCount){ + if(isPropertyLoaded(SCHOOL_COUNT_PROPERTY) && Objects.equals(this.schoolCount, schoolCount)){ + return this; + } + handleUpdate(SCHOOL_COUNT_PROPERTY, getSchoolCount(), schoolCount); + this.schoolCount = schoolCount; + return this; + } + + + public static SchoolCapacitySummary refer(Long id){ + SchoolCapacitySummary refer = new SchoolCapacitySummary(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SchoolCapacitySummary comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "total_capacity": this.totalCapacity = (Integer) value; break; + + case "school_count": this.schoolCount = (Integer) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "total_capacity": return this.totalCapacity; + case "school_count": return this.schoolCount; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "totalCapacity": return this.totalCapacity; + case "schoolCount": return this.schoolCount; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java new file mode 100644 index 000000000..f7a93a383 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java @@ -0,0 +1,79 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SchoolCapacitySummaryChecker implements Checker{ + + public String type(){ + return SchoolCapacitySummary.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SchoolCapacitySummary schoolCapacitySummary, ObjectLocation _parentLocation){ + if(needCheck(_context, schoolCapacitySummary)){ + markAsChecked(_context, schoolCapacitySummary); + doCheck(_context, schoolCapacitySummary, _parentLocation); + } + } + + public void doCheck(UserContext _context, SchoolCapacitySummary schoolCapacitySummary, ObjectLocation _parentLocation){ + if((schoolCapacitySummary == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, schoolCapacitySummary); + if(schoolCapacitySummary.needPersist()){ + } + if(schoolCapacitySummary.newItem()){ + }else if(schoolCapacitySummary.updateItem()){ + if(!schoolCapacitySummary.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!schoolCapacitySummary.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!schoolCapacitySummary.isPropertyLoaded("total_capacity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "total_capacity"), "Mutation requires a fully loaded entity"); + } + if(!schoolCapacitySummary.isPropertyLoaded("school_count")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "school_count"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkTotalCapacity(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY), newLocation(_parentLocation, "total_capacity")); + checkSchoolCount(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY), newLocation(_parentLocation, "school_count")); + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkTotalCapacity(UserContext _context, Integer totalCapacity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, totalCapacity); + if((totalCapacity == null)){ + return; + } + } + public void checkSchoolCount(UserContext _context, Integer schoolCount, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, schoolCount); + if((schoolCount == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java new file mode 100644 index 000000000..349f2c3c7 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java @@ -0,0 +1,67 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SchoolCapacitySummaryExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolCapacitySummaryExpression(Expression expression){ + super(expression); + } + + public SchoolCapacitySummaryExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolCapacitySummaryExpression updateId(Long id){ + return new SchoolCapacitySummaryExpression(this, $it -> {((SchoolCapacitySummary)$it).__internalSet("id", id); return this;}); + } + + public SchoolCapacitySummaryExpression save(UserContext userContext){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolCapacitySummaryExpression save(String intent, UserContext userContext){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", SchoolCapacitySummary::getPlatform)); + } + + public SchoolCapacitySummaryExpression updatePlatform(Platform platform){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", SchoolCapacitySummary::getName); + } + public SchoolCapacitySummaryExpression updateName(String name){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateName(name)); + } + + public Expression getTotalCapacity(){ + return loaded("total_capacity", "getTotalCapacity", SchoolCapacitySummary::getTotalCapacity); + } + public SchoolCapacitySummaryExpression updateTotalCapacity(Integer totalCapacity){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateTotalCapacity(totalCapacity)); + } + + public Expression getSchoolCount(){ + return loaded("school_count", "getSchoolCount", SchoolCapacitySummary::getSchoolCount); + } + public SchoolCapacitySummaryExpression updateSchoolCount(Integer schoolCount){ + return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateSchoolCount(schoolCount)); + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java new file mode 100644 index 000000000..6c88d14c5 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolCapacitySummaryListExpression extends SmartListExpression { + public SchoolCapacitySummaryListExpression(Expression> expression){ + super(expression); + } + + public SchoolCapacitySummaryListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolCapacitySummaryExpression first() { + return new SchoolCapacitySummaryExpression(super.first()); + } + + public SchoolCapacitySummaryExpression get(int index) { + return new SchoolCapacitySummaryExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java new file mode 100644 index 000000000..a0a8e7086 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java @@ -0,0 +1,1059 @@ + +package com.example.schoolmanagementservice.schoolcapacitysummary; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SchoolCapacitySummaryRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolCapacitySummaryRequest(Class returnType){ + this(returnType, () -> (T) new SchoolCapacitySummary()); + } + + protected SchoolCapacitySummaryRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolCapacitySummaryRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolCapacitySummaryRequest copy(){ + return (SchoolCapacitySummaryRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolCapacitySummaryRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolCapacitySummaryRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolCapacitySummaryRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolCapacitySummaryRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolCapacitySummaryRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolCapacitySummaryRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolCapacitySummaryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolCapacitySummaryRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolCapacitySummaryRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolCapacitySummaryRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolCapacitySummaryRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolCapacitySummaryRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolCapacitySummaryRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolCapacitySummaryRequest matchingAnyOf(SchoolCapacitySummaryRequest schoolCapacitySummary){ + super.internalMatchAny(schoolCapacitySummary); + return this; + } + + public SchoolCapacitySummaryRequest matchingIdsOf(SchoolCapacitySummaryRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolCapacitySummary.ID_PROPERTY, request, SchoolCapacitySummary.ID_PROPERTY)); + } + + public SchoolCapacitySummaryRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolCapacitySummaryRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolCapacitySummaryRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolCapacitySummaryRequest selectSelf(){ + super.selectSelf(); + return selectId().selectPlatformIdOnly().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); + } + + public SchoolCapacitySummaryRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolCapacitySummaryRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolCapacitySummary.ID_PROPERTY); + selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + selectProperty(SchoolCapacitySummary.NAME_PROPERTY); + selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + selectProperty(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest selectAll(){ + super.selectAll(); + return selectId().selectPlatform().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); + } + + public SchoolCapacitySummaryRequest selectChildren(){ + super.selectAny(); + return selectId().selectPlatform().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); + } + + + public SchoolCapacitySummaryRequest selectId(){ + selectProperty(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolCapacitySummaryRequest unselectId(){ + unselectProperty(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectPlatformIdOnly(){ + selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolCapacitySummaryRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + enhanceRelation(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolCapacitySummary.PLATFORM_PROPERTY)); + return this; + } + + public SchoolCapacitySummaryRequest unselectPlatform(){ + unselectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectName(){ + selectProperty(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolCapacitySummaryRequest unselectName(){ + unselectProperty(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectTotalCapacity(){ + selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + /** + * fill the totalCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalCapacity) to fetch totalCapacity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the totalCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(totalCapacity) AS totalCapacity to fetch totalCapacity property. + * @param aggrFunction aggrFunction + */ + public SchoolCapacitySummaryRequest selectTotalCapacity(AggrFunction aggrFunction){ + selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, aggrFunction); + return this; + } + + + public SchoolCapacitySummaryRequest unselectTotalCapacity(){ + unselectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectSchoolCount(){ + selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + /** + * fill the schoolCount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS schoolCount) to fetch schoolCount property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the schoolCount with customized aggrFunction, TEAQL uses ({aggrFunction}(schoolCount) AS schoolCount to fetch schoolCount property. + * @param aggrFunction aggrFunction + */ + public SchoolCapacitySummaryRequest selectSchoolCount(AggrFunction aggrFunction){ + selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, aggrFunction); + return this; + } + + + public SchoolCapacitySummaryRequest unselectSchoolCount(){ + unselectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest selectVersion(){ + selectProperty(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolCapacitySummaryRequest unselectVersion(){ + unselectProperty(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.ID_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolCapacitySummaryRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolCapacitySummaryRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolCapacitySummaryRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolCapacitySummaryRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolCapacitySummaryRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolCapacitySummaryRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolCapacitySummaryRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolCapacitySummaryRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolCapacitySummaryRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.NAME_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolCapacitySummaryRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolCapacitySummaryRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolCapacitySummaryRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolCapacitySummaryRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolCapacitySummaryRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolCapacitySummaryRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolCapacitySummaryRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolCapacitySummaryRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolCapacitySummaryRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolCapacitySummaryRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolCapacitySummaryRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolCapacitySummaryRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolCapacitySummaryRequest filterByTotalCapacity(Integer... totalCapacity){ + if (totalCapacity == null || totalCapacity.length == 0) { + throw new IllegalArgumentException("filterByTotalCapacity parameter totalCapacity cannot be empty"); + } + return appendSearchCriteria(createTotalCapacityCriteria(Operator.EQUAL, (Object[])totalCapacity)); + } + + public SchoolCapacitySummaryRequest withTotalCapacity(Operator operator, Object... values){ + return appendSearchCriteria(createTotalCapacityCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIsUnknown(){ + return withTotalCapacity(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIsKnown(){ + return withTotalCapacity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createTotalCapacityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIs(Integer totalCapacity){ + return withTotalCapacity(Operator.EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIsNot(Integer totalCapacity){ + return withTotalCapacity(Operator.NOT_EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityIn(Integer... totalCapacity){ + return withTotalCapacity(Operator.IN, (Object[])totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityNotIn(Integer... totalCapacity){ + return withTotalCapacity(Operator.NOT_IN, (Object[])totalCapacity); + } + public SchoolCapacitySummaryRequest withTotalCapacityGreaterThan(Integer totalCapacity){ + return withTotalCapacity(Operator.GREATER_THAN, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityGreaterThanOrEqualTo(Integer totalCapacity){ + return withTotalCapacity(Operator.GREATER_THAN_OR_EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityLessThan(Integer totalCapacity){ + return withTotalCapacity(Operator.LESS_THAN, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityLessThanOrEqualTo(Integer totalCapacity){ + return withTotalCapacity(Operator.LESS_THAN_OR_EQUAL, totalCapacity); + } + + public SchoolCapacitySummaryRequest withTotalCapacityBetween(Integer startOfTotalCapacity, Integer endOfTotalCapacity){ + return withTotalCapacity(Operator.BETWEEN, startOfTotalCapacity, endOfTotalCapacity); + } + + + + public SchoolCapacitySummaryRequest filterBySchoolCount(Integer... schoolCount){ + if (schoolCount == null || schoolCount.length == 0) { + throw new IllegalArgumentException("filterBySchoolCount parameter schoolCount cannot be empty"); + } + return appendSearchCriteria(createSchoolCountCriteria(Operator.EQUAL, (Object[])schoolCount)); + } + + public SchoolCapacitySummaryRequest withSchoolCount(Operator operator, Object... values){ + return appendSearchCriteria(createSchoolCountCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withSchoolCountIsUnknown(){ + return withSchoolCount(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withSchoolCountIsKnown(){ + return withSchoolCount(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSchoolCountCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withSchoolCountIs(Integer schoolCount){ + return withSchoolCount(Operator.EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountIsNot(Integer schoolCount){ + return withSchoolCount(Operator.NOT_EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountIn(Integer... schoolCount){ + return withSchoolCount(Operator.IN, (Object[])schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountNotIn(Integer... schoolCount){ + return withSchoolCount(Operator.NOT_IN, (Object[])schoolCount); + } + public SchoolCapacitySummaryRequest withSchoolCountGreaterThan(Integer schoolCount){ + return withSchoolCount(Operator.GREATER_THAN, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountGreaterThanOrEqualTo(Integer schoolCount){ + return withSchoolCount(Operator.GREATER_THAN_OR_EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountLessThan(Integer schoolCount){ + return withSchoolCount(Operator.LESS_THAN, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountLessThanOrEqualTo(Integer schoolCount){ + return withSchoolCount(Operator.LESS_THAN_OR_EQUAL, schoolCount); + } + + public SchoolCapacitySummaryRequest withSchoolCountBetween(Integer startOfSchoolCount, Integer endOfSchoolCount){ + return withSchoolCount(Operator.BETWEEN, startOfSchoolCount, endOfSchoolCount); + } + + + + public SchoolCapacitySummaryRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolCapacitySummaryRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolCapacitySummaryRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolCapacitySummaryRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolCapacitySummary.VERSION_PROPERTY, operator, values); + } + + public SchoolCapacitySummaryRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolCapacitySummaryRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolCapacitySummaryRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolCapacitySummaryRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolCapacitySummaryRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolCapacitySummaryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SchoolCapacitySummaryRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolCapacitySummaryRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolCapacitySummaryRequest minTotalCapacity(){ + return minTotalCapacityAs(prefix("minOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest minTotalCapacityAs(String retName){ + super.min(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest maxTotalCapacity(){ + return maxTotalCapacityAs(prefix("maxOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest maxTotalCapacityAs(String retName){ + super.max(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sumTotalCapacity(){ + return sumTotalCapacityAs(prefix("sumOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sumTotalCapacityAs(String retName){ + super.sum(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest avgTotalCapacity(){ + return avgTotalCapacityAs(prefix("avgOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest avgTotalCapacityAs(String retName){ + super.avg(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest standardDeviationTotalCapacity(){ + return standardDeviationTotalCapacityAs(prefix("standardDeviationOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest standardDeviationTotalCapacityAs(String retName){ + super.standardDeviation(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationTotalCapacity(){ + return squareRootOfPopulationStandardDeviationTotalCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationTotalCapacityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sampleVarianceTotalCapacity(){ + return sampleVarianceTotalCapacityAs(prefix("sampleVarianceOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sampleVarianceTotalCapacityAs(String retName){ + super.sampleVariance(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest samplePopulationVarianceTotalCapacity(){ + return samplePopulationVarianceTotalCapacityAs(prefix("samplePopulationVarianceOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); + } + + public SchoolCapacitySummaryRequest samplePopulationVarianceTotalCapacityAs(String retName){ + super.samplePopulationVariance(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest minSchoolCount(){ + return minSchoolCountAs(prefix("minOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest minSchoolCountAs(String retName){ + super.min(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest maxSchoolCount(){ + return maxSchoolCountAs(prefix("maxOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest maxSchoolCountAs(String retName){ + super.max(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sumSchoolCount(){ + return sumSchoolCountAs(prefix("sumOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sumSchoolCountAs(String retName){ + super.sum(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest avgSchoolCount(){ + return avgSchoolCountAs(prefix("avgOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest avgSchoolCountAs(String retName){ + super.avg(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest standardDeviationSchoolCount(){ + return standardDeviationSchoolCountAs(prefix("standardDeviationOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest standardDeviationSchoolCountAs(String retName){ + super.standardDeviation(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationSchoolCount(){ + return squareRootOfPopulationStandardDeviationSchoolCountAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationSchoolCountAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest sampleVarianceSchoolCount(){ + return sampleVarianceSchoolCountAs(prefix("sampleVarianceOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest sampleVarianceSchoolCountAs(String retName){ + super.sampleVariance(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest samplePopulationVarianceSchoolCount(){ + return samplePopulationVarianceSchoolCountAs(prefix("samplePopulationVarianceOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); + } + + public SchoolCapacitySummaryRequest samplePopulationVarianceSchoolCountAs(String retName){ + super.samplePopulationVariance(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolCapacitySummaryRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(SchoolCapacitySummary.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + public SchoolCapacitySummaryRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.ID_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctTotalCapacity(){ + return countDistinctTotalCapacityAs("total_capacity_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctTotalCapacityAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctSchoolCount(){ + return countDistinctSchoolCountAs("school_count_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctSchoolCountAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolCapacitySummaryRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupById(){ + groupBy(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByIdAs(String retName){ + groupBy(retName, SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.ID_PROPERTY, function); + return this; + } + public SchoolCapacitySummaryRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(SchoolCapacitySummary.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolCapacitySummaryRequest groupByPlatform(){ + groupBy(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByPlatformAs(String retName){ + groupBy(retName, SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.PLATFORM_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupByName(){ + groupBy(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByNameAs(String retName){ + groupBy(retName, SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.NAME_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupByTotalCapacity(){ + groupBy(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByTotalCapacityAs(String retName){ + groupBy(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByTotalCapacityWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupBySchoolCount(){ + groupBy(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupBySchoolCountAs(String retName){ + groupBy(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupBySchoolCountWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, function); + return this; + } + + public SchoolCapacitySummaryRequest groupByVersion(){ + groupBy(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByVersionAs(String retName){ + groupBy(retName, SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolCapacitySummary.VERSION_PROPERTY, function); + return this; + } + + + + public SchoolCapacitySummaryRequest orderByIdAscending(){ + addOrderByAscending(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByIdDescending(){ + addOrderByDescending(SchoolCapacitySummary.ID_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByPlatformAscending(){ + addOrderByAscending(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByPlatformDescending(){ + addOrderByDescending(SchoolCapacitySummary.PLATFORM_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByNameAscending(){ + addOrderByAscending(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByNameDescending(){ + addOrderByDescending(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolCapacitySummary.NAME_PROPERTY); + return this; + } + public SchoolCapacitySummaryRequest orderByTotalCapacityAscending(){ + addOrderByAscending(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByTotalCapacityDescending(){ + addOrderByDescending(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderBySchoolCountAscending(){ + addOrderByAscending(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderBySchoolCountDescending(){ + addOrderByDescending(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByVersionAscending(){ + addOrderByAscending(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + public SchoolCapacitySummaryRequest orderByVersionDescending(){ + addOrderByDescending(SchoolCapacitySummary.VERSION_PROPERTY); + return this; + } + + + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + public SchoolCapacitySummaryRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolCapacitySummaryRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, SchoolCapacitySummary.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolCapacitySummary.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolCapacitySummaryRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolCapacitySummaryRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolCapacitySummaryRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolCapacitySummaryRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolCapacitySummaryRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolCapacitySummaryRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java new file mode 100644 index 000000000..082e03793 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java @@ -0,0 +1,193 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.school.School; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.math.BigDecimal; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SchoolType extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SchoolType"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "36f5b35e840d2f9ef89c6ee13c7d936fa10abc12a139d7f0373f9acabc9eac12"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "school_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String PLATFORM_PROPERTY = "platform"; + public static final String NAME_PROPERTY = "name"; + public static final String CODE_PROPERTY = "code"; + public static final String DISPLAY_ORDER_PROPERTY = "display_order"; + public static final String SCHOOL_LIST_PROPERTY = "school_list"; + private Platform platform; + + private String name; + + private String code; + + private BigDecimal displayOrder; + + private SmartList schoolList; + + public Platform getPlatform(){ + return this.platform; + } + + public String getName(){ + return this.name; + } + + public String getCode(){ + return this.code; + } + + public BigDecimal getDisplayOrder(){ + return this.displayOrder; + } + + public SmartList getSchoolList(){ + return this.schoolList == null ? SmartList.unloaded() : this.schoolList; + } + public SchoolType updatePlatform(Platform platform){ + if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ + return this; + } + handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); + this.platform = platform; + return this; + } + + public SchoolType updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public SchoolType updateCode(String code){ + code = (code == null ? null : code.trim()); + if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ + return this; + } + handleUpdate(CODE_PROPERTY, getCode(), code); + this.code = code; + return this; + } + + public SchoolType updateDisplayOrder(BigDecimal displayOrder){ + if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ + return this; + } + handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); + this.displayOrder = displayOrder; + return this; + } + + public SchoolType addSchool(School school){ + if (school == null){ + return this; + } + + if(null == this.schoolList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.schoolList = teaqlUnloadedItems.map(value -> value); + } + + this.schoolList.add(school); + school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); + return this; + } + + public static SchoolType refer(Long id){ + SchoolType refer = new SchoolType(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SchoolType comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "platform": this.platform = (Platform) value; break; + + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "code": this.code = (value == null ? null : ((String)value).trim()); break; + + case "display_order": this.displayOrder = (BigDecimal) value; break; + + case "school_list": this.schoolList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "display_order": return this.displayOrder; + case "school_list": return this.schoolList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "platform": return this.platform; + case "name": return this.name; + case "code": return this.code; + case "displayOrder": return this.displayOrder; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java new file mode 100644 index 000000000..daffc14d5 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java @@ -0,0 +1,87 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformChecker; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; +import java.math.BigDecimal; + +public class SchoolTypeChecker implements Checker{ + + public String type(){ + return SchoolType.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if(needCheck(_context, schoolType)){ + markAsChecked(_context, schoolType); + doCheck(_context, schoolType, _parentLocation); + } + } + + public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ + if((schoolType == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, schoolType); + if(schoolType.needPersist()){ + } + if(schoolType.newItem()){ + }else if(schoolType.updateItem()){ + if(!schoolType.isPropertyLoaded("platform")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("code")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); + } + if(!schoolType.isPropertyLoaded("display_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); + } + + } + checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); + checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); + checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); + checkDisplayOrder(_context, schoolType.getProperty(SchoolType.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); + for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ + School school = schoolType.getSchoolList().get(i); + new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); + } + } + + public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, platform); + if((platform == null)){ + return; + } + new PlatformChecker().checkAndFix(_context, platform, _parentLocation); + } + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } + public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, code); + if((code == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, code); + + } + public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ + if((displayOrder == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java new file mode 100644 index 000000000..f77c8c705 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java @@ -0,0 +1,76 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformExpression; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.math.BigDecimal; +import java.util.function.Function; + +public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SchoolTypeExpression(Expression expression){ + super(expression); + } + + public SchoolTypeExpression(Expression expression, Function function){ + super(expression, function); + } + + public SchoolTypeExpression updateId(Long id){ + return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); + } + + public SchoolTypeExpression save(UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SchoolTypeExpression save(String intent, UserContext userContext){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public PlatformExpression getPlatform(){ + return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); + } + + public SchoolTypeExpression updatePlatform(Platform platform){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); + } + + public Expression getName(){ + return loaded("name", "getName", SchoolType::getName); + } + public SchoolTypeExpression updateName(String name){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); + } + + public Expression getCode(){ + return loaded("code", "getCode", SchoolType::getCode); + } + public SchoolTypeExpression updateCode(String code){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); + } + + public Expression getDisplayOrder(){ + return loaded("display_order", "getDisplayOrder", SchoolType::getDisplayOrder); + } + public SchoolTypeExpression updateDisplayOrder(BigDecimal displayOrder){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateDisplayOrder(displayOrder)); + } + + public SchoolListExpression getSchoolList(){ + return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); + } + public SchoolTypeExpression addSchool(School school){ + return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java new file mode 100644 index 000000000..55fdae628 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java @@ -0,0 +1,25 @@ + +package com.example.schoolmanagementservice.schooltype; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SchoolTypeListExpression extends SmartListExpression { + public SchoolTypeListExpression(Expression> expression){ + super(expression); + } + + public SchoolTypeListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SchoolTypeExpression first() { + return new SchoolTypeExpression(super.first()); + } + + public SchoolTypeExpression get(int index) { + return new SchoolTypeExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java new file mode 100644 index 000000000..1b91f030f --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java @@ -0,0 +1,1238 @@ + +package com.example.schoolmanagementservice.schooltype; + +import com.example.schoolmanagementservice.Q; +import com.example.schoolmanagementservice.platform.Platform; +import com.example.schoolmanagementservice.platform.PlatformRequest; +import com.example.schoolmanagementservice.school.School; +import com.example.schoolmanagementservice.school.SchoolRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.math.BigDecimal; +import java.util.Objects; + +public class SchoolTypeRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SchoolTypeRequest(Class returnType){ + this(returnType, () -> (T) new SchoolType()); + } + + protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SchoolTypeRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SchoolTypeRequest copy(){ + return (SchoolTypeRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SchoolTypeRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SchoolTypeRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SchoolTypeRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SchoolTypeRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SchoolTypeRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); + } + + public SchoolTypeRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ + super.internalMatchAny(schoolType); + return this; + } + + public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); + } + + public SchoolTypeRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SchoolTypeRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SchoolTypeRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SchoolTypeRequest selectSelf(){ + super.selectSelf(); + return selectPlatformIdOnly().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + public SchoolTypeRequest selectSelfFields(){ + return selectSelf(); + } + + public SchoolTypeRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SchoolType.PLATFORM_PROPERTY); + selectProperty(SchoolType.ID_PROPERTY); + selectProperty(SchoolType.NAME_PROPERTY); + selectProperty(SchoolType.CODE_PROPERTY); + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest selectAll(){ + super.selectAll(); + return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + public SchoolTypeRequest selectChildren(){ + super.selectAny(); + selectSchoolList(); + return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); + } + + + public SchoolTypeRequest selectPlatformIdOnly(){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest selectPlatform(){ + return selectPlatformWith(Q.platforms().unlimited().selectSelf()); + } + + public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ + selectProperty(SchoolType.PLATFORM_PROPERTY); + enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + public SchoolTypeRequest unselectPlatform(){ + unselectProperty(SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest selectId(){ + selectProperty(SchoolType.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectId(){ + unselectProperty(SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest selectName(){ + selectProperty(SchoolType.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectName(){ + unselectProperty(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest selectCode(){ + selectProperty(SchoolType.CODE_PROPERTY); + return this; + } + + /** + * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectCode(){ + unselectProperty(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest selectDisplayOrder(){ + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + /** + * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. + * @param aggrFunction aggrFunction + */ + public SchoolTypeRequest selectDisplayOrder(AggrFunction aggrFunction){ + selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY, aggrFunction); + return this; + } + + + public SchoolTypeRequest unselectDisplayOrder(){ + unselectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest selectVersion(){ + selectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SchoolTypeRequest unselectVersion(){ + unselectProperty(SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest selectSchoolList(){ + return selectSchoolListWith(Q.schools().selectSelf()); + } + + public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ + enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest filterByPlatform(Platform... platform){ + if (platform == null || platform.length == 0) { + throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); + } + return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); + } + + public SchoolTypeRequest withPlatform(Operator operator, Object... values){ + return appendSearchCriteria(createPlatformCriteria(operator, values)); + } + + public SchoolTypeRequest withPlatformIsUnknown(){ + return withPlatform(Operator.IS_NULL); + } + + public SchoolTypeRequest withPlatformIsKnown(){ + return withPlatform(Operator.IS_NOT_NULL); + } + + public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); + } + + public SchoolTypeRequest filterByPlatform(Long platform){ + if(platform == null){ + return this; + } + return withPlatform(Operator.EQUAL, platform); + } + public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); + } + + public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); + } + + public SchoolTypeRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); + } + + public SchoolTypeRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SchoolTypeRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SchoolTypeRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SchoolTypeRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SchoolTypeRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SchoolTypeRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SchoolTypeRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SchoolTypeRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); + } + + public SchoolTypeRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SchoolTypeRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SchoolTypeRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SchoolTypeRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SchoolTypeRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SchoolTypeRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SchoolTypeRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SchoolTypeRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SchoolTypeRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SchoolTypeRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SchoolTypeRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SchoolTypeRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SchoolTypeRequest filterByCode(String... code){ + if (code == null || code.length == 0) { + throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); + } + return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); + } + + public SchoolTypeRequest withCode(Operator operator, Object... values){ + return appendSearchCriteria(createCodeCriteria(operator, values)); + } + + public SchoolTypeRequest withCodeIsUnknown(){ + return withCode(Operator.IS_NULL); + } + + public SchoolTypeRequest withCodeIsKnown(){ + return withCode(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCodeCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); + } + + public SchoolTypeRequest withCodeIsNot(String code){ + return withCode(Operator.NOT_EQUAL, code); + } + + public SchoolTypeRequest withCodeIn(String... code){ + return withCode(Operator.IN, (Object[])code); + } + + public SchoolTypeRequest withCodeNotIn(String... code){ + return withCode(Operator.NOT_IN, (Object[])code); + } + public SchoolTypeRequest withCodeGreaterThan(String code){ + return withCode(Operator.GREATER_THAN, code); + } + + public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ + return withCode(Operator.GREATER_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeLessThan(String code){ + return withCode(Operator.LESS_THAN, code); + } + + public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ + return withCode(Operator.LESS_THAN_OR_EQUAL, code); + } + + public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ + return withCode(Operator.BETWEEN, startOfCode, endOfCode); + } + public SchoolTypeRequest withCodeStartingWith(String code){ + return withCode(Operator.BEGIN_WITH, code); + } + public SchoolTypeRequest withCodeContaining(String code){ + return withCode(Operator.CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotContaining(String code){ + return withCode(Operator.NOT_CONTAIN, code); + } + + public SchoolTypeRequest withCodeNotStartingWith(String code){ + return withCode(Operator.NOT_BEGIN_WITH, code); + } + + public SchoolTypeRequest withCodeEndingWith(String code){ + return withCode(Operator.END_WITH, code); + } + + public SchoolTypeRequest withCodeNotEndingWith(String code){ + return withCode(Operator.NOT_END_WITH, code); + } + + public SchoolTypeRequest withCodeIs(String code){ + return withCode(Operator.EQUAL, code); + } + + public SchoolTypeRequest withCodeSoundingLike(String code){ + return withCode(Operator.SOUNDS_LIKE, code); + } + + + + public SchoolTypeRequest filterByDisplayOrder(BigDecimal... displayOrder){ + if (displayOrder == null || displayOrder.length == 0) { + throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); + } + return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); + } + + public SchoolTypeRequest withDisplayOrder(Operator operator, Object... values){ + return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); + } + + public SchoolTypeRequest withDisplayOrderIsUnknown(){ + return withDisplayOrder(Operator.IS_NULL); + } + + public SchoolTypeRequest withDisplayOrderIsKnown(){ + return withDisplayOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.DISPLAY_ORDER_PROPERTY, operator, values); + } + + public SchoolTypeRequest withDisplayOrderIs(BigDecimal displayOrder){ + return withDisplayOrder(Operator.EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderIsNot(BigDecimal displayOrder){ + return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.IN, (Object[])displayOrder); + } + + public SchoolTypeRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ + return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); + } + public SchoolTypeRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderLessThan(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ + return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); + } + + public SchoolTypeRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ + return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); + } + + + + public SchoolTypeRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SchoolTypeRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SchoolTypeRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SchoolTypeRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); + } + + public SchoolTypeRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SchoolTypeRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SchoolTypeRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SchoolTypeRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SchoolTypeRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); + } + + public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); + } + + public SchoolTypeRequest haveSchools(){ + return withSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest haveNoSchools(){ + return withoutSchoolListMatching(Q.schools().unlimited()); + } + + public SchoolTypeRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SchoolTypeRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SchoolTypeRequest minDisplayOrder(){ + return minDisplayOrderAs(prefix("minOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest minDisplayOrderAs(String retName){ + super.min(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest maxDisplayOrder(){ + return maxDisplayOrderAs(prefix("maxOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest maxDisplayOrderAs(String retName){ + super.max(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest sumDisplayOrder(){ + return sumDisplayOrderAs(prefix("sumOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest sumDisplayOrderAs(String retName){ + super.sum(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest avgDisplayOrder(){ + return avgDisplayOrderAs(prefix("avgOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest avgDisplayOrderAs(String retName){ + super.avg(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest standardDeviationDisplayOrder(){ + return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest standardDeviationDisplayOrderAs(String retName){ + super.standardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ + return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest sampleVarianceDisplayOrder(){ + return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest sampleVarianceDisplayOrderAs(String retName){ + super.sampleVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest samplePopulationVarianceDisplayOrder(){ + return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); + } + + public SchoolTypeRequest samplePopulationVarianceDisplayOrderAs(String retName){ + super.samplePopulationVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest groupByPlatformWithDetails(){ + return groupByPlatformWithDetails(Q.platforms().unlimited()); + } + + public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ + aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); + return this; + } + + + + + + + public SchoolTypeRequest countDistinctPlatform(){ + return countDistinctPlatformAs("platform_distinct_count"); + } + + public SchoolTypeRequest countDistinctPlatformAs(String alias){ + super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SchoolTypeRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SchoolTypeRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctCode(){ + return countDistinctCodeAs("code_distinct_count"); + } + + public SchoolTypeRequest countDistinctCodeAs(String alias){ + super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctDisplayOrder(){ + return countDistinctDisplayOrderAs("display_order_distinct_count"); + } + + public SchoolTypeRequest countDistinctDisplayOrderAs(String alias){ + super.countDistinctProperty(alias, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + public SchoolTypeRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SchoolTypeRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); + return this; + } + public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ + aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); + return this; + } + + public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ + groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); + return this; + } + public SchoolTypeRequest groupByPlatform(){ + groupBy(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformAs(String retName){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupById(){ + groupBy(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdAs(String retName){ + groupBy(retName, SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.ID_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByName(){ + groupBy(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameAs(String retName){ + groupBy(retName, SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.NAME_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByCode(){ + groupBy(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeAs(String retName){ + groupBy(retName, SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.CODE_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByDisplayOrder(){ + groupBy(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByDisplayOrderAs(String retName){ + groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY, function); + return this; + } + + public SchoolTypeRequest groupByVersion(){ + groupBy(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionAs(String retName){ + groupBy(retName, SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SchoolType.VERSION_PROPERTY, function); + return this; + } + + + + public SchoolTypeRequest orderByPlatformAscending(){ + addOrderByAscending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByPlatformDescending(){ + addOrderByDescending(SchoolType.PLATFORM_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdAscending(){ + addOrderByAscending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByIdDescending(){ + addOrderByDescending(SchoolType.ID_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameAscending(){ + addOrderByAscending(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescending(){ + addOrderByDescending(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscending(){ + addOrderByAscending(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescending(){ + addOrderByDescending(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); + return this; + } + public SchoolTypeRequest orderByDisplayOrderAscending(){ + addOrderByAscending(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByDisplayOrderDescending(){ + addOrderByDescending(SchoolType.DISPLAY_ORDER_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionAscending(){ + addOrderByAscending(SchoolType.VERSION_PROPERTY); + return this; + } + + public SchoolTypeRequest orderByVersionDescending(){ + addOrderByDescending(SchoolType.VERSION_PROPERTY); + return this; + } + + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ + return statsFromSchoolsAs(name, subRequest, false); + } + + public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ + return statsFromSchoolsAs(REFINEMENTS, subRequest); + } + public PlatformRequest rollUpToPlatform(){ + PlatformRequest platform = Q.platforms().unlimited(); + this.internalRollUpTo("platform", platform, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); + return platform; + } + + + + + + + public SchoolTypeRequest countSchools(){ + addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsAs(String name){ + addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ + addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest minStudentCapacityOfSchools(){ + addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ + return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest maxStudentCapacityOfSchools(){ + addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ + return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sumStudentCapacityOfSchools(){ + addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ + return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest avgStudentCapacityOfSchools(){ + addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ + return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ + return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ + addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ + return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ + return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ + addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), + School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ + return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); + } + + public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ + addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, + School.STUDENT_CAPACITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); + return this; + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ + return facetByPlatformAs(facetName, platform, true); + } + + public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ + addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SchoolTypeRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SchoolTypeRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SchoolTypeRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SchoolTypeRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SchoolTypeRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SchoolTypeRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/shared-load-state/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..29fd0dd7c --- /dev/null +++ b/examples/shared-load-state/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.example.schoolmanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/teaql/checker-model.json b/examples/shared-load-state/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..0b9363882 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:d36b1e0d50365a8a5a3654777b969de3e9e0de9673b6997e9522858ac7239249","entities":{"Platform":{"labels":{"en":"platform"},"fields":[{"name":"base_url","labels":{"en":"base url"},"aliases":["BaseUrl","baseUrl"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"school_capacity_summary_list","targetType":"SchoolCapacitySummary","labels":{"en":"School Capacity Summary"},"aliases":["SchoolCapacitySummaryList","schoolCapacitySummaryList"]},{"name":"school_list","targetType":"School","labels":{"en":"school"},"aliases":["SchoolList","schoolList"]},{"name":"school_type_list","targetType":"SchoolType","labels":{"en":"school type"},"aliases":["SchoolTypeList","schoolTypeList"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"School":{"labels":{"en":"school"},"fields":[{"name":"active","labels":{"en":"active"},"aliases":["Active"]},{"name":"address","labels":{"en":"address"},"aliases":["Address"]},{"name":"create_time","labels":{"en":"create time"},"aliases":["CreateTime","createTime"]},{"name":"established_date","labels":{"en":"established date"},"aliases":["EstablishedDate","establishedDate"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"school_type","targetType":"SchoolType","labels":{"en":"school type"},"aliases":["SchoolType","schoolType"]},{"name":"student_capacity","labels":{"en":"student capacity"},"aliases":["StudentCapacity","studentCapacity"]},{"name":"update_time","labels":{"en":"update time"},"aliases":["UpdateTime","updateTime"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolCapacitySummary":{"labels":{"en":"School Capacity Summary"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"school_count","labels":{"en":"school count"},"aliases":["SchoolCount","schoolCount"]},{"name":"total_capacity","labels":{"en":"total capacity"},"aliases":["TotalCapacity","totalCapacity"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SchoolType":{"labels":{"en":"school type"},"fields":[{"name":"code","labels":{"en":"code"},"aliases":["Code"]},{"name":"display_order","labels":{"en":"display order"},"aliases":["DisplayOrder","displayOrder"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"platform","targetType":"Platform","labels":{"en":"platform"},"aliases":["Platform"]},{"name":"school_list","targetType":"School","labels":{"en":"school"},"aliases":["SchoolList","schoolList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/shared-load-state/java-lib-core/teaql/model-provenance.json b/examples/shared-load-state/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..fbe565ea3 --- /dev/null +++ b/examples/shared-load-state/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:534f826bdc0ae660139ce4e39651bf9594ffcea9c9cdccaa1533b358bd6f89dc","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/shared-load-state/showcase.json b/examples/shared-load-state/showcase.json new file mode 100644 index 000000000..407302cd6 --- /dev/null +++ b/examples/shared-load-state/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/shared-load-state", + "library": { + "generatedFilesManifestSHA256": "ae532b2a9dc6810c0065ae17179ba3c5d8ff5c9be905673361b44e663a169981", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "0664ef5b32b1126100676782ec5c6c2d56e9e491920bfdfacadb4790a66b9ca9" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/school-inheritance-and-partial-views-generation/receipt.json", + "receiptSHA256": "7c8fb5f6c6619d7165638972cdbbe267d68e50cadf33d70065b45a52c68cf84f" + }, + "scene": "Read partial school records and preserve unseen business fields", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/shared-load-state/verify.sh", + "--workspace" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml" + ], + "generatedFilesManifestSHA256": "d775132150c44c4ad87a568c69c62c71d9d4a8454e80977b020c9a9c1c761b4f", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/shared-load-state/verify.sh b/examples/shared-load-state/verify.sh index 14c0866bd..e3b8b3830 100644 --- a/examples/shared-load-state/verify.sh +++ b/examples/shared-load-state/verify.sh @@ -3,16 +3,26 @@ set -euo pipefail example_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" runtime_dir="$(cd "$example_dir/../.." && pwd)" generate=false +workspace=false wide=false inheritance=false for argument in "$@"; do case "$argument" in + --workspace) workspace=true ;; --generate) generate=true ;; --wide) wide=true ;; --inheritance) inheritance=true ;; - *) printf 'Usage: bash verify.sh [--generate] [--wide] [--inheritance]\n' >&2; exit 2 ;; + *) printf 'Usage: bash verify.sh --workspace | [--generate] [--wide] [--inheritance]\n' >&2; exit 2 ;; esac done +fixture_dir="$example_dir/target/generated" +if [[ "$workspace" == true ]]; then + if [[ "$generate" == true || "$wide" == true || "$inheritance" == true ]]; then + printf 'Choose the narrow workspace or a separate generated fixture.\n' >&2 + exit 2 + fi + fixture_dir="$example_dir/java-lib-core" +fi if [[ "$generate" == true ]]; then : "${TEAQL_CODEGEN_DIR:?Set TEAQL_CODEGEN_DIR to the local generator checkout}" mvn -q -f "$TEAQL_CODEGEN_DIR/pom.xml" -pl generator -am \ @@ -21,8 +31,8 @@ if [[ "$generate" == true ]]; then "-Dteaql.java.dir=$runtime_dir" test fi fixture_mode=narrow -if [[ -f "$example_dir/target/generated/fixture-mode.txt" ]]; then - IFS= read -r fixture_mode <"$example_dir/target/generated/fixture-mode.txt" +if [[ -f "$fixture_dir/fixture-mode.txt" ]]; then + IFS= read -r fixture_mode <"$fixture_dir/fixture-mode.txt" fi if [[ "$wide" == true && "$fixture_mode" != wide ]]; then printf 'Wide verification requires a newly generated wide fixture.\n' >&2 @@ -34,8 +44,8 @@ case "$fixture_mode" in *) printf 'Invalid generated fixture mode\n' >&2; exit 1 ;; esac fixture_inheritance=false -if [[ -f "$example_dir/target/generated/fixture-inheritance.txt" ]]; then - IFS= read -r fixture_inheritance <"$example_dir/target/generated/fixture-inheritance.txt" +if [[ -f "$fixture_dir/fixture-inheritance.txt" ]]; then + IFS= read -r fixture_inheritance <"$fixture_dir/fixture-inheritance.txt" fi if [[ "$inheritance" == true && "$fixture_inheritance" != true ]]; then printf 'Inheritance verification requires a newly generated inherited fixture.\n' >&2 @@ -47,25 +57,41 @@ case "$fixture_inheritance" in false) ;; *) printf 'Invalid generated inheritance mode\n' >&2; exit 1 ;; esac -if [[ ! -f "$example_dir/target/generated/lib/pom.xml" ]]; then +if [[ ! -f "$fixture_dir/lib/pom.xml" ]]; then printf 'Generate first with TEAQL_CODEGEN_DIR= bash verify.sh --generate\n' >&2 exit 1 fi -run_dir="$(mktemp -d -t teaql-java-generated-state.XXXXXXXX)" -printf 'Evidence retained at %s\n' "$run_dir" +if [[ -n "${TEAQL_LOAD_STATE_EVIDENCE_DIR:-}" ]]; then + run_dir="$TEAQL_LOAD_STATE_EVIDENCE_DIR" + [[ "$run_dir" == /* ]] + mkdir -- "$run_dir" +else + run_dir="$(mktemp -d -t teaql-generated-state.XXXXXXXX)" + if [[ "$workspace" == true ]]; then + trap 'rm -rf -- "$run_dir"' EXIT + fi +fi +printf 'School load-state evidence: %s\n' "$run_dir" export TEAQL_LOCAL_RUNTIME_ROOT="$runtime_dir" export TEAQL_LOAD_STATE_DATABASE="$run_dir/school.sqlite" -rg --files --hidden --no-ignore "$example_dir/target/generated/lib/src" -0 | +rg --files --hidden --no-ignore "$fixture_dir/lib/src" -0 | sort -z | xargs -0 sha256sum >"$run_dir/generated-source.sha256" +reactor=(mvn -q -f "$runtime_dir/pom.xml" -Pshared-load-state-example -pl examples/shared-load-state -am) +if [[ "$workspace" == true ]]; then + reactor=(bash "$example_dir/workspace-reactor.sh") +fi for round in first second; do export TEAQL_LOAD_STATE_ROUND="$round" - mvn -q -f "$runtime_dir/pom.xml" -Pshared-load-state-example \ - -pl examples/shared-load-state -am \ + "${reactor[@]}" \ "-Dtest=$test_targets" "-Dteaql.loadState.inheritance=$fixture_inheritance" -Dsurefire.failIfNoSpecifiedTests=false test \ >"$run_dir/$round.log" 2>&1 || { tail -80 "$run_dir/$round.log" >&2 exit 1 } + if [[ "$workspace" == true ]]; then + rg -Fx -- "LOCAL_CLASS com.example.schoolmanagementservice.school.School $fixture_dir/lib/target/classes" "$run_dir/$round.log" + cp "$example_dir/java-app-console/target/surefire-reports/"TEST-*.xml "$run_dir/" + fi rg -F "PASS generated Java indexed Q/E/Checker/create/update/delete and snapshot sharing $round" "$run_dir/$round.log" rg -F "PASS generated Java typed native JSON roundtrip and snapshot sharing $round" "$run_dir/$round.log" rg -F "PASS generated Java reserved runtime JSON keys reject without provider entry or value leakage" "$run_dir/$round.log" diff --git a/examples/shared-load-state/workspace-reactor.sh b/examples/shared-load-state/workspace-reactor.sh new file mode 100644 index 000000000..a58fc3ee6 --- /dev/null +++ b/examples/shared-load-state/workspace-reactor.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail +example_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +runtime_dir="$(cd "$example_dir/../.." && pwd)" +reactor_dir="$(mktemp -d -t teaql-school-projection-reactor.XXXXXXXX)" +trap 'rm -rf -- "$reactor_dir"' EXIT +python3 -B - "$reactor_dir/pom.xml" "$runtime_dir" "$example_dir/java-lib-core/lib" "$example_dir/java-app-console" <<'PY' +from pathlib import Path +import sys +from xml.etree.ElementTree import Element, SubElement, ElementTree + +pom = Element('project', xmlns='http://maven.apache.org/POM/4.0.0') +for key, value in ( + ('modelVersion', '4.0.0'), ('groupId', 'io.teaql.test'), + ('artifactId', 'school-record-projection-reactor'), ('version', '1'), + ('packaging', 'pom'), +): + SubElement(pom, key).text = value +modules = SubElement(pom, 'modules') +for module in sys.argv[2:]: + SubElement(modules, 'module').text = module +ElementTree(pom).write(Path(sys.argv[1]), encoding='utf-8', xml_declaration=True) +PY +mvn -q -f "$reactor_dir/pom.xml" -pl :school-record-projection-workspace -am "$@" From b2d9c25fffc3f68d4a03a67c1efeb893bd765c44 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:56:15 +0800 Subject: [PATCH 49/71] Use a relocatable reactor for school projection verification --- examples/shared-load-state/verify.sh | 3 ++- examples/shared-load-state/workspace-reactor.sh | 3 ++- scripts/verify-examples.sh | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/shared-load-state/verify.sh b/examples/shared-load-state/verify.sh index e3b8b3830..5b8b960c9 100644 --- a/examples/shared-load-state/verify.sh +++ b/examples/shared-load-state/verify.sh @@ -90,7 +90,8 @@ for round in first second; do } if [[ "$workspace" == true ]]; then rg -Fx -- "LOCAL_CLASS com.example.schoolmanagementservice.school.School $fixture_dir/lib/target/classes" "$run_dir/$round.log" - cp "$example_dir/java-app-console/target/surefire-reports/"TEST-*.xml "$run_dir/" + mkdir -- "$run_dir/$round-junit" + cp "$example_dir/java-app-console/target/surefire-reports/"TEST-*.xml "$run_dir/$round-junit/" fi rg -F "PASS generated Java indexed Q/E/Checker/create/update/delete and snapshot sharing $round" "$run_dir/$round.log" rg -F "PASS generated Java typed native JSON roundtrip and snapshot sharing $round" "$run_dir/$round.log" diff --git a/examples/shared-load-state/workspace-reactor.sh b/examples/shared-load-state/workspace-reactor.sh index a58fc3ee6..1d949f75b 100644 --- a/examples/shared-load-state/workspace-reactor.sh +++ b/examples/shared-load-state/workspace-reactor.sh @@ -5,6 +5,7 @@ runtime_dir="$(cd "$example_dir/../.." && pwd)" reactor_dir="$(mktemp -d -t teaql-school-projection-reactor.XXXXXXXX)" trap 'rm -rf -- "$reactor_dir"' EXIT python3 -B - "$reactor_dir/pom.xml" "$runtime_dir" "$example_dir/java-lib-core/lib" "$example_dir/java-app-console" <<'PY' +from os.path import relpath from pathlib import Path import sys from xml.etree.ElementTree import Element, SubElement, ElementTree @@ -18,7 +19,7 @@ for key, value in ( SubElement(pom, key).text = value modules = SubElement(pom, 'modules') for module in sys.argv[2:]: - SubElement(modules, 'module').text = module + SubElement(modules, 'module').text = relpath(module, Path(sys.argv[1]).parent) ElementTree(pom).write(Path(sys.argv[1]), encoding='utf-8', xml_declaration=True) PY mvn -q -f "$reactor_dir/pom.xml" -pl :school-record-projection-workspace -am "$@" diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index b0e37747a..78088e47d 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -52,6 +52,8 @@ bash examples/trace-chain/verify.sh bash examples/trace-chain/verify-standard-telemetry.sh TEAQL_JAVA_STANDARD_ORDER_EVIDENCE_DIR="$verification_dir/standard-order" bash examples/standard-order/verify.sh TEAQL_CODEGEN_DIR="$build_dir/generator" bash examples/shared-load-state/verify.sh --generate +TEAQL_LOAD_STATE_EVIDENCE_DIR="$evidence_dir/shared-load-state" bash examples/shared-load-state/verify.sh --workspace +TEAQL_MAINSTREAM_EVIDENCE_DIR="$evidence_dir/mainstream-reference" bash examples/shared-load-state/benchmark-mainstream.sh --workspace TEAQL_JAVA_EXACT_EVIDENCE_DIR="$evidence_dir/exact-decimal" \ bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/exact-decimal/verify.sh" TEAQL_FREIGHT_QUOTE_EVIDENCE_DIR="$evidence_dir/freight-quotes" bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-freight-quotes.sh" From 8649902b7ff1d4919185dbe9b61af2fb3f519dd6 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:58:19 +0800 Subject: [PATCH 50/71] Record focused java examples/inheritance-save business qualification --- examples/inheritance-save/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/inheritance-save/showcase.json b/examples/inheritance-save/showcase.json index 91e54d374..18dec5cfc 100644 --- a/examples/inheritance-save/showcase.json +++ b/examples/inheritance-save/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/school-inheritance-and-partial-views-generation/receipt.json", "receiptSHA256": "7c8fb5f6c6619d7165638972cdbbe267d68e50cadf33d70065b45a52c68cf84f" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-inheritance-workspace-native/runtime/inheritance-save/receipt.json", + "businessReceiptSHA256": "eb229e2216d4115ed7280b0d77c89dcea7b99c95d1e3b442873ea6c58deae3db", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-inheritance-workspace-native/receipt.json", + "nativeReceiptSHA256": "71603bb3d3230154ad17601ab3047271270caf06edaf1c9cb9fdbad62e1aeacf", + "remainingFullRuntimeInventory": true, + "sourceCommit": "26d4aaadb7c5f57b6986be9384773b220eb2749d" + }, "scene": "Edit inherited school and academy fields through the same identity", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "node", "examples/inheritance-save/verify.cjs" From 80bb99c24b16338bf805a62a55c26c0f62e234e4 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 18:59:45 +0800 Subject: [PATCH 51/71] Record focused java examples/shared-load-state business qualification --- examples/shared-load-state/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/shared-load-state/showcase.json b/examples/shared-load-state/showcase.json index 407302cd6..35d129453 100644 --- a/examples/shared-load-state/showcase.json +++ b/examples/shared-load-state/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/school-inheritance-and-partial-views-generation/receipt.json", "receiptSHA256": "7c8fb5f6c6619d7165638972cdbbe267d68e50cadf33d70065b45a52c68cf84f" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-shared-load-state-reactor-native/runtime/shared-load-state/receipt.json", + "businessReceiptSHA256": "30d8ab35536763b9de523ec71daa88f872ca30cf4b05ca34a0015a872a8a8850", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-shared-load-state-reactor-native/receipt.json", + "nativeReceiptSHA256": "17cd557e98c5704fe8aeeb8827bd3ddd3bcb865a5300853da5700608ecd7dfa7", + "remainingFullRuntimeInventory": true, + "sourceCommit": "b2d9c25fffc3f68d4a03a67c1efeb893bd765c44" + }, "scene": "Read partial school records and preserve unseen business fields", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/shared-load-state/verify.sh", From c5945730ea25897e25f01c3a0ff1650c86fcc973 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:00:42 +0800 Subject: [PATCH 52/71] Document the academy and school record workspace scenarios --- examples/inheritance-save/README.md | 4 ++++ examples/shared-load-state/README.md | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/examples/inheritance-save/README.md b/examples/inheritance-save/README.md index 178698013..3d5209c95 100644 --- a/examples/inheritance-save/README.md +++ b/examples/inheritance-save/README.md @@ -1,5 +1,9 @@ # Generic and inherited audited saves +The scene starts from `model.xml`. The generated domain lives in +`java-lib-core`. The `java-app-console` workspace runs the lifecycle +against that library with the runtime from this checkout. + This six-object SQLite example saves Academy through a generic audited helper, then reads and updates the same logical object through generated Academy and School Q/E APIs. It never inserts a parent row manually. The first lifecycle diff --git a/examples/shared-load-state/README.md b/examples/shared-load-state/README.md index 65984b949..a82e0ffc3 100644 --- a/examples/shared-load-state/README.md +++ b/examples/shared-load-state/README.md @@ -1,5 +1,20 @@ # Generated Java shared load state example +The School model in `model.xml` generates `java-lib-core`. The +`java-app-console` workspace runs the original school-record tests +against that library. Two rounds share one SQLite file and check that +partial reads distinguish omitted fields from loaded values, rejected edits +preserve stored values, and accepted saves leave sibling records intact. + +```bash +bash examples/shared-load-state/verify.sh --workspace +bash examples/shared-load-state/benchmark-mainstream.sh --workspace +``` + +The comparison reuses the original full and sparse fixture at 1, 100 and +10,000 rows as a separate calibration. The wide and inherited fixture +options below use their own generation paths. + This small SQLite acceptance example uses a newly generated School library and the Java runtime source from the same Maven reactor. It does not install, publish or substitute TeaQL jars from a public repository. From 5a93937e17fe7dcd51034d6d98bcfd8716ba0cc8 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:10:28 +0800 Subject: [PATCH 53/71] Qualify persisted Java order edits through scoped references --- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 67 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 30 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 154 +++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../teaql/ordereditreference/Checkers.java | 0 .../teaql/ordereditreference/Constants.java | 9 + .../java/com/teaql/ordereditreference/E.java | 23 + .../EntityMetaRegistry.java | 405 ++++++++ .../GeneratedRuntimeModule.java | 38 + .../OrderEditReferenceUserContext.java | 10 + .../java/com/teaql/ordereditreference/Q.java | 34 + .../ordereditreference/Repositories.java | 0 .../ordereditreference/merchant/Merchant.java | 130 +++ .../merchant/MerchantChecker.java | 52 + .../merchant/MerchantExpression.java | 51 + .../merchant/MerchantListExpression.java | 25 + .../merchant/MerchantRequest.java | 623 ++++++++++++ .../orderitem/OrderItem.java | 148 +++ .../orderitem/OrderItemChecker.java | 69 ++ .../orderitem/OrderItemExpression.java | 60 ++ .../orderitem/OrderItemListExpression.java | 25 + .../orderitem/OrderItemRequest.java | 874 +++++++++++++++++ .../salesorder/SalesOrder.java | 151 +++ .../salesorder/SalesOrderChecker.java | 65 ++ .../salesorder/SalesOrderExpression.java | 61 ++ .../salesorder/SalesOrderListExpression.java | 25 + .../salesorder/SalesOrderRequest.java | 902 ++++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-app-console/pom.xml | 109 +++ .../com/teaql/ordereditreference/App.java | 99 ++ .../ordereditreference/CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../OrderReferenceEditorTest.java | 145 +++ .../java-app-console/teaql-i18n.json | 111 +++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../java-lib-core/lib/pom.xml | 142 +++ .../BaseServiceConfiguration.java | 0 .../teaql/ordereditreference/Checkers.java | 0 .../teaql/ordereditreference/Constants.java | 9 + .../java/com/teaql/ordereditreference/E.java | 23 + .../EntityMetaRegistry.java | 405 ++++++++ .../GeneratedRuntimeModule.java | 38 + .../OrderEditReferenceUserContext.java | 10 + .../java/com/teaql/ordereditreference/Q.java | 34 + .../ordereditreference/Repositories.java | 0 .../ordereditreference/merchant/Merchant.java | 130 +++ .../merchant/MerchantChecker.java | 52 + .../merchant/MerchantExpression.java | 51 + .../merchant/MerchantListExpression.java | 25 + .../merchant/MerchantRequest.java | 623 ++++++++++++ .../orderitem/OrderItem.java | 148 +++ .../orderitem/OrderItemChecker.java | 69 ++ .../orderitem/OrderItemExpression.java | 60 ++ .../orderitem/OrderItemListExpression.java | 25 + .../orderitem/OrderItemRequest.java | 874 +++++++++++++++++ .../salesorder/SalesOrder.java | 151 +++ .../salesorder/SalesOrderChecker.java | 65 ++ .../salesorder/SalesOrderExpression.java | 61 ++ .../salesorder/SalesOrderListExpression.java | 25 + .../salesorder/SalesOrderRequest.java | 902 ++++++++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + .../round-trip-reference-runtime/model.xml | 6 + .../showcase.json | 40 + .../round-trip-reference-runtime/verify.sh | 44 + scripts/verify-examples.sh | 3 +- 77 files changed, 8907 insertions(+), 2 deletions(-) create mode 100644 examples/round-trip-reference-runtime/java-app-console/.gitignore create mode 100644 examples/round-trip-reference-runtime/java-app-console/AGENTS.md create mode 100644 examples/round-trip-reference-runtime/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/round-trip-reference-runtime/java-app-console/Makefile create mode 100644 examples/round-trip-reference-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/round-trip-reference-runtime/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/round-trip-reference-runtime/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/round-trip-reference-runtime/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/pom.xml create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Checkers.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Repositories.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/round-trip-reference-runtime/java-app-console/pom.xml create mode 100644 examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/App.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/CustomUserContext.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/WorkspaceTeaQLDatabase.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/src/main/resources/application.properties create mode 100644 examples/round-trip-reference-runtime/java-app-console/src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java create mode 100644 examples/round-trip-reference-runtime/java-app-console/teaql-i18n.json create mode 100644 examples/round-trip-reference-runtime/java-app-console/teaql/checker-model.json create mode 100644 examples/round-trip-reference-runtime/java-app-console/teaql/model-provenance.json create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/pom.xml create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Checkers.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Constants.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/E.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Q.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Repositories.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java create mode 100644 examples/round-trip-reference-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/round-trip-reference-runtime/java-lib-core/teaql/checker-model.json create mode 100644 examples/round-trip-reference-runtime/java-lib-core/teaql/model-provenance.json create mode 100644 examples/round-trip-reference-runtime/model.xml create mode 100644 examples/round-trip-reference-runtime/showcase.json create mode 100644 examples/round-trip-reference-runtime/verify.sh diff --git a/examples/round-trip-reference-runtime/java-app-console/.gitignore b/examples/round-trip-reference-runtime/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/AGENTS.md b/examples/round-trip-reference-runtime/java-app-console/AGENTS.md new file mode 100644 index 000000000..05f13ae10 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/AGENTS.md @@ -0,0 +1,67 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| merchant | merchant | +| sales_order | sales_order | +| order_item | order_item | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/round-trip-reference-runtime/java-app-console/DOMAIN_API_GUIDE.md b/examples/round-trip-reference-runtime/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..48484b7f5 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,30 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/order-edit-reference.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| merchant | merchant | +| sales_order | sales_order | +| order_item | order_item | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/Makefile b/examples/round-trip-reference-runtime/java-app-console/Makefile new file mode 100644 index 000000000..97f7c7adf --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/order-edit-reference-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/order-edit-reference-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/round-trip-reference-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..b3261135e --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/order-edit-reference.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/STANDARD_TELEMETRY.md b/examples/round-trip-reference-runtime/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/round-trip-reference-runtime/java-app-console/TOOL_API_GUIDE.md b/examples/round-trip-reference-runtime/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..bd9dd2cdc --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/order-edit-reference.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/order-edit-reference.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/order-edit-reference.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/order-edit-reference.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/order-edit-reference.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/order-edit-reference.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/docs/teaql-java-crud-guide.md b/examples/round-trip-reference-runtime/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..a24525f12 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,154 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.ordereditreference`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.OrderEditReferenceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.merchants() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.merchants() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Merchant(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.merchants() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.merchants() + .selectSalesOrderListWith(Q.salesOrders().selectSelf()) + .comment("load with salesOrderList") + .purpose("fetch child salesOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.salesOrders() + .selectMerchantWith(Q.merchants().selectSelf()) + .comment("load with merchant") + .purpose("fetch associated merchant") + .executeForList(userContext); +``` + + +```java +var list = Q.salesOrders() + .selectOrderItemListWith(Q.orderItems().selectSelf()) + .comment("load with orderItemList") + .purpose("fetch child orderItemList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Merchant`: reverse relations `1`, query `Q.merchants()`, save `new Merchant().auditAs("comment").save(userContext)`, request `com.teaql.ordereditreference.merchant.MerchantRequest` +- `SalesOrder`: reverse relations `1`, query `Q.salesOrders()`, save `new SalesOrder().auditAs("comment").save(userContext)`, request `com.teaql.ordereditreference.salesorder.SalesOrderRequest` \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/pom.xml b/examples/round-trip-reference-runtime/java-app-console/lib/pom.xml new file mode 100644 index 000000000..f574b27bd --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + order-edit-reference-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Checkers.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java new file mode 100644 index 000000000..68ecabba0 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.ordereditreference; + +import com.teaql.ordereditreference.merchant.Merchant; + +public interface Constants { + public static final long MERCHANT_ID = 1l; + public static final Merchant MERCHANT = Merchant.refer(MERCHANT_ID); +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java new file mode 100644 index 000000000..42215a2bf --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java @@ -0,0 +1,23 @@ + +package com.teaql.ordereditreference; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantExpression; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemExpression; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static MerchantExpression merchant(Merchant merchant){ + return new MerchantExpression(new ValueExpression(merchant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.merchant()")); + } + public static SalesOrderExpression salesOrder(SalesOrder salesOrder){ + return new SalesOrderExpression(new ValueExpression(salesOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.salesOrder()")); + } + public static OrderItemExpression orderItem(OrderItem orderItem){ + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java new file mode 100644 index 000000000..0bbe6ea3e --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java @@ -0,0 +1,405 @@ + +package com.teaql.ordereditreference; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerMerchant(); + registerSalesOrder(); + registerOrderItem(); + } + private void registerMerchant() { + FieldLayout.installGenerated(com.teaql.ordereditreference.merchant.Merchant.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordereditreference.merchant.Merchant.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordereditreference.merchant.Merchant.class); + entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.merchant.Merchant::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Northwind Retail") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSalesOrder() { + FieldLayout.installGenerated(com.teaql.ordereditreference.salesorder.SalesOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordereditreference.salesorder.SalesOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordereditreference.salesorder.SalesOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.salesorder.SalesOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor merchant = + entityDescriptor.addObjectProperty($factory, com.teaql.ordereditreference.salesorder.SalesOrder.MERCHANT_PROPERTY, com.teaql.ordereditreference.merchant.Merchant.INTERNAL_TYPE, com.teaql.ordereditreference.merchant.Merchant.SALES_ORDER_LIST_PROPERTY, com.teaql.ordereditreference.merchant.Merchant.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.MERCHANT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderItem() { + FieldLayout.installGenerated(com.teaql.ordereditreference.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordereditreference.orderitem.OrderItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordereditreference.orderitem.OrderItem.class); + entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.orderitem.OrderItem::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor salesOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.ordereditreference.orderitem.OrderItem.SALES_ORDER_PROPERTY, com.teaql.ordereditreference.salesorder.SalesOrder.INTERNAL_TYPE, com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.ordereditreference.salesorder.SalesOrder.class) + ; + PropertyDescriptor sku = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY, String.class) + ; + PropertyDescriptor quantity = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY, Integer.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SALES_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java new file mode 100644 index 000000000..663fa2609 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.ordereditreference; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.ordereditreference.merchant.MerchantChecker(), new com.teaql.ordereditreference.salesorder.SalesOrderChecker(), new com.teaql.ordereditreference.orderitem.OrderItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:c2dacaf8377a726fc38a9cf13920679bb314d4127c7cc9c550dc98d516508240\",\"entities\":{\"Merchant\":{\"labels\":{\"en\":\"merchant\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"sales_order_list\",\"targetType\":\"SalesOrder\",\"labels\":{\"en\":\"sales order\"},\"aliases\":[\"SalesOrderList\",\"salesOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"order item\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"sales_order\",\"targetType\":\"SalesOrder\",\"labels\":{\"en\":\"sales order\"},\"aliases\":[\"SalesOrder\",\"salesOrder\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SalesOrder\":{\"labels\":{\"en\":\"sales order\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Merchant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SalesOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("sales_order", "salesOrder"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.merchants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.ordereditreference.merchant.Merchant domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.ordereditreference.merchant.Merchant(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Northwind Retail"); + domainRoot.auditAs("create generated Domain Root Merchant").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Merchant", domainRoot.getId())); + } +} diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java new file mode 100644 index 000000000..38a8d79c3 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.ordereditreference; + +import io.teaql.core.UserContext; +public interface OrderEditReferenceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java new file mode 100644 index 000000000..49d46f241 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.ordereditreference; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.ordereditreference.merchant.MerchantRequest merchants(){ + return new com.teaql.ordereditreference.merchant.MerchantRequest(com.teaql.ordereditreference.merchant.Merchant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordereditreference.merchant.MerchantRequest merchantsWithMinimalFields(){ + return new com.teaql.ordereditreference.merchant.MerchantRequest(com.teaql.ordereditreference.merchant.Merchant.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordereditreference.salesorder.SalesOrderRequest salesOrders(){ + return new com.teaql.ordereditreference.salesorder.SalesOrderRequest(com.teaql.ordereditreference.salesorder.SalesOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordereditreference.salesorder.SalesOrderRequest salesOrdersWithMinimalFields(){ + return new com.teaql.ordereditreference.salesorder.SalesOrderRequest(com.teaql.ordereditreference.salesorder.SalesOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordereditreference.orderitem.OrderItemRequest orderItems(){ + return new com.teaql.ordereditreference.orderitem.OrderItemRequest(com.teaql.ordereditreference.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordereditreference.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ + return new com.teaql.ordereditreference.orderitem.OrderItemRequest(com.teaql.ordereditreference.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Repositories.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java new file mode 100644 index 000000000..ed385f8aa --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java @@ -0,0 +1,130 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Merchant extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Merchant"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5f39ea5c4412183f01dd053549e36ebdc775b789c2346cb2b800a9f80d8cdb5a"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "sales_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Merchant.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SALES_ORDER_LIST_PROPERTY = "sales_order_list"; + private String name; + + private SmartList salesOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getSalesOrderList(){ + return this.salesOrderList == null ? SmartList.unloaded() : this.salesOrderList; + } + public Merchant updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Merchant addSalesOrder(SalesOrder salesOrder){ + if (salesOrder == null){ + return this; + } + + if(null == this.salesOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.salesOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.salesOrderList.add(salesOrder); + salesOrder.updateMerchant(this); + return this; + } + + public static Merchant refer(Long id){ + Merchant refer = new Merchant(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Merchant comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "sales_order_list": this.salesOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "sales_order_list": return this.salesOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java new file mode 100644 index 000000000..4594a518b --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class MerchantChecker implements Checker{ + + public String type(){ + return Merchant.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if(needCheck(_context, merchant)){ + markAsChecked(_context, merchant); + doCheck(_context, merchant, _parentLocation); + } + } + + public void doCheck(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if((merchant == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, merchant); + if(merchant.needPersist()){ + } + if(merchant.newItem()){ + }else if(merchant.updateItem()){ + if(!merchant.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, merchant.getProperty(Merchant.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; merchant.getSalesOrderList() != null && i < merchant.getSalesOrderList().size(); i++){ + SalesOrder salesOrder = merchant.getSalesOrderList().get(i); + new SalesOrderChecker().checkAndFix(_context, salesOrder, newLocation(_parentLocation, "sales_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java new file mode 100644 index 000000000..adc417be6 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class MerchantExpression extends ExpressionAdaptor implements BaseEntityExpression { + public MerchantExpression(Expression expression){ + super(expression); + } + + public MerchantExpression(Expression expression, Function function){ + super(expression, function); + } + + public MerchantExpression updateId(Long id){ + return new MerchantExpression(this, $it -> {((Merchant)$it).__internalSet("id", id); return this;}); + } + + public MerchantExpression save(UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs("Saved by Expression").save(userContext)); + } + + public MerchantExpression save(String intent, UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Merchant::getName); + } + public MerchantExpression updateName(String name){ + return new MerchantExpression(this, $it -> ((Merchant)$it).updateName(name)); + } + + public SalesOrderListExpression getSalesOrderList(){ + return new SalesOrderListExpression(loaded("sales_order_list", "getSalesOrderList", Merchant::getSalesOrderList)); + } + public MerchantExpression addSalesOrder(SalesOrder salesOrder){ + return new MerchantExpression(this, $it -> ((Merchant)$it).addSalesOrder(salesOrder)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java new file mode 100644 index 000000000..256390530 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordereditreference.merchant; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class MerchantListExpression extends SmartListExpression { + public MerchantListExpression(Expression> expression){ + super(expression); + } + + public MerchantListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public MerchantExpression first() { + return new MerchantExpression(super.first()); + } + + public MerchantExpression get(int index) { + return new MerchantExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java new file mode 100644 index 000000000..96d82292c --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class MerchantRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public MerchantRequest(Class returnType){ + this(returnType, () -> (T) new Merchant()); + } + + protected MerchantRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public MerchantRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public MerchantRequest copy(){ + return (MerchantRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new MerchantRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public MerchantRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public MerchantRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public MerchantRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public MerchantRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public MerchantRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public MerchantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public MerchantRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public MerchantRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (MerchantRequest)super.appendSearchCriteria(searchCriteria); + } + + public MerchantRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public MerchantRequest matchingAnyOf(MerchantRequest merchant){ + super.internalMatchAny(merchant); + return this; + } + + public MerchantRequest matchingIdsOf(MerchantRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Merchant.ID_PROPERTY, request, Merchant.ID_PROPERTY)); + } + + public MerchantRequest enhanceChildrenIfNeeded(){ + return this; + } + + public MerchantRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public MerchantRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public MerchantRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectSelfFields(){ + return selectSelf(); + } + + public MerchantRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Merchant.ID_PROPERTY); + selectProperty(Merchant.NAME_PROPERTY); + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectChildren(){ + super.selectAny(); + selectSalesOrderList(); + return selectId().selectName().selectVersion(); + } + + + public MerchantRequest selectId(){ + selectProperty(Merchant.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectId(){ + unselectProperty(Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest selectName(){ + selectProperty(Merchant.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectName(){ + unselectProperty(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest selectVersion(){ + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectVersion(){ + unselectProperty(Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest selectSalesOrderList(){ + return selectSalesOrderListWith(Q.salesOrders().selectSelf()); + } + + public MerchantRequest selectSalesOrderListWith(SalesOrderRequest salesOrderList){ + enhanceRelation(Merchant.SALES_ORDER_LIST_PROPERTY, salesOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSalesOrderListWith", null, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.ID_PROPERTY, operator, values); + } + + public MerchantRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public MerchantRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public MerchantRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public MerchantRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public MerchantRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public MerchantRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public MerchantRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public MerchantRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.NAME_PROPERTY, operator, values); + } + + public MerchantRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public MerchantRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public MerchantRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public MerchantRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public MerchantRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public MerchantRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public MerchantRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public MerchantRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public MerchantRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public MerchantRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public MerchantRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public MerchantRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public MerchantRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public MerchantRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public MerchantRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public MerchantRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public MerchantRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public MerchantRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.VERSION_PROPERTY, operator, values); + } + + public MerchantRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public MerchantRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public MerchantRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public MerchantRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public MerchantRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public MerchantRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public MerchantRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public MerchantRequest withSalesOrderListMatching(SalesOrderRequest salesOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, salesOrderRequest, SalesOrder.MERCHANT_PROPERTY)); + } + + public MerchantRequest withoutSalesOrderListMatching(SalesOrderRequest salesOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, salesOrderRequest, SalesOrder.MERCHANT_PROPERTY))); + } + + public MerchantRequest haveSalesOrders(){ + return withSalesOrderListMatching(Q.salesOrders().unlimited()); + } + + public MerchantRequest haveNoSalesOrders(){ + return withoutSalesOrderListMatching(Q.salesOrders().unlimited()); + } + + public MerchantRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public MerchantRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public MerchantRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public MerchantRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public MerchantRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public MerchantRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest groupBySalesOrdersWithDetails(SalesOrderRequest subRequest){ + aggregate(Merchant.SALES_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public MerchantRequest groupById(){ + groupBy(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdAs(String retName){ + groupBy(retName, Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.ID_PROPERTY, function); + return this; + } + + public MerchantRequest groupByName(){ + groupBy(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameAs(String retName){ + groupBy(retName, Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.NAME_PROPERTY, function); + return this; + } + + public MerchantRequest groupByVersion(){ + groupBy(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionAs(String retName){ + groupBy(retName, Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.VERSION_PROPERTY, function); + return this; + } + + + + public MerchantRequest orderByIdAscending(){ + addOrderByAscending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByIdDescending(){ + addOrderByDescending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByNameAscending(){ + addOrderByAscending(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescending(){ + addOrderByDescending(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByVersionAscending(){ + addOrderByAscending(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest orderByVersionDescending(){ + addOrderByDescending(Merchant.VERSION_PROPERTY); + return this; + } + + + public MerchantRequest statsFromSalesOrdersAs(String name, SalesOrderRequest subRequest){ + return statsFromSalesOrdersAs(name, subRequest, false); + } + + public MerchantRequest statsFromSalesOrdersAs(String name, SalesOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SalesOrder.MERCHANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSalesOrdersAs", name, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest statsFromSalesOrders(SalesOrderRequest subRequest){ + return statsFromSalesOrdersAs(REFINEMENTS, subRequest); + } + public MerchantRequest countSalesOrders(){ + addRelationCount("Count", Q.salesOrders().unlimited(), SalesOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrders", null, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countSalesOrdersAs(String name){ + addRelationCount(name, Q.salesOrders().unlimited(), SalesOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrdersAs", name, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countSalesOrdersWith(String name, SalesOrderRequest subRequest){ + addRelationCount(name, subRequest, SalesOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrdersWith", name, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public MerchantRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public MerchantRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public MerchantRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public MerchantRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public MerchantRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public MerchantRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java new file mode 100644 index 000000000..25e0728e2 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java @@ -0,0 +1,148 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d70859137f59ca1b9c6e9daa84dde3e7300bdbbb95ca56c147662302a8a6aba"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("sales_order", 1), java.util.Map.entry("sku", 2), java.util.Map.entry("quantity", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("sales_order", java.util.List.of("salesOrder", "sales_order")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String SALES_ORDER_PROPERTY = "sales_order"; + public static final String SKU_PROPERTY = "sku"; + public static final String QUANTITY_PROPERTY = "quantity"; + private SalesOrder salesOrder; + + private String sku; + + private Integer quantity; + + + public SalesOrder getSalesOrder(){ + return this.salesOrder; + } + + public String getSku(){ + return this.sku; + } + + public Integer getQuantity(){ + return this.quantity; + } + + public OrderItem updateSalesOrder(SalesOrder salesOrder){ + if(isPropertyLoaded(SALES_ORDER_PROPERTY) && Objects.equals(this.salesOrder, salesOrder)){ + return this; + } + handleUpdate(SALES_ORDER_PROPERTY, getSalesOrder(), salesOrder); + this.salesOrder = salesOrder; + return this; + } + + public OrderItem updateSku(String sku){ + sku = (sku == null ? null : sku.trim()); + if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ + return this; + } + handleUpdate(SKU_PROPERTY, getSku(), sku); + this.sku = sku; + return this; + } + + public OrderItem updateQuantity(Integer quantity){ + if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ + return this; + } + handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); + this.quantity = quantity; + return this; + } + + + public static OrderItem refer(Long id){ + OrderItem refer = new OrderItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "sales_order": this.salesOrder = (SalesOrder) value; break; + + case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; + + case "quantity": this.quantity = (Integer) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "sales_order": return this.salesOrder; + case "sku": return this.sku; + case "quantity": return this.quantity; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "salesOrder": return this.salesOrder; + case "sku": return this.sku; + case "quantity": return this.quantity; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java new file mode 100644 index 000000000..a13d78b0a --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java @@ -0,0 +1,69 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class OrderItemChecker implements Checker{ + + public String type(){ + return OrderItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if(needCheck(_context, orderItem)){ + markAsChecked(_context, orderItem); + doCheck(_context, orderItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if((orderItem == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + } + if(orderItem.newItem()){ + }else if(orderItem.updateItem()){ + if(!orderItem.isPropertyLoaded("sales_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sales_order"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("sku")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("quantity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); + } + + } + checkSalesOrder(_context, orderItem.getProperty(OrderItem.SALES_ORDER_PROPERTY), newLocation(_parentLocation, "sales_order")); + checkSku(_context, orderItem.getProperty(OrderItem.SKU_PROPERTY), newLocation(_parentLocation, "sku")); + checkQuantity(_context, orderItem.getProperty(OrderItem.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); + } + + public void checkSalesOrder(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, salesOrder); + if((salesOrder == null)){ + return; + } + new SalesOrderChecker().checkAndFix(_context, salesOrder, _parentLocation); + } + public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sku); + if((sku == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, sku); + + } + public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quantity); + if((quantity == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java new file mode 100644 index 000000000..d7a5a442e --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java @@ -0,0 +1,60 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderItemExpression(Expression expression){ + super(expression); + } + + public OrderItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderItemExpression updateId(Long id){ + return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); + } + + public OrderItemExpression save(UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderItemExpression save(String intent, UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public SalesOrderExpression getSalesOrder(){ + return new SalesOrderExpression(loaded("sales_order", "getSalesOrder", OrderItem::getSalesOrder)); + } + + public OrderItemExpression updateSalesOrder(SalesOrder salesOrder){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateSalesOrder(salesOrder)); + } + + public Expression getSku(){ + return loaded("sku", "getSku", OrderItem::getSku); + } + public OrderItemExpression updateSku(String sku){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateSku(sku)); + } + + public Expression getQuantity(){ + return loaded("quantity", "getQuantity", OrderItem::getQuantity); + } + public OrderItemExpression updateQuantity(Integer quantity){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateQuantity(quantity)); + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java new file mode 100644 index 000000000..db1c0ce5c --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordereditreference.orderitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderItemListExpression extends SmartListExpression { + public OrderItemListExpression(Expression> expression){ + super(expression); + } + + public OrderItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderItemExpression first() { + return new OrderItemExpression(super.first()); + } + + public OrderItemExpression get(int index) { + return new OrderItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java new file mode 100644 index 000000000..3e6e862be --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java @@ -0,0 +1,874 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class OrderItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderItemRequest(Class returnType){ + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ + super.internalMatchAny(orderItem); + return this; + } + + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + + public OrderItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectSalesOrderIdOnly().selectSku().selectQuantity().selectVersion(); + } + + public OrderItemRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.SALES_ORDER_PROPERTY); + selectProperty(OrderItem.SKU_PROPERTY); + selectProperty(OrderItem.QUANTITY_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest selectAll(){ + super.selectAll(); + return selectId().selectSalesOrder().selectSku().selectQuantity().selectVersion(); + } + + public OrderItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectSalesOrder().selectSku().selectQuantity().selectVersion(); + } + + + public OrderItemRequest selectId(){ + selectProperty(OrderItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectId(){ + unselectProperty(OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest selectSalesOrderIdOnly(){ + selectProperty(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest selectSalesOrder(){ + return selectSalesOrderWith(Q.salesOrders().unlimited().selectSelf()); + } + + public OrderItemRequest selectSalesOrderWith(SalesOrderRequest salesOrder){ + selectProperty(OrderItem.SALES_ORDER_PROPERTY); + enhanceRelation(OrderItem.SALES_ORDER_PROPERTY, salesOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSalesOrderWith", null, OrderItem.SALES_ORDER_PROPERTY)); + return this; + } + + public OrderItemRequest unselectSalesOrder(){ + unselectProperty(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + public OrderItemRequest selectSku(){ + selectProperty(OrderItem.SKU_PROPERTY); + return this; + } + + /** + * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectSku(){ + unselectProperty(OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest selectQuantity(){ + selectProperty(OrderItem.QUANTITY_PROPERTY); + return this; + } + + /** + * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. + * @param aggrFunction aggrFunction + */ + public OrderItemRequest selectQuantity(AggrFunction aggrFunction){ + selectProperty(OrderItem.QUANTITY_PROPERTY, aggrFunction); + return this; + } + + + public OrderItemRequest unselectQuantity(){ + unselectProperty(OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest selectVersion(){ + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectVersion(){ + unselectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); + } + + public OrderItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderItemRequest filterBySalesOrder(SalesOrder... salesOrder){ + if (salesOrder == null || salesOrder.length == 0) { + throw new IllegalArgumentException("filterBySalesOrder parameter salesOrder cannot be empty"); + } + return appendSearchCriteria(createSalesOrderCriteria(Operator.EQUAL, (Object[])salesOrder)); + } + + public OrderItemRequest withSalesOrder(Operator operator, Object... values){ + return appendSearchCriteria(createSalesOrderCriteria(operator, values)); + } + + public OrderItemRequest withSalesOrderIsUnknown(){ + return withSalesOrder(Operator.IS_NULL); + } + + public OrderItemRequest withSalesOrderIsKnown(){ + return withSalesOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSalesOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.SALES_ORDER_PROPERTY, operator, values); + } + + public OrderItemRequest filterBySalesOrder(Long salesOrder){ + if(salesOrder == null){ + return this; + } + return withSalesOrder(Operator.EQUAL, salesOrder); + } + public OrderItemRequest withSalesOrderMatching(SalesOrderRequest salesOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.SALES_ORDER_PROPERTY, salesOrder, SalesOrder.ID_PROPERTY)); + } + + public OrderItemRequest withoutSalesOrderMatching(SalesOrderRequest salesOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.SALES_ORDER_PROPERTY, salesOrder, SalesOrder.ID_PROPERTY))); + } + + public OrderItemRequest filterBySku(String... sku){ + if (sku == null || sku.length == 0) { + throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); + } + return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); + } + + public OrderItemRequest withSku(Operator operator, Object... values){ + return appendSearchCriteria(createSkuCriteria(operator, values)); + } + + public OrderItemRequest withSkuIsUnknown(){ + return withSku(Operator.IS_NULL); + } + + public OrderItemRequest withSkuIsKnown(){ + return withSku(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSkuCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.SKU_PROPERTY, operator, values); + } + + public OrderItemRequest withSkuIsNot(String sku){ + return withSku(Operator.NOT_EQUAL, sku); + } + + public OrderItemRequest withSkuIn(String... sku){ + return withSku(Operator.IN, (Object[])sku); + } + + public OrderItemRequest withSkuNotIn(String... sku){ + return withSku(Operator.NOT_IN, (Object[])sku); + } + public OrderItemRequest withSkuGreaterThan(String sku){ + return withSku(Operator.GREATER_THAN, sku); + } + + public OrderItemRequest withSkuGreaterThanOrEqualTo(String sku){ + return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); + } + + public OrderItemRequest withSkuLessThan(String sku){ + return withSku(Operator.LESS_THAN, sku); + } + + public OrderItemRequest withSkuLessThanOrEqualTo(String sku){ + return withSku(Operator.LESS_THAN_OR_EQUAL, sku); + } + + public OrderItemRequest withSkuBetween(String startOfSku, String endOfSku){ + return withSku(Operator.BETWEEN, startOfSku, endOfSku); + } + public OrderItemRequest withSkuStartingWith(String sku){ + return withSku(Operator.BEGIN_WITH, sku); + } + public OrderItemRequest withSkuContaining(String sku){ + return withSku(Operator.CONTAIN, sku); + } + + public OrderItemRequest withSkuNotContaining(String sku){ + return withSku(Operator.NOT_CONTAIN, sku); + } + + public OrderItemRequest withSkuNotStartingWith(String sku){ + return withSku(Operator.NOT_BEGIN_WITH, sku); + } + + public OrderItemRequest withSkuEndingWith(String sku){ + return withSku(Operator.END_WITH, sku); + } + + public OrderItemRequest withSkuNotEndingWith(String sku){ + return withSku(Operator.NOT_END_WITH, sku); + } + + public OrderItemRequest withSkuIs(String sku){ + return withSku(Operator.EQUAL, sku); + } + + public OrderItemRequest withSkuSoundingLike(String sku){ + return withSku(Operator.SOUNDS_LIKE, sku); + } + + + + public OrderItemRequest filterByQuantity(Integer... quantity){ + if (quantity == null || quantity.length == 0) { + throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); + } + return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); + } + + public OrderItemRequest withQuantity(Operator operator, Object... values){ + return appendSearchCriteria(createQuantityCriteria(operator, values)); + } + + public OrderItemRequest withQuantityIsUnknown(){ + return withQuantity(Operator.IS_NULL); + } + + public OrderItemRequest withQuantityIsKnown(){ + return withQuantity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.QUANTITY_PROPERTY, operator, values); + } + + public OrderItemRequest withQuantityIs(Integer quantity){ + return withQuantity(Operator.EQUAL, quantity); + } + + public OrderItemRequest withQuantityIsNot(Integer quantity){ + return withQuantity(Operator.NOT_EQUAL, quantity); + } + + public OrderItemRequest withQuantityIn(Integer... quantity){ + return withQuantity(Operator.IN, (Object[])quantity); + } + + public OrderItemRequest withQuantityNotIn(Integer... quantity){ + return withQuantity(Operator.NOT_IN, (Object[])quantity); + } + public OrderItemRequest withQuantityGreaterThan(Integer quantity){ + return withQuantity(Operator.GREATER_THAN, quantity); + } + + public OrderItemRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); + } + + public OrderItemRequest withQuantityLessThan(Integer quantity){ + return withQuantity(Operator.LESS_THAN, quantity); + } + + public OrderItemRequest withQuantityLessThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); + } + + public OrderItemRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ + return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); + } + + + + public OrderItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); + } + + public OrderItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderItemRequest minQuantity(){ + return minQuantityAs(prefix("minOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest minQuantityAs(String retName){ + super.min(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest maxQuantity(){ + return maxQuantityAs(prefix("maxOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest maxQuantityAs(String retName){ + super.max(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest sumQuantity(){ + return sumQuantityAs(prefix("sumOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest sumQuantityAs(String retName){ + super.sum(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest avgQuantity(){ + return avgQuantityAs(prefix("avgOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest avgQuantityAs(String retName){ + super.avg(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest standardDeviationQuantity(){ + return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest standardDeviationQuantityAs(String retName){ + super.standardDeviation(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest squareRootOfPopulationStandardDeviationQuantity(){ + return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest sampleVarianceQuantity(){ + return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest sampleVarianceQuantityAs(String retName){ + super.sampleVariance(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest samplePopulationVarianceQuantity(){ + return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest samplePopulationVarianceQuantityAs(String retName){ + super.samplePopulationVariance(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest groupBySalesOrderWithDetails(){ + return groupBySalesOrderWithDetails(Q.salesOrders().unlimited()); + } + + public OrderItemRequest groupBySalesOrderWithDetails(SalesOrderRequest subRequest){ + aggregate(OrderItem.SALES_ORDER_PROPERTY, subRequest); + return this; + } + + + + + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctSalesOrder(){ + return countDistinctSalesOrderAs("sales_order_distinct_count"); + } + + public OrderItemRequest countDistinctSalesOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.SALES_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctSku(){ + return countDistinctSkuAs("sku_distinct_count"); + } + + public OrderItemRequest countDistinctSkuAs(String alias){ + super.countDistinctProperty(alias, OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest countDistinctQuantity(){ + return countDistinctQuantityAs("quantity_distinct_count"); + } + + public OrderItemRequest countDistinctQuantityAs(String alias){ + super.countDistinctProperty(alias, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupById(){ + groupBy(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdAs(String retName){ + groupBy(retName, OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.ID_PROPERTY, function); + return this; + } + public OrderItemRequest groupBySalesOrderWith(SalesOrderRequest subRequest){ + groupBy(OrderItem.SALES_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySalesOrderWith", null, "sales_order")); + return this; + } + public OrderItemRequest groupBySalesOrder(){ + groupBy(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupBySalesOrderAs(String retName){ + groupBy(retName, OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupBySalesOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.SALES_ORDER_PROPERTY, function); + return this; + } + + public OrderItemRequest groupBySku(){ + groupBy(OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest groupBySkuAs(String retName){ + groupBy(retName, OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest groupBySkuWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.SKU_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByQuantity(){ + groupBy(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest groupByQuantityAs(String retName){ + groupBy(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest groupByQuantityWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.QUANTITY_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByVersion(){ + groupBy(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionAs(String retName){ + groupBy(retName, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.VERSION_PROPERTY, function); + return this; + } + + + + public OrderItemRequest orderByIdAscending(){ + addOrderByAscending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByIdDescending(){ + addOrderByDescending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderBySalesOrderAscending(){ + addOrderByAscending(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderBySalesOrderDescending(){ + addOrderByDescending(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderBySkuAscending(){ + addOrderByAscending(OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest orderBySkuDescending(){ + addOrderByDescending(OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest orderBySkuAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest orderBySkuDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest orderByQuantityAscending(){ + addOrderByAscending(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest orderByQuantityDescending(){ + addOrderByDescending(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionAscending(){ + addOrderByAscending(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionDescending(){ + addOrderByDescending(OrderItem.VERSION_PROPERTY); + return this; + } + + + public SalesOrderRequest rollUpToSalesOrder(){ + SalesOrderRequest salesOrder = Q.salesOrders().unlimited(); + this.internalRollUpTo("sales_order", salesOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSalesOrder", null, "sales_order")); + return salesOrder; + } + + + + + + public OrderItemRequest facetBySalesOrderAs(String facetName, SalesOrderRequest salesOrder){ + return facetBySalesOrderAs(facetName, salesOrder, true); + } + + public OrderItemRequest facetBySalesOrderAs(String facetName, SalesOrderRequest salesOrder, boolean includeAllFacets){ + addFacet(facetName, OrderItem.SALES_ORDER_PROPERTY, salesOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySalesOrderAs", facetName, OrderItem.SALES_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java new file mode 100644 index 000000000..919b8f4c7 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java @@ -0,0 +1,151 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.orderitem.OrderItem; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SalesOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SalesOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c887e95abcd3078f0518b67a359e764511c1e109c190cfab61732bd002847815"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("order_number", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SalesOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String MERCHANT_PROPERTY = "merchant"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private Merchant merchant; + + private String orderNumber; + + private SmartList orderItemList; + + public Merchant getMerchant(){ + return this.merchant; + } + + public String getOrderNumber(){ + return this.orderNumber; + } + + public SmartList getOrderItemList(){ + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; + } + public SalesOrder updateMerchant(Merchant merchant){ + if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ + return this; + } + handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); + this.merchant = merchant; + return this; + } + + public SalesOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public SalesOrder addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); + } + + this.orderItemList.add(orderItem); + orderItem.updateSalesOrder(this); + return this; + } + + public static SalesOrder refer(Long id){ + SalesOrder refer = new SalesOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SalesOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "merchant": this.merchant = (Merchant) value; break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "merchant": return this.merchant; + case "order_number": return this.orderNumber; + case "order_item_list": return this.orderItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "merchant": return this.merchant; + case "orderNumber": return this.orderNumber; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java new file mode 100644 index 000000000..07cedc666 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantChecker; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SalesOrderChecker implements Checker{ + + public String type(){ + return SalesOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, salesOrder)){ + markAsChecked(_context, salesOrder); + doCheck(_context, salesOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ + if((salesOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, salesOrder); + if(salesOrder.needPersist()){ + } + if(salesOrder.newItem()){ + }else if(salesOrder.updateItem()){ + if(!salesOrder.isPropertyLoaded("merchant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); + } + if(!salesOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + + } + checkMerchant(_context, salesOrder.getProperty(SalesOrder.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); + checkOrderNumber(_context, salesOrder.getProperty(SalesOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + for(int i = 0; salesOrder.getOrderItemList() != null && i < salesOrder.getOrderItemList().size(); i++){ + OrderItem orderItem = salesOrder.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, merchant); + if((merchant == null)){ + return; + } + new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); + } + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java new file mode 100644 index 000000000..a034c8604 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantExpression; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SalesOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SalesOrderExpression(Expression expression){ + super(expression); + } + + public SalesOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public SalesOrderExpression updateId(Long id){ + return new SalesOrderExpression(this, $it -> {((SalesOrder)$it).__internalSet("id", id); return this;}); + } + + public SalesOrderExpression save(UserContext userContext){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SalesOrderExpression save(String intent, UserContext userContext){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public MerchantExpression getMerchant(){ + return new MerchantExpression(loaded("merchant", "getMerchant", SalesOrder::getMerchant)); + } + + public SalesOrderExpression updateMerchant(Merchant merchant){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).updateMerchant(merchant)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", SalesOrder::getOrderNumber); + } + public SalesOrderExpression updateOrderNumber(String orderNumber){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).updateOrderNumber(orderNumber)); + } + + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", SalesOrder::getOrderItemList)); + } + public SalesOrderExpression addOrderItem(OrderItem orderItem){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java new file mode 100644 index 000000000..8e041cce7 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordereditreference.salesorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SalesOrderListExpression extends SmartListExpression { + public SalesOrderListExpression(Expression> expression){ + super(expression); + } + + public SalesOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SalesOrderExpression first() { + return new SalesOrderExpression(super.first()); + } + + public SalesOrderExpression get(int index) { + return new SalesOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java new file mode 100644 index 000000000..fd2ff1dde --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java @@ -0,0 +1,902 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantRequest; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SalesOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SalesOrderRequest(Class returnType){ + this(returnType, () -> (T) new SalesOrder()); + } + + protected SalesOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SalesOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SalesOrderRequest copy(){ + return (SalesOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SalesOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SalesOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SalesOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SalesOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SalesOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SalesOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SalesOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SalesOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SalesOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SalesOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SalesOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SalesOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public SalesOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SalesOrderRequest matchingAnyOf(SalesOrderRequest salesOrder){ + super.internalMatchAny(salesOrder); + return this; + } + + public SalesOrderRequest matchingIdsOf(SalesOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SalesOrder.ID_PROPERTY, request, SalesOrder.ID_PROPERTY)); + } + + public SalesOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SalesOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SalesOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SalesOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectMerchantIdOnly().selectOrderNumber().selectVersion(); + } + + public SalesOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public SalesOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SalesOrder.ID_PROPERTY); + selectProperty(SalesOrder.MERCHANT_PROPERTY); + selectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); + selectProperty(SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectMerchant().selectOrderNumber().selectVersion(); + } + + public SalesOrderRequest selectChildren(){ + super.selectAny(); + selectOrderItemList(); + return selectId().selectMerchant().selectOrderNumber().selectVersion(); + } + + + public SalesOrderRequest selectId(){ + selectProperty(SalesOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SalesOrderRequest unselectId(){ + unselectProperty(SalesOrder.ID_PROPERTY); + return this; + } + public SalesOrderRequest selectMerchantIdOnly(){ + selectProperty(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest selectMerchant(){ + return selectMerchantWith(Q.merchants().unlimited().selectSelf()); + } + + public SalesOrderRequest selectMerchantWith(MerchantRequest merchant){ + selectProperty(SalesOrder.MERCHANT_PROPERTY); + enhanceRelation(SalesOrder.MERCHANT_PROPERTY, merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, SalesOrder.MERCHANT_PROPERTY)); + return this; + } + + public SalesOrderRequest unselectMerchant(){ + unselectProperty(SalesOrder.MERCHANT_PROPERTY); + return this; + } + public SalesOrderRequest selectOrderNumber(){ + selectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SalesOrderRequest unselectOrderNumber(){ + unselectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest selectVersion(){ + selectProperty(SalesOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SalesOrderRequest unselectVersion(){ + unselectProperty(SalesOrder.VERSION_PROPERTY); + return this; + } + public SalesOrderRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public SalesOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(SalesOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.ID_PROPERTY, operator, values); + } + + public SalesOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SalesOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SalesOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SalesOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SalesOrderRequest filterByMerchant(Merchant... merchant){ + if (merchant == null || merchant.length == 0) { + throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); + } + return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); + } + + public SalesOrderRequest withMerchant(Operator operator, Object... values){ + return appendSearchCriteria(createMerchantCriteria(operator, values)); + } + + public SalesOrderRequest withMerchantIsUnknown(){ + return withMerchant(Operator.IS_NULL); + } + + public SalesOrderRequest withMerchantIsKnown(){ + return withMerchant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.MERCHANT_PROPERTY, operator, values); + } + + public SalesOrderRequest filterByMerchant(Long merchant){ + if(merchant == null){ + return this; + } + return withMerchant(Operator.EQUAL, merchant); + } + public SalesOrderRequest withMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(new SubQuerySearchCriteria(SalesOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); + } + + public SalesOrderRequest withoutMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SalesOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); + } + + public SalesOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public SalesOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public SalesOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public SalesOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public SalesOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public SalesOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public SalesOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public SalesOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public SalesOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public SalesOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public SalesOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public SalesOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public SalesOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public SalesOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public SalesOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public SalesOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public SalesOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SalesOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SalesOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SalesOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.VERSION_PROPERTY, operator, values); + } + + public SalesOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SalesOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SalesOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SalesOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SalesOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SalesOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SalesOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SalesOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SalesOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SalesOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(SalesOrder.ID_PROPERTY, orderItemRequest, OrderItem.SALES_ORDER_PROPERTY)); + } + + public SalesOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SalesOrder.ID_PROPERTY, orderItemRequest, OrderItem.SALES_ORDER_PROPERTY))); + } + + public SalesOrderRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public SalesOrderRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public SalesOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SalesOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SalesOrderRequest groupByMerchantWithDetails(){ + return groupByMerchantWithDetails(Q.merchants().unlimited()); + } + + public SalesOrderRequest groupByMerchantWithDetails(MerchantRequest subRequest){ + aggregate(SalesOrder.MERCHANT_PROPERTY, subRequest); + return this; + } + + + + public SalesOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SalesOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.ID_PROPERTY); + return this; + } + public SalesOrderRequest countDistinctMerchant(){ + return countDistinctMerchantAs("merchant_distinct_count"); + } + + public SalesOrderRequest countDistinctMerchantAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.MERCHANT_PROPERTY); + return this; + } + public SalesOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public SalesOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SalesOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.VERSION_PROPERTY); + return this; + } + public SalesOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(SalesOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public SalesOrderRequest groupById(){ + groupBy(SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest groupByIdAs(String retName){ + groupBy(retName, SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.ID_PROPERTY, function); + return this; + } + public SalesOrderRequest groupByMerchantWith(MerchantRequest subRequest){ + groupBy(SalesOrder.MERCHANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); + return this; + } + public SalesOrderRequest groupByMerchant(){ + groupBy(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest groupByMerchantAs(String retName){ + groupBy(retName, SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest groupByMerchantWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.MERCHANT_PROPERTY, function); + return this; + } + + public SalesOrderRequest groupByOrderNumber(){ + groupBy(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public SalesOrderRequest groupByVersion(){ + groupBy(SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest groupByVersionAs(String retName){ + groupBy(retName, SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.VERSION_PROPERTY, function); + return this; + } + + + + public SalesOrderRequest orderByIdAscending(){ + addOrderByAscending(SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest orderByIdDescending(){ + addOrderByDescending(SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest orderByMerchantAscending(){ + addOrderByAscending(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest orderByMerchantDescending(){ + addOrderByDescending(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest orderByVersionAscending(){ + addOrderByAscending(SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest orderByVersionDescending(){ + addOrderByDescending(SalesOrder.VERSION_PROPERTY); + return this; + } + + + public SalesOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public SalesOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public MerchantRequest rollUpToMerchant(){ + MerchantRequest merchant = Q.merchants().unlimited(); + this.internalRollUpTo("merchant", merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); + return merchant; + } + + + + public SalesOrderRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.SALES_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.SALES_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest minQuantityOfOrderItems(){ + addRelationScalarAggregate("minQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest minQuantityOfOrderItemsAs(String name){ + return minQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest minQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest maxQuantityOfOrderItems(){ + addRelationScalarAggregate("maxQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest maxQuantityOfOrderItemsAs(String name){ + return maxQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest maxQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest sumQuantityOfOrderItems(){ + addRelationScalarAggregate("sumQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest sumQuantityOfOrderItemsAs(String name){ + return sumQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest sumQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest avgQuantityOfOrderItems(){ + addRelationScalarAggregate("avgQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest avgQuantityOfOrderItemsAs(String name){ + return avgQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest avgQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest standardDeviationQuantityOfOrderItems(){ + addRelationScalarAggregate("stdDevQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest standardDeviationQuantityOfOrderItemsAs(String name){ + return standardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest standardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItems(){ + addRelationScalarAggregate("stdDevPopQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest sampleVarianceQuantityOfOrderItems(){ + addRelationScalarAggregate("varSampQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name){ + return sampleVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItems(){ + addRelationScalarAggregate("varPopQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name){ + return samplePopulationVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ + return facetByMerchantAs(facetName, merchant, true); + } + + public SalesOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ + addFacet(facetName, SalesOrder.MERCHANT_PROPERTY, merchant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, SalesOrder.MERCHANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SalesOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SalesOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SalesOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SalesOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SalesOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SalesOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..86905e0e5 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.ordereditreference.EntityMetaRegistry \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/pom.xml b/examples/round-trip-reference-runtime/java-app-console/pom.xml new file mode 100644 index 000000000..6c705a1cf --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/pom.xml @@ -0,0 +1,109 @@ + + + + 4.0.0 + + + io.teaql + teaql-java-parent + 6.3.0 + ../../../pom.xml + + com.teaql + order-edit-reference + 0.0.1-SNAPSHOT + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + junit + junit + test + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.teaql + order-edit-reference-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.teaql.ordereditreference.App + + + + + + + + \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/App.java b/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/App.java new file mode 100644 index 000000000..76476a9db --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/App.java @@ -0,0 +1,99 @@ + +package com.teaql.ordereditreference; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/CustomUserContext.java b/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/CustomUserContext.java new file mode 100644 index 000000000..f3961b811 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.ordereditreference; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements OrderEditReferenceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/WorkspaceTeaQLDatabase.java b/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..a626fe104 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/src/main/java/com/teaql/ordereditreference/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.ordereditreference; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/src/main/resources/application.properties b/examples/round-trip-reference-runtime/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..becf43f98 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:ordereditreference.db diff --git a/examples/round-trip-reference-runtime/java-app-console/src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java b/examples/round-trip-reference-runtime/java-app-console/src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java new file mode 100644 index 000000000..ef5768528 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java @@ -0,0 +1,145 @@ +package com.teaql.ordereditreference; + +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import io.teaql.core.UserContext; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.reference.ReferenceDocumentScope; +import io.teaql.core.reference.RoundTripReferenceErrorCode; +import io.teaql.core.reference.RoundTripReferenceException; +import io.teaql.core.reference.TrustedReferencePrincipal; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.runtime.reference.AeadRoundTripReferenceProvider; +import io.teaql.runtime.reference.DeploymentProfile; +import io.teaql.runtime.reference.RoundTripReferenceKey; +import io.teaql.runtime.reference.StaticRoundTripReferenceKeyProvider; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; + +import java.nio.file.Path; +import java.time.Duration; +import java.util.Arrays; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.junit.Assert.*; + +public class OrderReferenceEditorTest { + private static final String PURPOSE = "edit-order"; + private static final Duration REFERENCE_LIFETIME = Duration.ofMinutes(15); + + private static UserContext editor(TeaQLRuntime runtime, String subject, long merchant) { + return new DefaultUserContext(runtime).withTrustedReferencePrincipal( + new TrustedReferencePrincipal("oidc", subject, "Merchant", merchant)); + } + + private static ReferenceDocumentScope scope(SalesOrder order, String purpose, long orderId) { + return new ReferenceDocumentScope("editor-" + order.getId(), purpose, "SalesOrder", + orderId, order.getVersion()); + } + + private static OrderItem loadLine(UserContext context, long id) { + return Q.orderItems().withIdIs(id).selectSalesOrder().limit(1) + .comment("Read the line by its authenticated ID") + .purpose("Verify current version and order membership before editing") + .executeForOne(context); + } + + private static void amend(UserContext context, SalesOrder order, Object token, int quantity) { + var claims = context.resolveReference(token, scope(order, PURPOSE, order.getId()), "OrderItem"); + var line = loadLine(context, claims.id()); + if (line == null || !order.getId().equals(E.orderItem(line).getSalesOrder().eval().getId())) { + throw new IllegalArgumentException("Line is outside the order being edited"); + } + if (line.getVersion() != claims.version()) { + throw new IllegalStateException("The edit page is stale"); + } + line.updateQuantity(quantity); + line.auditAs("Accept the edited tea quantity").save(context); + } + + @Test + public void authenticatedReferenceResolvesARealOrderLineAndCannotReplayAnEdit() throws Exception { + var file = Path.of(System.getenv("TEAQL_REFERENCE_DATABASE")); + var round = System.getenv("TEAQL_SHOWCASE_ROUND"); + var dataSource = new SQLiteDataSource(); + dataSource.setUrl("jdbc:sqlite:" + file); + var jdbc = new JdbcSqlExecutor(dataSource); + var sqlite = new SqliteDataServiceExecutor("sqlite", jdbc, dataSource); + var generator = new IdSpaceIdGenerator(new WorkspaceTeaQLDatabase(jdbc, dataSource)); + generator.ensureIdSpaceTable(); + var canEdit = new AtomicBoolean(true); + byte[] key = new byte[32]; + Arrays.fill(key, (byte) 0x27); + var codec = AeadRoundTripReferenceProvider.governed(DeploymentProfile.TEST, "order-editor", + "local", new StaticRoundTripReferenceKeyProvider(new RoundTripReferenceKey("fixture", key)), + (context, principal, scope, identity) -> { + if (!canEdit.get() || !"alice".equals(principal.subject()) + || !"Merchant".equals(principal.domainRootType()) + || principal.domainRootId() != 1 || !"SalesOrder".equals(scope.aggregateType()) + || !PURPOSE.equals(scope.purpose()) || !"OrderItem".equals(identity.entityType())) { + throw new RoundTripReferenceException(RoundTripReferenceErrorCode.AUTHORIZATION_REQUIRED, + "The current merchant editor policy denies this reference"); + } + }); + var runtime = TeaQLRuntime.builder() + .metadata(new SimpleEntityMetaFactory()).dataService("default", sqlite).dataService("sqlite", sqlite) + .idGenerationService(generator).roundTripReferenceProvider(codec) + .build().install(GeneratedRuntimeModule.module()); + var context = editor(runtime, "alice", 1); + context.ensureSchema(); + assertTrue(OrderItem.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath() + .endsWith("/java-lib-core/lib/target/classes/")); + var merchant = Q.merchantsWithMinimalFields().withIdIs(1L).limit(1) + .comment("Read the initialized merchant").purpose("Place the order under the trusted merchant") + .executeForOne(context); + assertNotNull(merchant); + String orderNumber = "EDIT-042-" + round; + var order = Q.salesOrders().comment("Prepare the order being edited") + .purpose("Create the merchant's order").newEntity(context); + order.updateMerchant(merchant); + order.updateOrderNumber(orderNumber); + order.auditAs("Open an editable order").save(context); + var line = Q.orderItems().comment("Prepare one tea line") + .purpose("Record a real initial quantity for the edit page").newEntity(context); + line.updateSalesOrder(order); + line.updateSku("TEA-001"); + line.updateQuantity(2); + line.auditAs("Record the initial tea quantity").save(context); + + var stored = loadLine(context, line.getId()); + assertNotNull(stored); + var scope = scope(order, PURPOSE, order.getId()); + String wire = (String) context.referenceFor(stored, scope, REFERENCE_LIFETIME); + assertTrue(wire.startsWith("tqr1.fixture.")); + var claims = context.resolveReference(wire, scope, "OrderItem"); + assertEquals(stored.getId().longValue(), claims.id()); + assertEquals(1L, claims.version()); + + int midpoint = wire.length() / 2; + String tampered = wire.substring(0, midpoint) + (wire.charAt(midpoint) == 'A' ? "B" : "A") + + wire.substring(midpoint + 1); + assertThrows(RoundTripReferenceException.class, () -> context.resolveReference(tampered, scope, "OrderItem")); + assertThrows(RoundTripReferenceException.class, () -> context.resolveReference(wire, scope(order, "view-order", order.getId()), "OrderItem")); + assertThrows(RoundTripReferenceException.class, () -> context.resolveReference(wire, scope(order, PURPOSE, order.getId() + 1), "OrderItem")); + assertThrows(RoundTripReferenceException.class, () -> editor(runtime, "bob", 1).resolveReference(wire, scope, "OrderItem")); + assertThrows(RoundTripReferenceException.class, () -> editor(runtime, "alice", 2).resolveReference(wire, scope, "OrderItem")); + canEdit.set(false); + assertEquals(RoundTripReferenceErrorCode.AUTHORIZATION_REQUIRED, + assertThrows(RoundTripReferenceException.class, () -> amend(context, order, wire, 99)).getCode()); + canEdit.set(true); + amend(context, order, wire, 4); + assertEquals("The edit page is stale", + assertThrows(IllegalStateException.class, () -> amend(context, order, wire, 99)).getMessage()); + var updated = loadLine(context, line.getId()); + assertEquals(Integer.valueOf(4), E.orderItem(updated).getQuantity().eval()); + assertEquals(Long.valueOf(2), updated.getVersion()); + assertEquals("TEA-001", E.orderItem(updated).getSku().eval()); + assertEquals(order.getId(), E.orderItem(updated).getSalesOrder().eval().getId()); + System.out.printf("ORDER_REFERENCE round=%s order_id=%d line_id=%d order_number=%s quantity=4 version=2 rejections=7%n", + round, order.getId(), line.getId(), orderNumber); + } +} diff --git a/examples/round-trip-reference-runtime/java-app-console/teaql-i18n.json b/examples/round-trip-reference-runtime/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..20c589ad0 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/teaql-i18n.json @@ -0,0 +1,111 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.salesOrder.merchant": "Merchant", + "property.orderItem.id": "Id", + "entity.orderItem": "Order Item", + "property.orderItem.sku": "Sku", + "entity.merchant": "Merchant", + "property.salesOrder.version": "Version", + "property.merchant.name": "Name", + "property.orderItem.salesOrder": "Sales Order", + "property.merchant.version": "Version", + "property.salesOrder.id": "Id", + "property.orderItem.version": "Version", + "property.salesOrder.orderNumber": "Order Number", + "property.merchant.id": "Id", + "property.orderItem.quantity": "Quantity", + "entity.salesOrder": "Sales Order" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/teaql/checker-model.json b/examples/round-trip-reference-runtime/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..935576973 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:c2dacaf8377a726fc38a9cf13920679bb314d4127c7cc9c550dc98d516508240","entities":{"Merchant":{"labels":{"en":"merchant"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"sales_order_list","targetType":"SalesOrder","labels":{"en":"sales order"},"aliases":["SalesOrderList","salesOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderItem":{"labels":{"en":"order item"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"quantity","labels":{"en":"quantity"},"aliases":["Quantity"]},{"name":"sales_order","targetType":"SalesOrder","labels":{"en":"sales order"},"aliases":["SalesOrder","salesOrder"]},{"name":"sku","labels":{"en":"sku"},"aliases":["Sku"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SalesOrder":{"labels":{"en":"sales order"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"merchant","targetType":"Merchant","labels":{"en":"merchant"},"aliases":["Merchant"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"order item"},"aliases":["OrderItemList","orderItemList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/teaql/model-provenance.json b/examples/round-trip-reference-runtime/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..d60a86fb8 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:83d0c3f4b8d0ed41289c81816c5f824fbda61fbeeaf1883a412e386829ecc1c8","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/pom.xml b/examples/round-trip-reference-runtime/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..80a859414 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.teaql + order-edit-reference-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Checkers.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Constants.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Constants.java new file mode 100644 index 000000000..68ecabba0 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.ordereditreference; + +import com.teaql.ordereditreference.merchant.Merchant; + +public interface Constants { + public static final long MERCHANT_ID = 1l; + public static final Merchant MERCHANT = Merchant.refer(MERCHANT_ID); +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/E.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/E.java new file mode 100644 index 000000000..42215a2bf --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/E.java @@ -0,0 +1,23 @@ + +package com.teaql.ordereditreference; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantExpression; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemExpression; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static MerchantExpression merchant(Merchant merchant){ + return new MerchantExpression(new ValueExpression(merchant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.merchant()")); + } + public static SalesOrderExpression salesOrder(SalesOrder salesOrder){ + return new SalesOrderExpression(new ValueExpression(salesOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.salesOrder()")); + } + public static OrderItemExpression orderItem(OrderItem orderItem){ + return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java new file mode 100644 index 000000000..0bbe6ea3e --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java @@ -0,0 +1,405 @@ + +package com.teaql.ordereditreference; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerMerchant(); + registerSalesOrder(); + registerOrderItem(); + } + private void registerMerchant() { + FieldLayout.installGenerated(com.teaql.ordereditreference.merchant.Merchant.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordereditreference.merchant.Merchant.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordereditreference.merchant.Merchant.class); + entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.merchant.Merchant::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Northwind Retail") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSalesOrder() { + FieldLayout.installGenerated(com.teaql.ordereditreference.salesorder.SalesOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordereditreference.salesorder.SalesOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordereditreference.salesorder.SalesOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.salesorder.SalesOrder::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor merchant = + entityDescriptor.addObjectProperty($factory, com.teaql.ordereditreference.salesorder.SalesOrder.MERCHANT_PROPERTY, com.teaql.ordereditreference.merchant.Merchant.INTERNAL_TYPE, com.teaql.ordereditreference.merchant.Merchant.SALES_ORDER_LIST_PROPERTY, com.teaql.ordereditreference.merchant.Merchant.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.MERCHANT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerOrderItem() { + FieldLayout.installGenerated(com.teaql.ordereditreference.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.ordereditreference.orderitem.OrderItem.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.ordereditreference.orderitem.OrderItem.class); + entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.orderitem.OrderItem::new); + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY, Long.class) + ; + PropertyDescriptor salesOrder = + entityDescriptor.addObjectProperty($factory, com.teaql.ordereditreference.orderitem.OrderItem.SALES_ORDER_PROPERTY, com.teaql.ordereditreference.salesorder.SalesOrder.INTERNAL_TYPE, com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.ordereditreference.salesorder.SalesOrder.class) + ; + PropertyDescriptor sku = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY, String.class) + ; + PropertyDescriptor quantity = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY, Integer.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SALES_ORDER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY).with("isPassword", "false") + + .with("db2_sqlType", "decimal(19,7)") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(19,7)") + + .with("javaType", "java.lang.Integer") + + .with("sqlType", "INTEGER") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "true") + + .with("isInt", "true") + + .with("isString", "false") + + .with("isDate", "false") + + .with("graphqlType", "Int") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java new file mode 100644 index 000000000..663fa2609 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.ordereditreference; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.ordereditreference.merchant.MerchantChecker(), new com.teaql.ordereditreference.salesorder.SalesOrderChecker(), new com.teaql.ordereditreference.orderitem.OrderItemChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:c2dacaf8377a726fc38a9cf13920679bb314d4127c7cc9c550dc98d516508240\",\"entities\":{\"Merchant\":{\"labels\":{\"en\":\"merchant\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"sales_order_list\",\"targetType\":\"SalesOrder\",\"labels\":{\"en\":\"sales order\"},\"aliases\":[\"SalesOrderList\",\"salesOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"order item\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"sales_order\",\"targetType\":\"SalesOrder\",\"labels\":{\"en\":\"sales order\"},\"aliases\":[\"SalesOrder\",\"salesOrder\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SalesOrder\":{\"labels\":{\"en\":\"sales order\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Merchant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SalesOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("sales_order", "salesOrder"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.merchants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.ordereditreference.merchant.Merchant domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.ordereditreference.merchant.Merchant(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Northwind Retail"); + domainRoot.auditAs("create generated Domain Root Merchant").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Merchant", domainRoot.getId())); + } +} diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java new file mode 100644 index 000000000..38a8d79c3 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.ordereditreference; + +import io.teaql.core.UserContext; +public interface OrderEditReferenceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Q.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Q.java new file mode 100644 index 000000000..49d46f241 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.ordereditreference; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.ordereditreference.merchant.MerchantRequest merchants(){ + return new com.teaql.ordereditreference.merchant.MerchantRequest(com.teaql.ordereditreference.merchant.Merchant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordereditreference.merchant.MerchantRequest merchantsWithMinimalFields(){ + return new com.teaql.ordereditreference.merchant.MerchantRequest(com.teaql.ordereditreference.merchant.Merchant.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordereditreference.salesorder.SalesOrderRequest salesOrders(){ + return new com.teaql.ordereditreference.salesorder.SalesOrderRequest(com.teaql.ordereditreference.salesorder.SalesOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordereditreference.salesorder.SalesOrderRequest salesOrdersWithMinimalFields(){ + return new com.teaql.ordereditreference.salesorder.SalesOrderRequest(com.teaql.ordereditreference.salesorder.SalesOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.ordereditreference.orderitem.OrderItemRequest orderItems(){ + return new com.teaql.ordereditreference.orderitem.OrderItemRequest(com.teaql.ordereditreference.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.ordereditreference.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ + return new com.teaql.ordereditreference.orderitem.OrderItemRequest(com.teaql.ordereditreference.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Repositories.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java new file mode 100644 index 000000000..ed385f8aa --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java @@ -0,0 +1,130 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Merchant extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Merchant"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5f39ea5c4412183f01dd053549e36ebdc775b789c2346cb2b800a9f80d8cdb5a"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "sales_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Merchant.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SALES_ORDER_LIST_PROPERTY = "sales_order_list"; + private String name; + + private SmartList salesOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getSalesOrderList(){ + return this.salesOrderList == null ? SmartList.unloaded() : this.salesOrderList; + } + public Merchant updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Merchant addSalesOrder(SalesOrder salesOrder){ + if (salesOrder == null){ + return this; + } + + if(null == this.salesOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.salesOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.salesOrderList.add(salesOrder); + salesOrder.updateMerchant(this); + return this; + } + + public static Merchant refer(Long id){ + Merchant refer = new Merchant(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Merchant comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "sales_order_list": this.salesOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "sales_order_list": return this.salesOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java new file mode 100644 index 000000000..4594a518b --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class MerchantChecker implements Checker{ + + public String type(){ + return Merchant.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if(needCheck(_context, merchant)){ + markAsChecked(_context, merchant); + doCheck(_context, merchant, _parentLocation); + } + } + + public void doCheck(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if((merchant == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, merchant); + if(merchant.needPersist()){ + } + if(merchant.newItem()){ + }else if(merchant.updateItem()){ + if(!merchant.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, merchant.getProperty(Merchant.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; merchant.getSalesOrderList() != null && i < merchant.getSalesOrderList().size(); i++){ + SalesOrder salesOrder = merchant.getSalesOrderList().get(i); + new SalesOrderChecker().checkAndFix(_context, salesOrder, newLocation(_parentLocation, "sales_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java new file mode 100644 index 000000000..adc417be6 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class MerchantExpression extends ExpressionAdaptor implements BaseEntityExpression { + public MerchantExpression(Expression expression){ + super(expression); + } + + public MerchantExpression(Expression expression, Function function){ + super(expression, function); + } + + public MerchantExpression updateId(Long id){ + return new MerchantExpression(this, $it -> {((Merchant)$it).__internalSet("id", id); return this;}); + } + + public MerchantExpression save(UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs("Saved by Expression").save(userContext)); + } + + public MerchantExpression save(String intent, UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Merchant::getName); + } + public MerchantExpression updateName(String name){ + return new MerchantExpression(this, $it -> ((Merchant)$it).updateName(name)); + } + + public SalesOrderListExpression getSalesOrderList(){ + return new SalesOrderListExpression(loaded("sales_order_list", "getSalesOrderList", Merchant::getSalesOrderList)); + } + public MerchantExpression addSalesOrder(SalesOrder salesOrder){ + return new MerchantExpression(this, $it -> ((Merchant)$it).addSalesOrder(salesOrder)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java new file mode 100644 index 000000000..256390530 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordereditreference.merchant; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class MerchantListExpression extends SmartListExpression { + public MerchantListExpression(Expression> expression){ + super(expression); + } + + public MerchantListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public MerchantExpression first() { + return new MerchantExpression(super.first()); + } + + public MerchantExpression get(int index) { + return new MerchantExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java new file mode 100644 index 000000000..96d82292c --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.ordereditreference.merchant; + +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class MerchantRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public MerchantRequest(Class returnType){ + this(returnType, () -> (T) new Merchant()); + } + + protected MerchantRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public MerchantRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public MerchantRequest copy(){ + return (MerchantRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new MerchantRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public MerchantRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public MerchantRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public MerchantRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public MerchantRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public MerchantRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public MerchantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public MerchantRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public MerchantRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (MerchantRequest)super.appendSearchCriteria(searchCriteria); + } + + public MerchantRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public MerchantRequest matchingAnyOf(MerchantRequest merchant){ + super.internalMatchAny(merchant); + return this; + } + + public MerchantRequest matchingIdsOf(MerchantRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Merchant.ID_PROPERTY, request, Merchant.ID_PROPERTY)); + } + + public MerchantRequest enhanceChildrenIfNeeded(){ + return this; + } + + public MerchantRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public MerchantRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public MerchantRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectSelfFields(){ + return selectSelf(); + } + + public MerchantRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Merchant.ID_PROPERTY); + selectProperty(Merchant.NAME_PROPERTY); + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectChildren(){ + super.selectAny(); + selectSalesOrderList(); + return selectId().selectName().selectVersion(); + } + + + public MerchantRequest selectId(){ + selectProperty(Merchant.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectId(){ + unselectProperty(Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest selectName(){ + selectProperty(Merchant.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectName(){ + unselectProperty(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest selectVersion(){ + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectVersion(){ + unselectProperty(Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest selectSalesOrderList(){ + return selectSalesOrderListWith(Q.salesOrders().selectSelf()); + } + + public MerchantRequest selectSalesOrderListWith(SalesOrderRequest salesOrderList){ + enhanceRelation(Merchant.SALES_ORDER_LIST_PROPERTY, salesOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSalesOrderListWith", null, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.ID_PROPERTY, operator, values); + } + + public MerchantRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public MerchantRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public MerchantRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public MerchantRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public MerchantRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public MerchantRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public MerchantRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public MerchantRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.NAME_PROPERTY, operator, values); + } + + public MerchantRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public MerchantRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public MerchantRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public MerchantRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public MerchantRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public MerchantRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public MerchantRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public MerchantRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public MerchantRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public MerchantRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public MerchantRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public MerchantRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public MerchantRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public MerchantRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public MerchantRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public MerchantRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public MerchantRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public MerchantRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.VERSION_PROPERTY, operator, values); + } + + public MerchantRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public MerchantRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public MerchantRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public MerchantRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public MerchantRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public MerchantRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public MerchantRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public MerchantRequest withSalesOrderListMatching(SalesOrderRequest salesOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, salesOrderRequest, SalesOrder.MERCHANT_PROPERTY)); + } + + public MerchantRequest withoutSalesOrderListMatching(SalesOrderRequest salesOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, salesOrderRequest, SalesOrder.MERCHANT_PROPERTY))); + } + + public MerchantRequest haveSalesOrders(){ + return withSalesOrderListMatching(Q.salesOrders().unlimited()); + } + + public MerchantRequest haveNoSalesOrders(){ + return withoutSalesOrderListMatching(Q.salesOrders().unlimited()); + } + + public MerchantRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public MerchantRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public MerchantRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public MerchantRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public MerchantRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public MerchantRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest groupBySalesOrdersWithDetails(SalesOrderRequest subRequest){ + aggregate(Merchant.SALES_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public MerchantRequest groupById(){ + groupBy(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdAs(String retName){ + groupBy(retName, Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.ID_PROPERTY, function); + return this; + } + + public MerchantRequest groupByName(){ + groupBy(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameAs(String retName){ + groupBy(retName, Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.NAME_PROPERTY, function); + return this; + } + + public MerchantRequest groupByVersion(){ + groupBy(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionAs(String retName){ + groupBy(retName, Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.VERSION_PROPERTY, function); + return this; + } + + + + public MerchantRequest orderByIdAscending(){ + addOrderByAscending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByIdDescending(){ + addOrderByDescending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByNameAscending(){ + addOrderByAscending(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescending(){ + addOrderByDescending(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByVersionAscending(){ + addOrderByAscending(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest orderByVersionDescending(){ + addOrderByDescending(Merchant.VERSION_PROPERTY); + return this; + } + + + public MerchantRequest statsFromSalesOrdersAs(String name, SalesOrderRequest subRequest){ + return statsFromSalesOrdersAs(name, subRequest, false); + } + + public MerchantRequest statsFromSalesOrdersAs(String name, SalesOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SalesOrder.MERCHANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSalesOrdersAs", name, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest statsFromSalesOrders(SalesOrderRequest subRequest){ + return statsFromSalesOrdersAs(REFINEMENTS, subRequest); + } + public MerchantRequest countSalesOrders(){ + addRelationCount("Count", Q.salesOrders().unlimited(), SalesOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrders", null, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countSalesOrdersAs(String name){ + addRelationCount(name, Q.salesOrders().unlimited(), SalesOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrdersAs", name, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countSalesOrdersWith(String name, SalesOrderRequest subRequest){ + addRelationCount(name, subRequest, SalesOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrdersWith", name, Merchant.SALES_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public MerchantRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public MerchantRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public MerchantRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public MerchantRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public MerchantRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public MerchantRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java new file mode 100644 index 000000000..25e0728e2 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java @@ -0,0 +1,148 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class OrderItem extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "OrderItem"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d70859137f59ca1b9c6e9daa84dde3e7300bdbbb95ca56c147662302a8a6aba"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("sales_order", 1), java.util.Map.entry("sku", 2), java.util.Map.entry("quantity", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("sales_order", java.util.List.of("salesOrder", "sales_order")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String SALES_ORDER_PROPERTY = "sales_order"; + public static final String SKU_PROPERTY = "sku"; + public static final String QUANTITY_PROPERTY = "quantity"; + private SalesOrder salesOrder; + + private String sku; + + private Integer quantity; + + + public SalesOrder getSalesOrder(){ + return this.salesOrder; + } + + public String getSku(){ + return this.sku; + } + + public Integer getQuantity(){ + return this.quantity; + } + + public OrderItem updateSalesOrder(SalesOrder salesOrder){ + if(isPropertyLoaded(SALES_ORDER_PROPERTY) && Objects.equals(this.salesOrder, salesOrder)){ + return this; + } + handleUpdate(SALES_ORDER_PROPERTY, getSalesOrder(), salesOrder); + this.salesOrder = salesOrder; + return this; + } + + public OrderItem updateSku(String sku){ + sku = (sku == null ? null : sku.trim()); + if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ + return this; + } + handleUpdate(SKU_PROPERTY, getSku(), sku); + this.sku = sku; + return this; + } + + public OrderItem updateQuantity(Integer quantity){ + if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ + return this; + } + handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); + this.quantity = quantity; + return this; + } + + + public static OrderItem refer(Long id){ + OrderItem refer = new OrderItem(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public OrderItem comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "sales_order": this.salesOrder = (SalesOrder) value; break; + + case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; + + case "quantity": this.quantity = (Integer) value; break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "sales_order": return this.salesOrder; + case "sku": return this.sku; + case "quantity": return this.quantity; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "salesOrder": return this.salesOrder; + case "sku": return this.sku; + case "quantity": return this.quantity; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java new file mode 100644 index 000000000..a13d78b0a --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java @@ -0,0 +1,69 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class OrderItemChecker implements Checker{ + + public String type(){ + return OrderItem.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if(needCheck(_context, orderItem)){ + markAsChecked(_context, orderItem); + doCheck(_context, orderItem, _parentLocation); + } + } + + public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ + if((orderItem == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, orderItem); + if(orderItem.needPersist()){ + } + if(orderItem.newItem()){ + }else if(orderItem.updateItem()){ + if(!orderItem.isPropertyLoaded("sales_order")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sales_order"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("sku")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); + } + if(!orderItem.isPropertyLoaded("quantity")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); + } + + } + checkSalesOrder(_context, orderItem.getProperty(OrderItem.SALES_ORDER_PROPERTY), newLocation(_parentLocation, "sales_order")); + checkSku(_context, orderItem.getProperty(OrderItem.SKU_PROPERTY), newLocation(_parentLocation, "sku")); + checkQuantity(_context, orderItem.getProperty(OrderItem.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); + } + + public void checkSalesOrder(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, salesOrder); + if((salesOrder == null)){ + return; + } + new SalesOrderChecker().checkAndFix(_context, salesOrder, _parentLocation); + } + public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, sku); + if((sku == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, sku); + + } + public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, quantity); + if((quantity == null)){ + return; + } + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java new file mode 100644 index 000000000..d7a5a442e --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java @@ -0,0 +1,60 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { + public OrderItemExpression(Expression expression){ + super(expression); + } + + public OrderItemExpression(Expression expression, Function function){ + super(expression, function); + } + + public OrderItemExpression updateId(Long id){ + return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); + } + + public OrderItemExpression save(UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); + } + + public OrderItemExpression save(String intent, UserContext userContext){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public SalesOrderExpression getSalesOrder(){ + return new SalesOrderExpression(loaded("sales_order", "getSalesOrder", OrderItem::getSalesOrder)); + } + + public OrderItemExpression updateSalesOrder(SalesOrder salesOrder){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateSalesOrder(salesOrder)); + } + + public Expression getSku(){ + return loaded("sku", "getSku", OrderItem::getSku); + } + public OrderItemExpression updateSku(String sku){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateSku(sku)); + } + + public Expression getQuantity(){ + return loaded("quantity", "getQuantity", OrderItem::getQuantity); + } + public OrderItemExpression updateQuantity(Integer quantity){ + return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateQuantity(quantity)); + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java new file mode 100644 index 000000000..db1c0ce5c --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordereditreference.orderitem; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class OrderItemListExpression extends SmartListExpression { + public OrderItemListExpression(Expression> expression){ + super(expression); + } + + public OrderItemListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public OrderItemExpression first() { + return new OrderItemExpression(super.first()); + } + + public OrderItemExpression get(int index) { + return new OrderItemExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java new file mode 100644 index 000000000..3e6e862be --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java @@ -0,0 +1,874 @@ + +package com.teaql.ordereditreference.orderitem; + +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.salesorder.SalesOrder; +import com.teaql.ordereditreference.salesorder.SalesOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class OrderItemRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public OrderItemRequest(Class returnType){ + this(returnType, () -> (T) new OrderItem()); + } + + protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public OrderItemRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public OrderItemRequest copy(){ + return (OrderItemRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public OrderItemRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public OrderItemRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public OrderItemRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public OrderItemRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public OrderItemRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); + } + + public OrderItemRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ + super.internalMatchAny(orderItem); + return this; + } + + public OrderItemRequest matchingIdsOf(OrderItemRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); + } + + public OrderItemRequest enhanceChildrenIfNeeded(){ + return this; + } + + public OrderItemRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public OrderItemRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public OrderItemRequest selectSelf(){ + super.selectSelf(); + return selectId().selectSalesOrderIdOnly().selectSku().selectQuantity().selectVersion(); + } + + public OrderItemRequest selectSelfFields(){ + return selectSelf(); + } + + public OrderItemRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(OrderItem.ID_PROPERTY); + selectProperty(OrderItem.SALES_ORDER_PROPERTY); + selectProperty(OrderItem.SKU_PROPERTY); + selectProperty(OrderItem.QUANTITY_PROPERTY); + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest selectAll(){ + super.selectAll(); + return selectId().selectSalesOrder().selectSku().selectQuantity().selectVersion(); + } + + public OrderItemRequest selectChildren(){ + super.selectAny(); + return selectId().selectSalesOrder().selectSku().selectQuantity().selectVersion(); + } + + + public OrderItemRequest selectId(){ + selectProperty(OrderItem.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectId(){ + unselectProperty(OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest selectSalesOrderIdOnly(){ + selectProperty(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest selectSalesOrder(){ + return selectSalesOrderWith(Q.salesOrders().unlimited().selectSelf()); + } + + public OrderItemRequest selectSalesOrderWith(SalesOrderRequest salesOrder){ + selectProperty(OrderItem.SALES_ORDER_PROPERTY); + enhanceRelation(OrderItem.SALES_ORDER_PROPERTY, salesOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSalesOrderWith", null, OrderItem.SALES_ORDER_PROPERTY)); + return this; + } + + public OrderItemRequest unselectSalesOrder(){ + unselectProperty(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + public OrderItemRequest selectSku(){ + selectProperty(OrderItem.SKU_PROPERTY); + return this; + } + + /** + * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectSku(){ + unselectProperty(OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest selectQuantity(){ + selectProperty(OrderItem.QUANTITY_PROPERTY); + return this; + } + + /** + * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + /** + * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. + * @param aggrFunction aggrFunction + */ + public OrderItemRequest selectQuantity(AggrFunction aggrFunction){ + selectProperty(OrderItem.QUANTITY_PROPERTY, aggrFunction); + return this; + } + + + public OrderItemRequest unselectQuantity(){ + unselectProperty(OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest selectVersion(){ + selectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public OrderItemRequest unselectVersion(){ + unselectProperty(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); + } + + public OrderItemRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public OrderItemRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public OrderItemRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public OrderItemRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public OrderItemRequest filterBySalesOrder(SalesOrder... salesOrder){ + if (salesOrder == null || salesOrder.length == 0) { + throw new IllegalArgumentException("filterBySalesOrder parameter salesOrder cannot be empty"); + } + return appendSearchCriteria(createSalesOrderCriteria(Operator.EQUAL, (Object[])salesOrder)); + } + + public OrderItemRequest withSalesOrder(Operator operator, Object... values){ + return appendSearchCriteria(createSalesOrderCriteria(operator, values)); + } + + public OrderItemRequest withSalesOrderIsUnknown(){ + return withSalesOrder(Operator.IS_NULL); + } + + public OrderItemRequest withSalesOrderIsKnown(){ + return withSalesOrder(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSalesOrderCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.SALES_ORDER_PROPERTY, operator, values); + } + + public OrderItemRequest filterBySalesOrder(Long salesOrder){ + if(salesOrder == null){ + return this; + } + return withSalesOrder(Operator.EQUAL, salesOrder); + } + public OrderItemRequest withSalesOrderMatching(SalesOrderRequest salesOrder){ + return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.SALES_ORDER_PROPERTY, salesOrder, SalesOrder.ID_PROPERTY)); + } + + public OrderItemRequest withoutSalesOrderMatching(SalesOrderRequest salesOrder){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(OrderItem.SALES_ORDER_PROPERTY, salesOrder, SalesOrder.ID_PROPERTY))); + } + + public OrderItemRequest filterBySku(String... sku){ + if (sku == null || sku.length == 0) { + throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); + } + return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); + } + + public OrderItemRequest withSku(Operator operator, Object... values){ + return appendSearchCriteria(createSkuCriteria(operator, values)); + } + + public OrderItemRequest withSkuIsUnknown(){ + return withSku(Operator.IS_NULL); + } + + public OrderItemRequest withSkuIsKnown(){ + return withSku(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSkuCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.SKU_PROPERTY, operator, values); + } + + public OrderItemRequest withSkuIsNot(String sku){ + return withSku(Operator.NOT_EQUAL, sku); + } + + public OrderItemRequest withSkuIn(String... sku){ + return withSku(Operator.IN, (Object[])sku); + } + + public OrderItemRequest withSkuNotIn(String... sku){ + return withSku(Operator.NOT_IN, (Object[])sku); + } + public OrderItemRequest withSkuGreaterThan(String sku){ + return withSku(Operator.GREATER_THAN, sku); + } + + public OrderItemRequest withSkuGreaterThanOrEqualTo(String sku){ + return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); + } + + public OrderItemRequest withSkuLessThan(String sku){ + return withSku(Operator.LESS_THAN, sku); + } + + public OrderItemRequest withSkuLessThanOrEqualTo(String sku){ + return withSku(Operator.LESS_THAN_OR_EQUAL, sku); + } + + public OrderItemRequest withSkuBetween(String startOfSku, String endOfSku){ + return withSku(Operator.BETWEEN, startOfSku, endOfSku); + } + public OrderItemRequest withSkuStartingWith(String sku){ + return withSku(Operator.BEGIN_WITH, sku); + } + public OrderItemRequest withSkuContaining(String sku){ + return withSku(Operator.CONTAIN, sku); + } + + public OrderItemRequest withSkuNotContaining(String sku){ + return withSku(Operator.NOT_CONTAIN, sku); + } + + public OrderItemRequest withSkuNotStartingWith(String sku){ + return withSku(Operator.NOT_BEGIN_WITH, sku); + } + + public OrderItemRequest withSkuEndingWith(String sku){ + return withSku(Operator.END_WITH, sku); + } + + public OrderItemRequest withSkuNotEndingWith(String sku){ + return withSku(Operator.NOT_END_WITH, sku); + } + + public OrderItemRequest withSkuIs(String sku){ + return withSku(Operator.EQUAL, sku); + } + + public OrderItemRequest withSkuSoundingLike(String sku){ + return withSku(Operator.SOUNDS_LIKE, sku); + } + + + + public OrderItemRequest filterByQuantity(Integer... quantity){ + if (quantity == null || quantity.length == 0) { + throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); + } + return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); + } + + public OrderItemRequest withQuantity(Operator operator, Object... values){ + return appendSearchCriteria(createQuantityCriteria(operator, values)); + } + + public OrderItemRequest withQuantityIsUnknown(){ + return withQuantity(Operator.IS_NULL); + } + + public OrderItemRequest withQuantityIsKnown(){ + return withQuantity(Operator.IS_NOT_NULL); + } + + public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.QUANTITY_PROPERTY, operator, values); + } + + public OrderItemRequest withQuantityIs(Integer quantity){ + return withQuantity(Operator.EQUAL, quantity); + } + + public OrderItemRequest withQuantityIsNot(Integer quantity){ + return withQuantity(Operator.NOT_EQUAL, quantity); + } + + public OrderItemRequest withQuantityIn(Integer... quantity){ + return withQuantity(Operator.IN, (Object[])quantity); + } + + public OrderItemRequest withQuantityNotIn(Integer... quantity){ + return withQuantity(Operator.NOT_IN, (Object[])quantity); + } + public OrderItemRequest withQuantityGreaterThan(Integer quantity){ + return withQuantity(Operator.GREATER_THAN, quantity); + } + + public OrderItemRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); + } + + public OrderItemRequest withQuantityLessThan(Integer quantity){ + return withQuantity(Operator.LESS_THAN, quantity); + } + + public OrderItemRequest withQuantityLessThanOrEqualTo(Integer quantity){ + return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); + } + + public OrderItemRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ + return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); + } + + + + public OrderItemRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public OrderItemRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public OrderItemRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public OrderItemRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); + } + + public OrderItemRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public OrderItemRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public OrderItemRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public OrderItemRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public OrderItemRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public OrderItemRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public OrderItemRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public OrderItemRequest minQuantity(){ + return minQuantityAs(prefix("minOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest minQuantityAs(String retName){ + super.min(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest maxQuantity(){ + return maxQuantityAs(prefix("maxOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest maxQuantityAs(String retName){ + super.max(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest sumQuantity(){ + return sumQuantityAs(prefix("sumOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest sumQuantityAs(String retName){ + super.sum(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest avgQuantity(){ + return avgQuantityAs(prefix("avgOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest avgQuantityAs(String retName){ + super.avg(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest standardDeviationQuantity(){ + return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest standardDeviationQuantityAs(String retName){ + super.standardDeviation(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest squareRootOfPopulationStandardDeviationQuantity(){ + return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ + super.squareRootOfPopulationStandardDeviation(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest sampleVarianceQuantity(){ + return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest sampleVarianceQuantityAs(String retName){ + super.sampleVariance(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest samplePopulationVarianceQuantity(){ + return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderItem.QUANTITY_PROPERTY)); + } + + public OrderItemRequest samplePopulationVarianceQuantityAs(String retName){ + super.samplePopulationVariance(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest groupBySalesOrderWithDetails(){ + return groupBySalesOrderWithDetails(Q.salesOrders().unlimited()); + } + + public OrderItemRequest groupBySalesOrderWithDetails(SalesOrderRequest subRequest){ + aggregate(OrderItem.SALES_ORDER_PROPERTY, subRequest); + return this; + } + + + + + public OrderItemRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public OrderItemRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); + return this; + } + public OrderItemRequest countDistinctSalesOrder(){ + return countDistinctSalesOrderAs("sales_order_distinct_count"); + } + + public OrderItemRequest countDistinctSalesOrderAs(String alias){ + super.countDistinctProperty(alias, OrderItem.SALES_ORDER_PROPERTY); + return this; + } + public OrderItemRequest countDistinctSku(){ + return countDistinctSkuAs("sku_distinct_count"); + } + + public OrderItemRequest countDistinctSkuAs(String alias){ + super.countDistinctProperty(alias, OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest countDistinctQuantity(){ + return countDistinctQuantityAs("quantity_distinct_count"); + } + + public OrderItemRequest countDistinctQuantityAs(String alias){ + super.countDistinctProperty(alias, OrderItem.QUANTITY_PROPERTY); + return this; + } + public OrderItemRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public OrderItemRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupById(){ + groupBy(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdAs(String retName){ + groupBy(retName, OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.ID_PROPERTY, function); + return this; + } + public OrderItemRequest groupBySalesOrderWith(SalesOrderRequest subRequest){ + groupBy(OrderItem.SALES_ORDER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySalesOrderWith", null, "sales_order")); + return this; + } + public OrderItemRequest groupBySalesOrder(){ + groupBy(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupBySalesOrderAs(String retName){ + groupBy(retName, OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest groupBySalesOrderWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.SALES_ORDER_PROPERTY, function); + return this; + } + + public OrderItemRequest groupBySku(){ + groupBy(OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest groupBySkuAs(String retName){ + groupBy(retName, OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest groupBySkuWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.SKU_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByQuantity(){ + groupBy(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest groupByQuantityAs(String retName){ + groupBy(retName, OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest groupByQuantityWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.QUANTITY_PROPERTY, function); + return this; + } + + public OrderItemRequest groupByVersion(){ + groupBy(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionAs(String retName){ + groupBy(retName, OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, OrderItem.VERSION_PROPERTY, function); + return this; + } + + + + public OrderItemRequest orderByIdAscending(){ + addOrderByAscending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderByIdDescending(){ + addOrderByDescending(OrderItem.ID_PROPERTY); + return this; + } + + public OrderItemRequest orderBySalesOrderAscending(){ + addOrderByAscending(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderBySalesOrderDescending(){ + addOrderByDescending(OrderItem.SALES_ORDER_PROPERTY); + return this; + } + + public OrderItemRequest orderBySkuAscending(){ + addOrderByAscending(OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest orderBySkuDescending(){ + addOrderByDescending(OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest orderBySkuAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(OrderItem.SKU_PROPERTY); + return this; + } + + public OrderItemRequest orderBySkuDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(OrderItem.SKU_PROPERTY); + return this; + } + public OrderItemRequest orderByQuantityAscending(){ + addOrderByAscending(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest orderByQuantityDescending(){ + addOrderByDescending(OrderItem.QUANTITY_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionAscending(){ + addOrderByAscending(OrderItem.VERSION_PROPERTY); + return this; + } + + public OrderItemRequest orderByVersionDescending(){ + addOrderByDescending(OrderItem.VERSION_PROPERTY); + return this; + } + + + public SalesOrderRequest rollUpToSalesOrder(){ + SalesOrderRequest salesOrder = Q.salesOrders().unlimited(); + this.internalRollUpTo("sales_order", salesOrder, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSalesOrder", null, "sales_order")); + return salesOrder; + } + + + + + + public OrderItemRequest facetBySalesOrderAs(String facetName, SalesOrderRequest salesOrder){ + return facetBySalesOrderAs(facetName, salesOrder, true); + } + + public OrderItemRequest facetBySalesOrderAs(String facetName, SalesOrderRequest salesOrder, boolean includeAllFacets){ + addFacet(facetName, OrderItem.SALES_ORDER_PROPERTY, salesOrder, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySalesOrderAs", facetName, OrderItem.SALES_ORDER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public OrderItemRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public OrderItemRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public OrderItemRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public OrderItemRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public OrderItemRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public OrderItemRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java new file mode 100644 index 000000000..919b8f4c7 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java @@ -0,0 +1,151 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.orderitem.OrderItem; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SalesOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SalesOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c887e95abcd3078f0518b67a359e764511c1e109c190cfab61732bd002847815"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("order_number", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "order_item_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SalesOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String MERCHANT_PROPERTY = "merchant"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; + private Merchant merchant; + + private String orderNumber; + + private SmartList orderItemList; + + public Merchant getMerchant(){ + return this.merchant; + } + + public String getOrderNumber(){ + return this.orderNumber; + } + + public SmartList getOrderItemList(){ + return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; + } + public SalesOrder updateMerchant(Merchant merchant){ + if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ + return this; + } + handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); + this.merchant = merchant; + return this; + } + + public SalesOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public SalesOrder addOrderItem(OrderItem orderItem){ + if (orderItem == null){ + return this; + } + + if(null == this.orderItemList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.orderItemList = teaqlUnloadedItems.map(value -> value); + } + + this.orderItemList.add(orderItem); + orderItem.updateSalesOrder(this); + return this; + } + + public static SalesOrder refer(Long id){ + SalesOrder refer = new SalesOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SalesOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "merchant": this.merchant = (Merchant) value; break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "order_item_list": this.orderItemList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "merchant": return this.merchant; + case "order_number": return this.orderNumber; + case "order_item_list": return this.orderItemList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "merchant": return this.merchant; + case "orderNumber": return this.orderNumber; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java new file mode 100644 index 000000000..07cedc666 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantChecker; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SalesOrderChecker implements Checker{ + + public String type(){ + return SalesOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, salesOrder)){ + markAsChecked(_context, salesOrder); + doCheck(_context, salesOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ + if((salesOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, salesOrder); + if(salesOrder.needPersist()){ + } + if(salesOrder.newItem()){ + }else if(salesOrder.updateItem()){ + if(!salesOrder.isPropertyLoaded("merchant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); + } + if(!salesOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + + } + checkMerchant(_context, salesOrder.getProperty(SalesOrder.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); + checkOrderNumber(_context, salesOrder.getProperty(SalesOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + for(int i = 0; salesOrder.getOrderItemList() != null && i < salesOrder.getOrderItemList().size(); i++){ + OrderItem orderItem = salesOrder.getOrderItemList().get(i); + new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); + } + } + + public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, merchant); + if((merchant == null)){ + return; + } + new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); + } + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java new file mode 100644 index 000000000..a034c8604 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantExpression; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SalesOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SalesOrderExpression(Expression expression){ + super(expression); + } + + public SalesOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public SalesOrderExpression updateId(Long id){ + return new SalesOrderExpression(this, $it -> {((SalesOrder)$it).__internalSet("id", id); return this;}); + } + + public SalesOrderExpression save(UserContext userContext){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SalesOrderExpression save(String intent, UserContext userContext){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public MerchantExpression getMerchant(){ + return new MerchantExpression(loaded("merchant", "getMerchant", SalesOrder::getMerchant)); + } + + public SalesOrderExpression updateMerchant(Merchant merchant){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).updateMerchant(merchant)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", SalesOrder::getOrderNumber); + } + public SalesOrderExpression updateOrderNumber(String orderNumber){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).updateOrderNumber(orderNumber)); + } + + public OrderItemListExpression getOrderItemList(){ + return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", SalesOrder::getOrderItemList)); + } + public SalesOrderExpression addOrderItem(OrderItem orderItem){ + return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).addOrderItem(orderItem)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java new file mode 100644 index 000000000..8e041cce7 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.ordereditreference.salesorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SalesOrderListExpression extends SmartListExpression { + public SalesOrderListExpression(Expression> expression){ + super(expression); + } + + public SalesOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SalesOrderExpression first() { + return new SalesOrderExpression(super.first()); + } + + public SalesOrderExpression get(int index) { + return new SalesOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java new file mode 100644 index 000000000..fd2ff1dde --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java @@ -0,0 +1,902 @@ + +package com.teaql.ordereditreference.salesorder; + +import com.teaql.ordereditreference.Q; +import com.teaql.ordereditreference.merchant.Merchant; +import com.teaql.ordereditreference.merchant.MerchantRequest; +import com.teaql.ordereditreference.orderitem.OrderItem; +import com.teaql.ordereditreference.orderitem.OrderItemRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SalesOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SalesOrderRequest(Class returnType){ + this(returnType, () -> (T) new SalesOrder()); + } + + protected SalesOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SalesOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SalesOrderRequest copy(){ + return (SalesOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SalesOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SalesOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SalesOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SalesOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SalesOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SalesOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SalesOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SalesOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SalesOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SalesOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SalesOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SalesOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public SalesOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SalesOrderRequest matchingAnyOf(SalesOrderRequest salesOrder){ + super.internalMatchAny(salesOrder); + return this; + } + + public SalesOrderRequest matchingIdsOf(SalesOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SalesOrder.ID_PROPERTY, request, SalesOrder.ID_PROPERTY)); + } + + public SalesOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SalesOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SalesOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SalesOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectMerchantIdOnly().selectOrderNumber().selectVersion(); + } + + public SalesOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public SalesOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SalesOrder.ID_PROPERTY); + selectProperty(SalesOrder.MERCHANT_PROPERTY); + selectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); + selectProperty(SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectMerchant().selectOrderNumber().selectVersion(); + } + + public SalesOrderRequest selectChildren(){ + super.selectAny(); + selectOrderItemList(); + return selectId().selectMerchant().selectOrderNumber().selectVersion(); + } + + + public SalesOrderRequest selectId(){ + selectProperty(SalesOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SalesOrderRequest unselectId(){ + unselectProperty(SalesOrder.ID_PROPERTY); + return this; + } + public SalesOrderRequest selectMerchantIdOnly(){ + selectProperty(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest selectMerchant(){ + return selectMerchantWith(Q.merchants().unlimited().selectSelf()); + } + + public SalesOrderRequest selectMerchantWith(MerchantRequest merchant){ + selectProperty(SalesOrder.MERCHANT_PROPERTY); + enhanceRelation(SalesOrder.MERCHANT_PROPERTY, merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, SalesOrder.MERCHANT_PROPERTY)); + return this; + } + + public SalesOrderRequest unselectMerchant(){ + unselectProperty(SalesOrder.MERCHANT_PROPERTY); + return this; + } + public SalesOrderRequest selectOrderNumber(){ + selectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SalesOrderRequest unselectOrderNumber(){ + unselectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest selectVersion(){ + selectProperty(SalesOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SalesOrderRequest unselectVersion(){ + unselectProperty(SalesOrder.VERSION_PROPERTY); + return this; + } + public SalesOrderRequest selectOrderItemList(){ + return selectOrderItemListWith(Q.orderItems().selectSelf()); + } + + public SalesOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ + enhanceRelation(SalesOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.ID_PROPERTY, operator, values); + } + + public SalesOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SalesOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SalesOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SalesOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SalesOrderRequest filterByMerchant(Merchant... merchant){ + if (merchant == null || merchant.length == 0) { + throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); + } + return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); + } + + public SalesOrderRequest withMerchant(Operator operator, Object... values){ + return appendSearchCriteria(createMerchantCriteria(operator, values)); + } + + public SalesOrderRequest withMerchantIsUnknown(){ + return withMerchant(Operator.IS_NULL); + } + + public SalesOrderRequest withMerchantIsKnown(){ + return withMerchant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.MERCHANT_PROPERTY, operator, values); + } + + public SalesOrderRequest filterByMerchant(Long merchant){ + if(merchant == null){ + return this; + } + return withMerchant(Operator.EQUAL, merchant); + } + public SalesOrderRequest withMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(new SubQuerySearchCriteria(SalesOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); + } + + public SalesOrderRequest withoutMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SalesOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); + } + + public SalesOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public SalesOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public SalesOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public SalesOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public SalesOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public SalesOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public SalesOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public SalesOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public SalesOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public SalesOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public SalesOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public SalesOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public SalesOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public SalesOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public SalesOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public SalesOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public SalesOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public SalesOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SalesOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SalesOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SalesOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SalesOrder.VERSION_PROPERTY, operator, values); + } + + public SalesOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SalesOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SalesOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SalesOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SalesOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SalesOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SalesOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SalesOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SalesOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SalesOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(SalesOrder.ID_PROPERTY, orderItemRequest, OrderItem.SALES_ORDER_PROPERTY)); + } + + public SalesOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SalesOrder.ID_PROPERTY, orderItemRequest, OrderItem.SALES_ORDER_PROPERTY))); + } + + public SalesOrderRequest haveOrderItems(){ + return withOrderItemListMatching(Q.orderItems().unlimited()); + } + + public SalesOrderRequest haveNoOrderItems(){ + return withoutOrderItemListMatching(Q.orderItems().unlimited()); + } + + public SalesOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SalesOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SalesOrderRequest groupByMerchantWithDetails(){ + return groupByMerchantWithDetails(Q.merchants().unlimited()); + } + + public SalesOrderRequest groupByMerchantWithDetails(MerchantRequest subRequest){ + aggregate(SalesOrder.MERCHANT_PROPERTY, subRequest); + return this; + } + + + + public SalesOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SalesOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.ID_PROPERTY); + return this; + } + public SalesOrderRequest countDistinctMerchant(){ + return countDistinctMerchantAs("merchant_distinct_count"); + } + + public SalesOrderRequest countDistinctMerchantAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.MERCHANT_PROPERTY); + return this; + } + public SalesOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public SalesOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SalesOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SalesOrder.VERSION_PROPERTY); + return this; + } + public SalesOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ + aggregate(SalesOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); + return this; + } + + public SalesOrderRequest groupById(){ + groupBy(SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest groupByIdAs(String retName){ + groupBy(retName, SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.ID_PROPERTY, function); + return this; + } + public SalesOrderRequest groupByMerchantWith(MerchantRequest subRequest){ + groupBy(SalesOrder.MERCHANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); + return this; + } + public SalesOrderRequest groupByMerchant(){ + groupBy(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest groupByMerchantAs(String retName){ + groupBy(retName, SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest groupByMerchantWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.MERCHANT_PROPERTY, function); + return this; + } + + public SalesOrderRequest groupByOrderNumber(){ + groupBy(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public SalesOrderRequest groupByVersion(){ + groupBy(SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest groupByVersionAs(String retName){ + groupBy(retName, SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SalesOrder.VERSION_PROPERTY, function); + return this; + } + + + + public SalesOrderRequest orderByIdAscending(){ + addOrderByAscending(SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest orderByIdDescending(){ + addOrderByDescending(SalesOrder.ID_PROPERTY); + return this; + } + + public SalesOrderRequest orderByMerchantAscending(){ + addOrderByAscending(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest orderByMerchantDescending(){ + addOrderByDescending(SalesOrder.MERCHANT_PROPERTY); + return this; + } + + public SalesOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public SalesOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SalesOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public SalesOrderRequest orderByVersionAscending(){ + addOrderByAscending(SalesOrder.VERSION_PROPERTY); + return this; + } + + public SalesOrderRequest orderByVersionDescending(){ + addOrderByDescending(SalesOrder.VERSION_PROPERTY); + return this; + } + + + public SalesOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ + return statsFromOrderItemsAs(name, subRequest, false); + } + + public SalesOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ + return statsFromOrderItemsAs(REFINEMENTS, subRequest); + } + public MerchantRequest rollUpToMerchant(){ + MerchantRequest merchant = Q.merchants().unlimited(); + this.internalRollUpTo("merchant", merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); + return merchant; + } + + + + public SalesOrderRequest countOrderItems(){ + addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.SALES_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest countOrderItemsAs(String name){ + addRelationCount(name, Q.orderItems().unlimited(), OrderItem.SALES_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ + addRelationCount(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest minQuantityOfOrderItems(){ + addRelationScalarAggregate("minQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest minQuantityOfOrderItemsAs(String name){ + return minQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest minQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest maxQuantityOfOrderItems(){ + addRelationScalarAggregate("maxQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest maxQuantityOfOrderItemsAs(String name){ + return maxQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest maxQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest sumQuantityOfOrderItems(){ + addRelationScalarAggregate("sumQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest sumQuantityOfOrderItemsAs(String name){ + return sumQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest sumQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest avgQuantityOfOrderItems(){ + addRelationScalarAggregate("avgQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest avgQuantityOfOrderItemsAs(String name){ + return avgQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest avgQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest standardDeviationQuantityOfOrderItems(){ + addRelationScalarAggregate("stdDevQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest standardDeviationQuantityOfOrderItemsAs(String name){ + return standardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest standardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItems(){ + addRelationScalarAggregate("stdDevPopQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name){ + return squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest sampleVarianceQuantityOfOrderItems(){ + addRelationScalarAggregate("varSampQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name){ + return sampleVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItems(){ + addRelationScalarAggregate("varPopQuantityOfOrderItems", Q.orderItems().unlimited(), + OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name){ + return samplePopulationVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); + } + + public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ + addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, + OrderItem.QUANTITY_PROPERTY, + io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); + return this; + } + + public SalesOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ + return facetByMerchantAs(facetName, merchant, true); + } + + public SalesOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ + addFacet(facetName, SalesOrder.MERCHANT_PROPERTY, merchant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, SalesOrder.MERCHANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SalesOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SalesOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SalesOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SalesOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SalesOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SalesOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..86905e0e5 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.ordereditreference.EntityMetaRegistry \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/teaql/checker-model.json b/examples/round-trip-reference-runtime/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..935576973 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:c2dacaf8377a726fc38a9cf13920679bb314d4127c7cc9c550dc98d516508240","entities":{"Merchant":{"labels":{"en":"merchant"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"sales_order_list","targetType":"SalesOrder","labels":{"en":"sales order"},"aliases":["SalesOrderList","salesOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"OrderItem":{"labels":{"en":"order item"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"quantity","labels":{"en":"quantity"},"aliases":["Quantity"]},{"name":"sales_order","targetType":"SalesOrder","labels":{"en":"sales order"},"aliases":["SalesOrder","salesOrder"]},{"name":"sku","labels":{"en":"sku"},"aliases":["Sku"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SalesOrder":{"labels":{"en":"sales order"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"merchant","targetType":"Merchant","labels":{"en":"merchant"},"aliases":["Merchant"]},{"name":"order_item_list","targetType":"OrderItem","labels":{"en":"order item"},"aliases":["OrderItemList","orderItemList"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-lib-core/teaql/model-provenance.json b/examples/round-trip-reference-runtime/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..d60a86fb8 --- /dev/null +++ b/examples/round-trip-reference-runtime/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:83d0c3f4b8d0ed41289c81816c5f824fbda61fbeeaf1883a412e386829ecc1c8","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/model.xml b/examples/round-trip-reference-runtime/model.xml new file mode 100644 index 000000000..055d4be01 --- /dev/null +++ b/examples/round-trip-reference-runtime/model.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/examples/round-trip-reference-runtime/showcase.json b/examples/round-trip-reference-runtime/showcase.json new file mode 100644 index 000000000..6dfac56f0 --- /dev/null +++ b/examples/round-trip-reference-runtime/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/round-trip-reference-runtime", + "library": { + "generatedFilesManifestSHA256": "efcc44417d42124fe7a0776596443ba9debbc6e4d443d4d764e7e0fd65dcb94a", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "065bad2b9154a08abbec48549e60cc907e6f2889e9a005b428d902a1cbd0999f" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-reference-and-line-restoration-evaluated-generation/receipt.json", + "receiptSHA256": "21eae4c57d59881287106fe7871d0958e6596ab455f9e7e095580b0b03a05dc8" + }, + "scene": "Resolve a scoped order-line reference before accepting an edit", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/round-trip-reference-runtime/verify.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java" + ], + "generatedFilesManifestSHA256": "1a34d54140420df516ae53cca73e99dd5107187dddef4679221b36aabc883f73", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/round-trip-reference-runtime/verify.sh b/examples/round-trip-reference-runtime/verify.sh new file mode 100644 index 000000000..ab94f371a --- /dev/null +++ b/examples/round-trip-reference-runtime/verify.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" +scratch="$(mktemp -d -t teaql-java-reference.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +evidence="${TEAQL_REFERENCE_EVIDENCE_DIR:-$scratch/evidence}" +[[ "$evidence" == /* ]] +mkdir -- "$evidence" +export TEAQL_REFERENCE_DATABASE="$evidence/orders.sqlite" +python3 -B - "$scratch/pom.xml" "$repo" "$example/java-lib-core/lib" "$example/java-app-console" <<'PY' +import sys +from os.path import relpath +from pathlib import Path +from xml.etree.ElementTree import Element, ElementTree, SubElement + +pom = Element('project', xmlns='http://maven.apache.org/POM/4.0.0') +for key, value in [('modelVersion','4.0.0'), ('groupId','io.teaql.test'), ('artifactId','order-editor-reactor'), + ('version','1'), ('packaging','pom')]: + SubElement(pom, key).text = value +file = Path(sys.argv[1]) +modules = SubElement(pom, 'modules') +for module in sys.argv[2:]: + SubElement(modules, 'module').text = relpath(module, file.parent) +ElementTree(pom).write(file, encoding='utf-8', xml_declaration=True) +PY +cd "$repo" +mvn -q -pl examples/round-trip-reference-runtime -am \ + -Dtest=RoundTripReferenceRuntimeExampleTest,ContextBoundRoundTripReferenceTest \ + -Dsurefire.failIfNoSpecifiedTests=false test >"$evidence/calibration.log" 2>&1 || { + tail -80 "$evidence/calibration.log" >&2 + exit 1 + } +cp "$example/target/surefire-reports/TEST-io.teaql.examples.reference.RoundTripReferenceRuntimeExampleTest.xml" "$evidence/" +cp "$repo/teaql-runtime/target/surefire-reports/TEST-io.teaql.runtime.reference.ContextBoundRoundTripReferenceTest.xml" "$evidence/" +for round in 1 2; do + TEAQL_SHOWCASE_ROUND="$round" mvn -q -f "$scratch/pom.xml" -pl :order-edit-reference -am \ + -Dtest=OrderReferenceEditorTest -Dsurefire.failIfNoSpecifiedTests=false test >"$evidence/round-$round.log" 2>&1 || { + tail -80 "$evidence/round-$round.log" >&2 + exit 1 + } + cp "$example/java-app-console/target/surefire-reports/TEST-com.teaql.ordereditreference.OrderReferenceEditorTest.xml" "$evidence/round-$round.xml" + rg '^ORDER_REFERENCE ' "$evidence/round-$round.log" +done diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 78088e47d..d6c479310 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -41,8 +41,7 @@ mvn -q -o -f examples/business-id-runtime/java-app-console/pom.xml compile \ "-Dexec.args=--teaql.datasource.url=jdbc:sqlite:$evidence_dir/business-id.sqlite" mvn -q -pl examples/security-foundations \ -Dtest=SecurityFoundationsExampleTest,SqlRelationMaskingTest test -mvn -q -pl examples/round-trip-reference-runtime \ - -Dtest=RoundTripReferenceRuntimeExampleTest test +TEAQL_REFERENCE_EVIDENCE_DIR="$evidence_dir/round-trip-reference" bash examples/round-trip-reference-runtime/verify.sh TEAQL_CONFORMANCE_EVIDENCE_DIR="$evidence_dir/conformance" bash examples/conformance/verify.sh mvn -q -f examples/school-management/java-lib-core/lib/pom.xml install -DskipTests mvn -q -f examples/school-management/java-app-console/pom.xml spring-boot:run \ From 163cd902f160508772cf03e3f949aa1af8d5dfbf Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:11:48 +0800 Subject: [PATCH 54/71] Resolve the Java reference workspace against local reactor versions --- examples/round-trip-reference-runtime/README.md | 14 +++++++++++++- .../java-app-console/pom.xml | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/round-trip-reference-runtime/README.md b/examples/round-trip-reference-runtime/README.md index 2fd40a232..bdd58f11b 100644 --- a/examples/round-trip-reference-runtime/README.md +++ b/examples/round-trip-reference-runtime/README.md @@ -1,4 +1,16 @@ -# Round-Trip Reference runtime example +# Edit an order using an opaque line reference + +The [model](model.xml) defines the merchant, sales order and line. Its +Java workspace installs the runtime reference provider and current +merchant editor policy, resolves the stored line and changes its quantity. +The original runtime tests still exercise key rotation, expiry and raw +diagnostics. + +```bash +bash examples/round-trip-reference-runtime/verify.sh +``` + +## Original adapter-neutral calibration This example proves that the reusable runtime serialization boundary can be called by any Web adapter without depending on Spring, JAX-RS, Servlet, or a diff --git a/examples/round-trip-reference-runtime/java-app-console/pom.xml b/examples/round-trip-reference-runtime/java-app-console/pom.xml index 6c705a1cf..b4dc24989 100644 --- a/examples/round-trip-reference-runtime/java-app-console/pom.xml +++ b/examples/round-trip-reference-runtime/java-app-console/pom.xml @@ -13,7 +13,6 @@ com.teaql order-edit-reference - 0.0.1-SNAPSHOT jar From 3677fd0dd17eb04d8203ae90ded72d43a8e2712a Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:13:10 +0800 Subject: [PATCH 55/71] Record focused java examples/round-trip-reference-runtime business qualification --- examples/round-trip-reference-runtime/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/round-trip-reference-runtime/showcase.json b/examples/round-trip-reference-runtime/showcase.json index 6dfac56f0..e9df030d4 100644 --- a/examples/round-trip-reference-runtime/showcase.json +++ b/examples/round-trip-reference-runtime/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-reference-and-line-restoration-evaluated-generation/receipt.json", "receiptSHA256": "21eae4c57d59881287106fe7871d0958e6596ab455f9e7e095580b0b03a05dc8" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-order-edit-reference-reactor-native/business-receipt.json", + "businessReceiptSHA256": "83c7fa119f17ad1ccff0e291dea346b6368f3c03136ec40e41a925146f1e2d71", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-order-edit-reference-reactor-native/receipt.json", + "nativeReceiptSHA256": "dc656a80288f885f382d8201b0ca0cdb252e9b8663807e316b7c670479521eb1", + "remainingFullRuntimeInventory": true, + "sourceCommit": "163cd902f160508772cf03e3f949aa1af8d5dfbf" + }, "scene": "Resolve a scoped order-line reference before accepting an edit", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/round-trip-reference-runtime/verify.sh" From 1ca62c8052658b02d1a9cb2732d71da32354408d Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:20:53 +0800 Subject: [PATCH 56/71] Synchronize persisted supplier orders through the Java HTTP Context --- .../java-app-console/.gitignore | 53 ++ .../java-app-console/AGENTS.md | 66 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 29 + .../http-resilience/java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 136 +++ .../java-app-console/lib/pom.xml | 102 +++ .../BaseServiceConfiguration.java | 0 .../supplierordersyncservice/Checkers.java | 0 .../supplierordersyncservice/Constants.java | 9 + .../com/teaql/supplierordersyncservice/E.java | 18 + .../EntityMetaRegistry.java | 297 +++++++ .../GeneratedRuntimeModule.java | 37 + .../com/teaql/supplierordersyncservice/Q.java | 25 + .../Repositories.java | 0 .../SupplierOrderSyncServiceUserContext.java | 10 + .../sampledata/SampleDataService.java | 0 .../supplier/Supplier.java | 130 +++ .../supplier/SupplierChecker.java | 52 ++ .../supplier/SupplierExpression.java | 51 ++ .../supplier/SupplierListExpression.java | 25 + .../supplier/SupplierRequest.java | 623 +++++++++++++ .../supplierorder/SupplierOrder.java | 149 ++++ .../supplierorder/SupplierOrderChecker.java | 71 ++ .../SupplierOrderExpression.java | 60 ++ .../SupplierOrderListExpression.java | 25 + .../supplierorder/SupplierOrderRequest.java | 836 ++++++++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../http-resilience/java-app-console/pom.xml | 112 +++ .../teaql/supplierordersyncservice/App.java | 99 +++ .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../SupplierOrderSyncTest.java | 205 +++++ .../java-app-console/teaql-i18n.json | 106 +++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../http-resilience/java-lib-core/lib/pom.xml | 142 +++ .../BaseServiceConfiguration.java | 0 .../supplierordersyncservice/Checkers.java | 0 .../supplierordersyncservice/Constants.java | 9 + .../com/teaql/supplierordersyncservice/E.java | 18 + .../EntityMetaRegistry.java | 297 +++++++ .../GeneratedRuntimeModule.java | 37 + .../com/teaql/supplierordersyncservice/Q.java | 25 + .../Repositories.java | 0 .../SupplierOrderSyncServiceUserContext.java | 10 + .../sampledata/SampleDataService.java | 0 .../supplier/Supplier.java | 130 +++ .../supplier/SupplierChecker.java | 52 ++ .../supplier/SupplierExpression.java | 51 ++ .../supplier/SupplierListExpression.java | 25 + .../supplier/SupplierRequest.java | 623 +++++++++++++ .../supplierorder/SupplierOrder.java | 149 ++++ .../supplierorder/SupplierOrderChecker.java | 71 ++ .../SupplierOrderExpression.java | 60 ++ .../SupplierOrderListExpression.java | 25 + .../supplierorder/SupplierOrderRequest.java | 836 ++++++++++++++++++ .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/http-resilience/model.xml | 6 + examples/http-resilience/showcase.json | 40 + examples/http-resilience/verify-sync.sh | 36 + scripts/verify-examples.sh | 1 + 67 files changed, 6213 insertions(+) create mode 100644 examples/http-resilience/java-app-console/.gitignore create mode 100644 examples/http-resilience/java-app-console/AGENTS.md create mode 100644 examples/http-resilience/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/http-resilience/java-app-console/Makefile create mode 100644 examples/http-resilience/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/http-resilience/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/http-resilience/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/http-resilience/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/http-resilience/java-app-console/lib/pom.xml create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java create mode 100644 examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/http-resilience/java-app-console/pom.xml create mode 100644 examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/App.java create mode 100644 examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/CustomUserContext.java create mode 100644 examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/http-resilience/java-app-console/src/main/resources/application.properties create mode 100644 examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java create mode 100644 examples/http-resilience/java-app-console/teaql-i18n.json create mode 100644 examples/http-resilience/java-app-console/teaql/checker-model.json create mode 100644 examples/http-resilience/java-app-console/teaql/model-provenance.json create mode 100644 examples/http-resilience/java-lib-core/lib/pom.xml create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/E.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java create mode 100644 examples/http-resilience/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/http-resilience/java-lib-core/teaql/checker-model.json create mode 100644 examples/http-resilience/java-lib-core/teaql/model-provenance.json create mode 100644 examples/http-resilience/model.xml create mode 100644 examples/http-resilience/showcase.json create mode 100644 examples/http-resilience/verify-sync.sh diff --git a/examples/http-resilience/java-app-console/.gitignore b/examples/http-resilience/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/http-resilience/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/AGENTS.md b/examples/http-resilience/java-app-console/AGENTS.md new file mode 100644 index 000000000..1548351db --- /dev/null +++ b/examples/http-resilience/java-app-console/AGENTS.md @@ -0,0 +1,66 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| supplier | Supplier | +| supplier_order | Supplier Order | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/http-resilience/java-app-console/DOMAIN_API_GUIDE.md b/examples/http-resilience/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..260ea7f41 --- /dev/null +++ b/examples/http-resilience/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,29 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/supplier-order-sync-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| supplier | Supplier | +| supplier_order | Supplier Order | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/Makefile b/examples/http-resilience/java-app-console/Makefile new file mode 100644 index 000000000..f017cc0ce --- /dev/null +++ b/examples/http-resilience/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/supplier-order-sync-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/supplier-order-sync-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/http-resilience/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..cecaf7236 --- /dev/null +++ b/examples/http-resilience/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/supplier-order-sync-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/STANDARD_TELEMETRY.md b/examples/http-resilience/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/http-resilience/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/http-resilience/java-app-console/TOOL_API_GUIDE.md b/examples/http-resilience/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..48ebb2f8b --- /dev/null +++ b/examples/http-resilience/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/supplier-order-sync-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/supplier-order-sync-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/supplier-order-sync-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/supplier-order-sync-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/supplier-order-sync-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/supplier-order-sync-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/docs/teaql-java-crud-guide.md b/examples/http-resilience/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..f3b821c5f --- /dev/null +++ b/examples/http-resilience/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,136 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.supplierordersyncservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.supplierordersyncservice.Q; +import com.teaql.supplierordersyncservice.SupplierOrderSyncServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.suppliers() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.suppliers() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Supplier(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.suppliers() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.suppliers() + .selectSupplierOrderListWith(Q.supplierOrders().selectSelf()) + .comment("load with supplierOrderList") + .purpose("fetch child supplierOrderList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Supplier`: reverse relations `1`, query `Q.suppliers()`, save `new Supplier().auditAs("comment").save(userContext)`, request `com.teaql.supplierordersyncservice.supplier.SupplierRequest` \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/pom.xml b/examples/http-resilience/java-app-console/lib/pom.xml new file mode 100644 index 000000000..c9e2217f5 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + supplier-order-sync-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java new file mode 100644 index 000000000..0fb961888 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.supplierordersyncservice; + +import com.teaql.supplierordersyncservice.supplier.Supplier; + +public interface Constants { + public static final long SUPPLIER_ID = 1l; + public static final Supplier SUPPLIER = Supplier.refer(SUPPLIER_ID); +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java new file mode 100644 index 000000000..93485513e --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java @@ -0,0 +1,18 @@ + +package com.teaql.supplierordersyncservice; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierExpression; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static SupplierExpression supplier(Supplier supplier){ + return new SupplierExpression(new ValueExpression(supplier, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.supplier()")); + } + public static SupplierOrderExpression supplierOrder(SupplierOrder supplierOrder){ + return new SupplierOrderExpression(new ValueExpression(supplierOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.supplierOrder()")); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java new file mode 100644 index 000000000..eed1abe4a --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java @@ -0,0 +1,297 @@ + +package com.teaql.supplierordersyncservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerSupplier(); + registerSupplierOrder(); + } + private void registerSupplier() { + FieldLayout.installGenerated(com.teaql.supplierordersyncservice.supplier.Supplier.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.supplierordersyncservice.supplier.Supplier.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.supplierordersyncservice.supplier.Supplier.class); + entityDescriptor.setEntitySupplier(com.teaql.supplierordersyncservice.supplier.Supplier::new); + entityDescriptor.with("name", "Supplier") + + .with("module", "Procurement") + + .with("module_key", "procurement") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Regional Supply Co") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSupplierOrder() { + FieldLayout.installGenerated(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder::new); + entityDescriptor.with("name", "Supplier Order") + + .with("module", "Procurement") + + .with("module_key", "procurement") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor supplier = + entityDescriptor.addObjectProperty($factory, com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SUPPLIER_PROPERTY, com.teaql.supplierordersyncservice.supplier.Supplier.INTERNAL_TYPE, com.teaql.supplierordersyncservice.supplier.Supplier.SUPPLIER_ORDER_LIST_PROPERTY, com.teaql.supplierordersyncservice.supplier.Supplier.class) + ; + PropertyDescriptor externalReference = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, String.class) + ; + PropertyDescriptor syncStatus = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SUPPLIER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..807a48c11 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.teaql.supplierordersyncservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.supplierordersyncservice.supplier.SupplierChecker(), new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:e586b81a9295abcb4491692dac6cf1ef33839a688fea9a396db189f87f7120c5\",\"entities\":{\"Supplier\":{\"labels\":{\"en\":\"Supplier\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"supplier_order_list\",\"targetType\":\"SupplierOrder\",\"labels\":{\"en\":\"Supplier Order\"},\"aliases\":[\"SupplierOrderList\",\"supplierOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SupplierOrder\":{\"labels\":{\"en\":\"Supplier Order\"},\"fields\":[{\"name\":\"external_reference\",\"labels\":{\"en\":\"external reference\"},\"aliases\":[\"ExternalReference\",\"externalReference\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"supplier\",\"targetType\":\"Supplier\",\"labels\":{\"en\":\"Supplier\"},\"aliases\":[\"Supplier\"]},{\"name\":\"sync_status\",\"labels\":{\"en\":\"sync status\"},\"aliases\":[\"SyncStatus\",\"syncStatus\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Supplier", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SupplierOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("supplier", "supplier"), java.util.Map.entry("external_reference", "externalReference"), java.util.Map.entry("sync_status", "syncStatus"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.suppliers().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.supplierordersyncservice.supplier.Supplier domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.supplierordersyncservice.supplier.Supplier(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Regional Supply Co"); + domainRoot.auditAs("create generated Domain Root Supplier").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Supplier", domainRoot.getId())); + } +} diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java new file mode 100644 index 000000000..f3b2f6042 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java @@ -0,0 +1,25 @@ + +package com.teaql.supplierordersyncservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.supplierordersyncservice.supplier.SupplierRequest suppliers(){ + return new com.teaql.supplierordersyncservice.supplier.SupplierRequest(com.teaql.supplierordersyncservice.supplier.Supplier.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.supplierordersyncservice.supplier.SupplierRequest suppliersWithMinimalFields(){ + return new com.teaql.supplierordersyncservice.supplier.SupplierRequest(com.teaql.supplierordersyncservice.supplier.Supplier.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest supplierOrders(){ + return new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest supplierOrdersWithMinimalFields(){ + return new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java new file mode 100644 index 000000000..6ef861b4e --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.supplierordersyncservice; + +import io.teaql.core.UserContext; +public interface SupplierOrderSyncServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java new file mode 100644 index 000000000..7b9fd781b --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java @@ -0,0 +1,130 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Supplier extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Supplier"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "235b3035c863f7dc4a320bb8cc07e1eb0f61b36fab66ddcf3dc268357a9d89e8"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "supplier_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Supplier.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SUPPLIER_ORDER_LIST_PROPERTY = "supplier_order_list"; + private String name; + + private SmartList supplierOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getSupplierOrderList(){ + return this.supplierOrderList == null ? SmartList.unloaded() : this.supplierOrderList; + } + public Supplier updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Supplier addSupplierOrder(SupplierOrder supplierOrder){ + if (supplierOrder == null){ + return this; + } + + if(null == this.supplierOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.supplierOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.supplierOrderList.add(supplierOrder); + supplierOrder.updateSupplier(this); + return this; + } + + public static Supplier refer(Long id){ + Supplier refer = new Supplier(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Supplier comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "supplier_order_list": this.supplierOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "supplier_order_list": return this.supplierOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java new file mode 100644 index 000000000..29015ca4d --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SupplierChecker implements Checker{ + + public String type(){ + return Supplier.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ + if(needCheck(_context, supplier)){ + markAsChecked(_context, supplier); + doCheck(_context, supplier, _parentLocation); + } + } + + public void doCheck(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ + if((supplier == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, supplier); + if(supplier.needPersist()){ + } + if(supplier.newItem()){ + }else if(supplier.updateItem()){ + if(!supplier.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, supplier.getProperty(Supplier.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; supplier.getSupplierOrderList() != null && i < supplier.getSupplierOrderList().size(); i++){ + SupplierOrder supplierOrder = supplier.getSupplierOrderList().get(i); + new SupplierOrderChecker().checkAndFix(_context, supplierOrder, newLocation(_parentLocation, "supplier_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java new file mode 100644 index 000000000..c5287235b --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SupplierExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SupplierExpression(Expression expression){ + super(expression); + } + + public SupplierExpression(Expression expression, Function function){ + super(expression, function); + } + + public SupplierExpression updateId(Long id){ + return new SupplierExpression(this, $it -> {((Supplier)$it).__internalSet("id", id); return this;}); + } + + public SupplierExpression save(UserContext userContext){ + return new SupplierExpression(this, $it -> ((Supplier)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SupplierExpression save(String intent, UserContext userContext){ + return new SupplierExpression(this, $it -> ((Supplier)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Supplier::getName); + } + public SupplierExpression updateName(String name){ + return new SupplierExpression(this, $it -> ((Supplier)$it).updateName(name)); + } + + public SupplierOrderListExpression getSupplierOrderList(){ + return new SupplierOrderListExpression(loaded("supplier_order_list", "getSupplierOrderList", Supplier::getSupplierOrderList)); + } + public SupplierExpression addSupplierOrder(SupplierOrder supplierOrder){ + return new SupplierExpression(this, $it -> ((Supplier)$it).addSupplierOrder(supplierOrder)); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java new file mode 100644 index 000000000..da446b513 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SupplierListExpression extends SmartListExpression { + public SupplierListExpression(Expression> expression){ + super(expression); + } + + public SupplierListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SupplierExpression first() { + return new SupplierExpression(super.first()); + } + + public SupplierExpression get(int index) { + return new SupplierExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java new file mode 100644 index 000000000..6de102641 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.Q; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SupplierRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SupplierRequest(Class returnType){ + this(returnType, () -> (T) new Supplier()); + } + + protected SupplierRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SupplierRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SupplierRequest copy(){ + return (SupplierRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SupplierRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SupplierRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SupplierRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SupplierRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SupplierRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SupplierRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SupplierRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SupplierRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SupplierRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SupplierRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SupplierRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SupplierRequest)super.appendSearchCriteria(searchCriteria); + } + + public SupplierRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SupplierRequest matchingAnyOf(SupplierRequest supplier){ + super.internalMatchAny(supplier); + return this; + } + + public SupplierRequest matchingIdsOf(SupplierRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Supplier.ID_PROPERTY, request, Supplier.ID_PROPERTY)); + } + + public SupplierRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SupplierRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SupplierRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SupplierRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public SupplierRequest selectSelfFields(){ + return selectSelf(); + } + + public SupplierRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Supplier.ID_PROPERTY); + selectProperty(Supplier.NAME_PROPERTY); + selectProperty(Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public SupplierRequest selectChildren(){ + super.selectAny(); + selectSupplierOrderList(); + return selectId().selectName().selectVersion(); + } + + + public SupplierRequest selectId(){ + selectProperty(Supplier.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierRequest unselectId(){ + unselectProperty(Supplier.ID_PROPERTY); + return this; + } + public SupplierRequest selectName(){ + selectProperty(Supplier.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierRequest unselectName(){ + unselectProperty(Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest selectVersion(){ + selectProperty(Supplier.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierRequest unselectVersion(){ + unselectProperty(Supplier.VERSION_PROPERTY); + return this; + } + public SupplierRequest selectSupplierOrderList(){ + return selectSupplierOrderListWith(Q.supplierOrders().selectSelf()); + } + + public SupplierRequest selectSupplierOrderListWith(SupplierOrderRequest supplierOrderList){ + enhanceRelation(Supplier.SUPPLIER_ORDER_LIST_PROPERTY, supplierOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSupplierOrderListWith", null, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Supplier.ID_PROPERTY, operator, values); + } + + public SupplierRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SupplierRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SupplierRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SupplierRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SupplierRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SupplierRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SupplierRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SupplierRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Supplier.NAME_PROPERTY, operator, values); + } + + public SupplierRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SupplierRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SupplierRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SupplierRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SupplierRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SupplierRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SupplierRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SupplierRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SupplierRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SupplierRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SupplierRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SupplierRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SupplierRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SupplierRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SupplierRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SupplierRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SupplierRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SupplierRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SupplierRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SupplierRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Supplier.VERSION_PROPERTY, operator, values); + } + + public SupplierRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SupplierRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SupplierRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SupplierRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SupplierRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SupplierRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SupplierRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SupplierRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SupplierRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SupplierRequest withSupplierOrderListMatching(SupplierOrderRequest supplierOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Supplier.ID_PROPERTY, supplierOrderRequest, SupplierOrder.SUPPLIER_PROPERTY)); + } + + public SupplierRequest withoutSupplierOrderListMatching(SupplierOrderRequest supplierOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Supplier.ID_PROPERTY, supplierOrderRequest, SupplierOrder.SUPPLIER_PROPERTY))); + } + + public SupplierRequest haveSupplierOrders(){ + return withSupplierOrderListMatching(Q.supplierOrders().unlimited()); + } + + public SupplierRequest haveNoSupplierOrders(){ + return withoutSupplierOrderListMatching(Q.supplierOrders().unlimited()); + } + + public SupplierRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SupplierRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SupplierRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SupplierRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Supplier.ID_PROPERTY); + return this; + } + public SupplierRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SupplierRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SupplierRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Supplier.VERSION_PROPERTY); + return this; + } + public SupplierRequest groupBySupplierOrdersWithDetails(SupplierOrderRequest subRequest){ + aggregate(Supplier.SUPPLIER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public SupplierRequest groupById(){ + groupBy(Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest groupByIdAs(String retName){ + groupBy(retName, Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Supplier.ID_PROPERTY, function); + return this; + } + + public SupplierRequest groupByName(){ + groupBy(Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest groupByNameAs(String retName){ + groupBy(retName, Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Supplier.NAME_PROPERTY, function); + return this; + } + + public SupplierRequest groupByVersion(){ + groupBy(Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest groupByVersionAs(String retName){ + groupBy(retName, Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Supplier.VERSION_PROPERTY, function); + return this; + } + + + + public SupplierRequest orderByIdAscending(){ + addOrderByAscending(Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest orderByIdDescending(){ + addOrderByDescending(Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest orderByNameAscending(){ + addOrderByAscending(Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest orderByNameDescending(){ + addOrderByDescending(Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest orderByVersionAscending(){ + addOrderByAscending(Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest orderByVersionDescending(){ + addOrderByDescending(Supplier.VERSION_PROPERTY); + return this; + } + + + public SupplierRequest statsFromSupplierOrdersAs(String name, SupplierOrderRequest subRequest){ + return statsFromSupplierOrdersAs(name, subRequest, false); + } + + public SupplierRequest statsFromSupplierOrdersAs(String name, SupplierOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SupplierOrder.SUPPLIER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSupplierOrdersAs", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest statsFromSupplierOrders(SupplierOrderRequest subRequest){ + return statsFromSupplierOrdersAs(REFINEMENTS, subRequest); + } + public SupplierRequest countSupplierOrders(){ + addRelationCount("Count", Q.supplierOrders().unlimited(), SupplierOrder.SUPPLIER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrders", null, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest countSupplierOrdersAs(String name){ + addRelationCount(name, Q.supplierOrders().unlimited(), SupplierOrder.SUPPLIER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrdersAs", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest countSupplierOrdersWith(String name, SupplierOrderRequest subRequest){ + addRelationCount(name, subRequest, SupplierOrder.SUPPLIER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrdersWith", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public SupplierRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SupplierRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SupplierRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SupplierRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SupplierRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SupplierRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java new file mode 100644 index 000000000..46e89b872 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java @@ -0,0 +1,149 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SupplierOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SupplierOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c0177bc460393fa876fee1a230cdfe3c9269b316b16a102e12484e7b39e1a67f"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("supplier", 1), java.util.Map.entry("external_reference", 2), java.util.Map.entry("sync_status", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("supplier", java.util.List.of("supplier", "supplier")), java.util.Map.entry("external_reference", java.util.List.of("externalReference", "external_reference")), java.util.Map.entry("sync_status", java.util.List.of("syncStatus", "sync_status")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SupplierOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String SUPPLIER_PROPERTY = "supplier"; + public static final String EXTERNAL_REFERENCE_PROPERTY = "external_reference"; + public static final String SYNC_STATUS_PROPERTY = "sync_status"; + private Supplier supplier; + + private String externalReference; + + private String syncStatus; + + + public Supplier getSupplier(){ + return this.supplier; + } + + public String getExternalReference(){ + return this.externalReference; + } + + public String getSyncStatus(){ + return this.syncStatus; + } + + public SupplierOrder updateSupplier(Supplier supplier){ + if(isPropertyLoaded(SUPPLIER_PROPERTY) && Objects.equals(this.supplier, supplier)){ + return this; + } + handleUpdate(SUPPLIER_PROPERTY, getSupplier(), supplier); + this.supplier = supplier; + return this; + } + + public SupplierOrder updateExternalReference(String externalReference){ + externalReference = (externalReference == null ? null : externalReference.trim()); + if(isPropertyLoaded(EXTERNAL_REFERENCE_PROPERTY) && Objects.equals(this.externalReference, externalReference)){ + return this; + } + handleUpdate(EXTERNAL_REFERENCE_PROPERTY, getExternalReference(), externalReference); + this.externalReference = externalReference; + return this; + } + + public SupplierOrder updateSyncStatus(String syncStatus){ + syncStatus = (syncStatus == null ? null : syncStatus.trim()); + if(isPropertyLoaded(SYNC_STATUS_PROPERTY) && Objects.equals(this.syncStatus, syncStatus)){ + return this; + } + handleUpdate(SYNC_STATUS_PROPERTY, getSyncStatus(), syncStatus); + this.syncStatus = syncStatus; + return this; + } + + + public static SupplierOrder refer(Long id){ + SupplierOrder refer = new SupplierOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SupplierOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "supplier": this.supplier = (Supplier) value; break; + + case "external_reference": this.externalReference = (value == null ? null : ((String)value).trim()); break; + + case "sync_status": this.syncStatus = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "supplier": return this.supplier; + case "external_reference": return this.externalReference; + case "sync_status": return this.syncStatus; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "supplier": return this.supplier; + case "externalReference": return this.externalReference; + case "syncStatus": return this.syncStatus; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java new file mode 100644 index 000000000..3ae0777a2 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java @@ -0,0 +1,71 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SupplierOrderChecker implements Checker{ + + public String type(){ + return SupplierOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SupplierOrder supplierOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, supplierOrder)){ + markAsChecked(_context, supplierOrder); + doCheck(_context, supplierOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, SupplierOrder supplierOrder, ObjectLocation _parentLocation){ + if((supplierOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, supplierOrder); + if(supplierOrder.needPersist()){ + } + if(supplierOrder.newItem()){ + }else if(supplierOrder.updateItem()){ + if(!supplierOrder.isPropertyLoaded("supplier")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "supplier"), "Mutation requires a fully loaded entity"); + } + if(!supplierOrder.isPropertyLoaded("external_reference")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "external_reference"), "Mutation requires a fully loaded entity"); + } + if(!supplierOrder.isPropertyLoaded("sync_status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sync_status"), "Mutation requires a fully loaded entity"); + } + + } + checkSupplier(_context, supplierOrder.getProperty(SupplierOrder.SUPPLIER_PROPERTY), newLocation(_parentLocation, "supplier")); + checkExternalReference(_context, supplierOrder.getProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY), newLocation(_parentLocation, "external_reference")); + checkSyncStatus(_context, supplierOrder.getProperty(SupplierOrder.SYNC_STATUS_PROPERTY), newLocation(_parentLocation, "sync_status")); + } + + public void checkSupplier(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, supplier); + if((supplier == null)){ + return; + } + new SupplierChecker().checkAndFix(_context, supplier, _parentLocation); + } + public void checkExternalReference(UserContext _context, String externalReference, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, externalReference); + if((externalReference == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, externalReference); + + } + public void checkSyncStatus(UserContext _context, String syncStatus, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, syncStatus); + if((syncStatus == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, syncStatus); + + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java new file mode 100644 index 000000000..b4f7739d3 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java @@ -0,0 +1,60 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SupplierOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SupplierOrderExpression(Expression expression){ + super(expression); + } + + public SupplierOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public SupplierOrderExpression updateId(Long id){ + return new SupplierOrderExpression(this, $it -> {((SupplierOrder)$it).__internalSet("id", id); return this;}); + } + + public SupplierOrderExpression save(UserContext userContext){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SupplierOrderExpression save(String intent, UserContext userContext){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public SupplierExpression getSupplier(){ + return new SupplierExpression(loaded("supplier", "getSupplier", SupplierOrder::getSupplier)); + } + + public SupplierOrderExpression updateSupplier(Supplier supplier){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateSupplier(supplier)); + } + + public Expression getExternalReference(){ + return loaded("external_reference", "getExternalReference", SupplierOrder::getExternalReference); + } + public SupplierOrderExpression updateExternalReference(String externalReference){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateExternalReference(externalReference)); + } + + public Expression getSyncStatus(){ + return loaded("sync_status", "getSyncStatus", SupplierOrder::getSyncStatus); + } + public SupplierOrderExpression updateSyncStatus(String syncStatus){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateSyncStatus(syncStatus)); + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java new file mode 100644 index 000000000..7d3b6d399 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SupplierOrderListExpression extends SmartListExpression { + public SupplierOrderListExpression(Expression> expression){ + super(expression); + } + + public SupplierOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SupplierOrderExpression first() { + return new SupplierOrderExpression(super.first()); + } + + public SupplierOrderExpression get(int index) { + return new SupplierOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java new file mode 100644 index 000000000..080da4fc8 --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java @@ -0,0 +1,836 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.Q; +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SupplierOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SupplierOrderRequest(Class returnType){ + this(returnType, () -> (T) new SupplierOrder()); + } + + protected SupplierOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SupplierOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SupplierOrderRequest copy(){ + return (SupplierOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SupplierOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SupplierOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SupplierOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SupplierOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SupplierOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SupplierOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SupplierOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SupplierOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SupplierOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SupplierOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SupplierOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SupplierOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public SupplierOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SupplierOrderRequest matchingAnyOf(SupplierOrderRequest supplierOrder){ + super.internalMatchAny(supplierOrder); + return this; + } + + public SupplierOrderRequest matchingIdsOf(SupplierOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SupplierOrder.ID_PROPERTY, request, SupplierOrder.ID_PROPERTY)); + } + + public SupplierOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SupplierOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SupplierOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SupplierOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectSupplierIdOnly().selectExternalReference().selectSyncStatus().selectVersion(); + } + + public SupplierOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public SupplierOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SupplierOrder.ID_PROPERTY); + selectProperty(SupplierOrder.SUPPLIER_PROPERTY); + selectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + selectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); + selectProperty(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectSupplier().selectExternalReference().selectSyncStatus().selectVersion(); + } + + public SupplierOrderRequest selectChildren(){ + super.selectAny(); + return selectId().selectSupplier().selectExternalReference().selectSyncStatus().selectVersion(); + } + + + public SupplierOrderRequest selectId(){ + selectProperty(SupplierOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectId(){ + unselectProperty(SupplierOrder.ID_PROPERTY); + return this; + } + public SupplierOrderRequest selectSupplierIdOnly(){ + selectProperty(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest selectSupplier(){ + return selectSupplierWith(Q.suppliers().unlimited().selectSelf()); + } + + public SupplierOrderRequest selectSupplierWith(SupplierRequest supplier){ + selectProperty(SupplierOrder.SUPPLIER_PROPERTY); + enhanceRelation(SupplierOrder.SUPPLIER_PROPERTY, supplier, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSupplierWith", null, SupplierOrder.SUPPLIER_PROPERTY)); + return this; + } + + public SupplierOrderRequest unselectSupplier(){ + unselectProperty(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + public SupplierOrderRequest selectExternalReference(){ + selectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + /** + * fill the externalReference with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS externalReference) to fetch externalReference property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectExternalReference(){ + unselectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest selectSyncStatus(){ + selectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + /** + * fill the syncStatus with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS syncStatus) to fetch syncStatus property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectSyncStatus(){ + unselectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest selectVersion(){ + selectProperty(SupplierOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectVersion(){ + unselectProperty(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.ID_PROPERTY, operator, values); + } + + public SupplierOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SupplierOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SupplierOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SupplierOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SupplierOrderRequest filterBySupplier(Supplier... supplier){ + if (supplier == null || supplier.length == 0) { + throw new IllegalArgumentException("filterBySupplier parameter supplier cannot be empty"); + } + return appendSearchCriteria(createSupplierCriteria(Operator.EQUAL, (Object[])supplier)); + } + + public SupplierOrderRequest withSupplier(Operator operator, Object... values){ + return appendSearchCriteria(createSupplierCriteria(operator, values)); + } + + public SupplierOrderRequest withSupplierIsUnknown(){ + return withSupplier(Operator.IS_NULL); + } + + public SupplierOrderRequest withSupplierIsKnown(){ + return withSupplier(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSupplierCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, operator, values); + } + + public SupplierOrderRequest filterBySupplier(Long supplier){ + if(supplier == null){ + return this; + } + return withSupplier(Operator.EQUAL, supplier); + } + public SupplierOrderRequest withSupplierMatching(SupplierRequest supplier){ + return appendSearchCriteria(new SubQuerySearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, supplier, Supplier.ID_PROPERTY)); + } + + public SupplierOrderRequest withoutSupplierMatching(SupplierRequest supplier){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, supplier, Supplier.ID_PROPERTY))); + } + + public SupplierOrderRequest filterByExternalReference(String... externalReference){ + if (externalReference == null || externalReference.length == 0) { + throw new IllegalArgumentException("filterByExternalReference parameter externalReference cannot be empty"); + } + return appendSearchCriteria(createExternalReferenceCriteria(Operator.EQUAL, (Object[])externalReference)); + } + + public SupplierOrderRequest withExternalReference(Operator operator, Object... values){ + return appendSearchCriteria(createExternalReferenceCriteria(operator, values)); + } + + public SupplierOrderRequest withExternalReferenceIsUnknown(){ + return withExternalReference(Operator.IS_NULL); + } + + public SupplierOrderRequest withExternalReferenceIsKnown(){ + return withExternalReference(Operator.IS_NOT_NULL); + } + + public SearchCriteria createExternalReferenceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, operator, values); + } + + public SupplierOrderRequest withExternalReferenceIsNot(String externalReference){ + return withExternalReference(Operator.NOT_EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceIn(String... externalReference){ + return withExternalReference(Operator.IN, (Object[])externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotIn(String... externalReference){ + return withExternalReference(Operator.NOT_IN, (Object[])externalReference); + } + public SupplierOrderRequest withExternalReferenceGreaterThan(String externalReference){ + return withExternalReference(Operator.GREATER_THAN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceGreaterThanOrEqualTo(String externalReference){ + return withExternalReference(Operator.GREATER_THAN_OR_EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceLessThan(String externalReference){ + return withExternalReference(Operator.LESS_THAN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceLessThanOrEqualTo(String externalReference){ + return withExternalReference(Operator.LESS_THAN_OR_EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceBetween(String startOfExternalReference, String endOfExternalReference){ + return withExternalReference(Operator.BETWEEN, startOfExternalReference, endOfExternalReference); + } + public SupplierOrderRequest withExternalReferenceStartingWith(String externalReference){ + return withExternalReference(Operator.BEGIN_WITH, externalReference); + } + public SupplierOrderRequest withExternalReferenceContaining(String externalReference){ + return withExternalReference(Operator.CONTAIN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotContaining(String externalReference){ + return withExternalReference(Operator.NOT_CONTAIN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotStartingWith(String externalReference){ + return withExternalReference(Operator.NOT_BEGIN_WITH, externalReference); + } + + public SupplierOrderRequest withExternalReferenceEndingWith(String externalReference){ + return withExternalReference(Operator.END_WITH, externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotEndingWith(String externalReference){ + return withExternalReference(Operator.NOT_END_WITH, externalReference); + } + + public SupplierOrderRequest withExternalReferenceIs(String externalReference){ + return withExternalReference(Operator.EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceSoundingLike(String externalReference){ + return withExternalReference(Operator.SOUNDS_LIKE, externalReference); + } + + + + public SupplierOrderRequest filterBySyncStatus(String... syncStatus){ + if (syncStatus == null || syncStatus.length == 0) { + throw new IllegalArgumentException("filterBySyncStatus parameter syncStatus cannot be empty"); + } + return appendSearchCriteria(createSyncStatusCriteria(Operator.EQUAL, (Object[])syncStatus)); + } + + public SupplierOrderRequest withSyncStatus(Operator operator, Object... values){ + return appendSearchCriteria(createSyncStatusCriteria(operator, values)); + } + + public SupplierOrderRequest withSyncStatusIsUnknown(){ + return withSyncStatus(Operator.IS_NULL); + } + + public SupplierOrderRequest withSyncStatusIsKnown(){ + return withSyncStatus(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSyncStatusCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.SYNC_STATUS_PROPERTY, operator, values); + } + + public SupplierOrderRequest withSyncStatusIsNot(String syncStatus){ + return withSyncStatus(Operator.NOT_EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusIn(String... syncStatus){ + return withSyncStatus(Operator.IN, (Object[])syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotIn(String... syncStatus){ + return withSyncStatus(Operator.NOT_IN, (Object[])syncStatus); + } + public SupplierOrderRequest withSyncStatusGreaterThan(String syncStatus){ + return withSyncStatus(Operator.GREATER_THAN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusGreaterThanOrEqualTo(String syncStatus){ + return withSyncStatus(Operator.GREATER_THAN_OR_EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusLessThan(String syncStatus){ + return withSyncStatus(Operator.LESS_THAN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusLessThanOrEqualTo(String syncStatus){ + return withSyncStatus(Operator.LESS_THAN_OR_EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusBetween(String startOfSyncStatus, String endOfSyncStatus){ + return withSyncStatus(Operator.BETWEEN, startOfSyncStatus, endOfSyncStatus); + } + public SupplierOrderRequest withSyncStatusStartingWith(String syncStatus){ + return withSyncStatus(Operator.BEGIN_WITH, syncStatus); + } + public SupplierOrderRequest withSyncStatusContaining(String syncStatus){ + return withSyncStatus(Operator.CONTAIN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotContaining(String syncStatus){ + return withSyncStatus(Operator.NOT_CONTAIN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotStartingWith(String syncStatus){ + return withSyncStatus(Operator.NOT_BEGIN_WITH, syncStatus); + } + + public SupplierOrderRequest withSyncStatusEndingWith(String syncStatus){ + return withSyncStatus(Operator.END_WITH, syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotEndingWith(String syncStatus){ + return withSyncStatus(Operator.NOT_END_WITH, syncStatus); + } + + public SupplierOrderRequest withSyncStatusIs(String syncStatus){ + return withSyncStatus(Operator.EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusSoundingLike(String syncStatus){ + return withSyncStatus(Operator.SOUNDS_LIKE, syncStatus); + } + + + + public SupplierOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SupplierOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SupplierOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SupplierOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.VERSION_PROPERTY, operator, values); + } + + public SupplierOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SupplierOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SupplierOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SupplierOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SupplierOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SupplierOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SupplierOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SupplierOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SupplierOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SupplierOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SupplierOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SupplierOrderRequest groupBySupplierWithDetails(){ + return groupBySupplierWithDetails(Q.suppliers().unlimited()); + } + + public SupplierOrderRequest groupBySupplierWithDetails(SupplierRequest subRequest){ + aggregate(SupplierOrder.SUPPLIER_PROPERTY, subRequest); + return this; + } + + + + + public SupplierOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SupplierOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.ID_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctSupplier(){ + return countDistinctSupplierAs("supplier_distinct_count"); + } + + public SupplierOrderRequest countDistinctSupplierAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctExternalReference(){ + return countDistinctExternalReferenceAs("external_reference_distinct_count"); + } + + public SupplierOrderRequest countDistinctExternalReferenceAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctSyncStatus(){ + return countDistinctSyncStatusAs("sync_status_distinct_count"); + } + + public SupplierOrderRequest countDistinctSyncStatusAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SupplierOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest groupById(){ + groupBy(SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByIdAs(String retName){ + groupBy(retName, SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.ID_PROPERTY, function); + return this; + } + public SupplierOrderRequest groupBySupplierWith(SupplierRequest subRequest){ + groupBy(SupplierOrder.SUPPLIER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySupplierWith", null, "supplier")); + return this; + } + public SupplierOrderRequest groupBySupplier(){ + groupBy(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySupplierAs(String retName){ + groupBy(retName, SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySupplierWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.SUPPLIER_PROPERTY, function); + return this; + } + + public SupplierOrderRequest groupByExternalReference(){ + groupBy(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByExternalReferenceAs(String retName){ + groupBy(retName, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByExternalReferenceWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, function); + return this; + } + + public SupplierOrderRequest groupBySyncStatus(){ + groupBy(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySyncStatusAs(String retName){ + groupBy(retName, SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySyncStatusWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.SYNC_STATUS_PROPERTY, function); + return this; + } + + public SupplierOrderRequest groupByVersion(){ + groupBy(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByVersionAs(String retName){ + groupBy(retName, SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.VERSION_PROPERTY, function); + return this; + } + + + + public SupplierOrderRequest orderByIdAscending(){ + addOrderByAscending(SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByIdDescending(){ + addOrderByDescending(SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySupplierAscending(){ + addOrderByAscending(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySupplierDescending(){ + addOrderByDescending(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByExternalReferenceAscending(){ + addOrderByAscending(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByExternalReferenceDescending(){ + addOrderByDescending(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest orderByExternalReferenceAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByExternalReferenceDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest orderBySyncStatusAscending(){ + addOrderByAscending(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySyncStatusDescending(){ + addOrderByDescending(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest orderBySyncStatusAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySyncStatusDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest orderByVersionAscending(){ + addOrderByAscending(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByVersionDescending(){ + addOrderByDescending(SupplierOrder.VERSION_PROPERTY); + return this; + } + + + public SupplierRequest rollUpToSupplier(){ + SupplierRequest supplier = Q.suppliers().unlimited(); + this.internalRollUpTo("supplier", supplier, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSupplier", null, "supplier")); + return supplier; + } + + + + + + public SupplierOrderRequest facetBySupplierAs(String facetName, SupplierRequest supplier){ + return facetBySupplierAs(facetName, supplier, true); + } + + public SupplierOrderRequest facetBySupplierAs(String facetName, SupplierRequest supplier, boolean includeAllFacets){ + addFacet(facetName, SupplierOrder.SUPPLIER_PROPERTY, supplier, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySupplierAs", facetName, SupplierOrder.SUPPLIER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SupplierOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SupplierOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SupplierOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SupplierOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SupplierOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SupplierOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..0fd6fbfda --- /dev/null +++ b/examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.supplierordersyncservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/pom.xml b/examples/http-resilience/java-app-console/pom.xml new file mode 100644 index 000000000..2605f875a --- /dev/null +++ b/examples/http-resilience/java-app-console/pom.xml @@ -0,0 +1,112 @@ + + + + 4.0.0 + + + io.teaql + teaql-java-parent + 6.3.0 + ../../../pom.xml + + com.teaql + supplier-order-sync-service + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-tool-http + + + junit + junit + test + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.teaql + supplier-order-sync-service-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.teaql.supplierordersyncservice.App + + + + + + + + \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/App.java b/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/App.java new file mode 100644 index 000000000..788f54139 --- /dev/null +++ b/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/App.java @@ -0,0 +1,99 @@ + +package com.teaql.supplierordersyncservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/CustomUserContext.java b/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/CustomUserContext.java new file mode 100644 index 000000000..76b539608 --- /dev/null +++ b/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.supplierordersyncservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements SupplierOrderSyncServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/WorkspaceTeaQLDatabase.java b/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..7ee479e98 --- /dev/null +++ b/examples/http-resilience/java-app-console/src/main/java/com/teaql/supplierordersyncservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.supplierordersyncservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/src/main/resources/application.properties b/examples/http-resilience/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..f337be0e1 --- /dev/null +++ b/examples/http-resilience/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:supplierordersyncservice.db diff --git a/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java b/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java new file mode 100644 index 000000000..6a13e7893 --- /dev/null +++ b/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java @@ -0,0 +1,205 @@ +package com.teaql.supplierordersyncservice; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpServer; +import io.teaql.core.UserContext; +import io.teaql.core.http.HttpObservation; +import io.teaql.core.http.HttpRequestFailure; +import io.teaql.core.http.HttpRequestService; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.tools.http.HttpServiceProfile; +import io.teaql.tools.http.JdkHttpRequestService; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import static org.junit.Assert.*; + +public class SupplierOrderSyncTest { + private static final String SUPPLIER_PROFILE = "supplier-orders"; + + private record Scenario(String name, int attempts, String status) { + String reference(String round) { return "SYNC-" + name + "-" + round; } + boolean canRetry() { return Set.of("retry", "failed", "cancel").contains(name); } + } + + private static final List SCENARIOS = List.of( + new Scenario("direct", 1, "acknowledged"), + new Scenario("retry", 2, "dispatched"), + new Scenario("failed", 2, "pending"), + new Scenario("cancel", 1, "pending"), + new Scenario("mismatch", 1, "pending")); + + private static void serve(HttpExchange exchange, String round, Map attempts, + CountDownLatch arrived, CountDownLatch release) throws IOException { + try (exchange) { + assertEquals("GET", exchange.getRequestMethod()); + assertEquals("probe=PRIVATE_QUERY_SYNC", exchange.getRequestURI().getRawQuery()); + String reference = exchange.getRequestURI().getPath().substring("/api/orders/".length()); + var scenario = SCENARIOS.stream().filter(item -> item.reference(round).equals(reference)) + .findFirst().orElseThrow(); + int attempt = attempts.merge(reference, 1, Integer::sum); + if (scenario.name().equals("cancel")) { + arrived.countDown(); + try { + assertTrue(release.await(8, TimeUnit.SECONDS)); + } catch (InterruptedException failure) { + Thread.currentThread().interrupt(); + } + return; + } + boolean unavailable = scenario.name().equals("failed") || (scenario.name().equals("retry") && attempt == 1); + boolean wrongOrder = scenario.name().equals("mismatch"); + var body = ("{\"reference\":\"" + (wrongOrder ? "OTHER-ORDER" : reference) + + "\",\"status\":\"" + scenario.status() + "\"}").getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().set("Content-Type", "application/json"); + exchange.sendResponseHeaders(unavailable ? 503 : 200, body.length); + exchange.getResponseBody().write(body); + } + } + + private static HttpRequestService.Call request(Scenario scenario, String reference) { + return new HttpRequestService.Call(SUPPLIER_PROFILE, HttpRequestService.Method.GET, + "orders/" + reference + "?probe=PRIVATE_QUERY_SYNC", Map.of(), null, null, + "Read dispatch status from the named supplier", HttpRequestService.IntentKind.PURPOSE, + "Reconcile the procurement order with supplier status", + scenario.canRetry() ? HttpRequestService.RetryMode.CONFIRMED_IDEMPOTENT + : HttpRequestService.RetryMode.NONE); + } + + private static void cancel(UserContext context, HttpRequestService.Call call, + CountDownLatch arrived, CountDownLatch release) throws InterruptedException { + var result = new AtomicReference(); + var worker = new Thread(() -> { + try { + context.httpRequests().execute(context, call); + } catch (Throwable failure) { + result.set(failure); + } + }); + worker.start(); + try { + assertTrue("The supplier must receive the order request before cancelling", + arrived.await(5, TimeUnit.SECONDS)); + worker.interrupt(); + worker.join(4000); + assertFalse(worker.isAlive()); + assertTrue(result.get() instanceof HttpRequestFailure); + assertEquals(HttpRequestFailure.Code.CANCELLED, ((HttpRequestFailure) result.get()).code()); + } finally { + release.countDown(); + if (worker.isAlive()) { + worker.interrupt(); + worker.join(8500); + } + assertFalse("The example owns the cancelled worker", worker.isAlive()); + } + } + + @Test public void applyOnlyTheMatchingSupplierResponseToThePersistedOrder() throws Exception { + String round = System.getenv("TEAQL_SHOWCASE_ROUND"); + var source = new SQLiteDataSource(); + source.setUrl("jdbc:sqlite:" + System.getenv("TEAQL_SUPPLIER_SYNC_DATABASE")); + var jdbc = new JdbcSqlExecutor(source); + var sqlite = new SqliteDataServiceExecutor("sqlite", jdbc, source); + var generator = new IdSpaceIdGenerator(new WorkspaceTeaQLDatabase(jdbc, source)); + generator.ensureIdSpaceTable(); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", sqlite).dataService("sqlite", sqlite) + .idGenerationService(generator).build().install(GeneratedRuntimeModule.module()); + var context = new DefaultUserContext(runtime); + context.ensureSchema(); + var supplier = Q.suppliersWithMinimalFields().withIdIs(1L).limit(1) + .comment("Read the model-initialized supplier").purpose("Link orders to the configured supplier") + .executeForOne(context); + assertNotNull(supplier); + + var attempts = new ConcurrentHashMap(); + var observed = new CopyOnWriteArrayList(); + var arrived = new CountDownLatch(1); + var release = new CountDownLatch(1); + var server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0); + server.createContext("/api/orders/", exchange -> serve(exchange, round, attempts, arrived, release)); + server.start(); + try { + var uri = URI.create("http://127.0.0.1:" + server.getAddress().getPort() + "/api/"); + var profile = HttpServiceProfile.builder(SUPPLIER_PROFILE, uri) + .budgets(Duration.ofSeconds(2), Duration.ofSeconds(7), Duration.ofSeconds(8)) + .retry(2, Duration.ofMillis(5), Set.of(HttpRequestService.Method.GET)).build(); + context.putAttribute(HttpRequestService.class.getName(), new JdkHttpRequestService(List.of(profile))); + context.putAttribute(HttpObservation.class.getName(), (HttpObservation) operation -> { + observed.add(operation); + return (outcome, number, elapsedMs) -> {}; + }); + var ids = new LinkedHashMap(); + for (var scenario : SCENARIOS) { + String reference = scenario.reference(round); + var order = Q.supplierOrders().comment("Create a procurement order to reconcile") + .purpose("Retain the pending supplier state until verification").newEntity(context); + order.updateSupplier(supplier); + order.updateExternalReference(reference); + order.updateSyncStatus("pending"); + order.auditAs("Record an order awaiting supplier status").save(context); + var call = request(scenario, E.supplierOrder(order).getExternalReference().eval()); + if (scenario.name().equals("cancel")) { + cancel(context, call, arrived, release); + } else { + var reply = context.httpRequests().execute(context, call); + assertEquals(scenario.attempts(), reply.attempts()); + var payload = (Map) reply.jsonValue(); + if (scenario.name().equals("failed")) { + assertEquals(503, reply.status()); + } else if (scenario.name().equals("mismatch")) { + assertEquals(200, reply.status()); + assertNotEquals(reference, payload.get("reference")); + } else { + assertEquals(200, reply.status()); + assertEquals(reference, payload.get("reference")); + assertEquals(scenario.status(), payload.get("status")); + order.updateSyncStatus((String) payload.get("status")); + order.auditAs("Apply the verified supplier status").save(context); + } + } + var stored = Q.supplierOrders().withIdIs(order.getId()).limit(1) + .comment("Read the order after the supplier call").purpose("Verify the local reconciliation") + .executeForOne(context); + var value = E.supplierOrder(stored); + assertEquals(reference, value.getExternalReference().eval()); + assertEquals(scenario.status(), value.getSyncStatus().eval()); + assertEquals(Long.valueOf(scenario.status().equals("pending") ? 1 : 2), stored.getVersion()); + assertEquals(Integer.valueOf(scenario.attempts()), attempts.get(reference)); + ids.put(scenario.name(), stored.getId()); + } + assertEquals(5, observed.size()); + assertFalse(observed.toString().contains("PRIVATE_QUERY_SYNC")); + assertEquals(7, attempts.values().stream().mapToInt(Integer::intValue).sum()); + Class type = com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class; + assertTrue(type.getProtectionDomain().getCodeSource().getLocation().toURI().getPath() + .endsWith("/java-lib-core/lib/target/classes/")); + var marker = Map.of("round", round, "orders", ids, "requests", 7, "cancelled", true); + System.out.println("SUPPLIER_ORDER_SYNC=" + new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(marker)); + } finally { + release.countDown(); + server.stop(0); + } + } +} diff --git a/examples/http-resilience/java-app-console/teaql-i18n.json b/examples/http-resilience/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..2bcc85b13 --- /dev/null +++ b/examples/http-resilience/java-app-console/teaql-i18n.json @@ -0,0 +1,106 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.supplierOrder.supplier": "Supplier", + "property.supplierOrder.externalReference": "External Reference", + "property.supplier.id": "Id", + "entity.supplier": "Supplier", + "property.supplierOrder.version": "Version", + "property.supplier.name": "Name", + "property.supplierOrder.id": "Id", + "entity.supplierOrder": "Supplier Order", + "property.supplier.version": "Version", + "property.supplierOrder.syncStatus": "Sync Status" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/teaql/checker-model.json b/examples/http-resilience/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..f9438a867 --- /dev/null +++ b/examples/http-resilience/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:e586b81a9295abcb4491692dac6cf1ef33839a688fea9a396db189f87f7120c5","entities":{"Supplier":{"labels":{"en":"Supplier"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"supplier_order_list","targetType":"SupplierOrder","labels":{"en":"Supplier Order"},"aliases":["SupplierOrderList","supplierOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SupplierOrder":{"labels":{"en":"Supplier Order"},"fields":[{"name":"external_reference","labels":{"en":"external reference"},"aliases":["ExternalReference","externalReference"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"supplier","targetType":"Supplier","labels":{"en":"Supplier"},"aliases":["Supplier"]},{"name":"sync_status","labels":{"en":"sync status"},"aliases":["SyncStatus","syncStatus"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/teaql/model-provenance.json b/examples/http-resilience/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..b8c5db0b1 --- /dev/null +++ b/examples/http-resilience/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:fefade494b361e037f7727f5922da19509dae9d2243eff472be95ba80791abe7","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/pom.xml b/examples/http-resilience/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..4ccfeed59 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.teaql + supplier-order-sync-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java new file mode 100644 index 000000000..0fb961888 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.supplierordersyncservice; + +import com.teaql.supplierordersyncservice.supplier.Supplier; + +public interface Constants { + public static final long SUPPLIER_ID = 1l; + public static final Supplier SUPPLIER = Supplier.refer(SUPPLIER_ID); +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/E.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/E.java new file mode 100644 index 000000000..93485513e --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/E.java @@ -0,0 +1,18 @@ + +package com.teaql.supplierordersyncservice; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierExpression; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static SupplierExpression supplier(Supplier supplier){ + return new SupplierExpression(new ValueExpression(supplier, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.supplier()")); + } + public static SupplierOrderExpression supplierOrder(SupplierOrder supplierOrder){ + return new SupplierOrderExpression(new ValueExpression(supplierOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.supplierOrder()")); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java new file mode 100644 index 000000000..eed1abe4a --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java @@ -0,0 +1,297 @@ + +package com.teaql.supplierordersyncservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerSupplier(); + registerSupplierOrder(); + } + private void registerSupplier() { + FieldLayout.installGenerated(com.teaql.supplierordersyncservice.supplier.Supplier.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.supplierordersyncservice.supplier.Supplier.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.supplierordersyncservice.supplier.Supplier.class); + entityDescriptor.setEntitySupplier(com.teaql.supplierordersyncservice.supplier.Supplier::new); + entityDescriptor.with("name", "Supplier") + + .with("module", "Procurement") + + .with("module_key", "procurement") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Regional Supply Co") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerSupplierOrder() { + FieldLayout.installGenerated(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder::new); + entityDescriptor.with("name", "Supplier Order") + + .with("module", "Procurement") + + .with("module_key", "procurement") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor supplier = + entityDescriptor.addObjectProperty($factory, com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SUPPLIER_PROPERTY, com.teaql.supplierordersyncservice.supplier.Supplier.INTERNAL_TYPE, com.teaql.supplierordersyncservice.supplier.Supplier.SUPPLIER_ORDER_LIST_PROPERTY, com.teaql.supplierordersyncservice.supplier.Supplier.class) + ; + PropertyDescriptor externalReference = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, String.class) + ; + PropertyDescriptor syncStatus = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SUPPLIER_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..807a48c11 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java @@ -0,0 +1,37 @@ +package com.teaql.supplierordersyncservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.supplierordersyncservice.supplier.SupplierChecker(), new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:e586b81a9295abcb4491692dac6cf1ef33839a688fea9a396db189f87f7120c5\",\"entities\":{\"Supplier\":{\"labels\":{\"en\":\"Supplier\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"supplier_order_list\",\"targetType\":\"SupplierOrder\",\"labels\":{\"en\":\"Supplier Order\"},\"aliases\":[\"SupplierOrderList\",\"supplierOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SupplierOrder\":{\"labels\":{\"en\":\"Supplier Order\"},\"fields\":[{\"name\":\"external_reference\",\"labels\":{\"en\":\"external reference\"},\"aliases\":[\"ExternalReference\",\"externalReference\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"supplier\",\"targetType\":\"Supplier\",\"labels\":{\"en\":\"Supplier\"},\"aliases\":[\"Supplier\"]},{\"name\":\"sync_status\",\"labels\":{\"en\":\"sync status\"},\"aliases\":[\"SyncStatus\",\"syncStatus\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Supplier", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("SupplierOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("supplier", "supplier"), java.util.Map.entry("external_reference", "externalReference"), java.util.Map.entry("sync_status", "syncStatus"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.suppliers().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.supplierordersyncservice.supplier.Supplier domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.supplierordersyncservice.supplier.Supplier(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Regional Supply Co"); + domainRoot.auditAs("create generated Domain Root Supplier").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Supplier", domainRoot.getId())); + } +} diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java new file mode 100644 index 000000000..f3b2f6042 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java @@ -0,0 +1,25 @@ + +package com.teaql.supplierordersyncservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.supplierordersyncservice.supplier.SupplierRequest suppliers(){ + return new com.teaql.supplierordersyncservice.supplier.SupplierRequest(com.teaql.supplierordersyncservice.supplier.Supplier.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.supplierordersyncservice.supplier.SupplierRequest suppliersWithMinimalFields(){ + return new com.teaql.supplierordersyncservice.supplier.SupplierRequest(com.teaql.supplierordersyncservice.supplier.Supplier.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest supplierOrders(){ + return new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest supplierOrdersWithMinimalFields(){ + return new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java new file mode 100644 index 000000000..6ef861b4e --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.supplierordersyncservice; + +import io.teaql.core.UserContext; +public interface SupplierOrderSyncServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java new file mode 100644 index 000000000..7b9fd781b --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java @@ -0,0 +1,130 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Supplier extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Supplier"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "235b3035c863f7dc4a320bb8cc07e1eb0f61b36fab66ddcf3dc268357a9d89e8"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "supplier_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Supplier.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String SUPPLIER_ORDER_LIST_PROPERTY = "supplier_order_list"; + private String name; + + private SmartList supplierOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getSupplierOrderList(){ + return this.supplierOrderList == null ? SmartList.unloaded() : this.supplierOrderList; + } + public Supplier updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Supplier addSupplierOrder(SupplierOrder supplierOrder){ + if (supplierOrder == null){ + return this; + } + + if(null == this.supplierOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.supplierOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.supplierOrderList.add(supplierOrder); + supplierOrder.updateSupplier(this); + return this; + } + + public static Supplier refer(Long id){ + Supplier refer = new Supplier(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Supplier comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "supplier_order_list": this.supplierOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "supplier_order_list": return this.supplierOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java new file mode 100644 index 000000000..29015ca4d --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java @@ -0,0 +1,52 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SupplierChecker implements Checker{ + + public String type(){ + return Supplier.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ + if(needCheck(_context, supplier)){ + markAsChecked(_context, supplier); + doCheck(_context, supplier, _parentLocation); + } + } + + public void doCheck(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ + if((supplier == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, supplier); + if(supplier.needPersist()){ + } + if(supplier.newItem()){ + }else if(supplier.updateItem()){ + if(!supplier.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, supplier.getProperty(Supplier.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; supplier.getSupplierOrderList() != null && i < supplier.getSupplierOrderList().size(); i++){ + SupplierOrder supplierOrder = supplier.getSupplierOrderList().get(i); + new SupplierOrderChecker().checkAndFix(_context, supplierOrder, newLocation(_parentLocation, "supplier_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java new file mode 100644 index 000000000..c5287235b --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java @@ -0,0 +1,51 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SupplierExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SupplierExpression(Expression expression){ + super(expression); + } + + public SupplierExpression(Expression expression, Function function){ + super(expression, function); + } + + public SupplierExpression updateId(Long id){ + return new SupplierExpression(this, $it -> {((Supplier)$it).__internalSet("id", id); return this;}); + } + + public SupplierExpression save(UserContext userContext){ + return new SupplierExpression(this, $it -> ((Supplier)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SupplierExpression save(String intent, UserContext userContext){ + return new SupplierExpression(this, $it -> ((Supplier)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Supplier::getName); + } + public SupplierExpression updateName(String name){ + return new SupplierExpression(this, $it -> ((Supplier)$it).updateName(name)); + } + + public SupplierOrderListExpression getSupplierOrderList(){ + return new SupplierOrderListExpression(loaded("supplier_order_list", "getSupplierOrderList", Supplier::getSupplierOrderList)); + } + public SupplierExpression addSupplierOrder(SupplierOrder supplierOrder){ + return new SupplierExpression(this, $it -> ((Supplier)$it).addSupplierOrder(supplierOrder)); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java new file mode 100644 index 000000000..da446b513 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SupplierListExpression extends SmartListExpression { + public SupplierListExpression(Expression> expression){ + super(expression); + } + + public SupplierListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SupplierExpression first() { + return new SupplierExpression(super.first()); + } + + public SupplierExpression get(int index) { + return new SupplierExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java new file mode 100644 index 000000000..6de102641 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java @@ -0,0 +1,623 @@ + +package com.teaql.supplierordersyncservice.supplier; + +import com.teaql.supplierordersyncservice.Q; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SupplierRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SupplierRequest(Class returnType){ + this(returnType, () -> (T) new Supplier()); + } + + protected SupplierRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SupplierRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SupplierRequest copy(){ + return (SupplierRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SupplierRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SupplierRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SupplierRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SupplierRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SupplierRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SupplierRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SupplierRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SupplierRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SupplierRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SupplierRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SupplierRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SupplierRequest)super.appendSearchCriteria(searchCriteria); + } + + public SupplierRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SupplierRequest matchingAnyOf(SupplierRequest supplier){ + super.internalMatchAny(supplier); + return this; + } + + public SupplierRequest matchingIdsOf(SupplierRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Supplier.ID_PROPERTY, request, Supplier.ID_PROPERTY)); + } + + public SupplierRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SupplierRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SupplierRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SupplierRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public SupplierRequest selectSelfFields(){ + return selectSelf(); + } + + public SupplierRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Supplier.ID_PROPERTY); + selectProperty(Supplier.NAME_PROPERTY); + selectProperty(Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public SupplierRequest selectChildren(){ + super.selectAny(); + selectSupplierOrderList(); + return selectId().selectName().selectVersion(); + } + + + public SupplierRequest selectId(){ + selectProperty(Supplier.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierRequest unselectId(){ + unselectProperty(Supplier.ID_PROPERTY); + return this; + } + public SupplierRequest selectName(){ + selectProperty(Supplier.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierRequest unselectName(){ + unselectProperty(Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest selectVersion(){ + selectProperty(Supplier.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierRequest unselectVersion(){ + unselectProperty(Supplier.VERSION_PROPERTY); + return this; + } + public SupplierRequest selectSupplierOrderList(){ + return selectSupplierOrderListWith(Q.supplierOrders().selectSelf()); + } + + public SupplierRequest selectSupplierOrderListWith(SupplierOrderRequest supplierOrderList){ + enhanceRelation(Supplier.SUPPLIER_ORDER_LIST_PROPERTY, supplierOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSupplierOrderListWith", null, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Supplier.ID_PROPERTY, operator, values); + } + + public SupplierRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SupplierRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SupplierRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SupplierRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SupplierRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public SupplierRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public SupplierRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public SupplierRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Supplier.NAME_PROPERTY, operator, values); + } + + public SupplierRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public SupplierRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public SupplierRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public SupplierRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public SupplierRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public SupplierRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public SupplierRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public SupplierRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public SupplierRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public SupplierRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public SupplierRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public SupplierRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public SupplierRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public SupplierRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public SupplierRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public SupplierRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public SupplierRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SupplierRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SupplierRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SupplierRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Supplier.VERSION_PROPERTY, operator, values); + } + + public SupplierRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SupplierRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SupplierRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SupplierRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SupplierRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SupplierRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SupplierRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SupplierRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SupplierRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public SupplierRequest withSupplierOrderListMatching(SupplierOrderRequest supplierOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Supplier.ID_PROPERTY, supplierOrderRequest, SupplierOrder.SUPPLIER_PROPERTY)); + } + + public SupplierRequest withoutSupplierOrderListMatching(SupplierOrderRequest supplierOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Supplier.ID_PROPERTY, supplierOrderRequest, SupplierOrder.SUPPLIER_PROPERTY))); + } + + public SupplierRequest haveSupplierOrders(){ + return withSupplierOrderListMatching(Q.supplierOrders().unlimited()); + } + + public SupplierRequest haveNoSupplierOrders(){ + return withoutSupplierOrderListMatching(Q.supplierOrders().unlimited()); + } + + public SupplierRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SupplierRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SupplierRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SupplierRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Supplier.ID_PROPERTY); + return this; + } + public SupplierRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public SupplierRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SupplierRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Supplier.VERSION_PROPERTY); + return this; + } + public SupplierRequest groupBySupplierOrdersWithDetails(SupplierOrderRequest subRequest){ + aggregate(Supplier.SUPPLIER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public SupplierRequest groupById(){ + groupBy(Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest groupByIdAs(String retName){ + groupBy(retName, Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Supplier.ID_PROPERTY, function); + return this; + } + + public SupplierRequest groupByName(){ + groupBy(Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest groupByNameAs(String retName){ + groupBy(retName, Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Supplier.NAME_PROPERTY, function); + return this; + } + + public SupplierRequest groupByVersion(){ + groupBy(Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest groupByVersionAs(String retName){ + groupBy(retName, Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Supplier.VERSION_PROPERTY, function); + return this; + } + + + + public SupplierRequest orderByIdAscending(){ + addOrderByAscending(Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest orderByIdDescending(){ + addOrderByDescending(Supplier.ID_PROPERTY); + return this; + } + + public SupplierRequest orderByNameAscending(){ + addOrderByAscending(Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest orderByNameDescending(){ + addOrderByDescending(Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Supplier.NAME_PROPERTY); + return this; + } + + public SupplierRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Supplier.NAME_PROPERTY); + return this; + } + public SupplierRequest orderByVersionAscending(){ + addOrderByAscending(Supplier.VERSION_PROPERTY); + return this; + } + + public SupplierRequest orderByVersionDescending(){ + addOrderByDescending(Supplier.VERSION_PROPERTY); + return this; + } + + + public SupplierRequest statsFromSupplierOrdersAs(String name, SupplierOrderRequest subRequest){ + return statsFromSupplierOrdersAs(name, subRequest, false); + } + + public SupplierRequest statsFromSupplierOrdersAs(String name, SupplierOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, SupplierOrder.SUPPLIER_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSupplierOrdersAs", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest statsFromSupplierOrders(SupplierOrderRequest subRequest){ + return statsFromSupplierOrdersAs(REFINEMENTS, subRequest); + } + public SupplierRequest countSupplierOrders(){ + addRelationCount("Count", Q.supplierOrders().unlimited(), SupplierOrder.SUPPLIER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrders", null, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest countSupplierOrdersAs(String name){ + addRelationCount(name, Q.supplierOrders().unlimited(), SupplierOrder.SUPPLIER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrdersAs", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + public SupplierRequest countSupplierOrdersWith(String name, SupplierOrderRequest subRequest){ + addRelationCount(name, subRequest, SupplierOrder.SUPPLIER_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrdersWith", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public SupplierRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SupplierRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SupplierRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SupplierRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SupplierRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SupplierRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java new file mode 100644 index 000000000..46e89b872 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java @@ -0,0 +1,149 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class SupplierOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "SupplierOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c0177bc460393fa876fee1a230cdfe3c9269b316b16a102e12484e7b39e1a67f"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("supplier", 1), java.util.Map.entry("external_reference", 2), java.util.Map.entry("sync_status", 3), java.util.Map.entry("version", 4)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("supplier", java.util.List.of("supplier", "supplier")), java.util.Map.entry("external_reference", java.util.List.of("externalReference", "external_reference")), java.util.Map.entry("sync_status", java.util.List.of("syncStatus", "sync_status")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + SupplierOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String SUPPLIER_PROPERTY = "supplier"; + public static final String EXTERNAL_REFERENCE_PROPERTY = "external_reference"; + public static final String SYNC_STATUS_PROPERTY = "sync_status"; + private Supplier supplier; + + private String externalReference; + + private String syncStatus; + + + public Supplier getSupplier(){ + return this.supplier; + } + + public String getExternalReference(){ + return this.externalReference; + } + + public String getSyncStatus(){ + return this.syncStatus; + } + + public SupplierOrder updateSupplier(Supplier supplier){ + if(isPropertyLoaded(SUPPLIER_PROPERTY) && Objects.equals(this.supplier, supplier)){ + return this; + } + handleUpdate(SUPPLIER_PROPERTY, getSupplier(), supplier); + this.supplier = supplier; + return this; + } + + public SupplierOrder updateExternalReference(String externalReference){ + externalReference = (externalReference == null ? null : externalReference.trim()); + if(isPropertyLoaded(EXTERNAL_REFERENCE_PROPERTY) && Objects.equals(this.externalReference, externalReference)){ + return this; + } + handleUpdate(EXTERNAL_REFERENCE_PROPERTY, getExternalReference(), externalReference); + this.externalReference = externalReference; + return this; + } + + public SupplierOrder updateSyncStatus(String syncStatus){ + syncStatus = (syncStatus == null ? null : syncStatus.trim()); + if(isPropertyLoaded(SYNC_STATUS_PROPERTY) && Objects.equals(this.syncStatus, syncStatus)){ + return this; + } + handleUpdate(SYNC_STATUS_PROPERTY, getSyncStatus(), syncStatus); + this.syncStatus = syncStatus; + return this; + } + + + public static SupplierOrder refer(Long id){ + SupplierOrder refer = new SupplierOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public SupplierOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "supplier": this.supplier = (Supplier) value; break; + + case "external_reference": this.externalReference = (value == null ? null : ((String)value).trim()); break; + + case "sync_status": this.syncStatus = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "supplier": return this.supplier; + case "external_reference": return this.externalReference; + case "sync_status": return this.syncStatus; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "supplier": return this.supplier; + case "externalReference": return this.externalReference; + case "syncStatus": return this.syncStatus; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java new file mode 100644 index 000000000..3ae0777a2 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java @@ -0,0 +1,71 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class SupplierOrderChecker implements Checker{ + + public String type(){ + return SupplierOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, SupplierOrder supplierOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, supplierOrder)){ + markAsChecked(_context, supplierOrder); + doCheck(_context, supplierOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, SupplierOrder supplierOrder, ObjectLocation _parentLocation){ + if((supplierOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, supplierOrder); + if(supplierOrder.needPersist()){ + } + if(supplierOrder.newItem()){ + }else if(supplierOrder.updateItem()){ + if(!supplierOrder.isPropertyLoaded("supplier")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "supplier"), "Mutation requires a fully loaded entity"); + } + if(!supplierOrder.isPropertyLoaded("external_reference")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "external_reference"), "Mutation requires a fully loaded entity"); + } + if(!supplierOrder.isPropertyLoaded("sync_status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "sync_status"), "Mutation requires a fully loaded entity"); + } + + } + checkSupplier(_context, supplierOrder.getProperty(SupplierOrder.SUPPLIER_PROPERTY), newLocation(_parentLocation, "supplier")); + checkExternalReference(_context, supplierOrder.getProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY), newLocation(_parentLocation, "external_reference")); + checkSyncStatus(_context, supplierOrder.getProperty(SupplierOrder.SYNC_STATUS_PROPERTY), newLocation(_parentLocation, "sync_status")); + } + + public void checkSupplier(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, supplier); + if((supplier == null)){ + return; + } + new SupplierChecker().checkAndFix(_context, supplier, _parentLocation); + } + public void checkExternalReference(UserContext _context, String externalReference, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, externalReference); + if((externalReference == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, externalReference); + + } + public void checkSyncStatus(UserContext _context, String syncStatus, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, syncStatus); + if((syncStatus == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, syncStatus); + + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java new file mode 100644 index 000000000..b4f7739d3 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java @@ -0,0 +1,60 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class SupplierOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public SupplierOrderExpression(Expression expression){ + super(expression); + } + + public SupplierOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public SupplierOrderExpression updateId(Long id){ + return new SupplierOrderExpression(this, $it -> {((SupplierOrder)$it).__internalSet("id", id); return this;}); + } + + public SupplierOrderExpression save(UserContext userContext){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public SupplierOrderExpression save(String intent, UserContext userContext){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public SupplierExpression getSupplier(){ + return new SupplierExpression(loaded("supplier", "getSupplier", SupplierOrder::getSupplier)); + } + + public SupplierOrderExpression updateSupplier(Supplier supplier){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateSupplier(supplier)); + } + + public Expression getExternalReference(){ + return loaded("external_reference", "getExternalReference", SupplierOrder::getExternalReference); + } + public SupplierOrderExpression updateExternalReference(String externalReference){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateExternalReference(externalReference)); + } + + public Expression getSyncStatus(){ + return loaded("sync_status", "getSyncStatus", SupplierOrder::getSyncStatus); + } + public SupplierOrderExpression updateSyncStatus(String syncStatus){ + return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateSyncStatus(syncStatus)); + } + +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java new file mode 100644 index 000000000..7d3b6d399 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class SupplierOrderListExpression extends SmartListExpression { + public SupplierOrderListExpression(Expression> expression){ + super(expression); + } + + public SupplierOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public SupplierOrderExpression first() { + return new SupplierOrderExpression(super.first()); + } + + public SupplierOrderExpression get(int index) { + return new SupplierOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java new file mode 100644 index 000000000..080da4fc8 --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java @@ -0,0 +1,836 @@ + +package com.teaql.supplierordersyncservice.supplierorder; + +import com.teaql.supplierordersyncservice.Q; +import com.teaql.supplierordersyncservice.supplier.Supplier; +import com.teaql.supplierordersyncservice.supplier.SupplierRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class SupplierOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public SupplierOrderRequest(Class returnType){ + this(returnType, () -> (T) new SupplierOrder()); + } + + protected SupplierOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public SupplierOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public SupplierOrderRequest copy(){ + return (SupplierOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new SupplierOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public SupplierOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public SupplierOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public SupplierOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public SupplierOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public SupplierOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public SupplierOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public SupplierOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public SupplierOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public SupplierOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public SupplierOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (SupplierOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public SupplierOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public SupplierOrderRequest matchingAnyOf(SupplierOrderRequest supplierOrder){ + super.internalMatchAny(supplierOrder); + return this; + } + + public SupplierOrderRequest matchingIdsOf(SupplierOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + SupplierOrder.ID_PROPERTY, request, SupplierOrder.ID_PROPERTY)); + } + + public SupplierOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public SupplierOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public SupplierOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public SupplierOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectSupplierIdOnly().selectExternalReference().selectSyncStatus().selectVersion(); + } + + public SupplierOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public SupplierOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(SupplierOrder.ID_PROPERTY); + selectProperty(SupplierOrder.SUPPLIER_PROPERTY); + selectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + selectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); + selectProperty(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectSupplier().selectExternalReference().selectSyncStatus().selectVersion(); + } + + public SupplierOrderRequest selectChildren(){ + super.selectAny(); + return selectId().selectSupplier().selectExternalReference().selectSyncStatus().selectVersion(); + } + + + public SupplierOrderRequest selectId(){ + selectProperty(SupplierOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectId(){ + unselectProperty(SupplierOrder.ID_PROPERTY); + return this; + } + public SupplierOrderRequest selectSupplierIdOnly(){ + selectProperty(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest selectSupplier(){ + return selectSupplierWith(Q.suppliers().unlimited().selectSelf()); + } + + public SupplierOrderRequest selectSupplierWith(SupplierRequest supplier){ + selectProperty(SupplierOrder.SUPPLIER_PROPERTY); + enhanceRelation(SupplierOrder.SUPPLIER_PROPERTY, supplier, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSupplierWith", null, SupplierOrder.SUPPLIER_PROPERTY)); + return this; + } + + public SupplierOrderRequest unselectSupplier(){ + unselectProperty(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + public SupplierOrderRequest selectExternalReference(){ + selectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + /** + * fill the externalReference with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS externalReference) to fetch externalReference property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectExternalReference(){ + unselectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest selectSyncStatus(){ + selectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + /** + * fill the syncStatus with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS syncStatus) to fetch syncStatus property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectSyncStatus(){ + unselectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest selectVersion(){ + selectProperty(SupplierOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public SupplierOrderRequest unselectVersion(){ + unselectProperty(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.ID_PROPERTY, operator, values); + } + + public SupplierOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public SupplierOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public SupplierOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public SupplierOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public SupplierOrderRequest filterBySupplier(Supplier... supplier){ + if (supplier == null || supplier.length == 0) { + throw new IllegalArgumentException("filterBySupplier parameter supplier cannot be empty"); + } + return appendSearchCriteria(createSupplierCriteria(Operator.EQUAL, (Object[])supplier)); + } + + public SupplierOrderRequest withSupplier(Operator operator, Object... values){ + return appendSearchCriteria(createSupplierCriteria(operator, values)); + } + + public SupplierOrderRequest withSupplierIsUnknown(){ + return withSupplier(Operator.IS_NULL); + } + + public SupplierOrderRequest withSupplierIsKnown(){ + return withSupplier(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSupplierCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, operator, values); + } + + public SupplierOrderRequest filterBySupplier(Long supplier){ + if(supplier == null){ + return this; + } + return withSupplier(Operator.EQUAL, supplier); + } + public SupplierOrderRequest withSupplierMatching(SupplierRequest supplier){ + return appendSearchCriteria(new SubQuerySearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, supplier, Supplier.ID_PROPERTY)); + } + + public SupplierOrderRequest withoutSupplierMatching(SupplierRequest supplier){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, supplier, Supplier.ID_PROPERTY))); + } + + public SupplierOrderRequest filterByExternalReference(String... externalReference){ + if (externalReference == null || externalReference.length == 0) { + throw new IllegalArgumentException("filterByExternalReference parameter externalReference cannot be empty"); + } + return appendSearchCriteria(createExternalReferenceCriteria(Operator.EQUAL, (Object[])externalReference)); + } + + public SupplierOrderRequest withExternalReference(Operator operator, Object... values){ + return appendSearchCriteria(createExternalReferenceCriteria(operator, values)); + } + + public SupplierOrderRequest withExternalReferenceIsUnknown(){ + return withExternalReference(Operator.IS_NULL); + } + + public SupplierOrderRequest withExternalReferenceIsKnown(){ + return withExternalReference(Operator.IS_NOT_NULL); + } + + public SearchCriteria createExternalReferenceCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, operator, values); + } + + public SupplierOrderRequest withExternalReferenceIsNot(String externalReference){ + return withExternalReference(Operator.NOT_EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceIn(String... externalReference){ + return withExternalReference(Operator.IN, (Object[])externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotIn(String... externalReference){ + return withExternalReference(Operator.NOT_IN, (Object[])externalReference); + } + public SupplierOrderRequest withExternalReferenceGreaterThan(String externalReference){ + return withExternalReference(Operator.GREATER_THAN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceGreaterThanOrEqualTo(String externalReference){ + return withExternalReference(Operator.GREATER_THAN_OR_EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceLessThan(String externalReference){ + return withExternalReference(Operator.LESS_THAN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceLessThanOrEqualTo(String externalReference){ + return withExternalReference(Operator.LESS_THAN_OR_EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceBetween(String startOfExternalReference, String endOfExternalReference){ + return withExternalReference(Operator.BETWEEN, startOfExternalReference, endOfExternalReference); + } + public SupplierOrderRequest withExternalReferenceStartingWith(String externalReference){ + return withExternalReference(Operator.BEGIN_WITH, externalReference); + } + public SupplierOrderRequest withExternalReferenceContaining(String externalReference){ + return withExternalReference(Operator.CONTAIN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotContaining(String externalReference){ + return withExternalReference(Operator.NOT_CONTAIN, externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotStartingWith(String externalReference){ + return withExternalReference(Operator.NOT_BEGIN_WITH, externalReference); + } + + public SupplierOrderRequest withExternalReferenceEndingWith(String externalReference){ + return withExternalReference(Operator.END_WITH, externalReference); + } + + public SupplierOrderRequest withExternalReferenceNotEndingWith(String externalReference){ + return withExternalReference(Operator.NOT_END_WITH, externalReference); + } + + public SupplierOrderRequest withExternalReferenceIs(String externalReference){ + return withExternalReference(Operator.EQUAL, externalReference); + } + + public SupplierOrderRequest withExternalReferenceSoundingLike(String externalReference){ + return withExternalReference(Operator.SOUNDS_LIKE, externalReference); + } + + + + public SupplierOrderRequest filterBySyncStatus(String... syncStatus){ + if (syncStatus == null || syncStatus.length == 0) { + throw new IllegalArgumentException("filterBySyncStatus parameter syncStatus cannot be empty"); + } + return appendSearchCriteria(createSyncStatusCriteria(Operator.EQUAL, (Object[])syncStatus)); + } + + public SupplierOrderRequest withSyncStatus(Operator operator, Object... values){ + return appendSearchCriteria(createSyncStatusCriteria(operator, values)); + } + + public SupplierOrderRequest withSyncStatusIsUnknown(){ + return withSyncStatus(Operator.IS_NULL); + } + + public SupplierOrderRequest withSyncStatusIsKnown(){ + return withSyncStatus(Operator.IS_NOT_NULL); + } + + public SearchCriteria createSyncStatusCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.SYNC_STATUS_PROPERTY, operator, values); + } + + public SupplierOrderRequest withSyncStatusIsNot(String syncStatus){ + return withSyncStatus(Operator.NOT_EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusIn(String... syncStatus){ + return withSyncStatus(Operator.IN, (Object[])syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotIn(String... syncStatus){ + return withSyncStatus(Operator.NOT_IN, (Object[])syncStatus); + } + public SupplierOrderRequest withSyncStatusGreaterThan(String syncStatus){ + return withSyncStatus(Operator.GREATER_THAN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusGreaterThanOrEqualTo(String syncStatus){ + return withSyncStatus(Operator.GREATER_THAN_OR_EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusLessThan(String syncStatus){ + return withSyncStatus(Operator.LESS_THAN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusLessThanOrEqualTo(String syncStatus){ + return withSyncStatus(Operator.LESS_THAN_OR_EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusBetween(String startOfSyncStatus, String endOfSyncStatus){ + return withSyncStatus(Operator.BETWEEN, startOfSyncStatus, endOfSyncStatus); + } + public SupplierOrderRequest withSyncStatusStartingWith(String syncStatus){ + return withSyncStatus(Operator.BEGIN_WITH, syncStatus); + } + public SupplierOrderRequest withSyncStatusContaining(String syncStatus){ + return withSyncStatus(Operator.CONTAIN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotContaining(String syncStatus){ + return withSyncStatus(Operator.NOT_CONTAIN, syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotStartingWith(String syncStatus){ + return withSyncStatus(Operator.NOT_BEGIN_WITH, syncStatus); + } + + public SupplierOrderRequest withSyncStatusEndingWith(String syncStatus){ + return withSyncStatus(Operator.END_WITH, syncStatus); + } + + public SupplierOrderRequest withSyncStatusNotEndingWith(String syncStatus){ + return withSyncStatus(Operator.NOT_END_WITH, syncStatus); + } + + public SupplierOrderRequest withSyncStatusIs(String syncStatus){ + return withSyncStatus(Operator.EQUAL, syncStatus); + } + + public SupplierOrderRequest withSyncStatusSoundingLike(String syncStatus){ + return withSyncStatus(Operator.SOUNDS_LIKE, syncStatus); + } + + + + public SupplierOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public SupplierOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public SupplierOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public SupplierOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(SupplierOrder.VERSION_PROPERTY, operator, values); + } + + public SupplierOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public SupplierOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public SupplierOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public SupplierOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public SupplierOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public SupplierOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public SupplierOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public SupplierOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public SupplierOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public SupplierOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public SupplierOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public SupplierOrderRequest groupBySupplierWithDetails(){ + return groupBySupplierWithDetails(Q.suppliers().unlimited()); + } + + public SupplierOrderRequest groupBySupplierWithDetails(SupplierRequest subRequest){ + aggregate(SupplierOrder.SUPPLIER_PROPERTY, subRequest); + return this; + } + + + + + public SupplierOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public SupplierOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.ID_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctSupplier(){ + return countDistinctSupplierAs("supplier_distinct_count"); + } + + public SupplierOrderRequest countDistinctSupplierAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctExternalReference(){ + return countDistinctExternalReferenceAs("external_reference_distinct_count"); + } + + public SupplierOrderRequest countDistinctExternalReferenceAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctSyncStatus(){ + return countDistinctSyncStatusAs("sync_status_distinct_count"); + } + + public SupplierOrderRequest countDistinctSyncStatusAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public SupplierOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest groupById(){ + groupBy(SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByIdAs(String retName){ + groupBy(retName, SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.ID_PROPERTY, function); + return this; + } + public SupplierOrderRequest groupBySupplierWith(SupplierRequest subRequest){ + groupBy(SupplierOrder.SUPPLIER_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySupplierWith", null, "supplier")); + return this; + } + public SupplierOrderRequest groupBySupplier(){ + groupBy(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySupplierAs(String retName){ + groupBy(retName, SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySupplierWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.SUPPLIER_PROPERTY, function); + return this; + } + + public SupplierOrderRequest groupByExternalReference(){ + groupBy(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByExternalReferenceAs(String retName){ + groupBy(retName, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByExternalReferenceWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, function); + return this; + } + + public SupplierOrderRequest groupBySyncStatus(){ + groupBy(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySyncStatusAs(String retName){ + groupBy(retName, SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest groupBySyncStatusWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.SYNC_STATUS_PROPERTY, function); + return this; + } + + public SupplierOrderRequest groupByVersion(){ + groupBy(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByVersionAs(String retName){ + groupBy(retName, SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, SupplierOrder.VERSION_PROPERTY, function); + return this; + } + + + + public SupplierOrderRequest orderByIdAscending(){ + addOrderByAscending(SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByIdDescending(){ + addOrderByDescending(SupplierOrder.ID_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySupplierAscending(){ + addOrderByAscending(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySupplierDescending(){ + addOrderByDescending(SupplierOrder.SUPPLIER_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByExternalReferenceAscending(){ + addOrderByAscending(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByExternalReferenceDescending(){ + addOrderByDescending(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest orderByExternalReferenceAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByExternalReferenceDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); + return this; + } + public SupplierOrderRequest orderBySyncStatusAscending(){ + addOrderByAscending(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySyncStatusDescending(){ + addOrderByDescending(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest orderBySyncStatusAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + + public SupplierOrderRequest orderBySyncStatusDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(SupplierOrder.SYNC_STATUS_PROPERTY); + return this; + } + public SupplierOrderRequest orderByVersionAscending(){ + addOrderByAscending(SupplierOrder.VERSION_PROPERTY); + return this; + } + + public SupplierOrderRequest orderByVersionDescending(){ + addOrderByDescending(SupplierOrder.VERSION_PROPERTY); + return this; + } + + + public SupplierRequest rollUpToSupplier(){ + SupplierRequest supplier = Q.suppliers().unlimited(); + this.internalRollUpTo("supplier", supplier, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSupplier", null, "supplier")); + return supplier; + } + + + + + + public SupplierOrderRequest facetBySupplierAs(String facetName, SupplierRequest supplier){ + return facetBySupplierAs(facetName, supplier, true); + } + + public SupplierOrderRequest facetBySupplierAs(String facetName, SupplierRequest supplier, boolean includeAllFacets){ + addFacet(facetName, SupplierOrder.SUPPLIER_PROPERTY, supplier, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySupplierAs", facetName, SupplierOrder.SUPPLIER_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public SupplierOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public SupplierOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public SupplierOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public SupplierOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public SupplierOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public SupplierOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/http-resilience/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..0fd6fbfda --- /dev/null +++ b/examples/http-resilience/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.supplierordersyncservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/teaql/checker-model.json b/examples/http-resilience/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..f9438a867 --- /dev/null +++ b/examples/http-resilience/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:e586b81a9295abcb4491692dac6cf1ef33839a688fea9a396db189f87f7120c5","entities":{"Supplier":{"labels":{"en":"Supplier"},"fields":[{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"supplier_order_list","targetType":"SupplierOrder","labels":{"en":"Supplier Order"},"aliases":["SupplierOrderList","supplierOrderList"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"SupplierOrder":{"labels":{"en":"Supplier Order"},"fields":[{"name":"external_reference","labels":{"en":"external reference"},"aliases":["ExternalReference","externalReference"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"supplier","targetType":"Supplier","labels":{"en":"Supplier"},"aliases":["Supplier"]},{"name":"sync_status","labels":{"en":"sync status"},"aliases":["SyncStatus","syncStatus"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/http-resilience/java-lib-core/teaql/model-provenance.json b/examples/http-resilience/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..b8c5db0b1 --- /dev/null +++ b/examples/http-resilience/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:fefade494b361e037f7727f5922da19509dae9d2243eff472be95ba80791abe7","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/http-resilience/model.xml b/examples/http-resilience/model.xml new file mode 100644 index 000000000..64af5132c --- /dev/null +++ b/examples/http-resilience/model.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/examples/http-resilience/showcase.json b/examples/http-resilience/showcase.json new file mode 100644 index 000000000..ffae8b146 --- /dev/null +++ b/examples/http-resilience/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/http-resilience", + "library": { + "generatedFilesManifestSHA256": "f84ffbb2f28d65b3a28f71e75b00129d766038dfd1838c642e3b6e3513586f6f", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "5d76e300a887915d0233def56cf14b4c58cf67711e347a6f4acb61fb274518d5" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/supplier-order-sync-generation/receipt.json", + "receiptSHA256": "0910413b97e26c19505f98e64bb0adaecbd5cacb09936c7daeaf810757838747" + }, + "scene": "Reconcile a supplier order by applying only a matching response for that order", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/http-resilience/verify-sync.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java" + ], + "generatedFilesManifestSHA256": "e3eb258f2b8cdf6fec76425ed308d03b9f2193632ba785b1d558a80cf76b6dca", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/http-resilience/verify-sync.sh b/examples/http-resilience/verify-sync.sh new file mode 100644 index 000000000..33216c176 --- /dev/null +++ b/examples/http-resilience/verify-sync.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" +scratch="$(mktemp -d -t teaql-java-supplier-sync.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +evidence="${TEAQL_SUPPLIER_SYNC_EVIDENCE_DIR:-$scratch/evidence}" +[[ "$evidence" == /* ]] +mkdir -- "$evidence" +export TEAQL_SUPPLIER_SYNC_DATABASE="$evidence/supplier-orders.sqlite" +python3 -B - "$scratch/pom.xml" "$repo" "$example/java-lib-core/lib" "$example/java-app-console" <<'PY' +import sys +from os.path import relpath +from pathlib import Path +from xml.etree.ElementTree import Element, ElementTree, SubElement + +project = Element('project', xmlns='http://maven.apache.org/POM/4.0.0') +properties = [('modelVersion', '4.0.0'), ('groupId', 'io.teaql.test'), + ('artifactId', 'supplier-sync-reactor'), ('version', '1'), ('packaging', 'pom')] +for key, value in properties: + SubElement(project, key).text = value +file = Path(sys.argv[1]) +modules = SubElement(project, 'modules') +for module in sys.argv[2:]: + SubElement(modules, 'module').text = relpath(module, file.parent) +ElementTree(project).write(file, encoding='utf-8', xml_declaration=True) +PY +for round in 1 2; do + TEAQL_SHOWCASE_ROUND="$round" mvn -q -f "$scratch/pom.xml" -pl :supplier-order-sync-service -am \ + -Dtest=SupplierOrderSyncTest -Dsurefire.failIfNoSpecifiedTests=false test >"$evidence/round-$round.log" 2>&1 || { + tail -80 "$evidence/round-$round.log" >&2 + exit 1 + } + cp "$example/java-app-console/target/surefire-reports/TEST-com.teaql.supplierordersyncservice.SupplierOrderSyncTest.xml" "$evidence/round-$round.xml" + rg '^SUPPLIER_ORDER_SYNC=' "$evidence/round-$round.log" +done diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index d6c479310..7bb3370c5 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -28,6 +28,7 @@ node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/inheritance-save/verify. --output "$evidence_dir/inheritance-save" bash examples/object-storage/verify.sh bash examples/http-resilience/verify.sh +TEAQL_SUPPLIER_SYNC_EVIDENCE_DIR="$evidence_dir/supplier-order-sync" bash examples/http-resilience/verify-sync.sh mvn -q -DskipTests install mvn -q -pl teaql-sqlite \ -Dtest=DerivedQueryTraceSqliteTest,LikeIntentPrivacySqliteTest,TypedIntentPrivacySqliteTest test From ccf0438d30a97b2963b9fdef24c964d445e44491 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:24:34 +0800 Subject: [PATCH 57/71] Record focused java examples/http-resilience business qualification --- examples/http-resilience/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/http-resilience/showcase.json b/examples/http-resilience/showcase.json index ffae8b146..9ce423751 100644 --- a/examples/http-resilience/showcase.json +++ b/examples/http-resilience/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/supplier-order-sync-generation/receipt.json", "receiptSHA256": "0910413b97e26c19505f98e64bb0adaecbd5cacb09936c7daeaf810757838747" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-supplier-order-sync-native/business-receipt.json", + "businessReceiptSHA256": "b6e440a859699eec77ee5474e5f536237a751e1bf5971b2ea800ea9d1af9457b", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-supplier-order-sync-native/receipt.json", + "nativeReceiptSHA256": "8b2a5d7152abd83aa7200067697698c0adb5d38edbfb45f43d18fd6a82051f9e", + "remainingFullRuntimeInventory": true, + "sourceCommit": "1ca62c8052658b02d1a9cb2732d71da32354408d" + }, "scene": "Reconcile a supplier order by applying only a matching response for that order", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/http-resilience/verify-sync.sh" From da876a0e4c4c06360e701f156cf5023763c6a225 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:26:21 +0800 Subject: [PATCH 58/71] Document supplier reconciliation and the original HTTP calibrations --- examples/http-resilience/README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/http-resilience/README.md b/examples/http-resilience/README.md index 1e8d848c2..c46d35776 100644 --- a/examples/http-resilience/README.md +++ b/examples/http-resilience/README.md @@ -1,4 +1,16 @@ -# Context-owned HTTP example +# Synchronize supplier order status + +The [supplier model](model.xml) defines the supplier and orders awaiting +confirmation. The generated workspace installs a named HTTP profile on +the Context and reconciles orders against a loopback supplier. A direct response +and one retry update their own orders. Retry exhaustion, cancellation and a +response for another order leave the local versions unchanged. + +```bash +bash examples/http-resilience/verify-sync.sh +``` + +## Original HTTP calibration Run `bash examples/http-resilience/verify.sh`. The verifier starts a loopback-only HTTP fixture, installs one named service profile on `DefaultUserContext`, and From b1ecdce3174a7dfedaced68cf82ce3aeedbb4db8 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:27:34 +0800 Subject: [PATCH 59/71] Model the pending order access and protocol showcases --- examples/security-foundations/model.xml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 examples/security-foundations/model.xml diff --git a/examples/security-foundations/model.xml b/examples/security-foundations/model.xml new file mode 100644 index 000000000..832eb2727 --- /dev/null +++ b/examples/security-foundations/model.xml @@ -0,0 +1,9 @@ + + + + + + From dfc483acdef426bc5d41210961bd9de834776b9e Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:32:25 +0800 Subject: [PATCH 60/71] Decide reconciliation from the actual supplier reply --- .../SupplierOrderSyncTest.java | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java b/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java index 6a13e7893..9ca3bd206 100644 --- a/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java +++ b/examples/http-resilience/java-app-console/src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java @@ -1,5 +1,6 @@ package com.teaql.supplierordersyncservice; +import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpServer; import io.teaql.core.UserContext; @@ -69,8 +70,9 @@ private static void serve(HttpExchange exchange, String round, Map payload)) return "invalid-status"; + if (!E.supplierOrder(order).getExternalReference().eval().equals(payload.get("reference"))) { + return "wrong-order"; + } + if (!(payload.get("status") instanceof String next) || !Set.of("acknowledged", "dispatched").contains(next)) { + return "invalid-status"; + } + order.updateSyncStatus(next); + order.auditAs("Apply the verified supplier status").save(context); + return "applied"; + } + + private static void cancel(UserContext context, SupplierOrder order, HttpRequestService.Call call, CountDownLatch arrived, CountDownLatch release) throws InterruptedException { var result = new AtomicReference(); var worker = new Thread(() -> { try { - context.httpRequests().execute(context, call); + reconcile(context, order, context.httpRequests().execute(context, call)); } catch (Throwable failure) { result.set(failure); } @@ -151,6 +167,7 @@ private static void cancel(UserContext context, HttpRequestService.Call call, return (outcome, number, elapsedMs) -> {}; }); var ids = new LinkedHashMap(); + var outcomes = new LinkedHashMap(); for (var scenario : SCENARIOS) { String reference = scenario.reference(round); var order = Q.supplierOrders().comment("Create a procurement order to reconcile") @@ -160,25 +177,16 @@ private static void cancel(UserContext context, HttpRequestService.Call call, order.updateSyncStatus("pending"); order.auditAs("Record an order awaiting supplier status").save(context); var call = request(scenario, E.supplierOrder(order).getExternalReference().eval()); + String outcome; if (scenario.name().equals("cancel")) { - cancel(context, call, arrived, release); + cancel(context, order, call, arrived, release); + outcome = "cancelled"; } else { var reply = context.httpRequests().execute(context, call); assertEquals(scenario.attempts(), reply.attempts()); - var payload = (Map) reply.jsonValue(); - if (scenario.name().equals("failed")) { - assertEquals(503, reply.status()); - } else if (scenario.name().equals("mismatch")) { - assertEquals(200, reply.status()); - assertNotEquals(reference, payload.get("reference")); - } else { - assertEquals(200, reply.status()); - assertEquals(reference, payload.get("reference")); - assertEquals(scenario.status(), payload.get("status")); - order.updateSyncStatus((String) payload.get("status")); - order.auditAs("Apply the verified supplier status").save(context); - } + outcome = reconcile(context, order, reply); } + outcomes.put(scenario.name(), outcome); var stored = Q.supplierOrders().withIdIs(order.getId()).limit(1) .comment("Read the order after the supplier call").purpose("Verify the local reconciliation") .executeForOne(context); @@ -189,13 +197,15 @@ private static void cancel(UserContext context, HttpRequestService.Call call, assertEquals(Integer.valueOf(scenario.attempts()), attempts.get(reference)); ids.put(scenario.name(), stored.getId()); } + assertEquals(Map.of("direct", "applied", "retry", "applied", "failed", "unavailable", + "cancel", "cancelled", "mismatch", "wrong-order"), outcomes); assertEquals(5, observed.size()); assertFalse(observed.toString().contains("PRIVATE_QUERY_SYNC")); assertEquals(7, attempts.values().stream().mapToInt(Integer::intValue).sum()); - Class type = com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class; + Class type = SupplierOrder.class; assertTrue(type.getProtectionDomain().getCodeSource().getLocation().toURI().getPath() .endsWith("/java-lib-core/lib/target/classes/")); - var marker = Map.of("round", round, "orders", ids, "requests", 7, "cancelled", true); + var marker = Map.of("round", round, "orders", ids, "outcomes", outcomes, "requests", 7, "cancelled", true); System.out.println("SUPPLIER_ORDER_SYNC=" + new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(marker)); } finally { release.countDown(); From bef2ed950ab89db63ad06a1ad820950cacb10c3f Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:34:16 +0800 Subject: [PATCH 61/71] Record focused java examples/http-resilience business qualification --- examples/http-resilience/showcase.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/http-resilience/showcase.json b/examples/http-resilience/showcase.json index 9ce423751..5c980fb2a 100644 --- a/examples/http-resilience/showcase.json +++ b/examples/http-resilience/showcase.json @@ -22,12 +22,12 @@ "receiptSHA256": "0910413b97e26c19505f98e64bb0adaecbd5cacb09936c7daeaf810757838747" }, "qualification": { - "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-supplier-order-sync-native/business-receipt.json", - "businessReceiptSHA256": "b6e440a859699eec77ee5474e5f536237a751e1bf5971b2ea800ea9d1af9457b", - "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-supplier-order-sync-native/receipt.json", - "nativeReceiptSHA256": "8b2a5d7152abd83aa7200067697698c0adb5d38edbfb45f43d18fd6a82051f9e", + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-supplier-order-sync-response-policy-native/business-receipt.json", + "businessReceiptSHA256": "67efaab35532da6a528369e7a4fd90f0becb0ee4b6389a2b34d00622b5334d62", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-supplier-order-sync-response-policy-native/receipt.json", + "nativeReceiptSHA256": "ff8f96b3489688e7c8145f20300148181b30c50f509e3bef5aaa4dd4c860b559", "remainingFullRuntimeInventory": true, - "sourceCommit": "1ca62c8052658b02d1a9cb2732d71da32354408d" + "sourceCommit": "dfc483acdef426bc5d41210961bd9de834776b9e" }, "scene": "Reconcile a supplier order by applying only a matching response for that order", "schema": "teaql.model-workspace-showcase/v1", From cc8d0e983facb0da22e0f5c6a73d7742bd8440bb Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:40:27 +0800 Subject: [PATCH 62/71] Demonstrate governed merchant order lookup and diagnostics in Java --- .../java-app-console/.gitignore | 53 + .../java-app-console/AGENTS.md | 67 ++ .../java-app-console/DOMAIN_API_GUIDE.md | 30 + .../java-app-console/Makefile | 32 + .../java-app-console/RUNTIME_CUSTOM_GUIDE.md | 25 + .../java-app-console/STANDARD_TELEMETRY.md | 45 + .../java-app-console/TOOL_API_GUIDE.md | 31 + .../docs/teaql-java-crud-guide.md | 162 +++ .../java-app-console/lib/pom.xml | 102 ++ .../BaseServiceConfiguration.java | 0 .../merchantorderprivacyservice/Checkers.java | 0 .../Constants.java | 9 + .../teaql/merchantorderprivacyservice/E.java | 23 + .../EntityMetaRegistry.java | 429 ++++++++ .../GeneratedRuntimeModule.java | 38 + ...erchantOrderPrivacyServiceUserContext.java | 10 + .../teaql/merchantorderprivacyservice/Q.java | 34 + .../Repositories.java | 0 .../customerorder/CustomerOrder.java | 170 ++++ .../customerorder/CustomerOrderChecker.java | 84 ++ .../CustomerOrderExpression.java | 70 ++ .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 959 ++++++++++++++++++ .../customerprofile/CustomerProfile.java | 151 +++ .../CustomerProfileChecker.java | 65 ++ .../CustomerProfileExpression.java | 61 ++ .../CustomerProfileListExpression.java | 25 + .../CustomerProfileRequest.java | 750 ++++++++++++++ .../merchant/Merchant.java | 152 +++ .../merchant/MerchantChecker.java | 58 ++ .../merchant/MerchantExpression.java | 59 ++ .../merchant/MerchantListExpression.java | 25 + .../merchant/MerchantRequest.java | 683 +++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-app-console/pom.xml | 108 ++ .../merchantorderprivacyservice/App.java | 99 ++ .../CustomUserContext.java | 26 + .../WorkspaceTeaQLDatabase.java | 75 ++ .../src/main/resources/application.properties | 2 + .../MerchantOrderPrivacyTest.java | 138 +++ .../java-app-console/teaql-i18n.json | 112 ++ .../java-app-console/teaql/checker-model.json | 1 + .../teaql/model-provenance.json | 1 + .../java-lib-core/lib/pom.xml | 142 +++ .../BaseServiceConfiguration.java | 0 .../merchantorderprivacyservice/Checkers.java | 0 .../Constants.java | 9 + .../teaql/merchantorderprivacyservice/E.java | 23 + .../EntityMetaRegistry.java | 429 ++++++++ .../GeneratedRuntimeModule.java | 38 + ...erchantOrderPrivacyServiceUserContext.java | 10 + .../teaql/merchantorderprivacyservice/Q.java | 34 + .../Repositories.java | 0 .../customerorder/CustomerOrder.java | 170 ++++ .../customerorder/CustomerOrderChecker.java | 84 ++ .../CustomerOrderExpression.java | 70 ++ .../CustomerOrderListExpression.java | 25 + .../customerorder/CustomerOrderRequest.java | 959 ++++++++++++++++++ .../customerprofile/CustomerProfile.java | 151 +++ .../CustomerProfileChecker.java | 65 ++ .../CustomerProfileExpression.java | 61 ++ .../CustomerProfileListExpression.java | 25 + .../CustomerProfileRequest.java | 750 ++++++++++++++ .../merchant/Merchant.java | 152 +++ .../merchant/MerchantChecker.java | 58 ++ .../merchant/MerchantExpression.java | 59 ++ .../merchant/MerchantListExpression.java | 25 + .../merchant/MerchantRequest.java | 683 +++++++++++++ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 + .../java-lib-core/teaql/checker-model.json | 1 + .../java-lib-core/teaql/model-provenance.json | 1 + examples/security-foundations/showcase.json | 40 + .../security-foundations/verify-privacy.sh | 42 + scripts/verify-examples.sh | 1 + 76 files changed, 9100 insertions(+) create mode 100644 examples/security-foundations/java-app-console/.gitignore create mode 100644 examples/security-foundations/java-app-console/AGENTS.md create mode 100644 examples/security-foundations/java-app-console/DOMAIN_API_GUIDE.md create mode 100644 examples/security-foundations/java-app-console/Makefile create mode 100644 examples/security-foundations/java-app-console/RUNTIME_CUSTOM_GUIDE.md create mode 100644 examples/security-foundations/java-app-console/STANDARD_TELEMETRY.md create mode 100644 examples/security-foundations/java-app-console/TOOL_API_GUIDE.md create mode 100644 examples/security-foundations/java-app-console/docs/teaql-java-crud-guide.md create mode 100644 examples/security-foundations/java-app-console/lib/pom.xml create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java create mode 100644 examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/security-foundations/java-app-console/pom.xml create mode 100644 examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/App.java create mode 100644 examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/CustomUserContext.java create mode 100644 examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/WorkspaceTeaQLDatabase.java create mode 100644 examples/security-foundations/java-app-console/src/main/resources/application.properties create mode 100644 examples/security-foundations/java-app-console/src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java create mode 100644 examples/security-foundations/java-app-console/teaql-i18n.json create mode 100644 examples/security-foundations/java-app-console/teaql/checker-model.json create mode 100644 examples/security-foundations/java-app-console/teaql/model-provenance.json create mode 100644 examples/security-foundations/java-lib-core/lib/pom.xml create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java create mode 100644 examples/security-foundations/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler create mode 100644 examples/security-foundations/java-lib-core/teaql/checker-model.json create mode 100644 examples/security-foundations/java-lib-core/teaql/model-provenance.json create mode 100644 examples/security-foundations/showcase.json create mode 100644 examples/security-foundations/verify-privacy.sh diff --git a/examples/security-foundations/java-app-console/.gitignore b/examples/security-foundations/java-app-console/.gitignore new file mode 100644 index 000000000..fe5546972 --- /dev/null +++ b/examples/security-foundations/java-app-console/.gitignore @@ -0,0 +1,53 @@ + +*.gz +target/ + +### IntelliJ IDEA ### +.idea/* +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/dist/ +/nbdist/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store + +*.class +*.log +*.contextt +.mtj.tmp/ +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar +hs_err_pid* +replay_pid* \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/AGENTS.md b/examples/security-foundations/java-app-console/AGENTS.md new file mode 100644 index 000000000..7bcae9a3d --- /dev/null +++ b/examples/security-foundations/java-app-console/AGENTS.md @@ -0,0 +1,67 @@ + + +# TeaQL Java Agent Instructions + +## TeaQL workspace rules + +- Work in application-owned files. Keep the generated domain library read-only. +- Discover API names and signatures through model-aware Assist only. + Do not read or search generated library source for API discovery. Use the + original evaluated KSML file or directory and its exact entity and field names. +- Ask for the current entity and action first. Request field-level query help + only for the fields you use. If Assist lacks the operation, report + `MISSING_ASSIST` with the entity, action, and relevant field or diagnostic. + +```text +cargo teaql --input [model] java-assist-[action]/[entity] +cargo teaql --input [model] java-assist-query/[entity].[field] +``` + +Replace the bracketed values with the actual model path, action, entity, and +field. Actions include `query`, `list-page`, `create`, `update`, `delete`, and +`expression`. Validate API usage by compiling and testing the application. + +- Use the trusted `UserContext` as the only runtime argument for generated query + execution and saves. Resolve tenant, actor, authorization, and provider + resources from trusted application setup. +- Keep queries bounded and provide a non-empty purpose and comment. Supply a + non-empty audit reason for writes through the API shown by Assist. + +> [!WARNING] +> **IGNORE GENERIC ORM EXPERIENCE** +> +> Do **not** use pre-trained habits from data-access frameworks, ORMs, or database integration libraries. +> +> Do **not** use MyBatis, JPA, Hibernate, Spring Data, MyBatis-Plus, or similar frameworks. +> +> Do **not** write raw SQL, DAOs, Repository implementations, or custom persistence layers. +> +> Do **not** guess TeaQL method names. + +## Model entities + +| entity-name | display-name | +|-------------|--------------| +| merchant | Merchant | +| customer_profile | Customer Profile | +| customer_order | Customer Order | + + +## Application entry and context + +Start in `App.java` under `src/main/java`. The console assembles the +`TeaQLRuntime` and creates its `UserContext` with `new CustomUserContext(runtime)`. + +## Additional References + +Read these only when the task requires them: + +* **`TOOL_API_GUIDE.md`** + Framework runtime references and context handling. + +* **`RUNTIME_CUSTOM_GUIDE.md`** + Runtime setup, debugging, and project-specific restrictions. + +## Optional standard telemetry + +See [STANDARD_TELEMETRY.md](STANDARD_TELEMETRY.md) for the selected runtime's optional module, trusted activation variables and safe startup diagnostics. diff --git a/examples/security-foundations/java-app-console/DOMAIN_API_GUIDE.md b/examples/security-foundations/java-app-console/DOMAIN_API_GUIDE.md new file mode 100644 index 000000000..de807691c --- /dev/null +++ b/examples/security-foundations/java-app-console/DOMAIN_API_GUIDE.md @@ -0,0 +1,30 @@ + +**ATTENTION AI AGENTS:** Do not guess TeaQL API methods! To get the exact API usage and query examples for the entity you are working on, you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command to download the exact contextual prompt for the entity: + +```bash +cargo teaql --input models/merchant-order-privacy-service.xml java-assist-[action]/[entity-name] +``` + +Replace `[entity-name]` with the exact entity-name of the entity. + +**Available candidate entities in this model:** + +| entity-name | display-name | +|-------------|--------------| +| merchant | Merchant | +| customer_profile | Customer Profile | +| customer_order | Customer Order | + + +Replace `[action]` with one of the following depending on what you are trying to write: + +| action | when-to-use | +|--------|-------------| +| query | You need to read/find records from the database using Q:: | +| create | You need to insert a new record into the database | +| update | You need to modify and save an existing record | +| delete | You need to remove or soft-delete a record | +| expression | You need to safely extract nested relation values (avoiding null panics) using the E:: facade | +| list-page | You need to implement a paginated query returning a SmartList | + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/Makefile b/examples/security-foundations/java-app-console/Makefile new file mode 100644 index 000000000..8c479e405 --- /dev/null +++ b/examples/security-foundations/java-app-console/Makefile @@ -0,0 +1,32 @@ + +# TEAQL WARNING: This project uses TeaQL. TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. +# AI AGENTS MUST STRICTLY USE THESE MAKE TARGETS ONLY. Do NOT guess other build commands. + +.PHONY: build test run clean help generate-lib + +# Default target +help: + @echo "Available commands:" + @echo " make generate-lib - Regenerate the TeaQL domain library" + @echo " make build - Build the Java console application (mvn clean package)" + @echo " make test - Run application tests (mvn test)" + @echo " make run - Run the application locally (java -jar target/merchant-order-privacy-service-0.0.1-SNAPSHOT.jar)" + @echo " make clean - Clean the project" + +generate-lib: + @echo "Regenerating TeaQL library..." + ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" + +build: + mvn -f lib/pom.xml install -DskipTests + mvn clean package -DskipTests + +test: + mvn -f lib/pom.xml install -DskipTests + mvn test + +run: build + java -jar target/merchant-order-privacy-service-0.0.1-SNAPSHOT.jar + +clean: + mvn clean \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/RUNTIME_CUSTOM_GUIDE.md b/examples/security-foundations/java-app-console/RUNTIME_CUSTOM_GUIDE.md new file mode 100644 index 000000000..24161de16 --- /dev/null +++ b/examples/security-foundations/java-app-console/RUNTIME_CUSTOM_GUIDE.md @@ -0,0 +1,25 @@ + +# TeaQL Runtime Customization Guide + +This is a plain Java console application. `App.main()` creates and closes the Hikari +DataSource, wraps it with `JdbcSqlExecutor`, and manually assembles `TeaQLRuntime.builder()`. +The generated runtime module installs metadata and runtime services; `CustomUserContext` +is then created explicitly and `context.ensureSchema()` initializes the database. + +Run `make run` to install the generated library, package the application, and launch it. +Configuration is loaded from `src/main/resources/application.properties`. Override values +with JVM properties or `--teaql.datasource.url=jdbc:...` command-line arguments. +Server database credentials use `TEAQL_DATABASE_USERNAME` and `TEAQL_DATABASE_PASSWORD`. +Keep business operations in the generated Q/E APIs and audited entity saves. + +> [!WARNING] +> **DO NOT GUESS RUNTIME CONFIGURATION** +> Do not guess how to configure the runtime, connection pools, or schema generation. + +To get the exact usage and examples for Customizing the Runtime (UserContext assembly, SQL debugging, Schema modes), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/merchant-order-privacy-service.xml java-assist-runtime-custom +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/STANDARD_TELEMETRY.md b/examples/security-foundations/java-app-console/STANDARD_TELEMETRY.md new file mode 100644 index 000000000..e8ec83d43 --- /dev/null +++ b/examples/security-foundations/java-app-console/STANDARD_TELEMETRY.md @@ -0,0 +1,45 @@ +## Standard OpenTelemetry module + +Use the optional standard module supplied by the selected TeaQL runtime. Match +its version to the runtime dependency selected by the model and workspace; +keep local source or internal Registry overrides during development. Do not +upgrade to an unrelated public release just to enable telemetry. A runtime +without this module reports `module_unavailable`; package installation alone +does not enable export. + +On a supported backend, configure these trusted process variables before startup, never +through a query, JSON or TFP payload: + +```bash +export TEAQL_TELEMETRY_ENABLED=true +export TEAQL_TELEMETRY_SERVICE_NAME=payment-service +export TEAQL_TELEMETRY_OTLP_ENDPOINT=http://localhost:4318 +``` + +Without enablement, startup reports `disabled` and all three activation variables; +no SDK export resources are created. Enabled startup reports safe effective +settings, full recording and masking. Invalid settings produce a fixed safe +diagnostic, not a claim of successful export. Never print credentials or raw +configuration values. + +The module automatically records supported Q, graph mutation and physical SQL +operations as traces, logs and metrics. SQL is expanded with masked parameters; +plaintext debugging never authorizes plaintext telemetry export. Full recording +does not promise lossless delivery when bounded queues or exporters fail. +Do not add per-method spans or replace the customer's global SDK providers. + +Keep schema reconciliation explicit. Run the generated ensure-schema and seed +flow through the same configured runtime to observe startup settings and audited, +idempotent seeding. Telemetry setup must not run ensure-schema implicitly. +Flush and shut down the owned pipeline at application shutdown, not per query. +Exporter failures do not change business results; durable business audit remains +an independent path. + + +### Java assembly + +Add the optional Maven artifact `io.teaql:teaql-opentelemetry` to the application, +using the exact same version as its TeaQL runtime dependency. Keep it out of the +generated domain library's mandatory dependencies. TeaQLRuntime discovers the +module through ServiceLoader at startup; no application SDK initialization is +required. Set the three variables before starting the JVM. diff --git a/examples/security-foundations/java-app-console/TOOL_API_GUIDE.md b/examples/security-foundations/java-app-console/TOOL_API_GUIDE.md new file mode 100644 index 000000000..7c02ed52c --- /dev/null +++ b/examples/security-foundations/java-app-console/TOOL_API_GUIDE.md @@ -0,0 +1,31 @@ + +# TeaQL Tool & Runtime API Reference + +> [!WARNING] +> **DO NOT GUESS FRAMEWORK APIS** +> Do not guess how to use `UserContext`, `SmartList`, `WebResponse`, or how to manage transactions. + +> [!IMPORTANT] +> **USE TEAQL'S OWN TOOLING FIRST** +> Always use `cargo teaql` to retrieve assist content. Never bypass the CLI or invoke the generator endpoint directly. + +To get the exact API usage and examples for Framework-level APIs (UserContext, SmartList, WebResponse, Entity Expression, Checkers, etc.), you must fetch the dynamically generated prompt directly from the code generation server. Use your tools to execute the following command: + +```bash +cargo teaql --input models/merchant-order-privacy-service.xml java-assist-tool-api +``` + +Once the command succeeds, read its output. Use the printed code as a template to write your logic. + +## Domain Object Assist APIs + +If you need reference code or tool APIs specifically tailored for your domain objects (e.g., `user`, `order`), TeaQL provides code generators that yield perfect, ready-to-copy Java code snippets. + +You can query these assist APIs for any object defined in your `models/merchant-order-privacy-service.xml`: + +| Target | Description | Example Command | +|--------|-------------|-----------------| +| `java-assist-query/[object]` | How to query and filter `[object]` | `cargo teaql --input models/merchant-order-privacy-service.xml java-assist-query/school` | +| `java-assist-create/[object]` | How to insert/create `[object]` | `cargo teaql --input models/merchant-order-privacy-service.xml java-assist-create/school` | +| `java-assist-update/[object]` | How to update `[object]` | `cargo teaql --input models/merchant-order-privacy-service.xml java-assist-update/school` | +| `java-assist-delete/[object]` | How to delete `[object]` | `cargo teaql --input models/merchant-order-privacy-service.xml java-assist-delete/school` | \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/docs/teaql-java-crud-guide.md b/examples/security-foundations/java-app-console/docs/teaql-java-crud-guide.md new file mode 100644 index 000000000..175f9436b --- /dev/null +++ b/examples/security-foundations/java-app-console/docs/teaql-java-crud-guide.md @@ -0,0 +1,162 @@ + +# TeaQL Java CRUD Guide + +Generated for `com.teaql.merchantorderprivacyservice`. Use this guide when adding controllers, services, jobs, or integration code in this workspace. + +## Setup + +```java +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.MerchantOrderPrivacyServiceUserContext; +import io.teaql.core.web.WebResponse; +``` + +The console entry point manually builds TeaQLRuntime and creates `new CustomUserContext(runtime)`. +Pass that context to generated Q/E APIs and audited saves. + +## Non-Negotiable Database Rule + +Never use SQL to operate on the database from workspace business code. This includes select, insert, update, delete, schema changes, JDBC templates, native queries, direct repositories, and ad hoc SQL helpers. + +If the generated TeaQL API does not provide a path for the requested change, stop and report the missing API. Do not implement a SQL workaround. + +## Mandatory Update Method Rule + +Use generated `updateXxx(...)` methods for all entity field changes. Do not use `setXxx(...)` in new code. Setters are deprecated even when the IDE or generated class makes them visible. + +```java +entity.updateName("new value"); +``` + +Do not write: + +```java +entity.setName("new value"); +``` + +## Read One Entity + +Prefer typed generated query entry points. Controller methods that return one object should wrap the result in `WebResponse.of(...)`: + +```java +public WebResponse getOne(@TQLContext UserContext userContext, Long id) { + try { + var entity = Q.merchants() + .filterById(id) + .selectSelf() + .comment("load detail by id") + .purpose("get task detail") + .executeForOne(userContext); + return WebResponse.of(entity); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Read A Page + +Controller methods that return multiple objects should wrap the list in `WebResponse.of(...)`: + +```java +public WebResponse list(@TQLContext UserContext userContext) { + try { + var list = Q.merchants() + .selectSelf() + .page(1, 20) + .comment("list tasks") + .purpose("render dashboard list") + .executeForList(userContext); + return WebResponse.of(list); + } catch (Exception e) { + return WebResponse.fail(e.getMessage()); + } +} +``` + +## Create + +```java +var entity = new Merchant(); +// Fill fields with generated updateXxx(...) methods, not setXxx(...). +entity.auditAs("Create new item").save(userContext); +``` + +## Update + +```java +var entity = Q.merchants() + .filterById(id) + .selectSelf() + .comment("load for update") + .purpose("edit entity") + .executeForOne(userContext); + +// Use updateXxx(...) methods for state changes. +// entity.updateName("new value"); +entity.auditAs("Update entity properties").save(userContext); +``` + +## Load Relations + +Use generated selectors. Do not write a loop that queries children one row at a time. The examples below focus on the entities with the highest reverse relation counts because they are stronger aggregate-root candidates. + +```java +var list = Q.merchants() + .selectCustomerProfileListWith(Q.customerProfiles().selectSelf()) + .comment("load with customerProfileList") + .purpose("fetch child customerProfileList") + .executeForList(userContext); +``` + +```java +var list = Q.merchants() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + +```java +var list = Q.customerProfiles() + .selectMerchantWith(Q.merchants().selectSelf()) + .comment("load with merchant") + .purpose("fetch associated merchant") + .executeForList(userContext); +``` + + +```java +var list = Q.customerProfiles() + .selectCustomerOrderListWith(Q.customerOrders().selectSelf()) + .comment("load with customerOrderList") + .purpose("fetch child customerOrderList") + .executeForList(userContext); +``` + + +## Delete + +Use `java-assist-delete/[entity]` with the original KSML input to get the exact +soft-delete API. If Assist lacks the operation, report `MISSING_ASSIST`. + +Do not hard-delete rows. Do not write SQL `DELETE` or `UPDATE` statements. If the soft-delete API is not visible, stop and report that blocker instead of changing data through SQL. + +## Common Mistakes + +- Do not instantiate repositories directly in workspace business code. +- Do not use SQL for any database operation. +- Do not use deprecated `setXxx(...)` methods for updates. Use `updateXxx(...)`. +- Do not return raw entities or lists from controller query methods. Return `WebResponse.of(entity)` or `WebResponse.of(list)`. +- Do not forget `.executeForOne(userContext)` or `.executeForList(userContext)`. +- Do not forget `.comment("...")` and `.purpose("...")` on queries. +- Do not forget `.auditAs("...")` before calling `.save(context)` on entities. +- Do not assume relations are loaded unless the query selected them. +- Do not bypass `UserContext`; context carries logging, tenant, security, and repository resolution behavior. + +## Entity Cheat Sheet + +These entities are selected by reverse relation count, not by model declaration order. + +- `Merchant`: reverse relations `2`, query `Q.merchants()`, save `new Merchant().auditAs("comment").save(userContext)`, request `com.teaql.merchantorderprivacyservice.merchant.MerchantRequest` +- `CustomerProfile`: reverse relations `1`, query `Q.customerProfiles()`, save `new CustomerProfile().auditAs("comment").save(userContext)`, request `com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest` \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/pom.xml b/examples/security-foundations/java-app-console/lib/pom.xml new file mode 100644 index 000000000..bf1225a19 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/pom.xml @@ -0,0 +1,102 @@ + + + 4.0.0 + + com.teaql + merchant-order-privacy-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + io.teaql + teaql-sqlite + 6.3.0 + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java new file mode 100644 index 000000000..bc79fc767 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.merchantorderprivacyservice; + +import com.teaql.merchantorderprivacyservice.merchant.Merchant; + +public interface Constants { + public static final long MERCHANT_ID = 1l; + public static final Merchant MERCHANT = Merchant.refer(MERCHANT_ID); +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java new file mode 100644 index 000000000..e791a61e2 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java @@ -0,0 +1,23 @@ + +package com.teaql.merchantorderprivacyservice; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderExpression; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileExpression; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static MerchantExpression merchant(Merchant merchant){ + return new MerchantExpression(new ValueExpression(merchant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.merchant()")); + } + public static CustomerProfileExpression customerProfile(CustomerProfile customerProfile){ + return new CustomerProfileExpression(new ValueExpression(customerProfile, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerProfile()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java new file mode 100644 index 000000000..a573c8fcc --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java @@ -0,0 +1,429 @@ + +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerMerchant(); + registerCustomerProfile(); + registerCustomerOrder(); + } + private void registerMerchant() { + FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.merchant.Merchant.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.merchant.Merchant.class); + entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.merchant.Merchant::new); + entityDescriptor.with("name", "Merchant") + + .with("module", "Sales") + + .with("module_key", "sales") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Harbour Retail") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerProfile() { + FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class); + entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile::new); + entityDescriptor.with("name", "Customer Profile") + + .with("module", "Sales") + + .with("module_key", "sales") + + .with("audit_mask_fields", "email") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY, Long.class) + ; + PropertyDescriptor merchant = + entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.MERCHANT_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.merchant.Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.class) + ; + PropertyDescriptor email = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.MERCHANT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder::new); + entityDescriptor.with("name", "Customer Order") + + .with("module", "Sales") + + .with("module_key", "sales") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor merchant = + entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.MERCHANT_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.merchant.Merchant.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.class) + ; + PropertyDescriptor customerProfile = + entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.CUSTOMER_PROFILE_PROPERTY, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor fulfillmentStatus = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.MERCHANT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.CUSTOMER_PROFILE_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..591b7e603 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.merchantorderprivacyservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.merchantorderprivacyservice.merchant.MerchantChecker(), new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker(), new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:9136e660d5a681229d56c6670cb24a5831b04ca1677b181ea98574f12221c515\",\"entities\":{\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"customer_profile\",\"targetType\":\"CustomerProfile\",\"labels\":{\"en\":\"Customer Profile\"},\"aliases\":[\"CustomerProfile\",\"customerProfile\"]},{\"name\":\"fulfillment_status\",\"labels\":{\"en\":\"fulfillment status\"},\"aliases\":[\"FulfillmentStatus\",\"fulfillmentStatus\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"Merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerProfile\":{\"labels\":{\"en\":\"Customer Profile\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"email\",\"labels\":{\"en\":\"email\"},\"aliases\":[\"Email\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"Merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Merchant\":{\"labels\":{\"en\":\"Merchant\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"customer_profile_list\",\"targetType\":\"CustomerProfile\",\"labels\":{\"en\":\"Customer Profile\"},\"aliases\":[\"CustomerProfileList\",\"customerProfileList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Merchant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerProfile", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("email", "email"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("customer_profile", "customerProfile"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("fulfillment_status", "fulfillmentStatus"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.merchants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.merchantorderprivacyservice.merchant.Merchant domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.merchantorderprivacyservice.merchant.Merchant(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Harbour Retail"); + domainRoot.auditAs("create generated Domain Root Merchant").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Merchant", domainRoot.getId())); + } +} diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java new file mode 100644 index 000000000..8b8afaf68 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.UserContext; +public interface MerchantOrderPrivacyServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java new file mode 100644 index 000000000..8feed11c0 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.merchantorderprivacyservice.merchant.MerchantRequest merchants(){ + return new com.teaql.merchantorderprivacyservice.merchant.MerchantRequest(com.teaql.merchantorderprivacyservice.merchant.Merchant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.merchantorderprivacyservice.merchant.MerchantRequest merchantsWithMinimalFields(){ + return new com.teaql.merchantorderprivacyservice.merchant.MerchantRequest(com.teaql.merchantorderprivacyservice.merchant.Merchant.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest customerProfiles(){ + return new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest customerProfilesWithMinimalFields(){ + return new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..2a3c3f2cf --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java @@ -0,0 +1,170 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "1e5c269646b9d3a77d2b8da3dfb1cf2899c91e276510b91bba15700d02c0d1a3"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("customer_profile", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("fulfillment_status", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("customer_profile", java.util.List.of("customerProfile", "customer_profile")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("fulfillment_status", java.util.List.of("fulfillmentStatus", "fulfillment_status")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String MERCHANT_PROPERTY = "merchant"; + public static final String CUSTOMER_PROFILE_PROPERTY = "customer_profile"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String FULFILLMENT_STATUS_PROPERTY = "fulfillment_status"; + private Merchant merchant; + + private CustomerProfile customerProfile; + + private String orderNumber; + + private String fulfillmentStatus; + + + public Merchant getMerchant(){ + return this.merchant; + } + + public CustomerProfile getCustomerProfile(){ + return this.customerProfile; + } + + public String getOrderNumber(){ + return this.orderNumber; + } + + public String getFulfillmentStatus(){ + return this.fulfillmentStatus; + } + + public CustomerOrder updateMerchant(Merchant merchant){ + if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ + return this; + } + handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); + this.merchant = merchant; + return this; + } + + public CustomerOrder updateCustomerProfile(CustomerProfile customerProfile){ + if(isPropertyLoaded(CUSTOMER_PROFILE_PROPERTY) && Objects.equals(this.customerProfile, customerProfile)){ + return this; + } + handleUpdate(CUSTOMER_PROFILE_PROPERTY, getCustomerProfile(), customerProfile); + this.customerProfile = customerProfile; + return this; + } + + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateFulfillmentStatus(String fulfillmentStatus){ + fulfillmentStatus = (fulfillmentStatus == null ? null : fulfillmentStatus.trim()); + if(isPropertyLoaded(FULFILLMENT_STATUS_PROPERTY) && Objects.equals(this.fulfillmentStatus, fulfillmentStatus)){ + return this; + } + handleUpdate(FULFILLMENT_STATUS_PROPERTY, getFulfillmentStatus(), fulfillmentStatus); + this.fulfillmentStatus = fulfillmentStatus; + return this; + } + + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "merchant": this.merchant = (Merchant) value; break; + + case "customer_profile": this.customerProfile = (CustomerProfile) value; break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "fulfillment_status": this.fulfillmentStatus = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "merchant": return this.merchant; + case "customer_profile": return this.customerProfile; + case "order_number": return this.orderNumber; + case "fulfillment_status": return this.fulfillmentStatus; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "merchant": return this.merchant; + case "customerProfile": return this.customerProfile; + case "orderNumber": return this.orderNumber; + case "fulfillmentStatus": return this.fulfillmentStatus; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..dc1f2d837 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,84 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + }else if(customerOrder.updateItem()){ + if(!customerOrder.isPropertyLoaded("merchant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("customer_profile")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_profile"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("fulfillment_status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "fulfillment_status"), "Mutation requires a fully loaded entity"); + } + + } + checkMerchant(_context, customerOrder.getProperty(CustomerOrder.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); + checkCustomerProfile(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY), newLocation(_parentLocation, "customer_profile")); + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkFulfillmentStatus(_context, customerOrder.getProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY), newLocation(_parentLocation, "fulfillment_status")); + } + + public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, merchant); + if((merchant == null)){ + return; + } + new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); + } + public void checkCustomerProfile(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerProfile); + if((customerProfile == null)){ + return; + } + new CustomerProfileChecker().checkAndFix(_context, customerProfile, _parentLocation); + } + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkFulfillmentStatus(UserContext _context, String fulfillmentStatus, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, fulfillmentStatus); + if((fulfillmentStatus == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, fulfillmentStatus); + + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..326968aa8 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,70 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileExpression; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public MerchantExpression getMerchant(){ + return new MerchantExpression(loaded("merchant", "getMerchant", CustomerOrder::getMerchant)); + } + + public CustomerOrderExpression updateMerchant(Merchant merchant){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateMerchant(merchant)); + } + + public CustomerProfileExpression getCustomerProfile(){ + return new CustomerProfileExpression(loaded("customer_profile", "getCustomerProfile", CustomerOrder::getCustomerProfile)); + } + + public CustomerOrderExpression updateCustomerProfile(CustomerProfile customerProfile){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomerProfile(customerProfile)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public Expression getFulfillmentStatus(){ + return loaded("fulfillment_status", "getFulfillmentStatus", CustomerOrder::getFulfillmentStatus); + } + public CustomerOrderExpression updateFulfillmentStatus(String fulfillmentStatus){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateFulfillmentStatus(fulfillmentStatus)); + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..bb3804728 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..b2495f5f8 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,959 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectMerchantIdOnly().selectCustomerProfileIdOnly().selectOrderNumber().selectFulfillmentStatus().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.MERCHANT_PROPERTY); + selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectMerchant().selectCustomerProfile().selectOrderNumber().selectFulfillmentStatus().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + return selectId().selectMerchant().selectCustomerProfile().selectOrderNumber().selectFulfillmentStatus().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectMerchantIdOnly(){ + selectProperty(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest selectMerchant(){ + return selectMerchantWith(Q.merchants().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectMerchantWith(MerchantRequest merchant){ + selectProperty(CustomerOrder.MERCHANT_PROPERTY); + enhanceRelation(CustomerOrder.MERCHANT_PROPERTY, merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, CustomerOrder.MERCHANT_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectMerchant(){ + unselectProperty(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + public CustomerOrderRequest selectCustomerProfileIdOnly(){ + selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCustomerProfile(){ + return selectCustomerProfileWith(Q.customerProfiles().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCustomerProfileWith(CustomerProfileRequest customerProfile){ + selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + enhanceRelation(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerProfileWith", null, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCustomerProfile(){ + unselectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectFulfillmentStatus(){ + selectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + /** + * fill the fulfillmentStatus with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS fulfillmentStatus) to fetch fulfillmentStatus property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectFulfillmentStatus(){ + unselectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByMerchant(Merchant... merchant){ + if (merchant == null || merchant.length == 0) { + throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); + } + return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); + } + + public CustomerOrderRequest withMerchant(Operator operator, Object... values){ + return appendSearchCriteria(createMerchantCriteria(operator, values)); + } + + public CustomerOrderRequest withMerchantIsUnknown(){ + return withMerchant(Operator.IS_NULL); + } + + public CustomerOrderRequest withMerchantIsKnown(){ + return withMerchant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.MERCHANT_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByMerchant(Long merchant){ + if(merchant == null){ + return this; + } + return withMerchant(Operator.EQUAL, merchant); + } + public CustomerOrderRequest withMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByCustomerProfile(CustomerProfile... customerProfile){ + if (customerProfile == null || customerProfile.length == 0) { + throw new IllegalArgumentException("filterByCustomerProfile parameter customerProfile cannot be empty"); + } + return appendSearchCriteria(createCustomerProfileCriteria(Operator.EQUAL, (Object[])customerProfile)); + } + + public CustomerOrderRequest withCustomerProfile(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerProfileCriteria(operator, values)); + } + + public CustomerOrderRequest withCustomerProfileIsUnknown(){ + return withCustomerProfile(Operator.IS_NULL); + } + + public CustomerOrderRequest withCustomerProfileIsKnown(){ + return withCustomerProfile(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerProfileCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCustomerProfile(Long customerProfile){ + if(customerProfile == null){ + return this; + } + return withCustomerProfile(Operator.EQUAL, customerProfile); + } + public CustomerOrderRequest withCustomerProfileMatching(CustomerProfileRequest customerProfile){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, CustomerProfile.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCustomerProfileMatching(CustomerProfileRequest customerProfile){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, CustomerProfile.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByFulfillmentStatus(String... fulfillmentStatus){ + if (fulfillmentStatus == null || fulfillmentStatus.length == 0) { + throw new IllegalArgumentException("filterByFulfillmentStatus parameter fulfillmentStatus cannot be empty"); + } + return appendSearchCriteria(createFulfillmentStatusCriteria(Operator.EQUAL, (Object[])fulfillmentStatus)); + } + + public CustomerOrderRequest withFulfillmentStatus(Operator operator, Object... values){ + return appendSearchCriteria(createFulfillmentStatusCriteria(operator, values)); + } + + public CustomerOrderRequest withFulfillmentStatusIsUnknown(){ + return withFulfillmentStatus(Operator.IS_NULL); + } + + public CustomerOrderRequest withFulfillmentStatusIsKnown(){ + return withFulfillmentStatus(Operator.IS_NOT_NULL); + } + + public SearchCriteria createFulfillmentStatusCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.FULFILLMENT_STATUS_PROPERTY, operator, values); + } + + public CustomerOrderRequest withFulfillmentStatusIsNot(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusIn(String... fulfillmentStatus){ + return withFulfillmentStatus(Operator.IN, (Object[])fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotIn(String... fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_IN, (Object[])fulfillmentStatus); + } + public CustomerOrderRequest withFulfillmentStatusGreaterThan(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.GREATER_THAN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusGreaterThanOrEqualTo(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.GREATER_THAN_OR_EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusLessThan(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.LESS_THAN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusLessThanOrEqualTo(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.LESS_THAN_OR_EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusBetween(String startOfFulfillmentStatus, String endOfFulfillmentStatus){ + return withFulfillmentStatus(Operator.BETWEEN, startOfFulfillmentStatus, endOfFulfillmentStatus); + } + public CustomerOrderRequest withFulfillmentStatusStartingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.BEGIN_WITH, fulfillmentStatus); + } + public CustomerOrderRequest withFulfillmentStatusContaining(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.CONTAIN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotContaining(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_CONTAIN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotStartingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_BEGIN_WITH, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusEndingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.END_WITH, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotEndingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_END_WITH, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusIs(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusSoundingLike(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.SOUNDS_LIKE, fulfillmentStatus); + } + + + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest groupByMerchantWithDetails(){ + return groupByMerchantWithDetails(Q.merchants().unlimited()); + } + + public CustomerOrderRequest groupByMerchantWithDetails(MerchantRequest subRequest){ + aggregate(CustomerOrder.MERCHANT_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupByCustomerProfileWithDetails(){ + return groupByCustomerProfileWithDetails(Q.customerProfiles().unlimited()); + } + + public CustomerOrderRequest groupByCustomerProfileWithDetails(CustomerProfileRequest subRequest){ + aggregate(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, subRequest); + return this; + } + + + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctMerchant(){ + return countDistinctMerchantAs("merchant_distinct_count"); + } + + public CustomerOrderRequest countDistinctMerchantAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.MERCHANT_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCustomerProfile(){ + return countDistinctCustomerProfileAs("customer_profile_distinct_count"); + } + + public CustomerOrderRequest countDistinctCustomerProfileAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctFulfillmentStatus(){ + return countDistinctFulfillmentStatusAs("fulfillment_status_distinct_count"); + } + + public CustomerOrderRequest countDistinctFulfillmentStatusAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByMerchantWith(MerchantRequest subRequest){ + groupBy(CustomerOrder.MERCHANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); + return this; + } + public CustomerOrderRequest groupByMerchant(){ + groupBy(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByMerchantAs(String retName){ + groupBy(retName, CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByMerchantWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.MERCHANT_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCustomerProfileWith(CustomerProfileRequest subRequest){ + groupBy(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerProfileWith", null, "customer_profile")); + return this; + } + public CustomerOrderRequest groupByCustomerProfile(){ + groupBy(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerProfileAs(String retName){ + groupBy(retName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerProfileWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByFulfillmentStatus(){ + groupBy(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByFulfillmentStatusAs(String retName){ + groupBy(retName, CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByFulfillmentStatusWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.FULFILLMENT_STATUS_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByMerchantAscending(){ + addOrderByAscending(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByMerchantDescending(){ + addOrderByDescending(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerProfileAscending(){ + addOrderByAscending(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerProfileDescending(){ + addOrderByDescending(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByFulfillmentStatusAscending(){ + addOrderByAscending(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByFulfillmentStatusDescending(){ + addOrderByDescending(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest orderByFulfillmentStatusAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByFulfillmentStatusDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public MerchantRequest rollUpToMerchant(){ + MerchantRequest merchant = Q.merchants().unlimited(); + this.internalRollUpTo("merchant", merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); + return merchant; + } + + public CustomerProfileRequest rollUpToCustomerProfile(){ + CustomerProfileRequest customerProfile = Q.customerProfiles().unlimited(); + this.internalRollUpTo("customer_profile", customerProfile, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerProfile", null, "customer_profile")); + return customerProfile; + } + + + + + + public CustomerOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ + return facetByMerchantAs(facetName, merchant, true); + } + + public CustomerOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.MERCHANT_PROPERTY, merchant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, CustomerOrder.MERCHANT_PROPERTY)); + return this; + } + public CustomerOrderRequest facetByCustomerProfileAs(String facetName, CustomerProfileRequest customerProfile){ + return facetByCustomerProfileAs(facetName, customerProfile, true); + } + + public CustomerOrderRequest facetByCustomerProfileAs(String facetName, CustomerProfileRequest customerProfile, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerProfileAs", facetName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java new file mode 100644 index 000000000..60649102a --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java @@ -0,0 +1,151 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerProfile extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerProfile"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5a9cde22ab27c45df77fbacebdb80f8a03759bd10053dc56f76edb4c8b61e319"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("email", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("email", java.util.List.of("email", "email")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerProfile.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String MERCHANT_PROPERTY = "merchant"; + public static final String EMAIL_PROPERTY = "email"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private Merchant merchant; + + private String email; + + private SmartList customerOrderList; + + public Merchant getMerchant(){ + return this.merchant; + } + + public String getEmail(){ + return this.email; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public CustomerProfile updateMerchant(Merchant merchant){ + if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ + return this; + } + handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); + this.merchant = merchant; + return this; + } + + public CustomerProfile updateEmail(String email){ + email = (email == null ? null : email.trim()); + if(isPropertyLoaded(EMAIL_PROPERTY) && Objects.equals(this.email, email)){ + return this; + } + handleUpdate(EMAIL_PROPERTY, getEmail(), email); + this.email = email; + return this; + } + + public CustomerProfile addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCustomerProfile(this); + return this; + } + + public static CustomerProfile refer(Long id){ + CustomerProfile refer = new CustomerProfile(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerProfile comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "merchant": this.merchant = (Merchant) value; break; + + case "email": this.email = (value == null ? null : ((String)value).trim()); break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "merchant": return this.merchant; + case "email": return this.email; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "merchant": return this.merchant; + case "email": return this.email; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java new file mode 100644 index 000000000..cb92cd90b --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerProfileChecker implements Checker{ + + public String type(){ + return CustomerProfile.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ + if(needCheck(_context, customerProfile)){ + markAsChecked(_context, customerProfile); + doCheck(_context, customerProfile, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ + if((customerProfile == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerProfile); + if(customerProfile.needPersist()){ + } + if(customerProfile.newItem()){ + }else if(customerProfile.updateItem()){ + if(!customerProfile.isPropertyLoaded("merchant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); + } + if(!customerProfile.isPropertyLoaded("email")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "email"), "Mutation requires a fully loaded entity"); + } + + } + checkMerchant(_context, customerProfile.getProperty(CustomerProfile.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); + checkEmail(_context, customerProfile.getProperty(CustomerProfile.EMAIL_PROPERTY), newLocation(_parentLocation, "email")); + for(int i = 0; customerProfile.getCustomerOrderList() != null && i < customerProfile.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = customerProfile.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, merchant); + if((merchant == null)){ + return; + } + new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); + } + public void checkEmail(UserContext _context, String email, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, email); + if((email == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, email); + + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java new file mode 100644 index 000000000..2666acf8b --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderListExpression; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerProfileExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerProfileExpression(Expression expression){ + super(expression); + } + + public CustomerProfileExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerProfileExpression updateId(Long id){ + return new CustomerProfileExpression(this, $it -> {((CustomerProfile)$it).__internalSet("id", id); return this;}); + } + + public CustomerProfileExpression save(UserContext userContext){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerProfileExpression save(String intent, UserContext userContext){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public MerchantExpression getMerchant(){ + return new MerchantExpression(loaded("merchant", "getMerchant", CustomerProfile::getMerchant)); + } + + public CustomerProfileExpression updateMerchant(Merchant merchant){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).updateMerchant(merchant)); + } + + public Expression getEmail(){ + return loaded("email", "getEmail", CustomerProfile::getEmail); + } + public CustomerProfileExpression updateEmail(String email){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).updateEmail(email)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CustomerProfile::getCustomerOrderList)); + } + public CustomerProfileExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java new file mode 100644 index 000000000..410a30c3e --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerProfileListExpression extends SmartListExpression { + public CustomerProfileListExpression(Expression> expression){ + super(expression); + } + + public CustomerProfileListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerProfileExpression first() { + return new CustomerProfileExpression(super.first()); + } + + public CustomerProfileExpression get(int index) { + return new CustomerProfileExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java new file mode 100644 index 000000000..93e23a881 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java @@ -0,0 +1,750 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerProfileRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerProfileRequest(Class returnType){ + this(returnType, () -> (T) new CustomerProfile()); + } + + protected CustomerProfileRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerProfileRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerProfileRequest copy(){ + return (CustomerProfileRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerProfileRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerProfileRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerProfileRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerProfileRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerProfileRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerProfileRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerProfileRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerProfileRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerProfileRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerProfileRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerProfileRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerProfileRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerProfileRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerProfileRequest matchingAnyOf(CustomerProfileRequest customerProfile){ + super.internalMatchAny(customerProfile); + return this; + } + + public CustomerProfileRequest matchingIdsOf(CustomerProfileRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerProfile.ID_PROPERTY, request, CustomerProfile.ID_PROPERTY)); + } + + public CustomerProfileRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerProfileRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerProfileRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerProfileRequest selectSelf(){ + super.selectSelf(); + return selectId().selectMerchantIdOnly().selectEmail().selectVersion(); + } + + public CustomerProfileRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerProfileRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerProfile.ID_PROPERTY); + selectProperty(CustomerProfile.MERCHANT_PROPERTY); + selectProperty(CustomerProfile.EMAIL_PROPERTY); + selectProperty(CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest selectAll(){ + super.selectAll(); + return selectId().selectMerchant().selectEmail().selectVersion(); + } + + public CustomerProfileRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectMerchant().selectEmail().selectVersion(); + } + + + public CustomerProfileRequest selectId(){ + selectProperty(CustomerProfile.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerProfileRequest unselectId(){ + unselectProperty(CustomerProfile.ID_PROPERTY); + return this; + } + public CustomerProfileRequest selectMerchantIdOnly(){ + selectProperty(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest selectMerchant(){ + return selectMerchantWith(Q.merchants().unlimited().selectSelf()); + } + + public CustomerProfileRequest selectMerchantWith(MerchantRequest merchant){ + selectProperty(CustomerProfile.MERCHANT_PROPERTY); + enhanceRelation(CustomerProfile.MERCHANT_PROPERTY, merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, CustomerProfile.MERCHANT_PROPERTY)); + return this; + } + + public CustomerProfileRequest unselectMerchant(){ + unselectProperty(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + public CustomerProfileRequest selectEmail(){ + selectProperty(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + /** + * fill the email with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS email) to fetch email property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerProfileRequest unselectEmail(){ + unselectProperty(CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest selectVersion(){ + selectProperty(CustomerProfile.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerProfileRequest unselectVersion(){ + unselectProperty(CustomerProfile.VERSION_PROPERTY); + return this; + } + public CustomerProfileRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CustomerProfileRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.ID_PROPERTY, operator, values); + } + + public CustomerProfileRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerProfileRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerProfileRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerProfileRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerProfileRequest filterByMerchant(Merchant... merchant){ + if (merchant == null || merchant.length == 0) { + throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); + } + return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); + } + + public CustomerProfileRequest withMerchant(Operator operator, Object... values){ + return appendSearchCriteria(createMerchantCriteria(operator, values)); + } + + public CustomerProfileRequest withMerchantIsUnknown(){ + return withMerchant(Operator.IS_NULL); + } + + public CustomerProfileRequest withMerchantIsKnown(){ + return withMerchant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.MERCHANT_PROPERTY, operator, values); + } + + public CustomerProfileRequest filterByMerchant(Long merchant){ + if(merchant == null){ + return this; + } + return withMerchant(Operator.EQUAL, merchant); + } + public CustomerProfileRequest withMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerProfile.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); + } + + public CustomerProfileRequest withoutMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerProfile.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); + } + + public CustomerProfileRequest filterByEmail(String... email){ + if (email == null || email.length == 0) { + throw new IllegalArgumentException("filterByEmail parameter email cannot be empty"); + } + return appendSearchCriteria(createEmailCriteria(Operator.EQUAL, (Object[])email)); + } + + public CustomerProfileRequest withEmail(Operator operator, Object... values){ + return appendSearchCriteria(createEmailCriteria(operator, values)); + } + + public CustomerProfileRequest withEmailIsUnknown(){ + return withEmail(Operator.IS_NULL); + } + + public CustomerProfileRequest withEmailIsKnown(){ + return withEmail(Operator.IS_NOT_NULL); + } + + public SearchCriteria createEmailCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.EMAIL_PROPERTY, operator, values); + } + + public CustomerProfileRequest withEmailIsNot(String email){ + return withEmail(Operator.NOT_EQUAL, email); + } + + public CustomerProfileRequest withEmailIn(String... email){ + return withEmail(Operator.IN, (Object[])email); + } + + public CustomerProfileRequest withEmailNotIn(String... email){ + return withEmail(Operator.NOT_IN, (Object[])email); + } + public CustomerProfileRequest withEmailGreaterThan(String email){ + return withEmail(Operator.GREATER_THAN, email); + } + + public CustomerProfileRequest withEmailGreaterThanOrEqualTo(String email){ + return withEmail(Operator.GREATER_THAN_OR_EQUAL, email); + } + + public CustomerProfileRequest withEmailLessThan(String email){ + return withEmail(Operator.LESS_THAN, email); + } + + public CustomerProfileRequest withEmailLessThanOrEqualTo(String email){ + return withEmail(Operator.LESS_THAN_OR_EQUAL, email); + } + + public CustomerProfileRequest withEmailBetween(String startOfEmail, String endOfEmail){ + return withEmail(Operator.BETWEEN, startOfEmail, endOfEmail); + } + public CustomerProfileRequest withEmailStartingWith(String email){ + return withEmail(Operator.BEGIN_WITH, email); + } + public CustomerProfileRequest withEmailContaining(String email){ + return withEmail(Operator.CONTAIN, email); + } + + public CustomerProfileRequest withEmailNotContaining(String email){ + return withEmail(Operator.NOT_CONTAIN, email); + } + + public CustomerProfileRequest withEmailNotStartingWith(String email){ + return withEmail(Operator.NOT_BEGIN_WITH, email); + } + + public CustomerProfileRequest withEmailEndingWith(String email){ + return withEmail(Operator.END_WITH, email); + } + + public CustomerProfileRequest withEmailNotEndingWith(String email){ + return withEmail(Operator.NOT_END_WITH, email); + } + + public CustomerProfileRequest withEmailIs(String email){ + return withEmail(Operator.EQUAL, email); + } + + public CustomerProfileRequest withEmailSoundingLike(String email){ + return withEmail(Operator.SOUNDS_LIKE, email); + } + + + + public CustomerProfileRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerProfileRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerProfileRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerProfileRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.VERSION_PROPERTY, operator, values); + } + + public CustomerProfileRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerProfileRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerProfileRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerProfileRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerProfileRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerProfileRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerProfileRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerProfileRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerProfileRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerProfileRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerProfile.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); + } + + public CustomerProfileRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerProfile.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY))); + } + + public CustomerProfileRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerProfileRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerProfileRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerProfileRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerProfileRequest groupByMerchantWithDetails(){ + return groupByMerchantWithDetails(Q.merchants().unlimited()); + } + + public CustomerProfileRequest groupByMerchantWithDetails(MerchantRequest subRequest){ + aggregate(CustomerProfile.MERCHANT_PROPERTY, subRequest); + return this; + } + + + + public CustomerProfileRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerProfileRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.ID_PROPERTY); + return this; + } + public CustomerProfileRequest countDistinctMerchant(){ + return countDistinctMerchantAs("merchant_distinct_count"); + } + + public CustomerProfileRequest countDistinctMerchantAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.MERCHANT_PROPERTY); + return this; + } + public CustomerProfileRequest countDistinctEmail(){ + return countDistinctEmailAs("email_distinct_count"); + } + + public CustomerProfileRequest countDistinctEmailAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerProfileRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.VERSION_PROPERTY); + return this; + } + public CustomerProfileRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerProfileRequest groupById(){ + groupBy(CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByIdAs(String retName){ + groupBy(retName, CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.ID_PROPERTY, function); + return this; + } + public CustomerProfileRequest groupByMerchantWith(MerchantRequest subRequest){ + groupBy(CustomerProfile.MERCHANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); + return this; + } + public CustomerProfileRequest groupByMerchant(){ + groupBy(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByMerchantAs(String retName){ + groupBy(retName, CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByMerchantWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.MERCHANT_PROPERTY, function); + return this; + } + + public CustomerProfileRequest groupByEmail(){ + groupBy(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByEmailAs(String retName){ + groupBy(retName, CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByEmailWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.EMAIL_PROPERTY, function); + return this; + } + + public CustomerProfileRequest groupByVersion(){ + groupBy(CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerProfileRequest orderByIdAscending(){ + addOrderByAscending(CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByIdDescending(){ + addOrderByDescending(CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByMerchantAscending(){ + addOrderByAscending(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByMerchantDescending(){ + addOrderByDescending(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByEmailAscending(){ + addOrderByAscending(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByEmailDescending(){ + addOrderByDescending(CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest orderByEmailAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByEmailDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest orderByVersionAscending(){ + addOrderByAscending(CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByVersionDescending(){ + addOrderByDescending(CustomerProfile.VERSION_PROPERTY); + return this; + } + + + public CustomerProfileRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CustomerProfileRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public MerchantRequest rollUpToMerchant(){ + MerchantRequest merchant = Q.merchants().unlimited(); + this.internalRollUpTo("merchant", merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); + return merchant; + } + + + + public CustomerProfileRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROFILE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROFILE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ + return facetByMerchantAs(facetName, merchant, true); + } + + public CustomerProfileRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ + addFacet(facetName, CustomerProfile.MERCHANT_PROPERTY, merchant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, CustomerProfile.MERCHANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerProfileRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerProfileRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerProfileRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerProfileRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerProfileRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerProfileRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java new file mode 100644 index 000000000..10450efd1 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java @@ -0,0 +1,152 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Merchant extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Merchant"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "3825864cc8042afce6bd814bc155a414cc1fda5115c8807092b56cbb042a1e38"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_profile_list", "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Merchant.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CUSTOMER_PROFILE_LIST_PROPERTY = "customer_profile_list"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private SmartList customerProfileList; + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getCustomerProfileList(){ + return this.customerProfileList == null ? SmartList.unloaded() : this.customerProfileList; + } + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public Merchant updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Merchant addCustomerProfile(CustomerProfile customerProfile){ + if (customerProfile == null){ + return this; + } + + if(null == this.customerProfileList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerProfileList = teaqlUnloadedItems.map(value -> value); + } + + this.customerProfileList.add(customerProfile); + customerProfile.updateMerchant(this); + return this; + } + public Merchant addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateMerchant(this); + return this; + } + + public static Merchant refer(Long id){ + Merchant refer = new Merchant(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Merchant comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "customer_profile_list": this.customerProfileList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "customer_profile_list": return this.customerProfileList; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java new file mode 100644 index 000000000..7e6d403aa --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java @@ -0,0 +1,58 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class MerchantChecker implements Checker{ + + public String type(){ + return Merchant.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if(needCheck(_context, merchant)){ + markAsChecked(_context, merchant); + doCheck(_context, merchant, _parentLocation); + } + } + + public void doCheck(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if((merchant == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, merchant); + if(merchant.needPersist()){ + } + if(merchant.newItem()){ + }else if(merchant.updateItem()){ + if(!merchant.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, merchant.getProperty(Merchant.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; merchant.getCustomerProfileList() != null && i < merchant.getCustomerProfileList().size(); i++){ + CustomerProfile customerProfile = merchant.getCustomerProfileList().get(i); + new CustomerProfileChecker().checkAndFix(_context, customerProfile, newLocation(_parentLocation, "customer_profile_list", i)); + } + for(int i = 0; merchant.getCustomerOrderList() != null && i < merchant.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = merchant.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java new file mode 100644 index 000000000..8694004fd --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java @@ -0,0 +1,59 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderListExpression; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class MerchantExpression extends ExpressionAdaptor implements BaseEntityExpression { + public MerchantExpression(Expression expression){ + super(expression); + } + + public MerchantExpression(Expression expression, Function function){ + super(expression, function); + } + + public MerchantExpression updateId(Long id){ + return new MerchantExpression(this, $it -> {((Merchant)$it).__internalSet("id", id); return this;}); + } + + public MerchantExpression save(UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs("Saved by Expression").save(userContext)); + } + + public MerchantExpression save(String intent, UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Merchant::getName); + } + public MerchantExpression updateName(String name){ + return new MerchantExpression(this, $it -> ((Merchant)$it).updateName(name)); + } + + public CustomerProfileListExpression getCustomerProfileList(){ + return new CustomerProfileListExpression(loaded("customer_profile_list", "getCustomerProfileList", Merchant::getCustomerProfileList)); + } + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Merchant::getCustomerOrderList)); + } + public MerchantExpression addCustomerProfile(CustomerProfile customerProfile){ + return new MerchantExpression(this, $it -> ((Merchant)$it).addCustomerProfile(customerProfile)); + } + public MerchantExpression addCustomerOrder(CustomerOrder customerOrder){ + return new MerchantExpression(this, $it -> ((Merchant)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java new file mode 100644 index 000000000..fe54b0da5 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class MerchantListExpression extends SmartListExpression { + public MerchantListExpression(Expression> expression){ + super(expression); + } + + public MerchantListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public MerchantExpression first() { + return new MerchantExpression(super.first()); + } + + public MerchantExpression get(int index) { + return new MerchantExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java new file mode 100644 index 000000000..061ee087d --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java @@ -0,0 +1,683 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class MerchantRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public MerchantRequest(Class returnType){ + this(returnType, () -> (T) new Merchant()); + } + + protected MerchantRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public MerchantRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public MerchantRequest copy(){ + return (MerchantRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new MerchantRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public MerchantRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public MerchantRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public MerchantRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public MerchantRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public MerchantRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public MerchantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public MerchantRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public MerchantRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (MerchantRequest)super.appendSearchCriteria(searchCriteria); + } + + public MerchantRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public MerchantRequest matchingAnyOf(MerchantRequest merchant){ + super.internalMatchAny(merchant); + return this; + } + + public MerchantRequest matchingIdsOf(MerchantRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Merchant.ID_PROPERTY, request, Merchant.ID_PROPERTY)); + } + + public MerchantRequest enhanceChildrenIfNeeded(){ + return this; + } + + public MerchantRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public MerchantRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public MerchantRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectSelfFields(){ + return selectSelf(); + } + + public MerchantRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Merchant.ID_PROPERTY); + selectProperty(Merchant.NAME_PROPERTY); + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectChildren(){ + super.selectAny(); + selectCustomerProfileList().selectCustomerOrderList(); + return selectId().selectName().selectVersion(); + } + + + public MerchantRequest selectId(){ + selectProperty(Merchant.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectId(){ + unselectProperty(Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest selectName(){ + selectProperty(Merchant.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectName(){ + unselectProperty(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest selectVersion(){ + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectVersion(){ + unselectProperty(Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest selectCustomerProfileList(){ + return selectCustomerProfileListWith(Q.customerProfiles().selectSelf()); + } + + public MerchantRequest selectCustomerProfileListWith(CustomerProfileRequest customerProfileList){ + enhanceRelation(Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, customerProfileList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerProfileListWith", null, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + public MerchantRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public MerchantRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(Merchant.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.ID_PROPERTY, operator, values); + } + + public MerchantRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public MerchantRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public MerchantRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public MerchantRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public MerchantRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public MerchantRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public MerchantRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public MerchantRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.NAME_PROPERTY, operator, values); + } + + public MerchantRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public MerchantRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public MerchantRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public MerchantRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public MerchantRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public MerchantRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public MerchantRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public MerchantRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public MerchantRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public MerchantRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public MerchantRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public MerchantRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public MerchantRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public MerchantRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public MerchantRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public MerchantRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public MerchantRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public MerchantRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.VERSION_PROPERTY, operator, values); + } + + public MerchantRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public MerchantRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public MerchantRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public MerchantRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public MerchantRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public MerchantRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public MerchantRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public MerchantRequest withCustomerProfileListMatching(CustomerProfileRequest customerProfileRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerProfileRequest, CustomerProfile.MERCHANT_PROPERTY)); + } + + public MerchantRequest withoutCustomerProfileListMatching(CustomerProfileRequest customerProfileRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerProfileRequest, CustomerProfile.MERCHANT_PROPERTY))); + } + + public MerchantRequest haveCustomerProfiles(){ + return withCustomerProfileListMatching(Q.customerProfiles().unlimited()); + } + + public MerchantRequest haveNoCustomerProfiles(){ + return withoutCustomerProfileListMatching(Q.customerProfiles().unlimited()); + } + public MerchantRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerOrderRequest, CustomerOrder.MERCHANT_PROPERTY)); + } + + public MerchantRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerOrderRequest, CustomerOrder.MERCHANT_PROPERTY))); + } + + public MerchantRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public MerchantRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public MerchantRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public MerchantRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public MerchantRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public MerchantRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public MerchantRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public MerchantRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest groupByCustomerProfilesWithDetails(CustomerProfileRequest subRequest){ + aggregate(Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, subRequest); + return this; + } + public MerchantRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(Merchant.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public MerchantRequest groupById(){ + groupBy(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdAs(String retName){ + groupBy(retName, Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.ID_PROPERTY, function); + return this; + } + + public MerchantRequest groupByName(){ + groupBy(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameAs(String retName){ + groupBy(retName, Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.NAME_PROPERTY, function); + return this; + } + + public MerchantRequest groupByVersion(){ + groupBy(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionAs(String retName){ + groupBy(retName, Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.VERSION_PROPERTY, function); + return this; + } + + + + public MerchantRequest orderByIdAscending(){ + addOrderByAscending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByIdDescending(){ + addOrderByDescending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByNameAscending(){ + addOrderByAscending(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescending(){ + addOrderByDescending(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByVersionAscending(){ + addOrderByAscending(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest orderByVersionDescending(){ + addOrderByDescending(Merchant.VERSION_PROPERTY); + return this; + } + + + public MerchantRequest statsFromCustomerProfilesAs(String name, CustomerProfileRequest subRequest){ + return statsFromCustomerProfilesAs(name, subRequest, false); + } + + public MerchantRequest statsFromCustomerProfilesAs(String name, CustomerProfileRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerProfile.MERCHANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerProfilesAs", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + + public MerchantRequest statsFromCustomerProfiles(CustomerProfileRequest subRequest){ + return statsFromCustomerProfilesAs(REFINEMENTS, subRequest); + } + public MerchantRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public MerchantRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.MERCHANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public MerchantRequest countCustomerProfiles(){ + addRelationCount("Count", Q.customerProfiles().unlimited(), CustomerProfile.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfiles", null, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerProfilesAs(String name){ + addRelationCount(name, Q.customerProfiles().unlimited(), CustomerProfile.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfilesAs", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerProfilesWith(String name, CustomerProfileRequest subRequest){ + addRelationCount(name, subRequest, CustomerProfile.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfilesWith", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + public MerchantRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public MerchantRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public MerchantRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public MerchantRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public MerchantRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public MerchantRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public MerchantRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..7a28a8ea1 --- /dev/null +++ b/examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.merchantorderprivacyservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/pom.xml b/examples/security-foundations/java-app-console/pom.xml new file mode 100644 index 000000000..e5c5e3db9 --- /dev/null +++ b/examples/security-foundations/java-app-console/pom.xml @@ -0,0 +1,108 @@ + + + + 4.0.0 + + + io.teaql + teaql-java-parent + 6.3.0 + ../../../pom.xml + + com.teaql + merchant-order-privacy-service + jar + + + 21 + 0.0.1-SNAPSHOT + UTF-8 + true + 6.3.0 + + + + + aliyun-public + https://maven.aliyun.com/nexus/content/groups/public/ + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + junit + junit + test + + + io.teaql + teaql-provider-jdbc + ${teaql.version} + + + io.teaql + teaql-data-service-sql + ${teaql.version} + + + com.zaxxer + HikariCP + 6.3.0 + + + org.xerial + sqlite-jdbc + 3.53.2.1 + + com.teaql + merchant-order-privacy-service-core + ${libversion} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + package + shade + + false + + *:* + + META-INF/*.SF + META-INF/*.RSA + META-INF/*.DSA + + + + + + com.teaql.merchantorderprivacyservice.App + + + + + + + + \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/App.java b/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/App.java new file mode 100644 index 000000000..070b1c1e3 --- /dev/null +++ b/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/App.java @@ -0,0 +1,99 @@ + +package com.teaql.merchantorderprivacyservice; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.util.Properties; + +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.DataServiceExecutor; +import io.teaql.core.DataServiceRegistry; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.UserContext; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.TeaQLRuntime; +import javax.sql.DataSource; + +public class App { + + public static void main(String[] args) throws Exception { + Properties properties = new Properties(); + try (var input = App.class.getResourceAsStream("/application.properties")) { + if (input != null) properties.load(input); + } + for (String arg : args) { + if (!arg.startsWith("--") || !arg.contains("=")) { + throw new IllegalArgumentException("Expected --key=value argument"); + } + int separator = arg.indexOf('='); + properties.setProperty(arg.substring(2, separator), arg.substring(separator + 1)); + } + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(setting(properties, "teaql.datasource.url")); + String driver = setting(properties, "teaql.datasource.driver-class-name"); + if (driver != null) config.setDriverClassName(driver); + String username = setting(properties, "teaql.datasource.username"); + String password = setting(properties, "teaql.datasource.password"); + if (username != null) config.setUsername(username); + if (password != null) config.setPassword(password); + try (HikariDataSource source = new HikariDataSource(config)) { + App app = new App(); + JdbcSqlExecutor executor = new JdbcSqlExecutor(source); + TeaQLRuntime runtime = app.teaQLRuntime(app.entityMetaFactory(), + app.dataServiceRegistry(app.dataServiceExecutor(executor, source)), + app.teaQLDatabase(executor, source)); + UserContext context = new CustomUserContext(runtime); + context.ensureSchema(); + System.out.println("TeaQL schema ensured explicitly."); + System.out.println("TeaQL Console Application Started!"); + // Add your CLI logic here, using Q/E and context. + } + } + + private static String setting(Properties properties, String key) { + String value = System.getProperty(key, properties.getProperty(key)); + if (value != null && value.startsWith("${") && value.endsWith("}")) { + String variable = value.substring(2, value.length() - 1); + value = System.getenv(variable); + if (value == null) throw new IllegalStateException("Missing environment variable: " + variable); + } + return value; + } + + public EntityMetaFactory entityMetaFactory() { + SimpleEntityMetaFactory factory = new SimpleEntityMetaFactory(); + GeneratedRuntimeModule.module().install(factory); + EntityMetaFactory.registerGlobal(factory); + return factory; + } + + public DataServiceExecutor dataServiceExecutor( + JdbcSqlExecutor executor, DataSource dataSource) { + return new io.teaql.core.sqlite.SqliteDataServiceExecutor( + "default", executor, dataSource); + } + + public io.teaql.core.DataServiceRegistry dataServiceRegistry(DataServiceExecutor dataServiceExecutor) { + io.teaql.runtime.DefaultDataServiceRegistry registry = new io.teaql.runtime.DefaultDataServiceRegistry(); + registry.register("default", dataServiceExecutor); + return registry; + } + + public WorkspaceTeaQLDatabase teaQLDatabase(JdbcSqlExecutor executor, javax.sql.DataSource dataSource) { + return new WorkspaceTeaQLDatabase(executor, dataSource); + } + + public TeaQLRuntime teaQLRuntime( + EntityMetaFactory entityMetaFactory, + DataServiceRegistry registry, + WorkspaceTeaQLDatabase database) { + return TeaQLRuntime.builder() + .metadata(entityMetaFactory) + .registry(registry) + .idGenerationService(new IdSpaceIdGenerator(database)) + .build() + .install(GeneratedRuntimeModule.module()); + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/CustomUserContext.java b/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/CustomUserContext.java new file mode 100644 index 000000000..f4501a0ba --- /dev/null +++ b/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/CustomUserContext.java @@ -0,0 +1,26 @@ + +package com.teaql.merchantorderprivacyservice; + +import org.slf4j.MDC; +import io.teaql.runtime.DefaultUserContext; + +public class CustomUserContext extends DefaultUserContext implements MerchantOrderPrivacyServiceUserContext { + public CustomUserContext(io.teaql.runtime.TeaQLRuntime runtime) { + super(runtime); + } + public static final String USER_CONTEXT = "User-Context"; + public static final String ID_SPACE = "ID_SPACE"; + public static final String MERCHANT = "merchant"; + public static final String JOB = "job"; + + public void init(Object request) { + // String idSpace = getIdSpace(); + // if (idSpace != null) { + // MDC.put(ID_SPACE, idSpace); + // } + } + + public String getIdSpace() { + return null; // getHeader(ID_SPACE); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/WorkspaceTeaQLDatabase.java b/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/WorkspaceTeaQLDatabase.java new file mode 100644 index 000000000..6d17df75d --- /dev/null +++ b/examples/security-foundations/java-app-console/src/main/java/com/teaql/merchantorderprivacyservice/WorkspaceTeaQLDatabase.java @@ -0,0 +1,75 @@ +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.sql.portable.TeaQLDatabase; +import io.teaql.dataservice.sql.SqlExecutionAdapter; +import java.util.List; +import java.util.Map; + +/** SQL bridge used by framework services such as the persistent ID allocator. */ +public final class WorkspaceTeaQLDatabase implements TeaQLDatabase { + private final SqlExecutionAdapter executor; + private final javax.sql.DataSource dataSource; + + public WorkspaceTeaQLDatabase(SqlExecutionAdapter executor, javax.sql.DataSource dataSource) { + this.executor = executor; + this.dataSource = dataSource; + } + + @Override public List> query(String sql, Object[] args) { + return executor.queryForList(sql, args); + } + @Override public int executeUpdate(String sql, Object[] args) { + return executor.update(sql, args); + } + @Override public int[] batchUpdate(String sql, List args) { + return executor.batchUpdate(sql, args); + } + @Override public void execute(String sql) { executor.execute(sql); } + @Override public void executeInTransaction(Runnable action) { + executor.executeInTransaction(action); + } + @Override public List> getTableColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + var metadata = connection.getMetaData(); + var columns = new java.util.ArrayList>(); + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + try (var rows = metadata.getColumns(connection.getCatalog(), connection.getSchema(), name, null)) { + while (rows.next()) { + // JDBC table names are patterns: do not accept underscore wildcard matches. + if (!name.equals(rows.getString("TABLE_NAME"))) continue; + Map column = new java.util.HashMap<>(); + column.put("column_name", rows.getString("COLUMN_NAME")); + column.put("data_type", rows.getInt("DATA_TYPE")); + column.put("type_name", rows.getString("TYPE_NAME")); + column.put("column_size", rows.getInt("COLUMN_SIZE")); + column.put("decimal_digits", rows.getInt("DECIMAL_DIGITS")); + column.put("nullable", rows.getInt("NULLABLE")); + columns.add(column); + } + } + if (!columns.isEmpty()) break; + } + return columns; + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table columns: " + tableName, failure); + } + } + + @Override public java.util.Optional> getTablePrimaryKeyColumns(String tableName) { + try (var connection = dataSource.getConnection()) { + for (String name : List.of(tableName, tableName.toUpperCase(java.util.Locale.ROOT))) { + var ordered = new java.util.TreeMap(); + try (var rows = connection.getMetaData().getPrimaryKeys( + connection.getCatalog(), connection.getSchema(), name)) { + while (rows.next()) { + ordered.put(rows.getShort("KEY_SEQ"), rows.getString("COLUMN_NAME")); + } + } + if (!ordered.isEmpty()) return java.util.Optional.of(List.copyOf(ordered.values())); + } + return java.util.Optional.of(List.of()); + } catch (java.sql.SQLException failure) { + throw new IllegalStateException("Cannot inspect table primary key: " + tableName, failure); + } + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/src/main/resources/application.properties b/examples/security-foundations/java-app-console/src/main/resources/application.properties new file mode 100644 index 000000000..d707ccea6 --- /dev/null +++ b/examples/security-foundations/java-app-console/src/main/resources/application.properties @@ -0,0 +1,2 @@ +teaql.datasource.driver-class-name=org.sqlite.JDBC +teaql.datasource.url=jdbc:sqlite:merchantorderprivacyservice.db diff --git a/examples/security-foundations/java-app-console/src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java b/examples/security-foundations/java-app-console/src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java new file mode 100644 index 000000000..bca2917c4 --- /dev/null +++ b/examples/security-foundations/java-app-console/src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java @@ -0,0 +1,138 @@ +package com.teaql.merchantorderprivacyservice; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import io.teaql.core.UserContext; +import io.teaql.core.meta.SimpleEntityMetaFactory; +import io.teaql.core.reference.ReferenceDocumentScope; +import io.teaql.core.reference.RoundTripReferenceErrorCode; +import io.teaql.core.reference.RoundTripReferenceException; +import io.teaql.core.reference.TrustedReferencePrincipal; +import io.teaql.core.sql.portable.IdSpaceIdGenerator; +import io.teaql.core.sqlite.SqliteDataServiceExecutor; +import io.teaql.provider.jdbc.JdbcSqlExecutor; +import io.teaql.runtime.DefaultUserContext; +import io.teaql.runtime.SensitiveDiagnosticTextRuntimeLogSink; +import io.teaql.runtime.TeaQLRuntime; +import io.teaql.runtime.reference.AeadRoundTripReferenceProvider; +import io.teaql.runtime.reference.DeploymentProfile; +import io.teaql.runtime.reference.RoundTripReferenceKey; +import io.teaql.runtime.reference.StaticRoundTripReferenceKeyProvider; +import org.junit.Test; +import org.sqlite.SQLiteDataSource; + +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.Arrays; +import java.util.Map; + +import static org.junit.Assert.*; + +public class MerchantOrderPrivacyTest { + private static CustomerOrder order(UserContext context, Merchant merchant, String reference, String email) { + var profile = Q.customerProfiles().comment("Prepare a delivery profile") + .purpose("Associate customer delivery data with the authenticated merchant").newEntity(context); + profile.updateMerchant(merchant); + profile.updateEmail(email); + profile.auditAs("Record the customer's delivery profile").save(context); + var order = Q.customerOrders().comment("Prepare a dispatch order") + .purpose("Keep the merchant's dispatch and its delivery profile together").newEntity(context); + order.updateMerchant(merchant); + order.updateCustomerProfile(profile); + order.updateOrderNumber(reference); + order.updateFulfillmentStatus("ready"); + order.auditAs("Queue the merchant dispatch").save(context); + return order; + } + + private static CustomerOrder lookup(UserContext context, long merchant, long id, String reference, String email) { + return Q.customerOrders().withIdIs(id).withOrderNumberIs(reference) + .withMerchantMatching(Q.merchantsWithMinimalFields().withIdIs(merchant)) + .withCustomerProfileMatching(Q.customerProfilesWithMinimalFields().withEmailIs(email)) + .selectCustomerProfile().limit(1) + .comment("Read the scoped dispatch and its delivery profile") + .purpose("Show a dispatch belonging to the authenticated merchant") + .executeForOne(context); + } + + private static UserContext principal(TeaQLRuntime runtime, long merchant) { + return new DefaultUserContext(runtime).withTrustedReferencePrincipal( + new TrustedReferencePrincipal("local-fixture", "dispatcher", "Merchant", merchant)); + } + + @Test public void governedOrderAndItsPrivacyBoundaries() throws Exception { + String round = System.getenv("TEAQL_SHOWCASE_ROUND"); + var source = new SQLiteDataSource(); + source.setUrl("jdbc:sqlite:" + System.getenv("TEAQL_ORDER_PRIVACY_DATABASE")); + var jdbc = new JdbcSqlExecutor(source); + var sqlite = new SqliteDataServiceExecutor("sqlite", jdbc, source); + var ids = new IdSpaceIdGenerator(new WorkspaceTeaQLDatabase(jdbc, source)); + ids.ensureIdSpaceTable(); + + byte[] key = new byte[32]; + Arrays.fill(key, (byte) 0x27); + var provider = AeadRoundTripReferenceProvider.governed(DeploymentProfile.TEST, "merchant-dispatch", + "local-fixture", new StaticRoundTripReferenceKeyProvider(new RoundTripReferenceKey("fixture", key)), + (caller, principal, scope, identity) -> { + if (!"dispatcher".equals(principal.subject()) || !"Merchant".equals(principal.domainRootType()) + || principal.domainRootId() != 1 || !"view-dispatch".equals(scope.purpose()) + || !"CustomerOrder".equals(scope.aggregateType()) || !"CustomerOrder".equals(identity.entityType())) { + throw new RoundTripReferenceException(RoundTripReferenceErrorCode.AUTHORIZATION_REQUIRED, + "The principal cannot use this dispatch reference"); + } + }); + var runtime = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", sqlite).dataService("sqlite", sqlite) + .idGenerationService(ids).roundTripReferenceProvider(provider).build().install(GeneratedRuntimeModule.module()); + var context = principal(runtime, 1); + context.ensureSchema(); + var merchant = Q.merchantsWithMinimalFields().withIdIs(1L).limit(1) + .comment("Read the initialized merchant").purpose("Set the trusted dispatch scope").executeForOne(context); + assertNotNull(merchant); + var other = Q.merchants().comment("Prepare an independent merchant") + .purpose("Prove that a second merchant's order remains outside the current scope").newEntity(context); + other.updateName("Independent retailer " + round); + other.auditAs("Register a second merchant").save(context); + + String email = "sealed-" + round + "@example.test"; + String foreignEmail = "foreign-" + round + "@example.test"; + String reference = "SHIP-PRIVATE-" + round; + String foreignReference = "SHIP-OTHER-" + round; + var own = order(context, merchant, reference, email); + var foreign = order(context, other, foreignReference, foreignEmail); + var scope = new ReferenceDocumentScope("dispatch-" + own.getId(), "view-dispatch", "CustomerOrder", own.getId(), own.getVersion()); + Object token = context.referenceFor(own, scope, Duration.ofMinutes(5)); + assertTrue(token.toString().startsWith("tqr1.")); + var wrongPurpose = new ReferenceDocumentScope(scope.documentId(), "edit-dispatch", scope.aggregateType(), scope.aggregateId(), scope.aggregateRevision()); + assertThrows(RoundTripReferenceException.class, () -> context.resolveReference(token, wrongPurpose, "CustomerOrder")); + assertThrows(RoundTripReferenceException.class, () -> principal(runtime, other.getId()).resolveReference(token, scope, "CustomerOrder")); + var claims = context.resolveReference(token, scope, "CustomerOrder"); + var row = lookup(context, merchant.getId(), claims.id(), reference, email); + assertNotNull(row); + assertEquals(claims.version(), row.getVersion().longValue()); + assertEquals(email, E.customerOrder(row).getCustomerProfile().eval().getEmail()); + assertNull(lookup(context, merchant.getId(), foreign.getId(), foreignReference, foreignEmail)); + + try (var output = new PrintStream(Files.newOutputStream(Path.of(System.getenv("TEAQL_ORDER_PRIVACY_DEBUG_FILE"))), + true, StandardCharsets.UTF_8)) { + var isolatedDiagnostic = TeaQLRuntime.builder().metadata(new SimpleEntityMetaFactory()) + .dataService("default", sqlite).dataService("sqlite", sqlite).idGenerationService(ids) + .logSink(new SensitiveDiagnosticTextRuntimeLogSink(output)) + .build().install(GeneratedRuntimeModule.module()); + var checked = lookup(principal(isolatedDiagnostic, merchant.getId()), merchant.getId(), claims.id(), reference, email); + assertNotNull(checked); + assertEquals(row.getId(), checked.getId()); + } + + assertTrue(CustomerOrder.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath() + .endsWith("/java-lib-core/lib/target/classes/")); + System.out.println("ORDER_PRIVACY=" + new ObjectMapper().writeValueAsString(Map.of( + "round", round, "authorizedOrder", row.getId(), "foreignOrder", foreign.getId(), + "merchant", merchant.getId(), "foreignMerchant", other.getId(), + "purposeDenied", true, "foreignDenied", true, "version", row.getVersion()))); + } +} diff --git a/examples/security-foundations/java-app-console/teaql-i18n.json b/examples/security-foundations/java-app-console/teaql-i18n.json new file mode 100644 index 000000000..47f7657bc --- /dev/null +++ b/examples/security-foundations/java-app-console/teaql-i18n.json @@ -0,0 +1,112 @@ +{ + "schema": "teaql.i18n/v1", + "defaultLocale": "en", + "locales": { + "de": { + "vocabulary": { + }, + "messages": { + } + }, + "ko": { + "vocabulary": { + }, + "messages": { + } + }, + "pt": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-TW": { + "vocabulary": { + }, + "messages": { + } + }, + "fil": { + "vocabulary": { + }, + "messages": { + } + }, + "en": { + "vocabulary": { + "property.customerProfile.email": "Email", + "property.customerOrder.orderNumber": "Order Number", + "property.customerOrder.customerProfile": "Customer Profile", + "entity.merchant": "Merchant", + "property.merchant.name": "Name", + "property.customerOrder.fulfillmentStatus": "Fulfillment Status", + "property.merchant.version": "Version", + "property.customerProfile.version": "Version", + "entity.customerOrder": "Customer Order", + "property.customerProfile.merchant": "Merchant", + "property.customerProfile.id": "Id", + "property.customerOrder.id": "Id", + "property.customerOrder.merchant": "Merchant", + "property.merchant.id": "Id", + "entity.customerProfile": "Customer Profile", + "property.customerOrder.version": "Version" + }, + "messages": { + } + }, + "fr": { + "vocabulary": { + }, + "messages": { + } + }, + "zh-CN": { + "vocabulary": { + }, + "messages": { + } + }, + "es": { + "vocabulary": { + }, + "messages": { + } + }, + "ar": { + "vocabulary": { + }, + "messages": { + } + }, + "vi": { + "vocabulary": { + }, + "messages": { + } + }, + "th": { + "vocabulary": { + }, + "messages": { + } + }, + "uk": { + "vocabulary": { + }, + "messages": { + } + }, + "ja": { + "vocabulary": { + }, + "messages": { + } + }, + "id": { + "vocabulary": { + }, + "messages": { + } + } + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/teaql/checker-model.json b/examples/security-foundations/java-app-console/teaql/checker-model.json new file mode 100644 index 000000000..168786761 --- /dev/null +++ b/examples/security-foundations/java-app-console/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:9136e660d5a681229d56c6670cb24a5831b04ca1677b181ea98574f12221c515","entities":{"CustomerOrder":{"labels":{"en":"Customer Order"},"fields":[{"name":"customer_profile","targetType":"CustomerProfile","labels":{"en":"Customer Profile"},"aliases":["CustomerProfile","customerProfile"]},{"name":"fulfillment_status","labels":{"en":"fulfillment status"},"aliases":["FulfillmentStatus","fulfillmentStatus"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"merchant","targetType":"Merchant","labels":{"en":"Merchant"},"aliases":["Merchant"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerProfile":{"labels":{"en":"Customer Profile"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"email","labels":{"en":"email"},"aliases":["Email"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"merchant","targetType":"Merchant","labels":{"en":"Merchant"},"aliases":["Merchant"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Merchant":{"labels":{"en":"Merchant"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"customer_profile_list","targetType":"CustomerProfile","labels":{"en":"Customer Profile"},"aliases":["CustomerProfileList","customerProfileList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/teaql/model-provenance.json b/examples/security-foundations/java-app-console/teaql/model-provenance.json new file mode 100644 index 000000000..e4d7e1753 --- /dev/null +++ b/examples/security-foundations/java-app-console/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:fb96f88e8c6c737598d67e52cd0cb49e174286ab83ba418b0a041f42ecd3b4e8","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/pom.xml b/examples/security-foundations/java-lib-core/lib/pom.xml new file mode 100644 index 000000000..bd2c4cc53 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/pom.xml @@ -0,0 +1,142 @@ + + + 4.0.0 + + com.teaql + merchant-order-privacy-service-core + 0.0.1-SNAPSHOT + jar + + + 21 + 4.1.1 + 6.3.0 + UTF-8 + true + + + + + teaql + https://maven.teaql.io/repository/maven-releases/ + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + org.apache.tomcat.embed + tomcat-embed-core + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-el + 11.0.26 + + + org.apache.tomcat.embed + tomcat-embed-websocket + 11.0.26 + + + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-tx + + + io.teaql + teaql-sqlite + ${teaql.version} + + + io.teaql + teaql-core + ${teaql.version} + + + io.teaql + teaql-runtime + ${teaql.version} + + + cn.hutool + hutool-all + 5.8.20 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + ${java.version} + ${maven.compiler.parameters} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + enforce-java-version + + enforce + + + + + [${java.version},) + + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + + attach-sources + + jar-no-fork + + + + + + + + + + target-repo + https://maven.teaql.io/repository/maven-releases/ + + + \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java new file mode 100644 index 000000000..bc79fc767 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java @@ -0,0 +1,9 @@ + +package com.teaql.merchantorderprivacyservice; + +import com.teaql.merchantorderprivacyservice.merchant.Merchant; + +public interface Constants { + public static final long MERCHANT_ID = 1l; + public static final Merchant MERCHANT = Merchant.refer(MERCHANT_ID); +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java new file mode 100644 index 000000000..e791a61e2 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java @@ -0,0 +1,23 @@ + +package com.teaql.merchantorderprivacyservice; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderExpression; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileExpression; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; +import io.teaql.core.checker.JsonFieldNamingProfile; +import io.teaql.core.value.ValueExpression; + +public class E { + public static MerchantExpression merchant(Merchant merchant){ + return new MerchantExpression(new ValueExpression(merchant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.merchant()")); + } + public static CustomerProfileExpression customerProfile(CustomerProfile customerProfile){ + return new CustomerProfileExpression(new ValueExpression(customerProfile, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerProfile()")); + } + public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ + return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java new file mode 100644 index 000000000..a573c8fcc --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java @@ -0,0 +1,429 @@ + +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.FieldLayout; +import io.teaql.core.meta.EntityDescriptor; +import io.teaql.core.meta.EntityMetaAssembler; +import io.teaql.core.meta.EntityMetaFactory; +import io.teaql.core.meta.PropertyDescriptor; + +public class EntityMetaRegistry implements EntityMetaAssembler { + private EntityMetaFactory $factory; + + @Override + public void assemble(EntityMetaFactory factory) { + this.$factory = factory; + registerMerchant(); + registerCustomerProfile(); + registerCustomerOrder(); + } + private void registerMerchant() { + FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.merchant.Merchant.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.merchant.Merchant.class); + entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.merchant.Merchant::new); + entityDescriptor.with("name", "Merchant") + + .with("module", "Sales") + + .with("module_key", "sales") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY, Long.class) + ; + PropertyDescriptor name = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("candidates", "Harbour Retail") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerProfile() { + FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class); + entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile::new); + entityDescriptor.with("name", "Customer Profile") + + .with("module", "Sales") + + .with("module_key", "sales") + + .with("audit_mask_fields", "email") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY)); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY, Long.class) + ; + PropertyDescriptor merchant = + entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.MERCHANT_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.merchant.Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.class) + ; + PropertyDescriptor email = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.MERCHANT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } + private void registerCustomerOrder() { + FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); + EntityDescriptor entityDescriptor = new EntityDescriptor(); + entityDescriptor.setType(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.INTERNAL_TYPE); + entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class); + entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder::new); + entityDescriptor.with("name", "Customer Order") + + .with("module", "Sales") + + .with("module_key", "sales") + ; + + entityDescriptor.setAuditMaskFields(java.util.List.of()); + PropertyDescriptor id = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) + ; + PropertyDescriptor merchant = + entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.MERCHANT_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.merchant.Merchant.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.class) + ; + PropertyDescriptor customerProfile = + entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.CUSTOMER_PROFILE_PROPERTY, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class) + ; + PropertyDescriptor orderNumber = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) + ; + PropertyDescriptor fulfillmentStatus = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY, String.class) + ; + PropertyDescriptor version = + entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) + ; + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") + + .with("isVersion", "false") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "true") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.MERCHANT_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.CUSTOMER_PROFILE_PROPERTY).with("required", "true"); + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY).with("isPassword", "false") + + .with("max", "100") + + .with("isVersion", "false") + + .with("javaType", "java.lang.String") + + .with("sqlType", "VARCHAR()") + + .with("isId", "false") + + .with("isBool", "false") + + .with("isBaseEntityField", "false") + + .with("isNumber", "false") + + .with("isString", "true") + + .with("isDate", "false") + + .with("graphqlType", "String") + + .with("isTime", "false") + + .with("isText", "false") + ; + + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); + entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") + + .with("isVersion", "true") + + .with("oracle_sqlType", "number(11)") + + .with("javaType", "java.lang.Long") + + .with("sqlType", "BIGINT") + + .with("isId", "false") + + .with("isBaseEntityField", "true") + + .with("isBool", "false") + + .with("isNumber", "false") + + .with("isString", "false") + + .with("isDate", "false") + + .with("snowflake_sqlType", "number") + + .with("graphqlType", "Long") + + .with("isTime", "false") + + .with("isText", "false") + ; + + $factory.register(entityDescriptor); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java new file mode 100644 index 000000000..591b7e603 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java @@ -0,0 +1,38 @@ +package com.teaql.merchantorderprivacyservice; + +/** Passive generated manifest. Database changes require context.ensureSchema(). */ +public final class GeneratedRuntimeModule { + private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) + .withCheckers(new com.teaql.merchantorderprivacyservice.merchant.MerchantChecker(), new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker(), new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker()) + .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:9136e660d5a681229d56c6670cb24a5831b04ca1677b181ea98574f12221c515\",\"entities\":{\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"customer_profile\",\"targetType\":\"CustomerProfile\",\"labels\":{\"en\":\"Customer Profile\"},\"aliases\":[\"CustomerProfile\",\"customerProfile\"]},{\"name\":\"fulfillment_status\",\"labels\":{\"en\":\"fulfillment status\"},\"aliases\":[\"FulfillmentStatus\",\"fulfillmentStatus\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"Merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerProfile\":{\"labels\":{\"en\":\"Customer Profile\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"email\",\"labels\":{\"en\":\"email\"},\"aliases\":[\"Email\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"Merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Merchant\":{\"labels\":{\"en\":\"Merchant\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"customer_profile_list\",\"targetType\":\"CustomerProfile\",\"labels\":{\"en\":\"Customer Profile\"},\"aliases\":[\"CustomerProfileList\",\"customerProfileList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) + .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); + + private GeneratedRuntimeModule() {} + public static io.teaql.core.RuntimeModule module() { return MODULE; } + + /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ + public static java.util.Map> wireFieldMappings() { + return java.util.Map.ofEntries( + java.util.Map.entry("Merchant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerProfile", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("email", "email"), java.util.Map.entry("version", "version"))), + java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("customer_profile", "customerProfile"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("fulfillment_status", "fulfillmentStatus"), java.util.Map.entry("version", "version"))) + ); + } + + /** Accepted legacy aliases; empty until explicitly declared by the model. */ + public static java.util.Map> wireFieldAliases() { + return java.util.Map.of(); + } + + private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { + var domainRoots = Q.merchants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); + com.teaql.merchantorderprivacyservice.merchant.Merchant domainRoot; + if (domainRoots.isEmpty()) { + domainRoot = new com.teaql.merchantorderprivacyservice.merchant.Merchant(); + io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); + domainRoot.updateName("Harbour Retail"); + domainRoot.auditAs("create generated Domain Root Merchant").save(context); + } else { domainRoot = domainRoots.get(0); } + context.withActiveRoot(new io.teaql.core.ContextEntityRef("Merchant", domainRoot.getId())); + } +} diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java new file mode 100644 index 000000000..8b8afaf68 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java @@ -0,0 +1,10 @@ + +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.UserContext; +public interface MerchantOrderPrivacyServiceUserContext extends UserContext{ + + + + +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java new file mode 100644 index 000000000..8feed11c0 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java @@ -0,0 +1,34 @@ + +package com.teaql.merchantorderprivacyservice; + +import io.teaql.core.criteria.Operator; + +public class Q { + public static com.teaql.merchantorderprivacyservice.merchant.MerchantRequest merchants(){ + return new com.teaql.merchantorderprivacyservice.merchant.MerchantRequest(com.teaql.merchantorderprivacyservice.merchant.Merchant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.merchantorderprivacyservice.merchant.MerchantRequest merchantsWithMinimalFields(){ + return new com.teaql.merchantorderprivacyservice.merchant.MerchantRequest(com.teaql.merchantorderprivacyservice.merchant.Merchant.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest customerProfiles(){ + return new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest customerProfilesWithMinimalFields(){ + return new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + + public static com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest customerOrders(){ + return new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); + } + public static com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ + return new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); + } + + + +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java new file mode 100644 index 000000000..2a3c3f2cf --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java @@ -0,0 +1,170 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerOrder extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerOrder"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "1e5c269646b9d3a77d2b8da3dfb1cf2899c91e276510b91bba15700d02c0d1a3"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("customer_profile", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("fulfillment_status", 4), java.util.Map.entry("version", 5)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("customer_profile", java.util.List.of("customerProfile", "customer_profile")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("fulfillment_status", java.util.List.of("fulfillmentStatus", "fulfillment_status")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( +); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String MERCHANT_PROPERTY = "merchant"; + public static final String CUSTOMER_PROFILE_PROPERTY = "customer_profile"; + public static final String ORDER_NUMBER_PROPERTY = "order_number"; + public static final String FULFILLMENT_STATUS_PROPERTY = "fulfillment_status"; + private Merchant merchant; + + private CustomerProfile customerProfile; + + private String orderNumber; + + private String fulfillmentStatus; + + + public Merchant getMerchant(){ + return this.merchant; + } + + public CustomerProfile getCustomerProfile(){ + return this.customerProfile; + } + + public String getOrderNumber(){ + return this.orderNumber; + } + + public String getFulfillmentStatus(){ + return this.fulfillmentStatus; + } + + public CustomerOrder updateMerchant(Merchant merchant){ + if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ + return this; + } + handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); + this.merchant = merchant; + return this; + } + + public CustomerOrder updateCustomerProfile(CustomerProfile customerProfile){ + if(isPropertyLoaded(CUSTOMER_PROFILE_PROPERTY) && Objects.equals(this.customerProfile, customerProfile)){ + return this; + } + handleUpdate(CUSTOMER_PROFILE_PROPERTY, getCustomerProfile(), customerProfile); + this.customerProfile = customerProfile; + return this; + } + + public CustomerOrder updateOrderNumber(String orderNumber){ + orderNumber = (orderNumber == null ? null : orderNumber.trim()); + if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ + return this; + } + handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); + this.orderNumber = orderNumber; + return this; + } + + public CustomerOrder updateFulfillmentStatus(String fulfillmentStatus){ + fulfillmentStatus = (fulfillmentStatus == null ? null : fulfillmentStatus.trim()); + if(isPropertyLoaded(FULFILLMENT_STATUS_PROPERTY) && Objects.equals(this.fulfillmentStatus, fulfillmentStatus)){ + return this; + } + handleUpdate(FULFILLMENT_STATUS_PROPERTY, getFulfillmentStatus(), fulfillmentStatus); + this.fulfillmentStatus = fulfillmentStatus; + return this; + } + + + public static CustomerOrder refer(Long id){ + CustomerOrder refer = new CustomerOrder(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerOrder comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "merchant": this.merchant = (Merchant) value; break; + + case "customer_profile": this.customerProfile = (CustomerProfile) value; break; + + case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; + + case "fulfillment_status": this.fulfillmentStatus = (value == null ? null : ((String)value).trim()); break; + + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "merchant": return this.merchant; + case "customer_profile": return this.customerProfile; + case "order_number": return this.orderNumber; + case "fulfillment_status": return this.fulfillmentStatus; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "merchant": return this.merchant; + case "customerProfile": return this.customerProfile; + case "orderNumber": return this.orderNumber; + case "fulfillmentStatus": return this.fulfillmentStatus; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java new file mode 100644 index 000000000..dc1f2d837 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java @@ -0,0 +1,84 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerOrderChecker implements Checker{ + + public String type(){ + return CustomerOrder.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if(needCheck(_context, customerOrder)){ + markAsChecked(_context, customerOrder); + doCheck(_context, customerOrder, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ + if((customerOrder == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerOrder); + if(customerOrder.needPersist()){ + } + if(customerOrder.newItem()){ + }else if(customerOrder.updateItem()){ + if(!customerOrder.isPropertyLoaded("merchant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("customer_profile")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "customer_profile"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("order_number")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); + } + if(!customerOrder.isPropertyLoaded("fulfillment_status")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "fulfillment_status"), "Mutation requires a fully loaded entity"); + } + + } + checkMerchant(_context, customerOrder.getProperty(CustomerOrder.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); + checkCustomerProfile(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY), newLocation(_parentLocation, "customer_profile")); + checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); + checkFulfillmentStatus(_context, customerOrder.getProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY), newLocation(_parentLocation, "fulfillment_status")); + } + + public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, merchant); + if((merchant == null)){ + return; + } + new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); + } + public void checkCustomerProfile(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, customerProfile); + if((customerProfile == null)){ + return; + } + new CustomerProfileChecker().checkAndFix(_context, customerProfile, _parentLocation); + } + public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, orderNumber); + if((orderNumber == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, orderNumber); + + } + public void checkFulfillmentStatus(UserContext _context, String fulfillmentStatus, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, fulfillmentStatus); + if((fulfillmentStatus == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, fulfillmentStatus); + + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java new file mode 100644 index 000000000..326968aa8 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java @@ -0,0 +1,70 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileExpression; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerOrderExpression(Expression expression){ + super(expression); + } + + public CustomerOrderExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerOrderExpression updateId(Long id){ + return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); + } + + public CustomerOrderExpression save(UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerOrderExpression save(String intent, UserContext userContext){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public MerchantExpression getMerchant(){ + return new MerchantExpression(loaded("merchant", "getMerchant", CustomerOrder::getMerchant)); + } + + public CustomerOrderExpression updateMerchant(Merchant merchant){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateMerchant(merchant)); + } + + public CustomerProfileExpression getCustomerProfile(){ + return new CustomerProfileExpression(loaded("customer_profile", "getCustomerProfile", CustomerOrder::getCustomerProfile)); + } + + public CustomerOrderExpression updateCustomerProfile(CustomerProfile customerProfile){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomerProfile(customerProfile)); + } + + public Expression getOrderNumber(){ + return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); + } + public CustomerOrderExpression updateOrderNumber(String orderNumber){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); + } + + public Expression getFulfillmentStatus(){ + return loaded("fulfillment_status", "getFulfillmentStatus", CustomerOrder::getFulfillmentStatus); + } + public CustomerOrderExpression updateFulfillmentStatus(String fulfillmentStatus){ + return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateFulfillmentStatus(fulfillmentStatus)); + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java new file mode 100644 index 000000000..bb3804728 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerOrderListExpression extends SmartListExpression { + public CustomerOrderListExpression(Expression> expression){ + super(expression); + } + + public CustomerOrderListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerOrderExpression first() { + return new CustomerOrderExpression(super.first()); + } + + public CustomerOrderExpression get(int index) { + return new CustomerOrderExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java new file mode 100644 index 000000000..b2495f5f8 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java @@ -0,0 +1,959 @@ + +package com.teaql.merchantorderprivacyservice.customerorder; + +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerOrderRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerOrderRequest(Class returnType){ + this(returnType, () -> (T) new CustomerOrder()); + } + + protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerOrderRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerOrderRequest copy(){ + return (CustomerOrderRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerOrderRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerOrderRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerOrderRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerOrderRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerOrderRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerOrderRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ + super.internalMatchAny(customerOrder); + return this; + } + + public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); + } + + public CustomerOrderRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerOrderRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerOrderRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerOrderRequest selectSelf(){ + super.selectSelf(); + return selectId().selectMerchantIdOnly().selectCustomerProfileIdOnly().selectOrderNumber().selectFulfillmentStatus().selectVersion(); + } + + public CustomerOrderRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerOrderRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerOrder.ID_PROPERTY); + selectProperty(CustomerOrder.MERCHANT_PROPERTY); + selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + selectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest selectAll(){ + super.selectAll(); + return selectId().selectMerchant().selectCustomerProfile().selectOrderNumber().selectFulfillmentStatus().selectVersion(); + } + + public CustomerOrderRequest selectChildren(){ + super.selectAny(); + return selectId().selectMerchant().selectCustomerProfile().selectOrderNumber().selectFulfillmentStatus().selectVersion(); + } + + + public CustomerOrderRequest selectId(){ + selectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectId(){ + unselectProperty(CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest selectMerchantIdOnly(){ + selectProperty(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest selectMerchant(){ + return selectMerchantWith(Q.merchants().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectMerchantWith(MerchantRequest merchant){ + selectProperty(CustomerOrder.MERCHANT_PROPERTY); + enhanceRelation(CustomerOrder.MERCHANT_PROPERTY, merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, CustomerOrder.MERCHANT_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectMerchant(){ + unselectProperty(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + public CustomerOrderRequest selectCustomerProfileIdOnly(){ + selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest selectCustomerProfile(){ + return selectCustomerProfileWith(Q.customerProfiles().unlimited().selectSelf()); + } + + public CustomerOrderRequest selectCustomerProfileWith(CustomerProfileRequest customerProfile){ + selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + enhanceRelation(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerProfileWith", null, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); + return this; + } + + public CustomerOrderRequest unselectCustomerProfile(){ + unselectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + public CustomerOrderRequest selectOrderNumber(){ + selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + /** + * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectOrderNumber(){ + unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest selectFulfillmentStatus(){ + selectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + /** + * fill the fulfillmentStatus with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS fulfillmentStatus) to fetch fulfillmentStatus property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectFulfillmentStatus(){ + unselectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest selectVersion(){ + selectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerOrderRequest unselectVersion(){ + unselectProperty(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); + } + + public CustomerOrderRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerOrderRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerOrderRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerOrderRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerOrderRequest filterByMerchant(Merchant... merchant){ + if (merchant == null || merchant.length == 0) { + throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); + } + return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); + } + + public CustomerOrderRequest withMerchant(Operator operator, Object... values){ + return appendSearchCriteria(createMerchantCriteria(operator, values)); + } + + public CustomerOrderRequest withMerchantIsUnknown(){ + return withMerchant(Operator.IS_NULL); + } + + public CustomerOrderRequest withMerchantIsKnown(){ + return withMerchant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.MERCHANT_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByMerchant(Long merchant){ + if(merchant == null){ + return this; + } + return withMerchant(Operator.EQUAL, merchant); + } + public CustomerOrderRequest withMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByCustomerProfile(CustomerProfile... customerProfile){ + if (customerProfile == null || customerProfile.length == 0) { + throw new IllegalArgumentException("filterByCustomerProfile parameter customerProfile cannot be empty"); + } + return appendSearchCriteria(createCustomerProfileCriteria(Operator.EQUAL, (Object[])customerProfile)); + } + + public CustomerOrderRequest withCustomerProfile(Operator operator, Object... values){ + return appendSearchCriteria(createCustomerProfileCriteria(operator, values)); + } + + public CustomerOrderRequest withCustomerProfileIsUnknown(){ + return withCustomerProfile(Operator.IS_NULL); + } + + public CustomerOrderRequest withCustomerProfileIsKnown(){ + return withCustomerProfile(Operator.IS_NOT_NULL); + } + + public SearchCriteria createCustomerProfileCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, operator, values); + } + + public CustomerOrderRequest filterByCustomerProfile(Long customerProfile){ + if(customerProfile == null){ + return this; + } + return withCustomerProfile(Operator.EQUAL, customerProfile); + } + public CustomerOrderRequest withCustomerProfileMatching(CustomerProfileRequest customerProfile){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, CustomerProfile.ID_PROPERTY)); + } + + public CustomerOrderRequest withoutCustomerProfileMatching(CustomerProfileRequest customerProfile){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, CustomerProfile.ID_PROPERTY))); + } + + public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ + if (orderNumber == null || orderNumber.length == 0) { + throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); + } + return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); + } + + public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ + return appendSearchCriteria(createOrderNumberCriteria(operator, values)); + } + + public CustomerOrderRequest withOrderNumberIsUnknown(){ + return withOrderNumber(Operator.IS_NULL); + } + + public CustomerOrderRequest withOrderNumberIsKnown(){ + return withOrderNumber(Operator.IS_NOT_NULL); + } + + public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); + } + + public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ + return withOrderNumber(Operator.NOT_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ + return withOrderNumber(Operator.IN, (Object[])orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ + return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); + } + public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ + return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ + return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); + } + public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ + return withOrderNumber(Operator.BEGIN_WITH, orderNumber); + } + public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ + return withOrderNumber(Operator.CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ + return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ + return withOrderNumber(Operator.END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ + return withOrderNumber(Operator.NOT_END_WITH, orderNumber); + } + + public CustomerOrderRequest withOrderNumberIs(String orderNumber){ + return withOrderNumber(Operator.EQUAL, orderNumber); + } + + public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ + return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); + } + + + + public CustomerOrderRequest filterByFulfillmentStatus(String... fulfillmentStatus){ + if (fulfillmentStatus == null || fulfillmentStatus.length == 0) { + throw new IllegalArgumentException("filterByFulfillmentStatus parameter fulfillmentStatus cannot be empty"); + } + return appendSearchCriteria(createFulfillmentStatusCriteria(Operator.EQUAL, (Object[])fulfillmentStatus)); + } + + public CustomerOrderRequest withFulfillmentStatus(Operator operator, Object... values){ + return appendSearchCriteria(createFulfillmentStatusCriteria(operator, values)); + } + + public CustomerOrderRequest withFulfillmentStatusIsUnknown(){ + return withFulfillmentStatus(Operator.IS_NULL); + } + + public CustomerOrderRequest withFulfillmentStatusIsKnown(){ + return withFulfillmentStatus(Operator.IS_NOT_NULL); + } + + public SearchCriteria createFulfillmentStatusCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.FULFILLMENT_STATUS_PROPERTY, operator, values); + } + + public CustomerOrderRequest withFulfillmentStatusIsNot(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusIn(String... fulfillmentStatus){ + return withFulfillmentStatus(Operator.IN, (Object[])fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotIn(String... fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_IN, (Object[])fulfillmentStatus); + } + public CustomerOrderRequest withFulfillmentStatusGreaterThan(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.GREATER_THAN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusGreaterThanOrEqualTo(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.GREATER_THAN_OR_EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusLessThan(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.LESS_THAN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusLessThanOrEqualTo(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.LESS_THAN_OR_EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusBetween(String startOfFulfillmentStatus, String endOfFulfillmentStatus){ + return withFulfillmentStatus(Operator.BETWEEN, startOfFulfillmentStatus, endOfFulfillmentStatus); + } + public CustomerOrderRequest withFulfillmentStatusStartingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.BEGIN_WITH, fulfillmentStatus); + } + public CustomerOrderRequest withFulfillmentStatusContaining(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.CONTAIN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotContaining(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_CONTAIN, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotStartingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_BEGIN_WITH, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusEndingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.END_WITH, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusNotEndingWith(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.NOT_END_WITH, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusIs(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.EQUAL, fulfillmentStatus); + } + + public CustomerOrderRequest withFulfillmentStatusSoundingLike(String fulfillmentStatus){ + return withFulfillmentStatus(Operator.SOUNDS_LIKE, fulfillmentStatus); + } + + + + public CustomerOrderRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerOrderRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerOrderRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerOrderRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); + } + + public CustomerOrderRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerOrderRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerOrderRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerOrderRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerOrderRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + + public CustomerOrderRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerOrderRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerOrderRequest groupByMerchantWithDetails(){ + return groupByMerchantWithDetails(Q.merchants().unlimited()); + } + + public CustomerOrderRequest groupByMerchantWithDetails(MerchantRequest subRequest){ + aggregate(CustomerOrder.MERCHANT_PROPERTY, subRequest); + return this; + } + + public CustomerOrderRequest groupByCustomerProfileWithDetails(){ + return groupByCustomerProfileWithDetails(Q.customerProfiles().unlimited()); + } + + public CustomerOrderRequest groupByCustomerProfileWithDetails(CustomerProfileRequest subRequest){ + aggregate(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, subRequest); + return this; + } + + + + + public CustomerOrderRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerOrderRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctMerchant(){ + return countDistinctMerchantAs("merchant_distinct_count"); + } + + public CustomerOrderRequest countDistinctMerchantAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.MERCHANT_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctCustomerProfile(){ + return countDistinctCustomerProfileAs("customer_profile_distinct_count"); + } + + public CustomerOrderRequest countDistinctCustomerProfileAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctOrderNumber(){ + return countDistinctOrderNumberAs("order_number_distinct_count"); + } + + public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctFulfillmentStatus(){ + return countDistinctFulfillmentStatusAs("fulfillment_status_distinct_count"); + } + + public CustomerOrderRequest countDistinctFulfillmentStatusAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerOrderRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupById(){ + groupBy(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdAs(String retName){ + groupBy(retName, CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ID_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByMerchantWith(MerchantRequest subRequest){ + groupBy(CustomerOrder.MERCHANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); + return this; + } + public CustomerOrderRequest groupByMerchant(){ + groupBy(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByMerchantAs(String retName){ + groupBy(retName, CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByMerchantWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.MERCHANT_PROPERTY, function); + return this; + } + public CustomerOrderRequest groupByCustomerProfileWith(CustomerProfileRequest subRequest){ + groupBy(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerProfileWith", null, "customer_profile")); + return this; + } + public CustomerOrderRequest groupByCustomerProfile(){ + groupBy(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerProfileAs(String retName){ + groupBy(retName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByCustomerProfileWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByOrderNumber(){ + groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberAs(String retName){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByFulfillmentStatus(){ + groupBy(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByFulfillmentStatusAs(String retName){ + groupBy(retName, CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByFulfillmentStatusWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.FULFILLMENT_STATUS_PROPERTY, function); + return this; + } + + public CustomerOrderRequest groupByVersion(){ + groupBy(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerOrderRequest orderByIdAscending(){ + addOrderByAscending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByIdDescending(){ + addOrderByDescending(CustomerOrder.ID_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByMerchantAscending(){ + addOrderByAscending(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByMerchantDescending(){ + addOrderByDescending(CustomerOrder.MERCHANT_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerProfileAscending(){ + addOrderByAscending(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByCustomerProfileDescending(){ + addOrderByDescending(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberAscending(){ + addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescending(){ + addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); + return this; + } + public CustomerOrderRequest orderByFulfillmentStatusAscending(){ + addOrderByAscending(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByFulfillmentStatusDescending(){ + addOrderByDescending(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest orderByFulfillmentStatusAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByFulfillmentStatusDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); + return this; + } + public CustomerOrderRequest orderByVersionAscending(){ + addOrderByAscending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + public CustomerOrderRequest orderByVersionDescending(){ + addOrderByDescending(CustomerOrder.VERSION_PROPERTY); + return this; + } + + + public MerchantRequest rollUpToMerchant(){ + MerchantRequest merchant = Q.merchants().unlimited(); + this.internalRollUpTo("merchant", merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); + return merchant; + } + + public CustomerProfileRequest rollUpToCustomerProfile(){ + CustomerProfileRequest customerProfile = Q.customerProfiles().unlimited(); + this.internalRollUpTo("customer_profile", customerProfile, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerProfile", null, "customer_profile")); + return customerProfile; + } + + + + + + public CustomerOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ + return facetByMerchantAs(facetName, merchant, true); + } + + public CustomerOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.MERCHANT_PROPERTY, merchant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, CustomerOrder.MERCHANT_PROPERTY)); + return this; + } + public CustomerOrderRequest facetByCustomerProfileAs(String facetName, CustomerProfileRequest customerProfile){ + return facetByCustomerProfileAs(facetName, customerProfile, true); + } + + public CustomerOrderRequest facetByCustomerProfileAs(String facetName, CustomerProfileRequest customerProfile, boolean includeAllFacets){ + addFacet(facetName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerProfileAs", facetName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerOrderRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerOrderRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerOrderRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerOrderRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerOrderRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerOrderRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java new file mode 100644 index 000000000..60649102a --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java @@ -0,0 +1,151 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class CustomerProfile extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "CustomerProfile"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5a9cde22ab27c45df77fbacebdb80f8a03759bd10053dc56f76edb4c8b61e319"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("email", 2), java.util.Map.entry("version", 3)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("email", java.util.List.of("email", "email")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + CustomerProfile.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String MERCHANT_PROPERTY = "merchant"; + public static final String EMAIL_PROPERTY = "email"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private Merchant merchant; + + private String email; + + private SmartList customerOrderList; + + public Merchant getMerchant(){ + return this.merchant; + } + + public String getEmail(){ + return this.email; + } + + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public CustomerProfile updateMerchant(Merchant merchant){ + if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ + return this; + } + handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); + this.merchant = merchant; + return this; + } + + public CustomerProfile updateEmail(String email){ + email = (email == null ? null : email.trim()); + if(isPropertyLoaded(EMAIL_PROPERTY) && Objects.equals(this.email, email)){ + return this; + } + handleUpdate(EMAIL_PROPERTY, getEmail(), email); + this.email = email; + return this; + } + + public CustomerProfile addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateCustomerProfile(this); + return this; + } + + public static CustomerProfile refer(Long id){ + CustomerProfile refer = new CustomerProfile(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public CustomerProfile comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "merchant": this.merchant = (Merchant) value; break; + + case "email": this.email = (value == null ? null : ((String)value).trim()); break; + + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "merchant": return this.merchant; + case "email": return this.email; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "merchant": return this.merchant; + case "email": return this.email; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java new file mode 100644 index 000000000..cb92cd90b --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java @@ -0,0 +1,65 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class CustomerProfileChecker implements Checker{ + + public String type(){ + return CustomerProfile.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ + if(needCheck(_context, customerProfile)){ + markAsChecked(_context, customerProfile); + doCheck(_context, customerProfile, _parentLocation); + } + } + + public void doCheck(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ + if((customerProfile == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, customerProfile); + if(customerProfile.needPersist()){ + } + if(customerProfile.newItem()){ + }else if(customerProfile.updateItem()){ + if(!customerProfile.isPropertyLoaded("merchant")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); + } + if(!customerProfile.isPropertyLoaded("email")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "email"), "Mutation requires a fully loaded entity"); + } + + } + checkMerchant(_context, customerProfile.getProperty(CustomerProfile.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); + checkEmail(_context, customerProfile.getProperty(CustomerProfile.EMAIL_PROPERTY), newLocation(_parentLocation, "email")); + for(int i = 0; customerProfile.getCustomerOrderList() != null && i < customerProfile.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = customerProfile.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, merchant); + if((merchant == null)){ + return; + } + new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); + } + public void checkEmail(UserContext _context, String email, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, email); + if((email == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, email); + + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java new file mode 100644 index 000000000..2666acf8b --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java @@ -0,0 +1,61 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderListExpression; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class CustomerProfileExpression extends ExpressionAdaptor implements BaseEntityExpression { + public CustomerProfileExpression(Expression expression){ + super(expression); + } + + public CustomerProfileExpression(Expression expression, Function function){ + super(expression, function); + } + + public CustomerProfileExpression updateId(Long id){ + return new CustomerProfileExpression(this, $it -> {((CustomerProfile)$it).__internalSet("id", id); return this;}); + } + + public CustomerProfileExpression save(UserContext userContext){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).auditAs("Saved by Expression").save(userContext)); + } + + public CustomerProfileExpression save(String intent, UserContext userContext){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public MerchantExpression getMerchant(){ + return new MerchantExpression(loaded("merchant", "getMerchant", CustomerProfile::getMerchant)); + } + + public CustomerProfileExpression updateMerchant(Merchant merchant){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).updateMerchant(merchant)); + } + + public Expression getEmail(){ + return loaded("email", "getEmail", CustomerProfile::getEmail); + } + public CustomerProfileExpression updateEmail(String email){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).updateEmail(email)); + } + + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CustomerProfile::getCustomerOrderList)); + } + public CustomerProfileExpression addCustomerOrder(CustomerOrder customerOrder){ + return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java new file mode 100644 index 000000000..410a30c3e --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class CustomerProfileListExpression extends SmartListExpression { + public CustomerProfileListExpression(Expression> expression){ + super(expression); + } + + public CustomerProfileListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public CustomerProfileExpression first() { + return new CustomerProfileExpression(super.first()); + } + + public CustomerProfileExpression get(int index) { + return new CustomerProfileExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java new file mode 100644 index 000000000..93e23a881 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java @@ -0,0 +1,750 @@ + +package com.teaql.merchantorderprivacyservice.customerprofile; + +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest; +import com.teaql.merchantorderprivacyservice.merchant.Merchant; +import com.teaql.merchantorderprivacyservice.merchant.MerchantRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class CustomerProfileRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public CustomerProfileRequest(Class returnType){ + this(returnType, () -> (T) new CustomerProfile()); + } + + protected CustomerProfileRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public CustomerProfileRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public CustomerProfileRequest copy(){ + return (CustomerProfileRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new CustomerProfileRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public CustomerProfileRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public CustomerProfileRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public CustomerProfileRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public CustomerProfileRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public CustomerProfileRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public CustomerProfileRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public CustomerProfileRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public CustomerProfileRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public CustomerProfileRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public CustomerProfileRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (CustomerProfileRequest)super.appendSearchCriteria(searchCriteria); + } + + public CustomerProfileRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public CustomerProfileRequest matchingAnyOf(CustomerProfileRequest customerProfile){ + super.internalMatchAny(customerProfile); + return this; + } + + public CustomerProfileRequest matchingIdsOf(CustomerProfileRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + CustomerProfile.ID_PROPERTY, request, CustomerProfile.ID_PROPERTY)); + } + + public CustomerProfileRequest enhanceChildrenIfNeeded(){ + return this; + } + + public CustomerProfileRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public CustomerProfileRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public CustomerProfileRequest selectSelf(){ + super.selectSelf(); + return selectId().selectMerchantIdOnly().selectEmail().selectVersion(); + } + + public CustomerProfileRequest selectSelfFields(){ + return selectSelf(); + } + + public CustomerProfileRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(CustomerProfile.ID_PROPERTY); + selectProperty(CustomerProfile.MERCHANT_PROPERTY); + selectProperty(CustomerProfile.EMAIL_PROPERTY); + selectProperty(CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest selectAll(){ + super.selectAll(); + return selectId().selectMerchant().selectEmail().selectVersion(); + } + + public CustomerProfileRequest selectChildren(){ + super.selectAny(); + selectCustomerOrderList(); + return selectId().selectMerchant().selectEmail().selectVersion(); + } + + + public CustomerProfileRequest selectId(){ + selectProperty(CustomerProfile.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerProfileRequest unselectId(){ + unselectProperty(CustomerProfile.ID_PROPERTY); + return this; + } + public CustomerProfileRequest selectMerchantIdOnly(){ + selectProperty(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest selectMerchant(){ + return selectMerchantWith(Q.merchants().unlimited().selectSelf()); + } + + public CustomerProfileRequest selectMerchantWith(MerchantRequest merchant){ + selectProperty(CustomerProfile.MERCHANT_PROPERTY); + enhanceRelation(CustomerProfile.MERCHANT_PROPERTY, merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, CustomerProfile.MERCHANT_PROPERTY)); + return this; + } + + public CustomerProfileRequest unselectMerchant(){ + unselectProperty(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + public CustomerProfileRequest selectEmail(){ + selectProperty(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + /** + * fill the email with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS email) to fetch email property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerProfileRequest unselectEmail(){ + unselectProperty(CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest selectVersion(){ + selectProperty(CustomerProfile.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public CustomerProfileRequest unselectVersion(){ + unselectProperty(CustomerProfile.VERSION_PROPERTY); + return this; + } + public CustomerProfileRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public CustomerProfileRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.ID_PROPERTY, operator, values); + } + + public CustomerProfileRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public CustomerProfileRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public CustomerProfileRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public CustomerProfileRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public CustomerProfileRequest filterByMerchant(Merchant... merchant){ + if (merchant == null || merchant.length == 0) { + throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); + } + return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); + } + + public CustomerProfileRequest withMerchant(Operator operator, Object... values){ + return appendSearchCriteria(createMerchantCriteria(operator, values)); + } + + public CustomerProfileRequest withMerchantIsUnknown(){ + return withMerchant(Operator.IS_NULL); + } + + public CustomerProfileRequest withMerchantIsKnown(){ + return withMerchant(Operator.IS_NOT_NULL); + } + + public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.MERCHANT_PROPERTY, operator, values); + } + + public CustomerProfileRequest filterByMerchant(Long merchant){ + if(merchant == null){ + return this; + } + return withMerchant(Operator.EQUAL, merchant); + } + public CustomerProfileRequest withMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerProfile.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); + } + + public CustomerProfileRequest withoutMerchantMatching(MerchantRequest merchant){ + return appendSearchCriteria(SearchCriteria.not( + new SubQuerySearchCriteria(CustomerProfile.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); + } + + public CustomerProfileRequest filterByEmail(String... email){ + if (email == null || email.length == 0) { + throw new IllegalArgumentException("filterByEmail parameter email cannot be empty"); + } + return appendSearchCriteria(createEmailCriteria(Operator.EQUAL, (Object[])email)); + } + + public CustomerProfileRequest withEmail(Operator operator, Object... values){ + return appendSearchCriteria(createEmailCriteria(operator, values)); + } + + public CustomerProfileRequest withEmailIsUnknown(){ + return withEmail(Operator.IS_NULL); + } + + public CustomerProfileRequest withEmailIsKnown(){ + return withEmail(Operator.IS_NOT_NULL); + } + + public SearchCriteria createEmailCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.EMAIL_PROPERTY, operator, values); + } + + public CustomerProfileRequest withEmailIsNot(String email){ + return withEmail(Operator.NOT_EQUAL, email); + } + + public CustomerProfileRequest withEmailIn(String... email){ + return withEmail(Operator.IN, (Object[])email); + } + + public CustomerProfileRequest withEmailNotIn(String... email){ + return withEmail(Operator.NOT_IN, (Object[])email); + } + public CustomerProfileRequest withEmailGreaterThan(String email){ + return withEmail(Operator.GREATER_THAN, email); + } + + public CustomerProfileRequest withEmailGreaterThanOrEqualTo(String email){ + return withEmail(Operator.GREATER_THAN_OR_EQUAL, email); + } + + public CustomerProfileRequest withEmailLessThan(String email){ + return withEmail(Operator.LESS_THAN, email); + } + + public CustomerProfileRequest withEmailLessThanOrEqualTo(String email){ + return withEmail(Operator.LESS_THAN_OR_EQUAL, email); + } + + public CustomerProfileRequest withEmailBetween(String startOfEmail, String endOfEmail){ + return withEmail(Operator.BETWEEN, startOfEmail, endOfEmail); + } + public CustomerProfileRequest withEmailStartingWith(String email){ + return withEmail(Operator.BEGIN_WITH, email); + } + public CustomerProfileRequest withEmailContaining(String email){ + return withEmail(Operator.CONTAIN, email); + } + + public CustomerProfileRequest withEmailNotContaining(String email){ + return withEmail(Operator.NOT_CONTAIN, email); + } + + public CustomerProfileRequest withEmailNotStartingWith(String email){ + return withEmail(Operator.NOT_BEGIN_WITH, email); + } + + public CustomerProfileRequest withEmailEndingWith(String email){ + return withEmail(Operator.END_WITH, email); + } + + public CustomerProfileRequest withEmailNotEndingWith(String email){ + return withEmail(Operator.NOT_END_WITH, email); + } + + public CustomerProfileRequest withEmailIs(String email){ + return withEmail(Operator.EQUAL, email); + } + + public CustomerProfileRequest withEmailSoundingLike(String email){ + return withEmail(Operator.SOUNDS_LIKE, email); + } + + + + public CustomerProfileRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public CustomerProfileRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public CustomerProfileRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public CustomerProfileRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(CustomerProfile.VERSION_PROPERTY, operator, values); + } + + public CustomerProfileRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public CustomerProfileRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public CustomerProfileRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public CustomerProfileRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public CustomerProfileRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public CustomerProfileRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public CustomerProfileRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public CustomerProfileRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public CustomerProfileRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public CustomerProfileRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(CustomerProfile.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); + } + + public CustomerProfileRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerProfile.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY))); + } + + public CustomerProfileRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerProfileRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public CustomerProfileRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public CustomerProfileRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public CustomerProfileRequest groupByMerchantWithDetails(){ + return groupByMerchantWithDetails(Q.merchants().unlimited()); + } + + public CustomerProfileRequest groupByMerchantWithDetails(MerchantRequest subRequest){ + aggregate(CustomerProfile.MERCHANT_PROPERTY, subRequest); + return this; + } + + + + public CustomerProfileRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public CustomerProfileRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.ID_PROPERTY); + return this; + } + public CustomerProfileRequest countDistinctMerchant(){ + return countDistinctMerchantAs("merchant_distinct_count"); + } + + public CustomerProfileRequest countDistinctMerchantAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.MERCHANT_PROPERTY); + return this; + } + public CustomerProfileRequest countDistinctEmail(){ + return countDistinctEmailAs("email_distinct_count"); + } + + public CustomerProfileRequest countDistinctEmailAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public CustomerProfileRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, CustomerProfile.VERSION_PROPERTY); + return this; + } + public CustomerProfileRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public CustomerProfileRequest groupById(){ + groupBy(CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByIdAs(String retName){ + groupBy(retName, CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.ID_PROPERTY, function); + return this; + } + public CustomerProfileRequest groupByMerchantWith(MerchantRequest subRequest){ + groupBy(CustomerProfile.MERCHANT_PROPERTY, subRequest, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); + return this; + } + public CustomerProfileRequest groupByMerchant(){ + groupBy(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByMerchantAs(String retName){ + groupBy(retName, CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByMerchantWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.MERCHANT_PROPERTY, function); + return this; + } + + public CustomerProfileRequest groupByEmail(){ + groupBy(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByEmailAs(String retName){ + groupBy(retName, CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByEmailWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.EMAIL_PROPERTY, function); + return this; + } + + public CustomerProfileRequest groupByVersion(){ + groupBy(CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByVersionAs(String retName){ + groupBy(retName, CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, CustomerProfile.VERSION_PROPERTY, function); + return this; + } + + + + public CustomerProfileRequest orderByIdAscending(){ + addOrderByAscending(CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByIdDescending(){ + addOrderByDescending(CustomerProfile.ID_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByMerchantAscending(){ + addOrderByAscending(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByMerchantDescending(){ + addOrderByDescending(CustomerProfile.MERCHANT_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByEmailAscending(){ + addOrderByAscending(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByEmailDescending(){ + addOrderByDescending(CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest orderByEmailAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(CustomerProfile.EMAIL_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByEmailDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(CustomerProfile.EMAIL_PROPERTY); + return this; + } + public CustomerProfileRequest orderByVersionAscending(){ + addOrderByAscending(CustomerProfile.VERSION_PROPERTY); + return this; + } + + public CustomerProfileRequest orderByVersionDescending(){ + addOrderByDescending(CustomerProfile.VERSION_PROPERTY); + return this; + } + + + public CustomerProfileRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public CustomerProfileRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public MerchantRequest rollUpToMerchant(){ + MerchantRequest merchant = Q.merchants().unlimited(); + this.internalRollUpTo("merchant", merchant, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); + return merchant; + } + + + + public CustomerProfileRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROFILE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROFILE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public CustomerProfileRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ + return facetByMerchantAs(facetName, merchant, true); + } + + public CustomerProfileRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ + addFacet(facetName, CustomerProfile.MERCHANT_PROPERTY, merchant, includeAllFacets, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, CustomerProfile.MERCHANT_PROPERTY)); + return this; + } + + + /** + * get topN records + * @param topN records number + */ + public CustomerProfileRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public CustomerProfileRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public CustomerProfileRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public CustomerProfileRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public CustomerProfileRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public CustomerProfileRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java new file mode 100644 index 000000000..10450efd1 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java @@ -0,0 +1,152 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import io.teaql.core.Audited; +import io.teaql.core.BaseEntity; +import io.teaql.core.EntityStatus; +import io.teaql.core.FieldLayout; +import io.teaql.core.FrameworkInternal; +import io.teaql.core.RemoteInput; +import io.teaql.core.SmartList; +import io.teaql.core.checker.JsonFieldNamingProfile; +import java.util.Objects; + +/** + * [TEAQL AI WARNING] + * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. + * DO NOT GUESS METHOD NAMES! + * The methods listed below are the ONLY valid ways to interact with this entity. + * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. + * Read the method signatures in this file before proceeding. + */ +public class Merchant extends BaseEntity implements RemoteInput { + public static String INTERNAL_TYPE = "Merchant"; + + // Framework metadata: complete fixed layout, independent of SQL/projection order. + public static final String __TEAQL_FIELD_LAYOUT_REVISION = "3825864cc8042afce6bd814bc155a414cc1fda5115c8807092b56cbb042a1e38"; + public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = + java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); + public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = + java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); + public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( + "customer_profile_list", "customer_order_list"); + public static final FieldLayout __TEAQL_FIELD_LAYOUT = + FieldLayout.installGenerated(FieldLayout.generated( + Merchant.class, __TEAQL_FIELD_LAYOUT_REVISION, + __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, + JsonFieldNamingProfile.fromModelValue("camelCase"))); + + + public static final String NAME_PROPERTY = "name"; + public static final String CUSTOMER_PROFILE_LIST_PROPERTY = "customer_profile_list"; + public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; + private String name; + + private SmartList customerProfileList; + private SmartList customerOrderList; + + public String getName(){ + return this.name; + } + + public SmartList getCustomerProfileList(){ + return this.customerProfileList == null ? SmartList.unloaded() : this.customerProfileList; + } + public SmartList getCustomerOrderList(){ + return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; + } + public Merchant updateName(String name){ + name = (name == null ? null : name.trim()); + if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ + return this; + } + handleUpdate(NAME_PROPERTY, getName(), name); + this.name = name; + return this; + } + + public Merchant addCustomerProfile(CustomerProfile customerProfile){ + if (customerProfile == null){ + return this; + } + + if(null == this.customerProfileList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerProfileList = teaqlUnloadedItems.map(value -> value); + } + + this.customerProfileList.add(customerProfile); + customerProfile.updateMerchant(this); + return this; + } + public Merchant addCustomerOrder(CustomerOrder customerOrder){ + if (customerOrder == null){ + return this; + } + + if(null == this.customerOrderList){ + SmartList teaqlUnloadedItems = SmartList.unloaded(); + this.customerOrderList = teaqlUnloadedItems.map(value -> value); + } + + this.customerOrderList.add(customerOrder); + customerOrder.updateMerchant(this); + return this; + } + + public static Merchant refer(Long id){ + Merchant refer = new Merchant(); + refer.__internalSet("id", id); + refer.set$status(EntityStatus.REFER); + return refer; + } + @Override + public String typeName(){ + return INTERNAL_TYPE; + } + + public Merchant comment(String comment){ + this.setComment(comment); + return this; + } + + @Override + @SuppressWarnings("unchecked") + public Audited auditAs(String action) { + return new Audited<>(this, action); + } + + // ===== Framework Internal: generated switch dispatch ===== + @Override + @FrameworkInternal + public void __internalSet(String property, Object value) { + markPropertyLoaded(property); + switch (property) { + case "name": this.name = (value == null ? null : ((String)value).trim()); break; + + case "customer_profile_list": this.customerProfileList = (SmartList) value; break; + case "customer_order_list": this.customerOrderList = (SmartList) value; break; + default: super.__internalSet(property, value); + } + } + + @Override + @FrameworkInternal + public Object __internalGet(String property) { + switch (property) { + case "name": return this.name; + case "customer_profile_list": return this.customerProfileList; + case "customer_order_list": return this.customerOrderList; + default: + // Presentation uses the installed Java member mapping; SQL and + // hydration retain canonical names. These aliases only read. + switch (property) { + case "name": return this.name; + default: return super.__internalGet(property); + } + } + } + +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java new file mode 100644 index 000000000..7e6d403aa --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java @@ -0,0 +1,58 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker; +import io.teaql.core.UserContext; +import io.teaql.core.checker.Checker; +import io.teaql.core.checker.ObjectLocation; + +public class MerchantChecker implements Checker{ + + public String type(){ + return Merchant.INTERNAL_TYPE; + } + + public void checkAndFix(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if(needCheck(_context, merchant)){ + markAsChecked(_context, merchant); + doCheck(_context, merchant, _parentLocation); + } + } + + public void doCheck(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ + if((merchant == null)){ + return; + } + boolean _contextFixEligible = needContextFix(_context, merchant); + if(merchant.needPersist()){ + } + if(merchant.newItem()){ + }else if(merchant.updateItem()){ + if(!merchant.isPropertyLoaded("name")){ + invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); + } + + } + checkName(_context, merchant.getProperty(Merchant.NAME_PROPERTY), newLocation(_parentLocation, "name")); + for(int i = 0; merchant.getCustomerProfileList() != null && i < merchant.getCustomerProfileList().size(); i++){ + CustomerProfile customerProfile = merchant.getCustomerProfileList().get(i); + new CustomerProfileChecker().checkAndFix(_context, customerProfile, newLocation(_parentLocation, "customer_profile_list", i)); + } + for(int i = 0; merchant.getCustomerOrderList() != null && i < merchant.getCustomerOrderList().size(); i++){ + CustomerOrder customerOrder = merchant.getCustomerOrderList().get(i); + new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); + } + } + + public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ + requiredCheck(_context, _parentLocation, name); + if((name == null)){ + return; + } + maxStringCheck(_context, _parentLocation, 100, name); + + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java new file mode 100644 index 000000000..8694004fd --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java @@ -0,0 +1,59 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderListExpression; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileListExpression; +import io.teaql.core.UserContext; +import io.teaql.core.value.BaseEntityExpression; +import io.teaql.core.value.Expression; +import io.teaql.core.value.ExpressionAdaptor; +import java.util.function.Function; + +public class MerchantExpression extends ExpressionAdaptor implements BaseEntityExpression { + public MerchantExpression(Expression expression){ + super(expression); + } + + public MerchantExpression(Expression expression, Function function){ + super(expression, function); + } + + public MerchantExpression updateId(Long id){ + return new MerchantExpression(this, $it -> {((Merchant)$it).__internalSet("id", id); return this;}); + } + + public MerchantExpression save(UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs("Saved by Expression").save(userContext)); + } + + public MerchantExpression save(String intent, UserContext userContext){ + return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs(intent).save(userContext)); + } + + public boolean isNull() { + return resolve() == null; + } + + + public Expression getName(){ + return loaded("name", "getName", Merchant::getName); + } + public MerchantExpression updateName(String name){ + return new MerchantExpression(this, $it -> ((Merchant)$it).updateName(name)); + } + + public CustomerProfileListExpression getCustomerProfileList(){ + return new CustomerProfileListExpression(loaded("customer_profile_list", "getCustomerProfileList", Merchant::getCustomerProfileList)); + } + public CustomerOrderListExpression getCustomerOrderList(){ + return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Merchant::getCustomerOrderList)); + } + public MerchantExpression addCustomerProfile(CustomerProfile customerProfile){ + return new MerchantExpression(this, $it -> ((Merchant)$it).addCustomerProfile(customerProfile)); + } + public MerchantExpression addCustomerOrder(CustomerOrder customerOrder){ + return new MerchantExpression(this, $it -> ((Merchant)$it).addCustomerOrder(customerOrder)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java new file mode 100644 index 000000000..fe54b0da5 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java @@ -0,0 +1,25 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import io.teaql.core.SmartList; +import io.teaql.core.value.Expression; +import io.teaql.core.value.SmartListExpression; +import java.util.function.Function; + +public class MerchantListExpression extends SmartListExpression { + public MerchantListExpression(Expression> expression){ + super(expression); + } + + public MerchantListExpression(Expression expression, Function> function){ + super(expression, function); + } + + public MerchantExpression first() { + return new MerchantExpression(super.first()); + } + + public MerchantExpression get(int index) { + return new MerchantExpression(super.get(index)); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java new file mode 100644 index 000000000..061ee087d --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java @@ -0,0 +1,683 @@ + +package com.teaql.merchantorderprivacyservice.merchant; + +import com.teaql.merchantorderprivacyservice.Q; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; +import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; +import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest; +import io.teaql.core.AggrFunction; +import io.teaql.core.BaseRequest; +import io.teaql.core.PropertyReference; +import io.teaql.core.SearchCriteria; +import io.teaql.core.SubQuerySearchCriteria; +import io.teaql.core.criteria.Operator; +import io.teaql.core.criteria.TwoOperatorCriteria; +import java.util.Objects; + +public class MerchantRequest extends BaseRequest { + + /** + * @deprecated AI agents and business code must use the generated Q facade + * instead of constructing request builders directly. + */ + @Deprecated + @SuppressWarnings("unchecked") + public MerchantRequest(Class returnType){ + this(returnType, () -> (T) new Merchant()); + } + + protected MerchantRequest(Class returnType, java.util.function.Supplier factory){ + super(returnType, factory); + selectId(); + selectVersion(); + } + + public MerchantRequest comment(String comment){ + super.internalComment(comment); + return this; + } + + /** Independent query graph; ordinary roll-up handles remain live. */ + @Override + @SuppressWarnings("unchecked") + public MerchantRequest copy(){ + return (MerchantRequest) super.copy(); + } + + @Override + @SuppressWarnings("unchecked") + protected io.teaql.core.BaseRequest internalCopyTarget(){ + return new MerchantRequest<>((Class) returnType(), this::internalNewEntity); + } + + // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) + + public MerchantRequest returnType(Class returnType){ + super.setReturnType(returnType); + return this; + } + + public MerchantRequest enableAggregationCache(long cacheExpiredMillis){ + super.enableAggregationCache(); + super.aggregateCacheTime(cacheExpiredMillis); + return this; + } + + public MerchantRequest enableAggregationCache(){ + return enableAggregationCache(0l); + } + + + public MerchantRequest propagateAggregationCache(long cacheExpiredMillis){ + super.propagateAggregationCache(cacheExpiredMillis); + return this; + } + + /** + * Accept best-effort stateful seek optimization for browsing consecutive pages. + * Do not use this for business processing that must visit every row exactly once. + */ + public MerchantRequest optimizeForContinuousPageFetch(){ + super.optimizeForContinuousPageFetch(); + return this; + } + + public MerchantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ + super.optimizeForContinuousPageFetch(namespace, ttlSeconds); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet(){ + super.optimizePaginationWithIdSet(); + return this; + } + + public MerchantRequest optimizePaginationWithIdSet( + String namespace, int ttlSeconds, int maxIds){ + super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); + return this; + } + + public MerchantRequest topNProbeParentThreshold(int threshold){ + super.topNProbeParentThreshold(threshold); + return this; + } + + public MerchantRequest appendSearchCriteria(SearchCriteria searchCriteria){ + return (MerchantRequest)super.appendSearchCriteria(searchCriteria); + } + + public MerchantRequest filter(String property1, Operator operator, String property2){ + return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); + } + + + public MerchantRequest matchingAnyOf(MerchantRequest merchant){ + super.internalMatchAny(merchant); + return this; + } + + public MerchantRequest matchingIdsOf(MerchantRequest request){ + Objects.requireNonNull(request, "matching request"); + return appendSearchCriteria(new SubQuerySearchCriteria( + Merchant.ID_PROPERTY, request, Merchant.ID_PROPERTY)); + } + + public MerchantRequest enhanceChildrenIfNeeded(){ + return this; + } + + public MerchantRequest withDeletedRows(){ + super.withDeletedRows(); + return this; + } + + public MerchantRequest deletedRowsOnly(){ + super.deletedRowsOnly(); + return this; + } + + public MerchantRequest selectSelf(){ + super.selectSelf(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectSelfFields(){ + return selectSelf(); + } + + public MerchantRequest selectSelfWithoutParent(){ + selectId(); + selectVersion(); + selectProperty(Merchant.ID_PROPERTY); + selectProperty(Merchant.NAME_PROPERTY); + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest selectAll(){ + super.selectAll(); + return selectId().selectName().selectVersion(); + } + + public MerchantRequest selectChildren(){ + super.selectAny(); + selectCustomerProfileList().selectCustomerOrderList(); + return selectId().selectName().selectVersion(); + } + + + public MerchantRequest selectId(){ + selectProperty(Merchant.ID_PROPERTY); + return this; + } + + /** + * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectId(){ + unselectProperty(Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest selectName(){ + selectProperty(Merchant.NAME_PROPERTY); + return this; + } + + /** + * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectName(){ + unselectProperty(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest selectVersion(){ + selectProperty(Merchant.VERSION_PROPERTY); + return this; + } + + /** + * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. + * @param rawSqlSegment customized rawSqlSegment + */ + + + + + public MerchantRequest unselectVersion(){ + unselectProperty(Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest selectCustomerProfileList(){ + return selectCustomerProfileListWith(Q.customerProfiles().selectSelf()); + } + + public MerchantRequest selectCustomerProfileListWith(CustomerProfileRequest customerProfileList){ + enhanceRelation(Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, customerProfileList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerProfileListWith", null, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + public MerchantRequest selectCustomerOrderList(){ + return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); + } + + public MerchantRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ + enhanceRelation(Merchant.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest withId(Operator operator, Object... values){ + return appendSearchCriteria(createIdCriteria(operator, values)); + } + + public SearchCriteria createIdCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.ID_PROPERTY, operator, values); + } + + public MerchantRequest withIdIsNot(Long id){ + return withId(Operator.NOT_EQUAL, id); + } + + public MerchantRequest withIdIn(Long... id){ + return withId(Operator.IN, (Object[])id); + } + + public MerchantRequest withIdNotIn(Long... id){ + return withId(Operator.NOT_IN, (Object[])id); + } + public MerchantRequest withIdIs(Long id){ + return withId(Operator.EQUAL, id); + } + + + + public MerchantRequest filterByName(String... name){ + if (name == null || name.length == 0) { + throw new IllegalArgumentException("filterByName parameter name cannot be empty"); + } + return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); + } + + public MerchantRequest withName(Operator operator, Object... values){ + return appendSearchCriteria(createNameCriteria(operator, values)); + } + + public MerchantRequest withNameIsUnknown(){ + return withName(Operator.IS_NULL); + } + + public MerchantRequest withNameIsKnown(){ + return withName(Operator.IS_NOT_NULL); + } + + public SearchCriteria createNameCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.NAME_PROPERTY, operator, values); + } + + public MerchantRequest withNameIsNot(String name){ + return withName(Operator.NOT_EQUAL, name); + } + + public MerchantRequest withNameIn(String... name){ + return withName(Operator.IN, (Object[])name); + } + + public MerchantRequest withNameNotIn(String... name){ + return withName(Operator.NOT_IN, (Object[])name); + } + public MerchantRequest withNameGreaterThan(String name){ + return withName(Operator.GREATER_THAN, name); + } + + public MerchantRequest withNameGreaterThanOrEqualTo(String name){ + return withName(Operator.GREATER_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameLessThan(String name){ + return withName(Operator.LESS_THAN, name); + } + + public MerchantRequest withNameLessThanOrEqualTo(String name){ + return withName(Operator.LESS_THAN_OR_EQUAL, name); + } + + public MerchantRequest withNameBetween(String startOfName, String endOfName){ + return withName(Operator.BETWEEN, startOfName, endOfName); + } + public MerchantRequest withNameStartingWith(String name){ + return withName(Operator.BEGIN_WITH, name); + } + public MerchantRequest withNameContaining(String name){ + return withName(Operator.CONTAIN, name); + } + + public MerchantRequest withNameNotContaining(String name){ + return withName(Operator.NOT_CONTAIN, name); + } + + public MerchantRequest withNameNotStartingWith(String name){ + return withName(Operator.NOT_BEGIN_WITH, name); + } + + public MerchantRequest withNameEndingWith(String name){ + return withName(Operator.END_WITH, name); + } + + public MerchantRequest withNameNotEndingWith(String name){ + return withName(Operator.NOT_END_WITH, name); + } + + public MerchantRequest withNameIs(String name){ + return withName(Operator.EQUAL, name); + } + + public MerchantRequest withNameSoundingLike(String name){ + return withName(Operator.SOUNDS_LIKE, name); + } + + + + public MerchantRequest filterByVersion(Long... version){ + if (version == null || version.length == 0) { + throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); + } + return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); + } + + public MerchantRequest withVersion(Operator operator, Object... values){ + return appendSearchCriteria(createVersionCriteria(operator, values)); + } + + public MerchantRequest withVersionIsUnknown(){ + return withVersion(Operator.IS_NULL); + } + + public MerchantRequest withVersionIsKnown(){ + return withVersion(Operator.IS_NOT_NULL); + } + + public SearchCriteria createVersionCriteria(Operator operator, Object... values) { + return createBasicSearchCriteria(Merchant.VERSION_PROPERTY, operator, values); + } + + public MerchantRequest withVersionIs(Long version){ + return withVersion(Operator.EQUAL, version); + } + + public MerchantRequest withVersionIsNot(Long version){ + return withVersion(Operator.NOT_EQUAL, version); + } + + public MerchantRequest withVersionIn(Long... version){ + return withVersion(Operator.IN, (Object[])version); + } + + public MerchantRequest withVersionNotIn(Long... version){ + return withVersion(Operator.NOT_IN, (Object[])version); + } + public MerchantRequest withVersionGreaterThan(Long version){ + return withVersion(Operator.GREATER_THAN, version); + } + + public MerchantRequest withVersionGreaterThanOrEqualTo(Long version){ + return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionLessThan(Long version){ + return withVersion(Operator.LESS_THAN, version); + } + + public MerchantRequest withVersionLessThanOrEqualTo(Long version){ + return withVersion(Operator.LESS_THAN_OR_EQUAL, version); + } + + public MerchantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ + return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); + } + + + public MerchantRequest withCustomerProfileListMatching(CustomerProfileRequest customerProfileRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerProfileRequest, CustomerProfile.MERCHANT_PROPERTY)); + } + + public MerchantRequest withoutCustomerProfileListMatching(CustomerProfileRequest customerProfileRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerProfileRequest, CustomerProfile.MERCHANT_PROPERTY))); + } + + public MerchantRequest haveCustomerProfiles(){ + return withCustomerProfileListMatching(Q.customerProfiles().unlimited()); + } + + public MerchantRequest haveNoCustomerProfiles(){ + return withoutCustomerProfileListMatching(Q.customerProfiles().unlimited()); + } + public MerchantRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerOrderRequest, CustomerOrder.MERCHANT_PROPERTY)); + } + + public MerchantRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ + return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerOrderRequest, CustomerOrder.MERCHANT_PROPERTY))); + } + + public MerchantRequest haveCustomerOrders(){ + return withCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public MerchantRequest haveNoCustomerOrders(){ + return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); + } + + public MerchantRequest count(){ + super.count(); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); + return this; + } + public MerchantRequest countAs(String retName){ + super.count(retName); + setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); + return this; + } + public MerchantRequest countDistinctId(){ + return countDistinctIdAs("id_distinct_count"); + } + + public MerchantRequest countDistinctIdAs(String alias){ + super.countDistinctProperty(alias, Merchant.ID_PROPERTY); + return this; + } + public MerchantRequest countDistinctName(){ + return countDistinctNameAs("name_distinct_count"); + } + + public MerchantRequest countDistinctNameAs(String alias){ + super.countDistinctProperty(alias, Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest countDistinctVersion(){ + return countDistinctVersionAs("version_distinct_count"); + } + + public MerchantRequest countDistinctVersionAs(String alias){ + super.countDistinctProperty(alias, Merchant.VERSION_PROPERTY); + return this; + } + public MerchantRequest groupByCustomerProfilesWithDetails(CustomerProfileRequest subRequest){ + aggregate(Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, subRequest); + return this; + } + public MerchantRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ + aggregate(Merchant.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); + return this; + } + + public MerchantRequest groupById(){ + groupBy(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdAs(String retName){ + groupBy(retName, Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest groupByIdWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.ID_PROPERTY, function); + return this; + } + + public MerchantRequest groupByName(){ + groupBy(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameAs(String retName){ + groupBy(retName, Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest groupByNameWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.NAME_PROPERTY, function); + return this; + } + + public MerchantRequest groupByVersion(){ + groupBy(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionAs(String retName){ + groupBy(retName, Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest groupByVersionWithFunction(String retName, AggrFunction function){ + groupBy(retName, Merchant.VERSION_PROPERTY, function); + return this; + } + + + + public MerchantRequest orderByIdAscending(){ + addOrderByAscending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByIdDescending(){ + addOrderByDescending(Merchant.ID_PROPERTY); + return this; + } + + public MerchantRequest orderByNameAscending(){ + addOrderByAscending(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescending(){ + addOrderByDescending(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByNameAscendingUsingGBK(){ + addOrderByAscendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + + public MerchantRequest orderByNameDescendingUsingGBK(){ + addOrderByDescendingUsingGBK(Merchant.NAME_PROPERTY); + return this; + } + public MerchantRequest orderByVersionAscending(){ + addOrderByAscending(Merchant.VERSION_PROPERTY); + return this; + } + + public MerchantRequest orderByVersionDescending(){ + addOrderByDescending(Merchant.VERSION_PROPERTY); + return this; + } + + + public MerchantRequest statsFromCustomerProfilesAs(String name, CustomerProfileRequest subRequest){ + return statsFromCustomerProfilesAs(name, subRequest, false); + } + + public MerchantRequest statsFromCustomerProfilesAs(String name, CustomerProfileRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerProfile.MERCHANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerProfilesAs", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + + public MerchantRequest statsFromCustomerProfiles(CustomerProfileRequest subRequest){ + return statsFromCustomerProfilesAs(REFINEMENTS, subRequest); + } + public MerchantRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(name, subRequest, false); + } + + public MerchantRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ + addRelationAggregate(name, subRequest, CustomerOrder.MERCHANT_PROPERTY, singleResult, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ + return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); + } + public MerchantRequest countCustomerProfiles(){ + addRelationCount("Count", Q.customerProfiles().unlimited(), CustomerProfile.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfiles", null, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerProfilesAs(String name){ + addRelationCount(name, Q.customerProfiles().unlimited(), CustomerProfile.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfilesAs", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerProfilesWith(String name, CustomerProfileRequest subRequest){ + addRelationCount(name, subRequest, CustomerProfile.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfilesWith", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); + return this; + } + public MerchantRequest countCustomerOrders(){ + addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerOrdersAs(String name){ + addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + public MerchantRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ + addRelationCount(name, subRequest, CustomerOrder.MERCHANT_PROPERTY, + io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); + return this; + } + + + + /** + * get topN records + * @param topN records number + */ + public MerchantRequest top(int topN) { + super.top(topN); + return this; + } + + /** Cross-runtime bounded-query alias. */ + public MerchantRequest limit(int limit) { + return top(limit); + } + + /** + * get records from offset(inclusive) to offset+size(exclusive) + * @param offset record offset + * @param size records number + */ + public MerchantRequest offset(int offset, int size) { + super.offset(offset, size); + return this; + } + + /** + * retrieve all records + */ + public MerchantRequest unlimited() { + super.unlimited(); + return this; + } + + /** + * get records of one page + * @param pageNumber page number(1-based) + * @param pageSize page size + */ + public MerchantRequest page(int pageNumber, int pageSize) { + int offset = (pageNumber - 1) * pageSize; + return offset(offset, pageSize); + } + + /** + * get records of one page, default page size is 10 + * @param pageNumber page number(1-based) + */ + public MerchantRequest page(int pageNumber) { + return page(pageNumber, 10); + } +} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java b/examples/security-foundations/java-lib-core/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java new file mode 100644 index 000000000..e69de29bb diff --git a/examples/security-foundations/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/security-foundations/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler new file mode 100644 index 000000000..7a28a8ea1 --- /dev/null +++ b/examples/security-foundations/java-lib-core/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler @@ -0,0 +1,2 @@ + +com.teaql.merchantorderprivacyservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/teaql/checker-model.json b/examples/security-foundations/java-lib-core/teaql/checker-model.json new file mode 100644 index 000000000..168786761 --- /dev/null +++ b/examples/security-foundations/java-lib-core/teaql/checker-model.json @@ -0,0 +1 @@ +{"schema":"teaql.checker-model/v1","revision":"sha256:9136e660d5a681229d56c6670cb24a5831b04ca1677b181ea98574f12221c515","entities":{"CustomerOrder":{"labels":{"en":"Customer Order"},"fields":[{"name":"customer_profile","targetType":"CustomerProfile","labels":{"en":"Customer Profile"},"aliases":["CustomerProfile","customerProfile"]},{"name":"fulfillment_status","labels":{"en":"fulfillment status"},"aliases":["FulfillmentStatus","fulfillmentStatus"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"merchant","targetType":"Merchant","labels":{"en":"Merchant"},"aliases":["Merchant"]},{"name":"order_number","labels":{"en":"order number"},"aliases":["OrderNumber","orderNumber"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"CustomerProfile":{"labels":{"en":"Customer Profile"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"email","labels":{"en":"email"},"aliases":["Email"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"merchant","targetType":"Merchant","labels":{"en":"Merchant"},"aliases":["Merchant"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]},"Merchant":{"labels":{"en":"Merchant"},"fields":[{"name":"customer_order_list","targetType":"CustomerOrder","labels":{"en":"Customer Order"},"aliases":["CustomerOrderList","customerOrderList"]},{"name":"customer_profile_list","targetType":"CustomerProfile","labels":{"en":"Customer Profile"},"aliases":["CustomerProfileList","customerProfileList"]},{"name":"id","labels":{"en":"id"},"aliases":["Id"]},{"name":"name","labels":{"en":"name"},"aliases":["Name"]},{"name":"version","labels":{"en":"version"},"aliases":["Version"]}]}}} \ No newline at end of file diff --git a/examples/security-foundations/java-lib-core/teaql/model-provenance.json b/examples/security-foundations/java-lib-core/teaql/model-provenance.json new file mode 100644 index 000000000..e4d7e1753 --- /dev/null +++ b/examples/security-foundations/java-lib-core/teaql/model-provenance.json @@ -0,0 +1 @@ +{"schemaVersion":1,"modelUuid":null,"revisionHash":"sha256:fb96f88e8c6c737598d67e52cd0cb49e174286ab83ba418b0a041f42ecd3b4e8","generatorVersion":"99d6bde2"} \ No newline at end of file diff --git a/examples/security-foundations/showcase.json b/examples/security-foundations/showcase.json new file mode 100644 index 000000000..6e20fa6b6 --- /dev/null +++ b/examples/security-foundations/showcase.json @@ -0,0 +1,40 @@ +{ + "generatedDomainLibraryHandEdited": false, + "goalId": "java:examples/security-foundations", + "library": { + "generatedFilesManifestSHA256": "0e16c0bf8416bf8f81f175575918a809ce6694d44ce446f0d17eeda61b97f45e", + "root": "java-lib-core", + "scope": "java-lib-core" + }, + "model": { + "path": "model.xml", + "sha256": "4bd3524659417a530665b6bcbfec928ee3e5845f2e96570346193fd64981551a" + }, + "producer": { + "generator": { + "artifactKind": "qualified source build", + "jarSHA256": "029f602cf0e2de4ec0910495c340fbeb41f11772b6aca875569f498811158e7d", + "qualificationReceiptSHA256": "1012520de60d49cfc1e45c7e08fcf204dd2db36a163909e1e36752065a31047a", + "sourceCommit": "99d6bde2351d79b7d8b1b1c5cbc78c5dc777b6f2", + "tag": "unreleased-source-99d6bde2" + }, + "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-privacy-and-federation-generation/receipt.json", + "receiptSHA256": "0ae62ffb613692c2d0922b4da1b1dbb9ca6081e8a36a5786a27029a614b711d1" + }, + "scene": "View one authorized merchant order while protecting customer data in SQL diagnostics", + "schema": "teaql.model-workspace-showcase/v1", + "status": "implemented-pending-native-qualification", + "verification": [ + "bash", + "examples/security-foundations/verify-privacy.sh" + ], + "workspace": { + "applicationOwnedFiles": [ + "pom.xml", + "src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java" + ], + "generatedFilesManifestSHA256": "80da3356c9c341da63759603e86f6d6694bc1f974e0110bd3a298fa38553da82", + "root": "java-app-console", + "scope": "java-app-console" + } +} diff --git a/examples/security-foundations/verify-privacy.sh b/examples/security-foundations/verify-privacy.sh new file mode 100644 index 000000000..ebacf774d --- /dev/null +++ b/examples/security-foundations/verify-privacy.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -euo pipefail +example="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +repo="$(cd "$example/../.." && pwd)" +scratch="$(mktemp -d -t teaql-java-merchant-privacy.XXXXXXXX)" +trap 'status=$?; trap - EXIT; rm -rf -- "$scratch"; exit "$status"' EXIT +evidence="${TEAQL_ORDER_PRIVACY_EVIDENCE_DIR:-$scratch/evidence}" +[[ "$evidence" == /* ]] +mkdir -- "$evidence" +export TEAQL_ORDER_PRIVACY_DATABASE="$evidence/orders.sqlite" +python3 -B - "$scratch/pom.xml" "$repo" "$example/java-lib-core/lib" "$example/java-app-console" <<'PY' +import sys +from os.path import relpath +from pathlib import Path +from xml.etree.ElementTree import Element, ElementTree, SubElement + +project = Element('project', xmlns='http://maven.apache.org/POM/4.0.0') +properties = [('modelVersion', '4.0.0'), ('groupId', 'io.teaql.test'), + ('artifactId', 'merchant-privacy-reactor'), ('version', '1'), ('packaging', 'pom')] +for key, value in properties: + SubElement(project, key).text = value +file = Path(sys.argv[1]) +modules = SubElement(project, 'modules') +for module in sys.argv[2:]: + SubElement(modules, 'module').text = relpath(module, file.parent) +ElementTree(project).write(file, encoding='utf-8', xml_declaration=True) +PY +unset TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS TEAQL_SQL_DEBUG_ENDPOINT TEAQL_AUDIT_DEBUG_ENDPOINT +export TEAQL_LOG_FORMAT=json TEAQL_TELEMETRY_ENABLED=false +for round in 1 2; do + if [[ "$round" == 2 ]]; then + export TEAQL_ALLOW_SENSITIVE_PLAINTEXT_LOGS=I_UNDERSTAND_SENSITIVE_DATA_MAY_BE_WRITTEN_TO_DISK + fi + TEAQL_SHOWCASE_ROUND="$round" TEAQL_LOG_ENDPOINT="$evidence/ordinary-$round.log" \ + TEAQL_ORDER_PRIVACY_DEBUG_FILE="$evidence/debug-$round.log" mvn -q -f "$scratch/pom.xml" -pl :merchant-order-privacy-service -am \ + -Dtest=MerchantOrderPrivacyTest -Dsurefire.failIfNoSpecifiedTests=false test >"$evidence/round-$round.log" 2>&1 || { + tail -80 "$evidence/round-$round.log" >&2 + exit 1 + } + cp "$example/java-app-console/target/surefire-reports/TEST-com.teaql.merchantorderprivacyservice.MerchantOrderPrivacyTest.xml" "$evidence/round-$round.xml" + rg '^ORDER_PRIVACY=' "$evidence/round-$round.log" +done diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 7bb3370c5..52abcd4ea 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -42,6 +42,7 @@ mvn -q -o -f examples/business-id-runtime/java-app-console/pom.xml compile \ "-Dexec.args=--teaql.datasource.url=jdbc:sqlite:$evidence_dir/business-id.sqlite" mvn -q -pl examples/security-foundations \ -Dtest=SecurityFoundationsExampleTest,SqlRelationMaskingTest test +TEAQL_ORDER_PRIVACY_EVIDENCE_DIR="$evidence_dir/order-privacy" bash examples/security-foundations/verify-privacy.sh TEAQL_REFERENCE_EVIDENCE_DIR="$evidence_dir/round-trip-reference" bash examples/round-trip-reference-runtime/verify.sh TEAQL_CONFORMANCE_EVIDENCE_DIR="$evidence_dir/conformance" bash examples/conformance/verify.sh mvn -q -f examples/school-management/java-lib-core/lib/pom.xml install -DskipTests From 742b0f7238b43c315bc9a95066de6c9735517bcf Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:47:11 +0800 Subject: [PATCH 63/71] Record focused java examples/security-foundations business qualification --- examples/security-foundations/showcase.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/security-foundations/showcase.json b/examples/security-foundations/showcase.json index 6e20fa6b6..a9ffef9ee 100644 --- a/examples/security-foundations/showcase.json +++ b/examples/security-foundations/showcase.json @@ -21,9 +21,17 @@ "receipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/order-privacy-and-federation-generation/receipt.json", "receiptSHA256": "0ae62ffb613692c2d0922b4da1b1dbb9ca6081e8a36a5786a27029a614b711d1" }, + "qualification": { + "businessReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-merchant-order-privacy-native/business-receipt.json", + "businessReceiptSHA256": "41c017b1dbfa59bd67c8d27cf8a8e08a6407409d478f11015b7903fb31a5311c", + "nativeReceipt": "teaql-conformance/evidence/2026-11-20-example-showcase-remediation/java-merchant-order-privacy-native/receipt.json", + "nativeReceiptSHA256": "694db07060857f72f1bda9e3363068d54f95af37e37fd2e838d9244dc2c43202", + "remainingFullRuntimeInventory": true, + "sourceCommit": "cc8d0e983facb0da22e0f5c6a73d7742bd8440bb" + }, "scene": "View one authorized merchant order while protecting customer data in SQL diagnostics", "schema": "teaql.model-workspace-showcase/v1", - "status": "implemented-pending-native-qualification", + "status": "focused-verified", "verification": [ "bash", "examples/security-foundations/verify-privacy.sh" From 2030055cac444efe6c6f8e32720843db9f7f13f5 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 19:54:03 +0800 Subject: [PATCH 64/71] Qualify Java example artifacts from the Maven repository that installed them --- scripts/verify-examples.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 52abcd4ea..198ce6e77 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -12,6 +12,7 @@ trap cleanup EXIT node "$repo/scripts/prepare-example-isolation.cjs" "$build_dir" "$TEAQL_CODEGEN_DIR" "$evidence_dir" runtime_version="$(node -e 'const fs=require("fs");process.stdout.write(fs.readFileSync(process.argv[1],"utf8").match(/([^<]+)<\/version>/)[1])' "$repo/pom.xml")" export MAVEN_OPTS="${MAVEN_OPTS:-} -Dmaven.repo.local=$build_dir/maven -Dteaql.version=$runtime_version" +export TEAQL_MAVEN_DEPENDENCY_CACHE="$build_dir/maven" echo "Native example artifacts use an isolated disposable Maven repository; compact evidence: $evidence_dir" expected=(business-id-runtime conformance exact-decimal fix-e-alignment http-resilience inheritance-save object-storage order-management round-trip-reference-runtime scalar-type-probe school-management security-foundations shared-load-state standard-order trace-chain) mapfile -t actual < <(find "$repo/examples" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort) From 31264908bb968cf2645aeb80d64c4eb2f7fae250 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 22:54:35 +0800 Subject: [PATCH 65/71] Use only the sibling Maven domain library in Java example workspaces --- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../purchaseordernumbering/Checkers.java | 0 .../purchaseordernumbering/Constants.java | 9 - .../com/teaql/purchaseordernumbering/E.java | 18 - .../EntityMetaRegistry.java | 305 --- .../GeneratedRuntimeModule.java | 37 - .../PurchaseOrderNumberingUserContext.java | 10 - .../com/teaql/purchaseordernumbering/Q.java | 31 - .../purchaseordernumbering/Repositories.java | 0 .../platform/Platform.java | 130 -- .../platform/PlatformChecker.java | 52 - .../platform/PlatformExpression.java | 51 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 623 ------ .../purchaseorder/PurchaseOrder.java | 170 -- .../purchaseorder/PurchaseOrderChecker.java | 98 - .../PurchaseOrderExpression.java | 61 - .../PurchaseOrderListExpression.java | 25 - .../purchaseorder/PurchaseOrderRequest.java | 767 ------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/business-id-runtime/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../example/contextfixservice/Checkers.java | 0 .../example/contextfixservice/Constants.java | 9 - .../ContextFixServiceUserContext.java | 13 - .../java/com/example/contextfixservice/E.java | 18 - .../contextfixservice/EntityMetaRegistry.java | 501 ----- .../GeneratedRuntimeModule.java | 36 - .../java/com/example/contextfixservice/Q.java | 25 - .../contextfixservice/Repositories.java | 0 .../contextfixservice/catalog/Catalog.java | 130 -- .../catalog/CatalogChecker.java | 52 - .../catalog/CatalogExpression.java | 51 - .../catalog/CatalogListExpression.java | 25 - .../catalog/CatalogRequest.java | 586 ------ .../contextfixservice/entry/Entry.java | 274 --- .../contextfixservice/entry/EntryChecker.java | 170 -- .../entry/EntryExpression.java | 103 - .../entry/EntryListExpression.java | 25 - .../contextfixservice/entry/EntryRequest.java | 1590 --------------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - .../conformance/context-derived/showcase.json | 3 +- .../conformance/java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../Checkers.java | 0 .../Constants.java | 9 - .../runtimeexampleconformanceservice/E.java | 18 - .../EntityMetaRegistry.java | 300 --- .../GeneratedRuntimeModule.java | 37 - .../runtimeexampleconformanceservice/Q.java | 25 - .../Repositories.java | 0 ...eExampleConformanceServiceUserContext.java | 10 - .../platform/Platform.java | 130 -- .../platform/PlatformChecker.java | 52 - .../platform/PlatformExpression.java | 51 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 623 ------ .../sampledata/SampleDataService.java | 0 .../workitem/WorkItem.java | 149 -- .../workitem/WorkItemChecker.java | 71 - .../workitem/WorkItemExpression.java | 60 - .../workitem/WorkItemListExpression.java | 25 - .../workitem/WorkItemRequest.java | 832 -------- .../io.teaql.core.meta.EntityMetaAssembler | 2 - .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 ...eckerNaturalMessageServiceUserContext.java | 10 - .../Checkers.java | 0 .../Constants.java | 9 - .../checkernaturalmessageservice/E.java | 18 - .../EntityMetaRegistry.java | 343 ---- .../GeneratedRuntimeModule.java | 37 - .../checkernaturalmessageservice/Q.java | 25 - .../Repositories.java | 0 .../catalog/Catalog.java | 130 -- .../catalog/CatalogChecker.java | 52 - .../catalog/CatalogExpression.java | 51 - .../catalog/CatalogListExpression.java | 25 - .../catalog/CatalogRequest.java | 623 ------ .../entry/Entry.java | 169 -- .../entry/EntryChecker.java | 103 - .../entry/EntryExpression.java | 68 - .../entry/EntryListExpression.java | 25 - .../entry/EntryRequest.java | 957 --------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - .../natural-messages/showcase.json | 3 +- examples/conformance/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../example/exactdecimalservice/Checkers.java | 0 .../exactdecimalservice/Constants.java | 9 - .../com/example/exactdecimalservice/E.java | 18 - .../EntityMetaRegistry.java | 300 --- .../ExactDecimalServiceUserContext.java | 10 - .../GeneratedRuntimeModule.java | 37 - .../com/example/exactdecimalservice/Q.java | 25 - .../exactdecimalservice/Repositories.java | 0 .../decimalentry/DecimalEntry.java | 149 -- .../decimalentry/DecimalEntryChecker.java | 70 - .../decimalentry/DecimalEntryExpression.java | 61 - .../DecimalEntryListExpression.java | 25 - .../decimalentry/DecimalEntryRequest.java | 875 -------- .../platform/Platform.java | 130 -- .../platform/PlatformChecker.java | 52 - .../platform/PlatformExpression.java | 51 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 775 ------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/exact-decimal/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../CheckerFixAdvancedUserContext.java | 10 - .../teaql/checkerfixadvanced/Checkers.java | 0 .../teaql/checkerfixadvanced/Constants.java | 9 - .../java/com/teaql/checkerfixadvanced/E.java | 23 - .../EntityMetaRegistry.java | 610 ------ .../GeneratedRuntimeModule.java | 38 - .../java/com/teaql/checkerfixadvanced/Q.java | 34 - .../checkerfixadvanced/Repositories.java | 0 .../orderitem/OrderItem.java | 211 -- .../orderitem/OrderItemChecker.java | 139 -- .../orderitem/OrderItemExpression.java | 86 - .../orderitem/OrderItemListExpression.java | 25 - .../orderitem/OrderItemRequest.java | 1266 ------------ .../purchaseorder/PurchaseOrder.java | 213 -- .../purchaseorder/PurchaseOrderChecker.java | 129 -- .../PurchaseOrderExpression.java | 83 - .../PurchaseOrderListExpression.java | 25 - .../purchaseorder/PurchaseOrderRequest.java | 1317 ------------ .../sampledata/SampleDataService.java | 0 .../checkerfixadvanced/tenant/Tenant.java | 152 -- .../tenant/TenantChecker.java | 59 - .../tenant/TenantExpression.java | 59 - .../tenant/TenantListExpression.java | 25 - .../tenant/TenantRequest.java | 835 -------- .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/fix-e-alignment/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../supplierordersyncservice/Checkers.java | 0 .../supplierordersyncservice/Constants.java | 9 - .../com/teaql/supplierordersyncservice/E.java | 18 - .../EntityMetaRegistry.java | 297 --- .../GeneratedRuntimeModule.java | 37 - .../com/teaql/supplierordersyncservice/Q.java | 25 - .../Repositories.java | 0 .../SupplierOrderSyncServiceUserContext.java | 10 - .../sampledata/SampleDataService.java | 0 .../supplier/Supplier.java | 130 -- .../supplier/SupplierChecker.java | 52 - .../supplier/SupplierExpression.java | 51 - .../supplier/SupplierListExpression.java | 25 - .../supplier/SupplierRequest.java | 623 ------ .../supplierorder/SupplierOrder.java | 149 -- .../supplierorder/SupplierOrderChecker.java | 71 - .../SupplierOrderExpression.java | 60 - .../SupplierOrderListExpression.java | 25 - .../supplierorder/SupplierOrderRequest.java | 836 -------- .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/http-resilience/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../inheritancematchingservice/Checkers.java | 0 .../inheritancematchingservice/Constants.java | 13 - .../example/inheritancematchingservice/E.java | 38 - .../EntityMetaRegistry.java | 777 -------- .../GeneratedRuntimeModule.java | 74 - ...InheritanceMatchingServiceUserContext.java | 10 - .../example/inheritancematchingservice/Q.java | 78 - .../Repositories.java | 0 .../academy/Academy.java | 132 -- .../academy/AcademyChecker.java | 49 - .../academy/AcademyExpression.java | 43 - .../academy/AcademyListExpression.java | 25 - .../academy/AcademyRequest.java | 970 --------- .../college/College.java | 132 -- .../college/CollegeChecker.java | 49 - .../college/CollegeExpression.java | 43 - .../college/CollegeListExpression.java | 25 - .../college/CollegeRequest.java | 939 --------- .../platform/Platform.java | 173 -- .../platform/PlatformChecker.java | 70 - .../platform/PlatformExpression.java | 66 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 980 --------- .../sampledata/SampleDataService.java | 0 .../school/School.java | 184 -- .../school/SchoolChecker.java | 82 - .../school/SchoolExpression.java | 73 - .../school/SchoolListExpression.java | 25 - .../school/SchoolRequest.java | 1046 ---------- .../schooltype/SchoolType.java | 172 -- .../schooltype/SchoolTypeChecker.java | 77 - .../schooltype/SchoolTypeExpression.java | 68 - .../schooltype/SchoolTypeListExpression.java | 25 - .../schooltype/SchoolTypeRequest.java | 1052 ---------- .../trainingacademy/TrainingAcademy.java | 137 -- .../TrainingAcademyChecker.java | 49 - .../TrainingAcademyExpression.java | 43 - .../TrainingAcademyListExpression.java | 25 - .../TrainingAcademyRequest.java | 1024 ---------- .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/inheritance-save/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../orderattachmentservice/Checkers.java | 0 .../orderattachmentservice/Constants.java | 9 - .../com/teaql/orderattachmentservice/E.java | 23 - .../EntityMetaRegistry.java | 507 ----- .../GeneratedRuntimeModule.java | 38 - .../OrderAttachmentServiceUserContext.java | 10 - .../com/teaql/orderattachmentservice/Q.java | 34 - .../orderattachmentservice/Repositories.java | 0 .../commerceplatform/CommercePlatform.java | 130 -- .../CommercePlatformChecker.java | 52 - .../CommercePlatformExpression.java | 51 - .../CommercePlatformListExpression.java | 25 - .../CommercePlatformRequest.java | 623 ------ .../customerorder/CustomerOrder.java | 151 -- .../customerorder/CustomerOrderChecker.java | 65 - .../CustomerOrderExpression.java | 61 - .../CustomerOrderListExpression.java | 25 - .../customerorder/CustomerOrderRequest.java | 900 --------- .../orderattachment/OrderAttachment.java | 211 -- .../OrderAttachmentChecker.java | 105 - .../OrderAttachmentExpression.java | 81 - .../OrderAttachmentListExpression.java | 25 - .../OrderAttachmentRequest.java | 1315 ------------ .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/object-storage/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../ordermanagementservice/Checkers.java | 0 .../ordermanagementservice/Constants.java | 13 - .../com/teaql/ordermanagementservice/E.java | 43 - .../EntityMetaRegistry.java | 1741 ---------------- .../GeneratedRuntimeModule.java | 82 - .../OrderManagementServiceUserContext.java | 10 - .../com/teaql/ordermanagementservice/Q.java | 70 - .../ordermanagementservice/Repositories.java | 0 .../commerceplatform/CommercePlatform.java | 281 --- .../CommercePlatformChecker.java | 126 -- .../CommercePlatformExpression.java | 106 - .../CommercePlatformListExpression.java | 25 - .../CommercePlatformRequest.java | 1643 --------------- .../customer/Customer.java | 213 -- .../customer/CustomerChecker.java | 121 -- .../customer/CustomerExpression.java | 83 - .../customer/CustomerListExpression.java | 25 - .../customer/CustomerRequest.java | 1313 ------------ .../customerorder/CustomerOrder.java | 291 --- .../customerorder/CustomerOrderChecker.java | 157 -- .../CustomerOrderExpression.java | 115 -- .../CustomerOrderListExpression.java | 25 - .../customerorder/CustomerOrderRequest.java | 1742 ---------------- .../orderline/OrderLine.java | 232 --- .../orderline/OrderLineChecker.java | 126 -- .../orderline/OrderLineExpression.java | 95 - .../orderline/OrderLineListExpression.java | 25 - .../orderline/OrderLineRequest.java | 1402 ------------- .../ordersearchpreset/OrderSearchPreset.java | 232 --- .../OrderSearchPresetChecker.java | 139 -- .../OrderSearchPresetExpression.java | 89 - .../OrderSearchPresetListExpression.java | 25 - .../OrderSearchPresetRequest.java | 1390 ------------- .../orderstatus/OrderStatus.java | 214 -- .../orderstatus/OrderStatusChecker.java | 98 - .../orderstatus/OrderStatusExpression.java | 83 - .../OrderStatusListExpression.java | 25 - .../orderstatus/OrderStatusRequest.java | 1374 ------------- .../product/Product.java | 234 --- .../product/ProductChecker.java | 132 -- .../product/ProductExpression.java | 90 - .../product/ProductListExpression.java | 25 - .../product/ProductRequest.java | 1458 -------------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/order-management/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../teaql/ordereditreference/Checkers.java | 0 .../teaql/ordereditreference/Constants.java | 9 - .../java/com/teaql/ordereditreference/E.java | 23 - .../EntityMetaRegistry.java | 405 ---- .../GeneratedRuntimeModule.java | 38 - .../OrderEditReferenceUserContext.java | 10 - .../java/com/teaql/ordereditreference/Q.java | 34 - .../ordereditreference/Repositories.java | 0 .../ordereditreference/merchant/Merchant.java | 130 -- .../merchant/MerchantChecker.java | 52 - .../merchant/MerchantExpression.java | 51 - .../merchant/MerchantListExpression.java | 25 - .../merchant/MerchantRequest.java | 623 ------ .../orderitem/OrderItem.java | 148 -- .../orderitem/OrderItemChecker.java | 69 - .../orderitem/OrderItemExpression.java | 60 - .../orderitem/OrderItemListExpression.java | 25 - .../orderitem/OrderItemRequest.java | 874 -------- .../salesorder/SalesOrder.java | 151 -- .../salesorder/SalesOrderChecker.java | 65 - .../salesorder/SalesOrderExpression.java | 61 - .../salesorder/SalesOrderListExpression.java | 25 - .../salesorder/SalesOrderRequest.java | 902 --------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - .../showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../freightquotesettlement/Checkers.java | 0 .../freightquotesettlement/Constants.java | 9 - .../com/example/freightquotesettlement/E.java | 18 - .../EntityMetaRegistry.java | 508 ----- .../FreightQuoteSettlementUserContext.java | 10 - .../GeneratedRuntimeModule.java | 37 - .../com/example/freightquotesettlement/Q.java | 25 - .../freightquotesettlement/Repositories.java | 0 .../freightquote/FreightQuote.java | 273 --- .../freightquote/FreightQuoteChecker.java | 134 -- .../freightquote/FreightQuoteExpression.java | 106 - .../FreightQuoteListExpression.java | 25 - .../freightquote/FreightQuoteRequest.java | 1774 ----------------- .../platform/Platform.java | 130 -- .../platform/PlatformChecker.java | 52 - .../platform/PlatformExpression.java | 51 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 1079 ---------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/scalar-type-probe/showcase.json | 3 +- .../verify-freight-quotes.sh | 2 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../schoolmanagementservice/Checkers.java | 0 .../schoolmanagementservice/Constants.java | 13 - .../example/schoolmanagementservice/E.java | 23 - .../EntityMetaRegistry.java | 808 -------- .../GeneratedRuntimeModule.java | 75 - .../example/schoolmanagementservice/Q.java | 34 - .../schoolmanagementservice/Repositories.java | 0 .../SchoolManagementServiceUserContext.java | 10 - .../platform/Platform.java | 214 -- .../platform/PlatformChecker.java | 114 -- .../platform/PlatformExpression.java | 81 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 1396 ------------- .../sampledata/SampleDataService.java | 0 .../school/School.java | 287 --- .../school/SchoolChecker.java | 159 -- .../school/SchoolExpression.java | 110 - .../school/SchoolListExpression.java | 25 - .../school/SchoolRequest.java | 1643 --------------- .../schooltype/SchoolType.java | 193 -- .../schooltype/SchoolTypeChecker.java | 88 - .../schooltype/SchoolTypeExpression.java | 76 - .../schooltype/SchoolTypeListExpression.java | 25 - .../schooltype/SchoolTypeRequest.java | 1238 ------------ .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/school-management/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../merchantorderprivacyservice/Checkers.java | 0 .../Constants.java | 9 - .../teaql/merchantorderprivacyservice/E.java | 23 - .../EntityMetaRegistry.java | 429 ---- .../GeneratedRuntimeModule.java | 38 - ...erchantOrderPrivacyServiceUserContext.java | 10 - .../teaql/merchantorderprivacyservice/Q.java | 34 - .../Repositories.java | 0 .../customerorder/CustomerOrder.java | 170 -- .../customerorder/CustomerOrderChecker.java | 84 - .../CustomerOrderExpression.java | 70 - .../CustomerOrderListExpression.java | 25 - .../customerorder/CustomerOrderRequest.java | 959 --------- .../customerprofile/CustomerProfile.java | 151 -- .../CustomerProfileChecker.java | 65 - .../CustomerProfileExpression.java | 61 - .../CustomerProfileListExpression.java | 25 - .../CustomerProfileRequest.java | 750 ------- .../merchant/Merchant.java | 152 -- .../merchant/MerchantChecker.java | 58 - .../merchant/MerchantExpression.java | 59 - .../merchant/MerchantListExpression.java | 25 - .../merchant/MerchantRequest.java | 683 ------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/security-foundations/showcase.json | 3 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../schoolmanagementservice/Checkers.java | 0 .../schoolmanagementservice/Constants.java | 13 - .../example/schoolmanagementservice/E.java | 28 - .../EntityMetaRegistry.java | 988 --------- .../GeneratedRuntimeModule.java | 76 - .../example/schoolmanagementservice/Q.java | 43 - .../schoolmanagementservice/Repositories.java | 0 .../SchoolManagementServiceUserContext.java | 10 - .../platform/Platform.java | 236 --- .../platform/PlatformChecker.java | 120 -- .../platform/PlatformExpression.java | 89 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 1760 ---------------- .../sampledata/SampleDataService.java | 0 .../school/School.java | 287 --- .../school/SchoolChecker.java | 159 -- .../school/SchoolExpression.java | 110 - .../school/SchoolListExpression.java | 25 - .../school/SchoolRequest.java | 1643 --------------- .../SchoolCapacitySummary.java | 168 -- .../SchoolCapacitySummaryChecker.java | 79 - .../SchoolCapacitySummaryExpression.java | 67 - .../SchoolCapacitySummaryListExpression.java | 25 - .../SchoolCapacitySummaryRequest.java | 1059 ---------- .../schooltype/SchoolType.java | 193 -- .../schooltype/SchoolTypeChecker.java | 87 - .../schooltype/SchoolTypeExpression.java | 76 - .../schooltype/SchoolTypeListExpression.java | 25 - .../schooltype/SchoolTypeRequest.java | 1238 ------------ .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/shared-load-state/showcase.json | 3 +- examples/standard-order/AGENTS.md | 4 +- .../java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../requesttreeorderservice/Checkers.java | 0 .../requesttreeorderservice/Constants.java | 14 - .../example/requesttreeorderservice/E.java | 33 - .../EntityMetaRegistry.java | 907 --------- .../GeneratedRuntimeModule.java | 100 - .../example/requesttreeorderservice/Q.java | 52 - .../requesttreeorderservice/Repositories.java | 0 .../RequestTreeOrderServiceUserContext.java | 10 - .../customer/Customer.java | 151 -- .../customer/CustomerChecker.java | 65 - .../customer/CustomerExpression.java | 61 - .../customer/CustomerListExpression.java | 25 - .../customer/CustomerRequest.java | 902 --------- .../customerorder/CustomerOrder.java | 236 --- .../customerorder/CustomerOrderChecker.java | 100 - .../CustomerOrderExpression.java | 93 - .../CustomerOrderListExpression.java | 25 - .../customerorder/CustomerOrderRequest.java | 1516 -------------- .../orderitem/OrderItem.java | 169 -- .../orderitem/OrderItemChecker.java | 80 - .../orderitem/OrderItemExpression.java | 68 - .../orderitem/OrderItemListExpression.java | 25 - .../orderitem/OrderItemRequest.java | 1060 ---------- .../orderstatus/OrderStatus.java | 214 -- .../orderstatus/OrderStatusChecker.java | 100 - .../orderstatus/OrderStatusExpression.java | 83 - .../OrderStatusListExpression.java | 25 - .../orderstatus/OrderStatusRequest.java | 1385 ------------- .../platform/Platform.java | 152 -- .../platform/PlatformChecker.java | 58 - .../platform/PlatformExpression.java | 59 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 835 -------- .../sampledata/SampleDataService.java | 0 .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/standard-order/showcase.json | 3 +- examples/standard-order/verify.sh | 2 +- .../trace-chain/java-app-console/lib/pom.xml | 102 - .../BaseServiceConfiguration.java | 0 .../com/teaql/tracechainservice/Checkers.java | 0 .../teaql/tracechainservice/Constants.java | 9 - .../java/com/teaql/tracechainservice/E.java | 38 - .../tracechainservice/EntityMetaRegistry.java | 799 -------- .../GeneratedRuntimeModule.java | 41 - .../java/com/teaql/tracechainservice/Q.java | 61 - .../teaql/tracechainservice/Repositories.java | 0 .../TraceChainServiceUserContext.java | 10 - .../customerorder/CustomerOrder.java | 216 -- .../customerorder/CustomerOrderChecker.java | 89 - .../CustomerOrderExpression.java | 84 - .../CustomerOrderListExpression.java | 25 - .../customerorder/CustomerOrderRequest.java | 1017 ---------- .../orderitem/OrderItem.java | 128 -- .../orderitem/OrderItemChecker.java | 59 - .../orderitem/OrderItemExpression.java | 53 - .../orderitem/OrderItemListExpression.java | 25 - .../orderitem/OrderItemRequest.java | 689 ------- .../tracechainservice/payment/Payment.java | 151 -- .../payment/PaymentChecker.java | 65 - .../payment/PaymentExpression.java | 61 - .../payment/PaymentListExpression.java | 25 - .../payment/PaymentRequest.java | 750 ------- .../paymentattempt/PaymentAttempt.java | 128 -- .../paymentattempt/PaymentAttemptChecker.java | 59 - .../PaymentAttemptExpression.java | 53 - .../PaymentAttemptListExpression.java | 25 - .../paymentattempt/PaymentAttemptRequest.java | 689 ------- .../tracechainservice/platform/Platform.java | 130 -- .../platform/PlatformChecker.java | 52 - .../platform/PlatformExpression.java | 51 - .../platform/PlatformListExpression.java | 25 - .../platform/PlatformRequest.java | 623 ------ .../sampledata/SampleDataService.java | 0 .../tracechainservice/shipment/Shipment.java | 128 -- .../shipment/ShipmentChecker.java | 59 - .../shipment/ShipmentExpression.java | 53 - .../shipment/ShipmentListExpression.java | 25 - .../shipment/ShipmentRequest.java | 689 ------- .../io.teaql.core.meta.EntityMetaAssembler | 2 - examples/trace-chain/showcase.json | 3 +- 509 files changed, 38 insertions(+), 95190 deletions(-) delete mode 100644 examples/business-id-runtime/java-app-console/lib/pom.xml delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java delete mode 100644 examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/conformance/context-derived/java-app-console/lib/pom.xml delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Checkers.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Repositories.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java delete mode 100644 examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/conformance/java-app-console/lib/pom.xml delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java delete mode 100644 examples/conformance/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/pom.xml delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/E.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java delete mode 100644 examples/conformance/natural-messages/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/exact-decimal/java-app-console/lib/pom.xml delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Checkers.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Repositories.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java delete mode 100644 examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/fix-e-alignment/java-app-console/lib/pom.xml delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/E.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java delete mode 100644 examples/fix-e-alignment/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/http-resilience/java-app-console/lib/pom.xml delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java delete mode 100644 examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/inheritance-save/java-app-console/lib/pom.xml delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Constants.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/E.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Q.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/College.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/School.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java delete mode 100644 examples/inheritance-save/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/object-storage/java-app-console/lib/pom.xml delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java delete mode 100644 examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/order-management/java-app-console/lib/pom.xml delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java delete mode 100644 examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/pom.xml delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Checkers.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Repositories.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java delete mode 100644 examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/scalar-type-probe/java-app-console/lib/pom.xml delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Checkers.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Repositories.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java delete mode 100644 examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/school-management/java-app-console/lib/pom.xml delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java delete mode 100644 examples/school-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/security-foundations/java-app-console/lib/pom.xml delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java delete mode 100644 examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/shared-load-state/java-app-console/lib/pom.xml delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java delete mode 100644 examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/standard-order/java-app-console/lib/pom.xml delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Constants.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/E.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Q.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java delete mode 100644 examples/standard-order/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler delete mode 100644 examples/trace-chain/java-app-console/lib/pom.xml delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Checkers.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Constants.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/E.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Q.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Repositories.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java delete mode 100644 examples/trace-chain/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler diff --git a/examples/business-id-runtime/java-app-console/lib/pom.xml b/examples/business-id-runtime/java-app-console/lib/pom.xml deleted file mode 100644 index e6e38ff8b..000000000 --- a/examples/business-id-runtime/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - purchase-order-numbering-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java deleted file mode 100644 index 21f3171bf..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.purchaseordernumbering; - -import com.teaql.purchaseordernumbering.platform.Platform; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java deleted file mode 100644 index 253c026cf..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.teaql.purchaseordernumbering; - -import com.teaql.purchaseordernumbering.platform.Platform; -import com.teaql.purchaseordernumbering.platform.PlatformExpression; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static PurchaseOrderExpression purchaseOrder(PurchaseOrder purchaseOrder){ - return new PurchaseOrderExpression(new ValueExpression(purchaseOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.purchaseOrder()")); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java deleted file mode 100644 index ceda8f0ba..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/EntityMetaRegistry.java +++ /dev/null @@ -1,305 +0,0 @@ - -package com.teaql.purchaseordernumbering; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerPurchaseOrder(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.teaql.purchaseordernumbering.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.purchaseordernumbering.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.purchaseordernumbering.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.teaql.purchaseordernumbering.platform.Platform::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Procurement") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerPurchaseOrder() { - FieldLayout.installGenerated(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.PLATFORM_PROPERTY, com.teaql.purchaseordernumbering.platform.Platform.INTERNAL_TYPE, com.teaql.purchaseordernumbering.platform.Platform.PURCHASE_ORDER_LIST_PROPERTY, com.teaql.purchaseordernumbering.platform.Platform.class) - ; - PropertyDescriptor supplier = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY, String.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.SUPPLIER_PROPERTY).with("isPassword", "false") - - .with("max", "80") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("min", "1") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.ORDER_NUMBER_PROPERTY).with("policyVersion", "1") - - .with("splitbydate", "true") - - .with("isPassword", "false") - - .with("dateFormat", "yyyyMMdd") - - .with("max", "100") - - .with("prefix", "ORD") - - .with("profile", "daily-permuted-v1") - - .with("preserve_digits", "6") - - .with("isVersion", "false") - - .with("separator", "-") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("namespace", "order_number") - - .with("reset", "daily") - - .with("isString", "true") - - .with("isDate", "false") - - .with("isBusinessId", "true") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java deleted file mode 100644 index 9e1b662fa..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/GeneratedRuntimeModule.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.teaql.purchaseordernumbering; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.purchaseordernumbering.platform.PlatformChecker(), new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:304c22e5b2a924d8fc32148174ef6d249857e8080ea8459c2cb4d8a6fd75ae60\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"purchase_order_list\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrderList\",\"purchaseOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PurchaseOrder\":{\"labels\":{\"en\":\"purchase order\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"supplier\",\"labels\":{\"en\":\"supplier\"},\"aliases\":[\"Supplier\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("PurchaseOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("supplier", "supplier"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.purchaseordernumbering.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.purchaseordernumbering.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Procurement"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - } -} diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java deleted file mode 100644 index 4657ad0f1..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumberingUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.purchaseordernumbering; - -import io.teaql.core.UserContext; -public interface PurchaseOrderNumberingUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java deleted file mode 100644 index 9e36986b3..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Q.java +++ /dev/null @@ -1,31 +0,0 @@ - -package com.teaql.purchaseordernumbering; - -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.purchaseordernumbering.platform.PlatformRequest platforms(){ - return new com.teaql.purchaseordernumbering.platform.PlatformRequest(com.teaql.purchaseordernumbering.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.purchaseordernumbering.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.teaql.purchaseordernumbering.platform.PlatformRequest(com.teaql.purchaseordernumbering.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrders(){ - return new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrdersWithMinimalFields(){ - return new com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest(com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - public static com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest purchaseOrderByOrderNumber(OrderNumber value){ - return purchaseOrders() - .withOrderNumberIs(value) - .limit(2); - } - - -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java deleted file mode 100644 index 7a10bad15..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/Platform.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.teaql.purchaseordernumbering.platform; - -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "d902d21d4ba3eb14abdffc72b05a2e8008839fa2694a0e0978a2b236da59b3b6"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "purchase_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String PURCHASE_ORDER_LIST_PROPERTY = "purchase_order_list"; - private String name; - - private SmartList purchaseOrderList; - - public String getName(){ - return this.name; - } - - public SmartList getPurchaseOrderList(){ - return this.purchaseOrderList == null ? SmartList.unloaded() : this.purchaseOrderList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform addPurchaseOrder(PurchaseOrder purchaseOrder){ - if (purchaseOrder == null){ - return this; - } - - if(null == this.purchaseOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.purchaseOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.purchaseOrderList.add(purchaseOrder); - purchaseOrder.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "purchase_order_list": this.purchaseOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "purchase_order_list": return this.purchaseOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java deleted file mode 100644 index 1acced04e..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.teaql.purchaseordernumbering.platform; - -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; platform.getPurchaseOrderList() != null && i < platform.getPurchaseOrderList().size(); i++){ - PurchaseOrder purchaseOrder = platform.getPurchaseOrderList().get(i); - new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, newLocation(_parentLocation, "purchase_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java deleted file mode 100644 index bf49a9f08..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.teaql.purchaseordernumbering.platform; - -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public PurchaseOrderListExpression getPurchaseOrderList(){ - return new PurchaseOrderListExpression(loaded("purchase_order_list", "getPurchaseOrderList", Platform::getPurchaseOrderList)); - } - public PlatformExpression addPurchaseOrder(PurchaseOrder purchaseOrder){ - return new PlatformExpression(this, $it -> ((Platform)$it).addPurchaseOrder(purchaseOrder)); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java deleted file mode 100644 index 741d23e61..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.purchaseordernumbering.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java deleted file mode 100644 index f68efd9c8..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/platform/PlatformRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.teaql.purchaseordernumbering.platform; - -import com.teaql.purchaseordernumbering.Q; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectPurchaseOrderList(); - return selectId().selectName().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectPurchaseOrderList(){ - return selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()); - } - - public PlatformRequest selectPurchaseOrderListWith(PurchaseOrderRequest purchaseOrderList){ - enhanceRelation(Platform.PURCHASE_ORDER_LIST_PROPERTY, purchaseOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderListWith", null, Platform.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.PLATFORM_PROPERTY))); - } - - public PlatformRequest havePurchaseOrders(){ - return withPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); - } - - public PlatformRequest haveNoPurchaseOrders(){ - return withoutPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ - aggregate(Platform.PURCHASE_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest){ - return statsFromPurchaseOrdersAs(name, subRequest, false); - } - - public PlatformRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, PurchaseOrder.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPurchaseOrdersAs", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromPurchaseOrders(PurchaseOrderRequest subRequest){ - return statsFromPurchaseOrdersAs(REFINEMENTS, subRequest); - } - public PlatformRequest countPurchaseOrders(){ - addRelationCount("Count", Q.purchaseOrders().unlimited(), PurchaseOrder.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrders", null, Platform.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countPurchaseOrdersAs(String name){ - addRelationCount(name, Q.purchaseOrders().unlimited(), PurchaseOrder.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersAs", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countPurchaseOrdersWith(String name, PurchaseOrderRequest subRequest){ - addRelationCount(name, subRequest, PurchaseOrder.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersWith", name, Platform.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java deleted file mode 100644 index 874e77a05..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrder.java +++ /dev/null @@ -1,170 +0,0 @@ - -package com.teaql.purchaseordernumbering.purchaseorder; - -import com.teaql.purchaseordernumbering.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.businessid.BusinessIdDefinition; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class PurchaseOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "PurchaseOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5270760d55c941f82fc30cf0457d609378a6398d6229c0bb5ba44c7dea546787"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("supplier", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("supplier", java.util.List.of("supplier", "supplier")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - PurchaseOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - public record OrderNumber(String value) { - public OrderNumber { - value = value == null ? null : value.trim(); - if (value == null || value.isEmpty()) { - throw new IllegalArgumentException("order_number must not be blank"); - } - } - - public static OrderNumber of(String value) { - return new OrderNumber(value); - } - - public static BusinessIdDefinition definition() { - return new BusinessIdDefinition( - "order_number", "daily-permuted-v1", "ORD", - "yyyyMMdd", "daily", 6, - "-", "order_number", 1); - } - - @Override - public String toString() { return value; } - } - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String SUPPLIER_PROPERTY = "supplier"; - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - private Platform platform; - - private String supplier; - - private String orderNumber; - - public Platform getPlatform(){ - return this.platform; - } - - public String getSupplier(){ - return this.supplier; - } - - public OrderNumber getOrderNumber(){ - return this.orderNumber == null ? null : new OrderNumber(this.orderNumber); - } - public PurchaseOrder updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public PurchaseOrder updateSupplier(String supplier){ - supplier = (supplier == null ? null : supplier.trim()); - if(isPropertyLoaded(SUPPLIER_PROPERTY) && Objects.equals(this.supplier, supplier)){ - return this; - } - handleUpdate(SUPPLIER_PROPERTY, getSupplier(), supplier); - this.supplier = supplier; - return this; - } - - public PurchaseOrder updateOrderNumber(OrderNumber orderNumber){ - String canonical = orderNumber == null ? null : orderNumber.value(); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, canonical)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, this.orderNumber, canonical); - this.orderNumber = canonical; - return this; - } - - - public static PurchaseOrder refer(Long id){ - PurchaseOrder refer = new PurchaseOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public PurchaseOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "supplier": this.supplier = (value == null ? null : ((String)value).trim()); break; - - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "supplier": return this.supplier; - case "order_number": return this.orderNumber; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "supplier": return this.supplier; - case "orderNumber": return this.orderNumber; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java deleted file mode 100644 index ef68e96c3..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderChecker.java +++ /dev/null @@ -1,98 +0,0 @@ - -package com.teaql.purchaseordernumbering.purchaseorder; - -import com.teaql.purchaseordernumbering.platform.Platform; -import com.teaql.purchaseordernumbering.platform.PlatformChecker; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; -import io.teaql.core.UserContext; -import io.teaql.core.businessid.BusinessIdSlot; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PurchaseOrderChecker implements Checker{ - - public String type(){ - return PurchaseOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, purchaseOrder)){ - markAsChecked(_context, purchaseOrder); - doCheck(_context, purchaseOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ - if((purchaseOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, purchaseOrder); - if(purchaseOrder.needPersist()){ - } - if(purchaseOrder.newItem()){ - boolean orderNumberWasMissing = purchaseOrder.getOrderNumber() == null; - try { - _context.businessIds().ensure( - _context, - OrderNumber.definition(), - String.valueOf(_context.requireActiveRoot("Platform").id()), - type(), - new BusinessIdSlot() { - public String currentValue() { - OrderNumber current = purchaseOrder.getOrderNumber(); - return current == null ? null : current.value(); - } - public boolean newAggregate() { return true; } - public void assignCanonicalValue(String value) { - purchaseOrder.updateOrderNumber(OrderNumber.of(value)); - } - }); - if (orderNumberWasMissing) { - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "order_number", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "businessIdAllocator")); - } - } catch (io.teaql.core.businessid.BusinessIdException error) { - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), error.getCode() + ": " + error.getMessage()); - } - - }else if(purchaseOrder.updateItem()){ - if(!purchaseOrder.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!purchaseOrder.isPropertyLoaded("supplier")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "supplier"), "Mutation requires a fully loaded entity"); - } - if(!purchaseOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - if(purchaseOrder.getUpdatedProperties().contains(PurchaseOrder.ORDER_NUMBER_PROPERTY)){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Business ID is immutable after create"); - } - } - checkPlatform(_context, purchaseOrder.getProperty(PurchaseOrder.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkSupplier(_context, purchaseOrder.getProperty(PurchaseOrder.SUPPLIER_PROPERTY), newLocation(_parentLocation, "supplier")); - checkOrderNumber(_context, purchaseOrder.getOrderNumber(), newLocation(_parentLocation, "order_number")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkSupplier(UserContext _context, String supplier, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, supplier); - if((supplier == null)){ - return; - } - minStringCheck(_context, _parentLocation, 1, supplier); - maxStringCheck(_context, _parentLocation, 80, supplier); - - } - public void checkOrderNumber(UserContext _context, OrderNumber orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java deleted file mode 100644 index 0594527d8..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.teaql.purchaseordernumbering.purchaseorder; - -import com.teaql.purchaseordernumbering.platform.Platform; -import com.teaql.purchaseordernumbering.platform.PlatformExpression; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PurchaseOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PurchaseOrderExpression(Expression expression){ - super(expression); - } - - public PurchaseOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public PurchaseOrderExpression updateId(Long id){ - return new PurchaseOrderExpression(this, $it -> {((PurchaseOrder)$it).__internalSet("id", id); return this;}); - } - - public PurchaseOrderExpression save(UserContext userContext){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PurchaseOrderExpression save(String intent, UserContext userContext){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", PurchaseOrder::getPlatform)); - } - - public PurchaseOrderExpression updatePlatform(Platform platform){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updatePlatform(platform)); - } - - public Expression getSupplier(){ - return loaded("supplier", "getSupplier", PurchaseOrder::getSupplier); - } - public PurchaseOrderExpression updateSupplier(String supplier){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateSupplier(supplier)); - } - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", PurchaseOrder::getOrderNumber); - } - public PurchaseOrderExpression updateOrderNumber(OrderNumber orderNumber){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateOrderNumber(orderNumber)); - } - -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java deleted file mode 100644 index 17920adce..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.purchaseordernumbering.purchaseorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PurchaseOrderListExpression extends SmartListExpression { - public PurchaseOrderListExpression(Expression> expression){ - super(expression); - } - - public PurchaseOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PurchaseOrderExpression first() { - return new PurchaseOrderExpression(super.first()); - } - - public PurchaseOrderExpression get(int index) { - return new PurchaseOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java deleted file mode 100644 index aa96df543..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/purchaseorder/PurchaseOrderRequest.java +++ /dev/null @@ -1,767 +0,0 @@ - -package com.teaql.purchaseordernumbering.purchaseorder; - -import com.teaql.purchaseordernumbering.Q; -import com.teaql.purchaseordernumbering.platform.Platform; -import com.teaql.purchaseordernumbering.platform.PlatformRequest; -import com.teaql.purchaseordernumbering.purchaseorder.PurchaseOrder.OrderNumber; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PurchaseOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PurchaseOrderRequest(Class returnType){ - this(returnType, () -> (T) new PurchaseOrder()); - } - - protected PurchaseOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PurchaseOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PurchaseOrderRequest copy(){ - return (PurchaseOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PurchaseOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PurchaseOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PurchaseOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PurchaseOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PurchaseOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PurchaseOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PurchaseOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PurchaseOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PurchaseOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PurchaseOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PurchaseOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PurchaseOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public PurchaseOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder){ - super.internalMatchAny(purchaseOrder); - return this; - } - - public PurchaseOrderRequest matchingIdsOf(PurchaseOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - PurchaseOrder.ID_PROPERTY, request, PurchaseOrder.ID_PROPERTY)); - } - - public PurchaseOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PurchaseOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PurchaseOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PurchaseOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectSupplier().selectOrderNumber().selectVersion(); - } - - public PurchaseOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public PurchaseOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(PurchaseOrder.ID_PROPERTY); - selectProperty(PurchaseOrder.PLATFORM_PROPERTY); - selectProperty(PurchaseOrder.SUPPLIER_PROPERTY); - selectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); - selectProperty(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectSupplier().selectOrderNumber().selectVersion(); - } - - public PurchaseOrderRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectSupplier().selectOrderNumber().selectVersion(); - } - - - public PurchaseOrderRequest selectId(){ - selectProperty(PurchaseOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectId(){ - unselectProperty(PurchaseOrder.ID_PROPERTY); - return this; - } - public PurchaseOrderRequest selectPlatformIdOnly(){ - selectProperty(PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - - public PurchaseOrderRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public PurchaseOrderRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(PurchaseOrder.PLATFORM_PROPERTY); - enhanceRelation(PurchaseOrder.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, PurchaseOrder.PLATFORM_PROPERTY)); - return this; - } - - public PurchaseOrderRequest unselectPlatform(){ - unselectProperty(PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - public PurchaseOrderRequest selectSupplier(){ - selectProperty(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - - /** - * fill the supplier with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS supplier) to fetch supplier property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectSupplier(){ - unselectProperty(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - public PurchaseOrderRequest selectOrderNumber(){ - selectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectOrderNumber(){ - unselectProperty(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public PurchaseOrderRequest selectVersion(){ - selectProperty(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectVersion(){ - unselectProperty(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.ID_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PurchaseOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PurchaseOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PurchaseOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PurchaseOrderRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public PurchaseOrderRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public PurchaseOrderRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public PurchaseOrderRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, operator, values); - } - - public PurchaseOrderRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public PurchaseOrderRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public PurchaseOrderRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(PurchaseOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public PurchaseOrderRequest filterBySupplier(String... supplier){ - if (supplier == null || supplier.length == 0) { - throw new IllegalArgumentException("filterBySupplier parameter supplier cannot be empty"); - } - return appendSearchCriteria(createSupplierCriteria(Operator.EQUAL, (Object[])supplier)); - } - - public PurchaseOrderRequest withSupplier(Operator operator, Object... values){ - return appendSearchCriteria(createSupplierCriteria(operator, values)); - } - - public PurchaseOrderRequest withSupplierIsUnknown(){ - return withSupplier(Operator.IS_NULL); - } - - public PurchaseOrderRequest withSupplierIsKnown(){ - return withSupplier(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSupplierCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.SUPPLIER_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withSupplierIsNot(String supplier){ - return withSupplier(Operator.NOT_EQUAL, supplier); - } - - public PurchaseOrderRequest withSupplierIn(String... supplier){ - return withSupplier(Operator.IN, (Object[])supplier); - } - - public PurchaseOrderRequest withSupplierNotIn(String... supplier){ - return withSupplier(Operator.NOT_IN, (Object[])supplier); - } - public PurchaseOrderRequest withSupplierGreaterThan(String supplier){ - return withSupplier(Operator.GREATER_THAN, supplier); - } - - public PurchaseOrderRequest withSupplierGreaterThanOrEqualTo(String supplier){ - return withSupplier(Operator.GREATER_THAN_OR_EQUAL, supplier); - } - - public PurchaseOrderRequest withSupplierLessThan(String supplier){ - return withSupplier(Operator.LESS_THAN, supplier); - } - - public PurchaseOrderRequest withSupplierLessThanOrEqualTo(String supplier){ - return withSupplier(Operator.LESS_THAN_OR_EQUAL, supplier); - } - - public PurchaseOrderRequest withSupplierBetween(String startOfSupplier, String endOfSupplier){ - return withSupplier(Operator.BETWEEN, startOfSupplier, endOfSupplier); - } - public PurchaseOrderRequest withSupplierStartingWith(String supplier){ - return withSupplier(Operator.BEGIN_WITH, supplier); - } - public PurchaseOrderRequest withSupplierContaining(String supplier){ - return withSupplier(Operator.CONTAIN, supplier); - } - - public PurchaseOrderRequest withSupplierNotContaining(String supplier){ - return withSupplier(Operator.NOT_CONTAIN, supplier); - } - - public PurchaseOrderRequest withSupplierNotStartingWith(String supplier){ - return withSupplier(Operator.NOT_BEGIN_WITH, supplier); - } - - public PurchaseOrderRequest withSupplierEndingWith(String supplier){ - return withSupplier(Operator.END_WITH, supplier); - } - - public PurchaseOrderRequest withSupplierNotEndingWith(String supplier){ - return withSupplier(Operator.NOT_END_WITH, supplier); - } - - public PurchaseOrderRequest withSupplierIs(String supplier){ - return withSupplier(Operator.EQUAL, supplier); - } - - public PurchaseOrderRequest withSupplierSoundingLike(String supplier){ - return withSupplier(Operator.SOUNDS_LIKE, supplier); - } - - - - public PurchaseOrderRequest withOrderNumberIs(OrderNumber value){ - return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.EQUAL, value.value())); - } - - public PurchaseOrderRequest withOrderNumberIsNot(OrderNumber value){ - return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.NOT_EQUAL, value.value())); - } - - public PurchaseOrderRequest withOrderNumberIsUnknown(){ - return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.IS_NULL)); - } - - public PurchaseOrderRequest withOrderNumberIsKnown(){ - return appendSearchCriteria(createBasicSearchCriteria(PurchaseOrder.ORDER_NUMBER_PROPERTY, Operator.IS_NOT_NULL)); - } - - public PurchaseOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PurchaseOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PurchaseOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PurchaseOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.VERSION_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PurchaseOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PurchaseOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PurchaseOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PurchaseOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PurchaseOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PurchaseOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PurchaseOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PurchaseOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public PurchaseOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PurchaseOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PurchaseOrderRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public PurchaseOrderRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(PurchaseOrder.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public PurchaseOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PurchaseOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.ID_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public PurchaseOrderRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctSupplier(){ - return countDistinctSupplierAs("supplier_distinct_count"); - } - - public PurchaseOrderRequest countDistinctSupplierAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public PurchaseOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PurchaseOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupById(){ - groupBy(PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByIdAs(String retName){ - groupBy(retName, PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.ID_PROPERTY, function); - return this; - } - public PurchaseOrderRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(PurchaseOrder.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public PurchaseOrderRequest groupByPlatform(){ - groupBy(PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByPlatformAs(String retName){ - groupBy(retName, PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.PLATFORM_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupBySupplier(){ - groupBy(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupBySupplierAs(String retName){ - groupBy(retName, PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupBySupplierWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.SUPPLIER_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByOrderNumber(){ - groupBy(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByVersion(){ - groupBy(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByVersionAs(String retName){ - groupBy(retName, PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.VERSION_PROPERTY, function); - return this; - } - - - - public PurchaseOrderRequest orderByIdAscending(){ - addOrderByAscending(PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByIdDescending(){ - addOrderByDescending(PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByPlatformAscending(){ - addOrderByAscending(PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByPlatformDescending(){ - addOrderByDescending(PurchaseOrder.PLATFORM_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderBySupplierAscending(){ - addOrderByAscending(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderBySupplierDescending(){ - addOrderByDescending(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - public PurchaseOrderRequest orderBySupplierAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderBySupplierDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(PurchaseOrder.SUPPLIER_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(PurchaseOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByVersionAscending(){ - addOrderByAscending(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByVersionDescending(){ - addOrderByDescending(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - public PurchaseOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public PurchaseOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, PurchaseOrder.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, PurchaseOrder.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public PurchaseOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PurchaseOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PurchaseOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PurchaseOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PurchaseOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PurchaseOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java b/examples/business-id-runtime/java-app-console/lib/src/main/java/com/teaql/purchaseordernumbering/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index ebd1eefdf..000000000 --- a/examples/business-id-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.purchaseordernumbering.EntityMetaRegistry \ No newline at end of file diff --git a/examples/business-id-runtime/showcase.json b/examples/business-id-runtime/showcase.json index 3dd26874e..c12300df4 100644 --- a/examples/business-id-runtime/showcase.json +++ b/examples/business-id-runtime/showcase.json @@ -42,6 +42,7 @@ ], "generatedFilesManifestSHA256": "9ab05c103dd98dc0d7fc51f06cb2f7f8a4cef03524711b74101853c1dbbba719", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/conformance/context-derived/java-app-console/lib/pom.xml b/examples/conformance/context-derived/java-app-console/lib/pom.xml deleted file mode 100644 index 845a2f5f5..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - context-fix-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 1.556-RELEASE - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 1.556-RELEASE - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Checkers.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java deleted file mode 100644 index f359466e1..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.example.contextfixservice; - -import com.example.contextfixservice.catalog.Catalog; - -public interface Constants { - public static final long CATALOG_ID = 1l; - public static final Catalog CATALOG = Catalog.refer(CATALOG_ID); -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java deleted file mode 100644 index 4e02f8d3f..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/ContextFixServiceUserContext.java +++ /dev/null @@ -1,13 +0,0 @@ - -package com.example.contextfixservice; - -import io.teaql.core.UserContext; -public interface ContextFixServiceUserContext extends UserContext{ - public default String uniStr(String prefix){ - throw new RuntimeException("not implemented yet"); - } - - - - -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java deleted file mode 100644 index ce74647eb..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.example.contextfixservice; - -import com.example.contextfixservice.catalog.Catalog; -import com.example.contextfixservice.catalog.CatalogExpression; -import com.example.contextfixservice.entry.Entry; -import com.example.contextfixservice.entry.EntryExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static CatalogExpression catalog(Catalog catalog){ - return new CatalogExpression(new ValueExpression(catalog, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.catalog()")); - } - public static EntryExpression entry(Entry entry){ - return new EntryExpression(new ValueExpression(entry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.entry()")); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java deleted file mode 100644 index 63dfbe7b2..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/EntityMetaRegistry.java +++ /dev/null @@ -1,501 +0,0 @@ - -package com.example.contextfixservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.time.LocalDateTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerCatalog(); - registerEntry(); - } - private void registerCatalog() { - FieldLayout.installGenerated(com.example.contextfixservice.catalog.Catalog.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.contextfixservice.catalog.Catalog.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.contextfixservice.catalog.Catalog.class); - entityDescriptor.setEntitySupplier(com.example.contextfixservice.catalog.Catalog::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Catalog") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.catalog.Catalog.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerEntry() { - FieldLayout.installGenerated(com.example.contextfixservice.entry.Entry.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.contextfixservice.entry.Entry.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.contextfixservice.entry.Entry.class); - entityDescriptor.setEntitySupplier(com.example.contextfixservice.entry.Entry::new); - entityDescriptor.with("audit_mask_fields", "guarded_token") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY, Long.class) - ; - PropertyDescriptor catalog = - entityDescriptor.addObjectProperty($factory, com.example.contextfixservice.entry.Entry.CATALOG_PROPERTY, com.example.contextfixservice.catalog.Catalog.INTERNAL_TYPE, com.example.contextfixservice.catalog.Catalog.ENTRY_LIST_PROPERTY, com.example.contextfixservice.catalog.Catalog.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY, String.class) - ; - PropertyDescriptor bornAt = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor touchedAt = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor sourceIp = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY, String.class) - ; - PropertyDescriptor lastIp = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY, String.class) - ; - PropertyDescriptor openedBy = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY, String.class) - ; - PropertyDescriptor changedBy = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY, String.class) - ; - PropertyDescriptor guardedToken = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CATALOG_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.BORN_AT_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.TOUCHED_AT_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.SOURCE_IP_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.LAST_IP_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.OPENED_BY_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.CHANGED_BY_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.GUARDED_TOKEN_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("prefix", "") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("createFunction", "uniStr") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - - .with("createFunctionArgNames", "prefix") - ; - - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.contextfixservice.entry.Entry.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java deleted file mode 100644 index 9ad995608..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.example.contextfixservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.contextfixservice.catalog.CatalogChecker(), new com.example.contextfixservice.entry.EntryChecker()) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Catalog", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Entry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("catalog", "catalog"), java.util.Map.entry("name", "name"), java.util.Map.entry("born_at", "bornAt"), java.util.Map.entry("touched_at", "touchedAt"), java.util.Map.entry("source_ip", "sourceIp"), java.util.Map.entry("last_ip", "lastIp"), java.util.Map.entry("opened_by", "openedBy"), java.util.Map.entry("changed_by", "changedBy"), java.util.Map.entry("guarded_token", "guardedToken"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.catalogs().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.contextfixservice.catalog.Catalog domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.contextfixservice.catalog.Catalog(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Catalog"); - domainRoot.auditAs("create generated Domain Root Catalog").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Catalog", domainRoot.getId())); - } -} diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java deleted file mode 100644 index b8c9d8f3a..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Q.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.contextfixservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.contextfixservice.catalog.CatalogRequest catalogs(){ - return new com.example.contextfixservice.catalog.CatalogRequest(com.example.contextfixservice.catalog.Catalog.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.contextfixservice.catalog.CatalogRequest catalogsWithMinimalFields(){ - return new com.example.contextfixservice.catalog.CatalogRequest(com.example.contextfixservice.catalog.Catalog.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.contextfixservice.entry.EntryRequest entries(){ - return new com.example.contextfixservice.entry.EntryRequest(com.example.contextfixservice.entry.Entry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.contextfixservice.entry.EntryRequest entriesWithMinimalFields(){ - return new com.example.contextfixservice.entry.EntryRequest(com.example.contextfixservice.entry.Entry.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Repositories.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java deleted file mode 100644 index 7ab1bb4e6..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/Catalog.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.example.contextfixservice.catalog; - -import com.example.contextfixservice.entry.Entry; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Catalog extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Catalog"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "0dcb16e6cbbd1798e584c9779cf0bb7037ed8624c44749752b291414d58d4dd5"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "entry_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Catalog.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String ENTRY_LIST_PROPERTY = "entry_list"; - private String name; - - private SmartList entryList; - - public String getName(){ - return this.name; - } - - public SmartList getEntryList(){ - return this.entryList == null ? SmartList.unloaded() : this.entryList; - } - public Catalog updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Catalog addEntry(Entry entry){ - if (entry == null){ - return this; - } - - if(null == this.entryList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.entryList = teaqlUnloadedItems.map(value -> value); - } - - this.entryList.add(entry); - entry.updateCatalog(this); - return this; - } - - public static Catalog refer(Long id){ - Catalog refer = new Catalog(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Catalog comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "entry_list": this.entryList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "entry_list": return this.entryList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java deleted file mode 100644 index b00ede579..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.example.contextfixservice.catalog; - -import com.example.contextfixservice.entry.Entry; -import com.example.contextfixservice.entry.EntryChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CatalogChecker implements Checker{ - - public String type(){ - return Catalog.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ - if(needCheck(_context, catalog)){ - markAsChecked(_context, catalog); - doCheck(_context, catalog, _parentLocation); - } - } - - public void doCheck(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ - if((catalog == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, catalog); - if(catalog.needPersist()){ - } - if(catalog.newItem()){ - }else if(catalog.updateItem()){ - if(!catalog.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, catalog.getProperty(Catalog.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; catalog.getEntryList() != null && i < catalog.getEntryList().size(); i++){ - Entry entry = catalog.getEntryList().get(i); - new EntryChecker().checkAndFix(_context, entry, newLocation(_parentLocation, "entry_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java deleted file mode 100644 index 34e0edeb3..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.example.contextfixservice.catalog; - -import com.example.contextfixservice.entry.Entry; -import com.example.contextfixservice.entry.EntryListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CatalogExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CatalogExpression(Expression expression){ - super(expression); - } - - public CatalogExpression(Expression expression, Function function){ - super(expression, function); - } - - public CatalogExpression updateId(Long id){ - return new CatalogExpression(this, $it -> {((Catalog)$it).__internalSet("id", id); return this;}); - } - - public CatalogExpression save(UserContext userContext){ - return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CatalogExpression save(String intent, UserContext userContext){ - return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Catalog::getName); - } - public CatalogExpression updateName(String name){ - return new CatalogExpression(this, $it -> ((Catalog)$it).updateName(name)); - } - - public EntryListExpression getEntryList(){ - return new EntryListExpression(loaded("entry_list", "getEntryList", Catalog::getEntryList)); - } - public CatalogExpression addEntry(Entry entry){ - return new CatalogExpression(this, $it -> ((Catalog)$it).addEntry(entry)); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java deleted file mode 100644 index a10d96871..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.contextfixservice.catalog; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CatalogListExpression extends SmartListExpression { - public CatalogListExpression(Expression> expression){ - super(expression); - } - - public CatalogListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CatalogExpression first() { - return new CatalogExpression(super.first()); - } - - public CatalogExpression get(int index) { - return new CatalogExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java deleted file mode 100644 index c88d47e91..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/catalog/CatalogRequest.java +++ /dev/null @@ -1,586 +0,0 @@ - -package com.example.contextfixservice.catalog; - -import com.example.contextfixservice.Q; -import com.example.contextfixservice.entry.Entry; -import com.example.contextfixservice.entry.EntryRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CatalogRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CatalogRequest(Class returnType){ - this(returnType, () -> (T) new Catalog()); - } - - protected CatalogRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CatalogRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CatalogRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CatalogRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CatalogRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CatalogRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CatalogRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CatalogRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CatalogRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CatalogRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CatalogRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CatalogRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CatalogRequest)super.appendSearchCriteria(searchCriteria); - } - - public CatalogRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CatalogRequest matchingAnyOf(CatalogRequest catalog){ - super.internalMatchAny(catalog); - return this; - } - - public CatalogRequest matchingIdsOf(CatalogRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Catalog.ID_PROPERTY, request, Catalog.ID_PROPERTY)); - } - - public CatalogRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CatalogRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CatalogRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CatalogRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public CatalogRequest selectSelfFields(){ - return selectSelf(); - } - - public CatalogRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Catalog.ID_PROPERTY); - selectProperty(Catalog.NAME_PROPERTY); - selectProperty(Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public CatalogRequest selectChildren(){ - super.selectAny(); - selectEntryList(); - return selectId().selectName().selectVersion(); - } - - - public CatalogRequest selectId(){ - selectProperty(Catalog.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CatalogRequest unselectId(){ - unselectProperty(Catalog.ID_PROPERTY); - return this; - } - public CatalogRequest selectName(){ - selectProperty(Catalog.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CatalogRequest unselectName(){ - unselectProperty(Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest selectVersion(){ - selectProperty(Catalog.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CatalogRequest unselectVersion(){ - unselectProperty(Catalog.VERSION_PROPERTY); - return this; - } - public CatalogRequest selectEntryList(){ - return selectEntryListWith(Q.entries().selectSelf()); - } - - public CatalogRequest selectEntryListWith(EntryRequest entryList){ - enhanceRelation(Catalog.ENTRY_LIST_PROPERTY, entryList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectEntryListWith", null, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Catalog.ID_PROPERTY, operator, values); - } - - public CatalogRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CatalogRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CatalogRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CatalogRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CatalogRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public CatalogRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public CatalogRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public CatalogRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Catalog.NAME_PROPERTY, operator, values); - } - - public CatalogRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public CatalogRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public CatalogRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public CatalogRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public CatalogRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public CatalogRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public CatalogRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public CatalogRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public CatalogRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public CatalogRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public CatalogRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public CatalogRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public CatalogRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public CatalogRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public CatalogRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public CatalogRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public CatalogRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CatalogRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CatalogRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CatalogRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Catalog.VERSION_PROPERTY, operator, values); - } - - public CatalogRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CatalogRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CatalogRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CatalogRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CatalogRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CatalogRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CatalogRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CatalogRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CatalogRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CatalogRequest withEntryListMatching(EntryRequest entryRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY)); - } - - public CatalogRequest withoutEntryListMatching(EntryRequest entryRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY))); - } - - public CatalogRequest haveEntries(){ - return withEntryListMatching(Q.entries().unlimited()); - } - - public CatalogRequest haveNoEntries(){ - return withoutEntryListMatching(Q.entries().unlimited()); - } - - public CatalogRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CatalogRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CatalogRequest groupByEntriesWithDetails(EntryRequest subRequest){ - aggregate(Catalog.ENTRY_LIST_PROPERTY, subRequest); - return this; - } - - public CatalogRequest groupById(){ - groupBy(Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest groupByIdAs(String retName){ - groupBy(retName, Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Catalog.ID_PROPERTY, function); - return this; - } - - public CatalogRequest groupByName(){ - groupBy(Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest groupByNameAs(String retName){ - groupBy(retName, Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Catalog.NAME_PROPERTY, function); - return this; - } - - public CatalogRequest groupByVersion(){ - groupBy(Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest groupByVersionAs(String retName){ - groupBy(retName, Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Catalog.VERSION_PROPERTY, function); - return this; - } - - - - public CatalogRequest orderByIdAscending(){ - addOrderByAscending(Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest orderByIdDescending(){ - addOrderByDescending(Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest orderByNameAscending(){ - addOrderByAscending(Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest orderByNameDescending(){ - addOrderByDescending(Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest orderByVersionAscending(){ - addOrderByAscending(Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest orderByVersionDescending(){ - addOrderByDescending(Catalog.VERSION_PROPERTY); - return this; - } - - - public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest){ - return statsFromEntriesAs(name, subRequest, false); - } - - public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Entry.CATALOG_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest statsFromEntries(EntryRequest subRequest){ - return statsFromEntriesAs(REFINEMENTS, subRequest); - } - public CatalogRequest countEntries(){ - addRelationCount("Count", Q.entries().unlimited(), Entry.CATALOG_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntries", null, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest countEntriesAs(String name){ - addRelationCount(name, Q.entries().unlimited(), Entry.CATALOG_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest countEntriesWith(String name, EntryRequest subRequest){ - addRelationCount(name, subRequest, Entry.CATALOG_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesWith", name, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public CatalogRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CatalogRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CatalogRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CatalogRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CatalogRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CatalogRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java deleted file mode 100644 index c4f863c90..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/Entry.java +++ /dev/null @@ -1,274 +0,0 @@ - -package com.example.contextfixservice.entry; - -import com.example.contextfixservice.catalog.Catalog; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Entry extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Entry"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7ae3f6f25be2681c105a55532a8c60a599eada522a7c70284e22e2172db13492"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("catalog", 1), java.util.Map.entry("name", 2), java.util.Map.entry("born_at", 3), java.util.Map.entry("touched_at", 4), java.util.Map.entry("source_ip", 5), java.util.Map.entry("last_ip", 6), java.util.Map.entry("opened_by", 7), java.util.Map.entry("changed_by", 8), java.util.Map.entry("guarded_token", 9), java.util.Map.entry("version", 10)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("catalog", java.util.List.of("catalog", "catalog")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("born_at", java.util.List.of("bornAt", "born_at")), java.util.Map.entry("touched_at", java.util.List.of("touchedAt", "touched_at")), java.util.Map.entry("source_ip", java.util.List.of("sourceIp", "source_ip")), java.util.Map.entry("last_ip", java.util.List.of("lastIp", "last_ip")), java.util.Map.entry("opened_by", java.util.List.of("openedBy", "opened_by")), java.util.Map.entry("changed_by", java.util.List.of("changedBy", "changed_by")), java.util.Map.entry("guarded_token", java.util.List.of("guardedToken", "guarded_token")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Entry.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CATALOG_PROPERTY = "catalog"; - public static final String NAME_PROPERTY = "name"; - public static final String BORN_AT_PROPERTY = "born_at"; - public static final String TOUCHED_AT_PROPERTY = "touched_at"; - public static final String SOURCE_IP_PROPERTY = "source_ip"; - public static final String LAST_IP_PROPERTY = "last_ip"; - public static final String OPENED_BY_PROPERTY = "opened_by"; - public static final String CHANGED_BY_PROPERTY = "changed_by"; - public static final String GUARDED_TOKEN_PROPERTY = "guarded_token"; - private Catalog catalog; - - private String name; - - private LocalDateTime bornAt; - - private LocalDateTime touchedAt; - - private String sourceIp; - - private String lastIp; - - private String openedBy; - - private String changedBy; - - private String guardedToken; - - - public Catalog getCatalog(){ - return this.catalog; - } - - public String getName(){ - return this.name; - } - - public LocalDateTime getBornAt(){ - return this.bornAt; - } - - public LocalDateTime getTouchedAt(){ - return this.touchedAt; - } - - public String getSourceIp(){ - return this.sourceIp; - } - - public String getLastIp(){ - return this.lastIp; - } - - public String getOpenedBy(){ - return this.openedBy; - } - - public String getChangedBy(){ - return this.changedBy; - } - - public String getGuardedToken(){ - return this.guardedToken; - } - - public Entry updateCatalog(Catalog catalog){ - if(isPropertyLoaded(CATALOG_PROPERTY) && Objects.equals(this.catalog, catalog)){ - return this; - } - handleUpdate(CATALOG_PROPERTY, getCatalog(), catalog); - this.catalog = catalog; - return this; - } - - public Entry updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Entry updateBornAt(LocalDateTime bornAt){ - if(isPropertyLoaded(BORN_AT_PROPERTY) && Objects.equals(this.bornAt, bornAt)){ - return this; - } - handleUpdate(BORN_AT_PROPERTY, getBornAt(), bornAt); - this.bornAt = bornAt; - return this; - } - - public Entry updateTouchedAt(LocalDateTime touchedAt){ - if(isPropertyLoaded(TOUCHED_AT_PROPERTY) && Objects.equals(this.touchedAt, touchedAt)){ - return this; - } - handleUpdate(TOUCHED_AT_PROPERTY, getTouchedAt(), touchedAt); - this.touchedAt = touchedAt; - return this; - } - - public Entry updateSourceIp(String sourceIp){ - sourceIp = (sourceIp == null ? null : sourceIp.trim()); - if(isPropertyLoaded(SOURCE_IP_PROPERTY) && Objects.equals(this.sourceIp, sourceIp)){ - return this; - } - handleUpdate(SOURCE_IP_PROPERTY, getSourceIp(), sourceIp); - this.sourceIp = sourceIp; - return this; - } - - public Entry updateLastIp(String lastIp){ - lastIp = (lastIp == null ? null : lastIp.trim()); - if(isPropertyLoaded(LAST_IP_PROPERTY) && Objects.equals(this.lastIp, lastIp)){ - return this; - } - handleUpdate(LAST_IP_PROPERTY, getLastIp(), lastIp); - this.lastIp = lastIp; - return this; - } - - public Entry updateOpenedBy(String openedBy){ - openedBy = (openedBy == null ? null : openedBy.trim()); - if(isPropertyLoaded(OPENED_BY_PROPERTY) && Objects.equals(this.openedBy, openedBy)){ - return this; - } - handleUpdate(OPENED_BY_PROPERTY, getOpenedBy(), openedBy); - this.openedBy = openedBy; - return this; - } - - public Entry updateChangedBy(String changedBy){ - changedBy = (changedBy == null ? null : changedBy.trim()); - if(isPropertyLoaded(CHANGED_BY_PROPERTY) && Objects.equals(this.changedBy, changedBy)){ - return this; - } - handleUpdate(CHANGED_BY_PROPERTY, getChangedBy(), changedBy); - this.changedBy = changedBy; - return this; - } - - public Entry updateGuardedToken(String guardedToken){ - guardedToken = (guardedToken == null ? null : guardedToken.trim()); - if(isPropertyLoaded(GUARDED_TOKEN_PROPERTY) && Objects.equals(this.guardedToken, guardedToken)){ - return this; - } - handleUpdate(GUARDED_TOKEN_PROPERTY, getGuardedToken(), guardedToken); - this.guardedToken = guardedToken; - return this; - } - - - public static Entry refer(Long id){ - Entry refer = new Entry(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Entry comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "catalog": this.catalog = (Catalog) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "born_at": this.bornAt = (LocalDateTime) value; break; - - case "touched_at": this.touchedAt = (LocalDateTime) value; break; - - case "source_ip": this.sourceIp = (value == null ? null : ((String)value).trim()); break; - - case "last_ip": this.lastIp = (value == null ? null : ((String)value).trim()); break; - - case "opened_by": this.openedBy = (value == null ? null : ((String)value).trim()); break; - - case "changed_by": this.changedBy = (value == null ? null : ((String)value).trim()); break; - - case "guarded_token": this.guardedToken = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "catalog": return this.catalog; - case "name": return this.name; - case "born_at": return this.bornAt; - case "touched_at": return this.touchedAt; - case "source_ip": return this.sourceIp; - case "last_ip": return this.lastIp; - case "opened_by": return this.openedBy; - case "changed_by": return this.changedBy; - case "guarded_token": return this.guardedToken; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "catalog": return this.catalog; - case "name": return this.name; - case "bornAt": return this.bornAt; - case "touchedAt": return this.touchedAt; - case "sourceIp": return this.sourceIp; - case "lastIp": return this.lastIp; - case "openedBy": return this.openedBy; - case "changedBy": return this.changedBy; - case "guardedToken": return this.guardedToken; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java deleted file mode 100644 index 46bc7e8f1..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryChecker.java +++ /dev/null @@ -1,170 +0,0 @@ - -package com.example.contextfixservice.entry; - -import com.example.contextfixservice.catalog.Catalog; -import com.example.contextfixservice.catalog.CatalogChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class EntryChecker implements Checker{ - - public String type(){ - return Entry.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Entry entry, ObjectLocation _parentLocation){ - if(needCheck(_context, entry)){ - markAsChecked(_context, entry); - doCheck(_context, entry, _parentLocation); - } - } - - public void doCheck(UserContext _context, Entry entry, ObjectLocation _parentLocation){ - if((entry == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, entry); - if(entry.needPersist()){ - } - if(entry.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "born_at"), () -> { - entry.updateBornAt(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "born_at", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "touched_at"), () -> { - entry.updateTouchedAt(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "touched_at", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "guarded_token"), () -> { - entry.updateGuardedToken(_context.evaluate("uniStr", "prefix")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "guarded_token", - "now".equalsIgnoreCase("uniStr") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("uniStr") ? "graphClock" : "contextFunction:uniStr")); - }); - } - }else if(entry.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "touched_at"), () -> { - entry.updateTouchedAt(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "touched_at", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!entry.isPropertyLoaded("catalog")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "catalog"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("born_at")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "born_at"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("touched_at")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "touched_at"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("source_ip")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "source_ip"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("last_ip")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "last_ip"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("opened_by")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "opened_by"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("changed_by")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "changed_by"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("guarded_token")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "guarded_token"), "Mutation requires a fully loaded entity"); - } - - } - checkCatalog(_context, entry.getProperty(Entry.CATALOG_PROPERTY), newLocation(_parentLocation, "catalog")); - checkName(_context, entry.getProperty(Entry.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkBornAt(_context, entry.getProperty(Entry.BORN_AT_PROPERTY), newLocation(_parentLocation, "born_at")); - checkTouchedAt(_context, entry.getProperty(Entry.TOUCHED_AT_PROPERTY), newLocation(_parentLocation, "touched_at")); - checkSourceIp(_context, entry.getProperty(Entry.SOURCE_IP_PROPERTY), newLocation(_parentLocation, "source_ip")); - checkLastIp(_context, entry.getProperty(Entry.LAST_IP_PROPERTY), newLocation(_parentLocation, "last_ip")); - checkOpenedBy(_context, entry.getProperty(Entry.OPENED_BY_PROPERTY), newLocation(_parentLocation, "opened_by")); - checkChangedBy(_context, entry.getProperty(Entry.CHANGED_BY_PROPERTY), newLocation(_parentLocation, "changed_by")); - checkGuardedToken(_context, entry.getProperty(Entry.GUARDED_TOKEN_PROPERTY), newLocation(_parentLocation, "guarded_token")); - } - - public void checkCatalog(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, catalog); - if((catalog == null)){ - return; - } - new CatalogChecker().checkAndFix(_context, catalog, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkBornAt(UserContext _context, LocalDateTime bornAt, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, bornAt); - if((bornAt == null)){ - return; - } - } - public void checkTouchedAt(UserContext _context, LocalDateTime touchedAt, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, touchedAt); - if((touchedAt == null)){ - return; - } - } - public void checkSourceIp(UserContext _context, String sourceIp, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, sourceIp); - if((sourceIp == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, sourceIp); - - } - public void checkLastIp(UserContext _context, String lastIp, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, lastIp); - if((lastIp == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, lastIp); - - } - public void checkOpenedBy(UserContext _context, String openedBy, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, openedBy); - if((openedBy == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, openedBy); - - } - public void checkChangedBy(UserContext _context, String changedBy, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, changedBy); - if((changedBy == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, changedBy); - - } - public void checkGuardedToken(UserContext _context, String guardedToken, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, guardedToken); - if((guardedToken == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, guardedToken); - - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java deleted file mode 100644 index b61497cdf..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryExpression.java +++ /dev/null @@ -1,103 +0,0 @@ - -package com.example.contextfixservice.entry; - -import com.example.contextfixservice.catalog.Catalog; -import com.example.contextfixservice.catalog.CatalogExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class EntryExpression extends ExpressionAdaptor implements BaseEntityExpression { - public EntryExpression(Expression expression){ - super(expression); - } - - public EntryExpression(Expression expression, Function function){ - super(expression, function); - } - - public EntryExpression updateId(Long id){ - return new EntryExpression(this, $it -> {((Entry)$it).__internalSet("id", id); return this;}); - } - - public EntryExpression save(UserContext userContext){ - return new EntryExpression(this, $it -> ((Entry)$it).auditAs("Saved by Expression").save(userContext)); - } - - public EntryExpression save(String intent, UserContext userContext){ - return new EntryExpression(this, $it -> ((Entry)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CatalogExpression getCatalog(){ - return new CatalogExpression(loaded("catalog", "getCatalog", Entry::getCatalog)); - } - - public EntryExpression updateCatalog(Catalog catalog){ - return new EntryExpression(this, $it -> ((Entry)$it).updateCatalog(catalog)); - } - - public Expression getName(){ - return loaded("name", "getName", Entry::getName); - } - public EntryExpression updateName(String name){ - return new EntryExpression(this, $it -> ((Entry)$it).updateName(name)); - } - - public Expression getBornAt(){ - return loaded("born_at", "getBornAt", Entry::getBornAt); - } - public EntryExpression updateBornAt(LocalDateTime bornAt){ - return new EntryExpression(this, $it -> ((Entry)$it).updateBornAt(bornAt)); - } - - public Expression getTouchedAt(){ - return loaded("touched_at", "getTouchedAt", Entry::getTouchedAt); - } - public EntryExpression updateTouchedAt(LocalDateTime touchedAt){ - return new EntryExpression(this, $it -> ((Entry)$it).updateTouchedAt(touchedAt)); - } - - public Expression getSourceIp(){ - return loaded("source_ip", "getSourceIp", Entry::getSourceIp); - } - public EntryExpression updateSourceIp(String sourceIp){ - return new EntryExpression(this, $it -> ((Entry)$it).updateSourceIp(sourceIp)); - } - - public Expression getLastIp(){ - return loaded("last_ip", "getLastIp", Entry::getLastIp); - } - public EntryExpression updateLastIp(String lastIp){ - return new EntryExpression(this, $it -> ((Entry)$it).updateLastIp(lastIp)); - } - - public Expression getOpenedBy(){ - return loaded("opened_by", "getOpenedBy", Entry::getOpenedBy); - } - public EntryExpression updateOpenedBy(String openedBy){ - return new EntryExpression(this, $it -> ((Entry)$it).updateOpenedBy(openedBy)); - } - - public Expression getChangedBy(){ - return loaded("changed_by", "getChangedBy", Entry::getChangedBy); - } - public EntryExpression updateChangedBy(String changedBy){ - return new EntryExpression(this, $it -> ((Entry)$it).updateChangedBy(changedBy)); - } - - public Expression getGuardedToken(){ - return loaded("guarded_token", "getGuardedToken", Entry::getGuardedToken); - } - public EntryExpression updateGuardedToken(String guardedToken){ - return new EntryExpression(this, $it -> ((Entry)$it).updateGuardedToken(guardedToken)); - } - -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java deleted file mode 100644 index 3c0ef9888..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.contextfixservice.entry; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class EntryListExpression extends SmartListExpression { - public EntryListExpression(Expression> expression){ - super(expression); - } - - public EntryListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public EntryExpression first() { - return new EntryExpression(super.first()); - } - - public EntryExpression get(int index) { - return new EntryExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java deleted file mode 100644 index 37c26d212..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/entry/EntryRequest.java +++ /dev/null @@ -1,1590 +0,0 @@ - -package com.example.contextfixservice.entry; - -import com.example.contextfixservice.Q; -import com.example.contextfixservice.catalog.Catalog; -import com.example.contextfixservice.catalog.CatalogRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class EntryRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public EntryRequest(Class returnType){ - this(returnType, () -> (T) new Entry()); - } - - protected EntryRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public EntryRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public EntryRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public EntryRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public EntryRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public EntryRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public EntryRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public EntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public EntryRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public EntryRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public EntryRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public EntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (EntryRequest)super.appendSearchCriteria(searchCriteria); - } - - public EntryRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public EntryRequest matchingAnyOf(EntryRequest entry){ - super.internalMatchAny(entry); - return this; - } - - public EntryRequest matchingIdsOf(EntryRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Entry.ID_PROPERTY, request, Entry.ID_PROPERTY)); - } - - public EntryRequest enhanceChildrenIfNeeded(){ - return this; - } - - public EntryRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public EntryRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public EntryRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCatalogIdOnly().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); - } - - public EntryRequest selectSelfFields(){ - return selectSelf(); - } - - public EntryRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Entry.ID_PROPERTY); - selectProperty(Entry.CATALOG_PROPERTY); - selectProperty(Entry.NAME_PROPERTY); - selectProperty(Entry.BORN_AT_PROPERTY); - selectProperty(Entry.TOUCHED_AT_PROPERTY); - selectProperty(Entry.SOURCE_IP_PROPERTY); - selectProperty(Entry.LAST_IP_PROPERTY); - selectProperty(Entry.OPENED_BY_PROPERTY); - selectProperty(Entry.CHANGED_BY_PROPERTY); - selectProperty(Entry.GUARDED_TOKEN_PROPERTY); - selectProperty(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest selectAll(){ - super.selectAll(); - return selectId().selectCatalog().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); - } - - public EntryRequest selectChildren(){ - super.selectAny(); - return selectId().selectCatalog().selectName().selectBornAt().selectTouchedAt().selectSourceIp().selectLastIp().selectOpenedBy().selectChangedBy().selectGuardedToken().selectVersion(); - } - - - public EntryRequest selectId(){ - selectProperty(Entry.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectId(){ - unselectProperty(Entry.ID_PROPERTY); - return this; - } - public EntryRequest selectCatalogIdOnly(){ - selectProperty(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest selectCatalog(){ - return selectCatalogWith(Q.catalogs().unlimited().selectSelf()); - } - - public EntryRequest selectCatalogWith(CatalogRequest catalog){ - selectProperty(Entry.CATALOG_PROPERTY); - enhanceRelation(Entry.CATALOG_PROPERTY, catalog, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCatalogWith", null, Entry.CATALOG_PROPERTY)); - return this; - } - - public EntryRequest unselectCatalog(){ - unselectProperty(Entry.CATALOG_PROPERTY); - return this; - } - public EntryRequest selectName(){ - selectProperty(Entry.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectName(){ - unselectProperty(Entry.NAME_PROPERTY); - return this; - } - public EntryRequest selectBornAt(){ - selectProperty(Entry.BORN_AT_PROPERTY); - return this; - } - - /** - * fill the bornAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS bornAt) to fetch bornAt property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectBornAt(){ - unselectProperty(Entry.BORN_AT_PROPERTY); - return this; - } - public EntryRequest selectTouchedAt(){ - selectProperty(Entry.TOUCHED_AT_PROPERTY); - return this; - } - - /** - * fill the touchedAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS touchedAt) to fetch touchedAt property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectTouchedAt(){ - unselectProperty(Entry.TOUCHED_AT_PROPERTY); - return this; - } - public EntryRequest selectSourceIp(){ - selectProperty(Entry.SOURCE_IP_PROPERTY); - return this; - } - - /** - * fill the sourceIp with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sourceIp) to fetch sourceIp property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectSourceIp(){ - unselectProperty(Entry.SOURCE_IP_PROPERTY); - return this; - } - public EntryRequest selectLastIp(){ - selectProperty(Entry.LAST_IP_PROPERTY); - return this; - } - - /** - * fill the lastIp with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS lastIp) to fetch lastIp property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectLastIp(){ - unselectProperty(Entry.LAST_IP_PROPERTY); - return this; - } - public EntryRequest selectOpenedBy(){ - selectProperty(Entry.OPENED_BY_PROPERTY); - return this; - } - - /** - * fill the openedBy with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS openedBy) to fetch openedBy property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectOpenedBy(){ - unselectProperty(Entry.OPENED_BY_PROPERTY); - return this; - } - public EntryRequest selectChangedBy(){ - selectProperty(Entry.CHANGED_BY_PROPERTY); - return this; - } - - /** - * fill the changedBy with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS changedBy) to fetch changedBy property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectChangedBy(){ - unselectProperty(Entry.CHANGED_BY_PROPERTY); - return this; - } - public EntryRequest selectGuardedToken(){ - selectProperty(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - - /** - * fill the guardedToken with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS guardedToken) to fetch guardedToken property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectGuardedToken(){ - unselectProperty(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - public EntryRequest selectVersion(){ - selectProperty(Entry.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectVersion(){ - unselectProperty(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.ID_PROPERTY, operator, values); - } - - public EntryRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public EntryRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public EntryRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public EntryRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public EntryRequest filterByCatalog(Catalog... catalog){ - if (catalog == null || catalog.length == 0) { - throw new IllegalArgumentException("filterByCatalog parameter catalog cannot be empty"); - } - return appendSearchCriteria(createCatalogCriteria(Operator.EQUAL, (Object[])catalog)); - } - - public EntryRequest withCatalog(Operator operator, Object... values){ - return appendSearchCriteria(createCatalogCriteria(operator, values)); - } - - public EntryRequest withCatalogIsUnknown(){ - return withCatalog(Operator.IS_NULL); - } - - public EntryRequest withCatalogIsKnown(){ - return withCatalog(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCatalogCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.CATALOG_PROPERTY, operator, values); - } - - public EntryRequest filterByCatalog(Long catalog){ - if(catalog == null){ - return this; - } - return withCatalog(Operator.EQUAL, catalog); - } - public EntryRequest withCatalogMatching(CatalogRequest catalog){ - return appendSearchCriteria(new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY)); - } - - public EntryRequest withoutCatalogMatching(CatalogRequest catalog){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY))); - } - - public EntryRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public EntryRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public EntryRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public EntryRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.NAME_PROPERTY, operator, values); - } - - public EntryRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public EntryRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public EntryRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public EntryRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public EntryRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public EntryRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public EntryRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public EntryRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public EntryRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public EntryRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public EntryRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public EntryRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public EntryRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public EntryRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public EntryRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public EntryRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public EntryRequest filterByBornAt(LocalDateTime... bornAt){ - if (bornAt == null || bornAt.length == 0) { - throw new IllegalArgumentException("filterByBornAt parameter bornAt cannot be empty"); - } - return appendSearchCriteria(createBornAtCriteria(Operator.EQUAL, (Object[])bornAt)); - } - - public EntryRequest withBornAt(Operator operator, Object... values){ - return appendSearchCriteria(createBornAtCriteria(operator, values)); - } - - public EntryRequest withBornAtIsUnknown(){ - return withBornAt(Operator.IS_NULL); - } - - public EntryRequest withBornAtIsKnown(){ - return withBornAt(Operator.IS_NOT_NULL); - } - - public SearchCriteria createBornAtCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.BORN_AT_PROPERTY, operator, values); - } - - public EntryRequest withBornAtIs(LocalDateTime bornAt){ - return withBornAt(Operator.EQUAL, bornAt); - } - - public EntryRequest withBornAtIsNot(LocalDateTime bornAt){ - return withBornAt(Operator.NOT_EQUAL, bornAt); - } - - public EntryRequest withBornAtIn(LocalDateTime... bornAt){ - return withBornAt(Operator.IN, (Object[])bornAt); - } - - public EntryRequest withBornAtNotIn(LocalDateTime... bornAt){ - return withBornAt(Operator.NOT_IN, (Object[])bornAt); - } - public EntryRequest withBornAtGreaterThan(LocalDateTime bornAt){ - return withBornAt(Operator.GREATER_THAN, bornAt); - } - - public EntryRequest withBornAtGreaterThanOrEqualTo(LocalDateTime bornAt){ - return withBornAt(Operator.GREATER_THAN_OR_EQUAL, bornAt); - } - - public EntryRequest withBornAtLessThan(LocalDateTime bornAt){ - return withBornAt(Operator.LESS_THAN, bornAt); - } - - public EntryRequest withBornAtLessThanOrEqualTo(LocalDateTime bornAt){ - return withBornAt(Operator.LESS_THAN_OR_EQUAL, bornAt); - } - - public EntryRequest withBornAtBetween(LocalDateTime startOfBornAt, LocalDateTime endOfBornAt){ - return withBornAt(Operator.BETWEEN, startOfBornAt, endOfBornAt); - } - public EntryRequest withBornAtBefore(LocalDateTime bornAt){ - return withBornAt(Operator.LESS_THAN, bornAt); - } - - public EntryRequest withBornAtBefore(Date bornAt){ - return withBornAt(Operator.LESS_THAN, bornAt); - } - - public EntryRequest withBornAtAfter(LocalDateTime bornAt){ - return withBornAt(Operator.GREATER_THAN, bornAt); - } - - public EntryRequest withBornAtAfter(Date bornAt){ - return withBornAt(Operator.GREATER_THAN, bornAt); - } - - public EntryRequest withBornAtBetween(Date startOfBornAt, Date endOfBornAt){ - return withBornAt(Operator.BETWEEN, startOfBornAt, endOfBornAt); - } - - - - - public EntryRequest filterByTouchedAt(LocalDateTime... touchedAt){ - if (touchedAt == null || touchedAt.length == 0) { - throw new IllegalArgumentException("filterByTouchedAt parameter touchedAt cannot be empty"); - } - return appendSearchCriteria(createTouchedAtCriteria(Operator.EQUAL, (Object[])touchedAt)); - } - - public EntryRequest withTouchedAt(Operator operator, Object... values){ - return appendSearchCriteria(createTouchedAtCriteria(operator, values)); - } - - public EntryRequest withTouchedAtIsUnknown(){ - return withTouchedAt(Operator.IS_NULL); - } - - public EntryRequest withTouchedAtIsKnown(){ - return withTouchedAt(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTouchedAtCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.TOUCHED_AT_PROPERTY, operator, values); - } - - public EntryRequest withTouchedAtIs(LocalDateTime touchedAt){ - return withTouchedAt(Operator.EQUAL, touchedAt); - } - - public EntryRequest withTouchedAtIsNot(LocalDateTime touchedAt){ - return withTouchedAt(Operator.NOT_EQUAL, touchedAt); - } - - public EntryRequest withTouchedAtIn(LocalDateTime... touchedAt){ - return withTouchedAt(Operator.IN, (Object[])touchedAt); - } - - public EntryRequest withTouchedAtNotIn(LocalDateTime... touchedAt){ - return withTouchedAt(Operator.NOT_IN, (Object[])touchedAt); - } - public EntryRequest withTouchedAtGreaterThan(LocalDateTime touchedAt){ - return withTouchedAt(Operator.GREATER_THAN, touchedAt); - } - - public EntryRequest withTouchedAtGreaterThanOrEqualTo(LocalDateTime touchedAt){ - return withTouchedAt(Operator.GREATER_THAN_OR_EQUAL, touchedAt); - } - - public EntryRequest withTouchedAtLessThan(LocalDateTime touchedAt){ - return withTouchedAt(Operator.LESS_THAN, touchedAt); - } - - public EntryRequest withTouchedAtLessThanOrEqualTo(LocalDateTime touchedAt){ - return withTouchedAt(Operator.LESS_THAN_OR_EQUAL, touchedAt); - } - - public EntryRequest withTouchedAtBetween(LocalDateTime startOfTouchedAt, LocalDateTime endOfTouchedAt){ - return withTouchedAt(Operator.BETWEEN, startOfTouchedAt, endOfTouchedAt); - } - public EntryRequest withTouchedAtBefore(LocalDateTime touchedAt){ - return withTouchedAt(Operator.LESS_THAN, touchedAt); - } - - public EntryRequest withTouchedAtBefore(Date touchedAt){ - return withTouchedAt(Operator.LESS_THAN, touchedAt); - } - - public EntryRequest withTouchedAtAfter(LocalDateTime touchedAt){ - return withTouchedAt(Operator.GREATER_THAN, touchedAt); - } - - public EntryRequest withTouchedAtAfter(Date touchedAt){ - return withTouchedAt(Operator.GREATER_THAN, touchedAt); - } - - public EntryRequest withTouchedAtBetween(Date startOfTouchedAt, Date endOfTouchedAt){ - return withTouchedAt(Operator.BETWEEN, startOfTouchedAt, endOfTouchedAt); - } - - - - - public EntryRequest filterBySourceIp(String... sourceIp){ - if (sourceIp == null || sourceIp.length == 0) { - throw new IllegalArgumentException("filterBySourceIp parameter sourceIp cannot be empty"); - } - return appendSearchCriteria(createSourceIpCriteria(Operator.EQUAL, (Object[])sourceIp)); - } - - public EntryRequest withSourceIp(Operator operator, Object... values){ - return appendSearchCriteria(createSourceIpCriteria(operator, values)); - } - - public EntryRequest withSourceIpIsUnknown(){ - return withSourceIp(Operator.IS_NULL); - } - - public EntryRequest withSourceIpIsKnown(){ - return withSourceIp(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSourceIpCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.SOURCE_IP_PROPERTY, operator, values); - } - - public EntryRequest withSourceIpIsNot(String sourceIp){ - return withSourceIp(Operator.NOT_EQUAL, sourceIp); - } - - public EntryRequest withSourceIpIn(String... sourceIp){ - return withSourceIp(Operator.IN, (Object[])sourceIp); - } - - public EntryRequest withSourceIpNotIn(String... sourceIp){ - return withSourceIp(Operator.NOT_IN, (Object[])sourceIp); - } - public EntryRequest withSourceIpGreaterThan(String sourceIp){ - return withSourceIp(Operator.GREATER_THAN, sourceIp); - } - - public EntryRequest withSourceIpGreaterThanOrEqualTo(String sourceIp){ - return withSourceIp(Operator.GREATER_THAN_OR_EQUAL, sourceIp); - } - - public EntryRequest withSourceIpLessThan(String sourceIp){ - return withSourceIp(Operator.LESS_THAN, sourceIp); - } - - public EntryRequest withSourceIpLessThanOrEqualTo(String sourceIp){ - return withSourceIp(Operator.LESS_THAN_OR_EQUAL, sourceIp); - } - - public EntryRequest withSourceIpBetween(String startOfSourceIp, String endOfSourceIp){ - return withSourceIp(Operator.BETWEEN, startOfSourceIp, endOfSourceIp); - } - public EntryRequest withSourceIpStartingWith(String sourceIp){ - return withSourceIp(Operator.BEGIN_WITH, sourceIp); - } - public EntryRequest withSourceIpContaining(String sourceIp){ - return withSourceIp(Operator.CONTAIN, sourceIp); - } - - public EntryRequest withSourceIpNotContaining(String sourceIp){ - return withSourceIp(Operator.NOT_CONTAIN, sourceIp); - } - - public EntryRequest withSourceIpNotStartingWith(String sourceIp){ - return withSourceIp(Operator.NOT_BEGIN_WITH, sourceIp); - } - - public EntryRequest withSourceIpEndingWith(String sourceIp){ - return withSourceIp(Operator.END_WITH, sourceIp); - } - - public EntryRequest withSourceIpNotEndingWith(String sourceIp){ - return withSourceIp(Operator.NOT_END_WITH, sourceIp); - } - - public EntryRequest withSourceIpIs(String sourceIp){ - return withSourceIp(Operator.EQUAL, sourceIp); - } - - public EntryRequest withSourceIpSoundingLike(String sourceIp){ - return withSourceIp(Operator.SOUNDS_LIKE, sourceIp); - } - - - - public EntryRequest filterByLastIp(String... lastIp){ - if (lastIp == null || lastIp.length == 0) { - throw new IllegalArgumentException("filterByLastIp parameter lastIp cannot be empty"); - } - return appendSearchCriteria(createLastIpCriteria(Operator.EQUAL, (Object[])lastIp)); - } - - public EntryRequest withLastIp(Operator operator, Object... values){ - return appendSearchCriteria(createLastIpCriteria(operator, values)); - } - - public EntryRequest withLastIpIsUnknown(){ - return withLastIp(Operator.IS_NULL); - } - - public EntryRequest withLastIpIsKnown(){ - return withLastIp(Operator.IS_NOT_NULL); - } - - public SearchCriteria createLastIpCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.LAST_IP_PROPERTY, operator, values); - } - - public EntryRequest withLastIpIsNot(String lastIp){ - return withLastIp(Operator.NOT_EQUAL, lastIp); - } - - public EntryRequest withLastIpIn(String... lastIp){ - return withLastIp(Operator.IN, (Object[])lastIp); - } - - public EntryRequest withLastIpNotIn(String... lastIp){ - return withLastIp(Operator.NOT_IN, (Object[])lastIp); - } - public EntryRequest withLastIpGreaterThan(String lastIp){ - return withLastIp(Operator.GREATER_THAN, lastIp); - } - - public EntryRequest withLastIpGreaterThanOrEqualTo(String lastIp){ - return withLastIp(Operator.GREATER_THAN_OR_EQUAL, lastIp); - } - - public EntryRequest withLastIpLessThan(String lastIp){ - return withLastIp(Operator.LESS_THAN, lastIp); - } - - public EntryRequest withLastIpLessThanOrEqualTo(String lastIp){ - return withLastIp(Operator.LESS_THAN_OR_EQUAL, lastIp); - } - - public EntryRequest withLastIpBetween(String startOfLastIp, String endOfLastIp){ - return withLastIp(Operator.BETWEEN, startOfLastIp, endOfLastIp); - } - public EntryRequest withLastIpStartingWith(String lastIp){ - return withLastIp(Operator.BEGIN_WITH, lastIp); - } - public EntryRequest withLastIpContaining(String lastIp){ - return withLastIp(Operator.CONTAIN, lastIp); - } - - public EntryRequest withLastIpNotContaining(String lastIp){ - return withLastIp(Operator.NOT_CONTAIN, lastIp); - } - - public EntryRequest withLastIpNotStartingWith(String lastIp){ - return withLastIp(Operator.NOT_BEGIN_WITH, lastIp); - } - - public EntryRequest withLastIpEndingWith(String lastIp){ - return withLastIp(Operator.END_WITH, lastIp); - } - - public EntryRequest withLastIpNotEndingWith(String lastIp){ - return withLastIp(Operator.NOT_END_WITH, lastIp); - } - - public EntryRequest withLastIpIs(String lastIp){ - return withLastIp(Operator.EQUAL, lastIp); - } - - public EntryRequest withLastIpSoundingLike(String lastIp){ - return withLastIp(Operator.SOUNDS_LIKE, lastIp); - } - - - - public EntryRequest filterByOpenedBy(String... openedBy){ - if (openedBy == null || openedBy.length == 0) { - throw new IllegalArgumentException("filterByOpenedBy parameter openedBy cannot be empty"); - } - return appendSearchCriteria(createOpenedByCriteria(Operator.EQUAL, (Object[])openedBy)); - } - - public EntryRequest withOpenedBy(Operator operator, Object... values){ - return appendSearchCriteria(createOpenedByCriteria(operator, values)); - } - - public EntryRequest withOpenedByIsUnknown(){ - return withOpenedBy(Operator.IS_NULL); - } - - public EntryRequest withOpenedByIsKnown(){ - return withOpenedBy(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOpenedByCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.OPENED_BY_PROPERTY, operator, values); - } - - public EntryRequest withOpenedByIsNot(String openedBy){ - return withOpenedBy(Operator.NOT_EQUAL, openedBy); - } - - public EntryRequest withOpenedByIn(String... openedBy){ - return withOpenedBy(Operator.IN, (Object[])openedBy); - } - - public EntryRequest withOpenedByNotIn(String... openedBy){ - return withOpenedBy(Operator.NOT_IN, (Object[])openedBy); - } - public EntryRequest withOpenedByGreaterThan(String openedBy){ - return withOpenedBy(Operator.GREATER_THAN, openedBy); - } - - public EntryRequest withOpenedByGreaterThanOrEqualTo(String openedBy){ - return withOpenedBy(Operator.GREATER_THAN_OR_EQUAL, openedBy); - } - - public EntryRequest withOpenedByLessThan(String openedBy){ - return withOpenedBy(Operator.LESS_THAN, openedBy); - } - - public EntryRequest withOpenedByLessThanOrEqualTo(String openedBy){ - return withOpenedBy(Operator.LESS_THAN_OR_EQUAL, openedBy); - } - - public EntryRequest withOpenedByBetween(String startOfOpenedBy, String endOfOpenedBy){ - return withOpenedBy(Operator.BETWEEN, startOfOpenedBy, endOfOpenedBy); - } - public EntryRequest withOpenedByStartingWith(String openedBy){ - return withOpenedBy(Operator.BEGIN_WITH, openedBy); - } - public EntryRequest withOpenedByContaining(String openedBy){ - return withOpenedBy(Operator.CONTAIN, openedBy); - } - - public EntryRequest withOpenedByNotContaining(String openedBy){ - return withOpenedBy(Operator.NOT_CONTAIN, openedBy); - } - - public EntryRequest withOpenedByNotStartingWith(String openedBy){ - return withOpenedBy(Operator.NOT_BEGIN_WITH, openedBy); - } - - public EntryRequest withOpenedByEndingWith(String openedBy){ - return withOpenedBy(Operator.END_WITH, openedBy); - } - - public EntryRequest withOpenedByNotEndingWith(String openedBy){ - return withOpenedBy(Operator.NOT_END_WITH, openedBy); - } - - public EntryRequest withOpenedByIs(String openedBy){ - return withOpenedBy(Operator.EQUAL, openedBy); - } - - public EntryRequest withOpenedBySoundingLike(String openedBy){ - return withOpenedBy(Operator.SOUNDS_LIKE, openedBy); - } - - - - public EntryRequest filterByChangedBy(String... changedBy){ - if (changedBy == null || changedBy.length == 0) { - throw new IllegalArgumentException("filterByChangedBy parameter changedBy cannot be empty"); - } - return appendSearchCriteria(createChangedByCriteria(Operator.EQUAL, (Object[])changedBy)); - } - - public EntryRequest withChangedBy(Operator operator, Object... values){ - return appendSearchCriteria(createChangedByCriteria(operator, values)); - } - - public EntryRequest withChangedByIsUnknown(){ - return withChangedBy(Operator.IS_NULL); - } - - public EntryRequest withChangedByIsKnown(){ - return withChangedBy(Operator.IS_NOT_NULL); - } - - public SearchCriteria createChangedByCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.CHANGED_BY_PROPERTY, operator, values); - } - - public EntryRequest withChangedByIsNot(String changedBy){ - return withChangedBy(Operator.NOT_EQUAL, changedBy); - } - - public EntryRequest withChangedByIn(String... changedBy){ - return withChangedBy(Operator.IN, (Object[])changedBy); - } - - public EntryRequest withChangedByNotIn(String... changedBy){ - return withChangedBy(Operator.NOT_IN, (Object[])changedBy); - } - public EntryRequest withChangedByGreaterThan(String changedBy){ - return withChangedBy(Operator.GREATER_THAN, changedBy); - } - - public EntryRequest withChangedByGreaterThanOrEqualTo(String changedBy){ - return withChangedBy(Operator.GREATER_THAN_OR_EQUAL, changedBy); - } - - public EntryRequest withChangedByLessThan(String changedBy){ - return withChangedBy(Operator.LESS_THAN, changedBy); - } - - public EntryRequest withChangedByLessThanOrEqualTo(String changedBy){ - return withChangedBy(Operator.LESS_THAN_OR_EQUAL, changedBy); - } - - public EntryRequest withChangedByBetween(String startOfChangedBy, String endOfChangedBy){ - return withChangedBy(Operator.BETWEEN, startOfChangedBy, endOfChangedBy); - } - public EntryRequest withChangedByStartingWith(String changedBy){ - return withChangedBy(Operator.BEGIN_WITH, changedBy); - } - public EntryRequest withChangedByContaining(String changedBy){ - return withChangedBy(Operator.CONTAIN, changedBy); - } - - public EntryRequest withChangedByNotContaining(String changedBy){ - return withChangedBy(Operator.NOT_CONTAIN, changedBy); - } - - public EntryRequest withChangedByNotStartingWith(String changedBy){ - return withChangedBy(Operator.NOT_BEGIN_WITH, changedBy); - } - - public EntryRequest withChangedByEndingWith(String changedBy){ - return withChangedBy(Operator.END_WITH, changedBy); - } - - public EntryRequest withChangedByNotEndingWith(String changedBy){ - return withChangedBy(Operator.NOT_END_WITH, changedBy); - } - - public EntryRequest withChangedByIs(String changedBy){ - return withChangedBy(Operator.EQUAL, changedBy); - } - - public EntryRequest withChangedBySoundingLike(String changedBy){ - return withChangedBy(Operator.SOUNDS_LIKE, changedBy); - } - - - - public EntryRequest filterByGuardedToken(String... guardedToken){ - if (guardedToken == null || guardedToken.length == 0) { - throw new IllegalArgumentException("filterByGuardedToken parameter guardedToken cannot be empty"); - } - return appendSearchCriteria(createGuardedTokenCriteria(Operator.EQUAL, (Object[])guardedToken)); - } - - public EntryRequest withGuardedToken(Operator operator, Object... values){ - return appendSearchCriteria(createGuardedTokenCriteria(operator, values)); - } - - public EntryRequest withGuardedTokenIsUnknown(){ - return withGuardedToken(Operator.IS_NULL); - } - - public EntryRequest withGuardedTokenIsKnown(){ - return withGuardedToken(Operator.IS_NOT_NULL); - } - - public SearchCriteria createGuardedTokenCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.GUARDED_TOKEN_PROPERTY, operator, values); - } - - public EntryRequest withGuardedTokenIsNot(String guardedToken){ - return withGuardedToken(Operator.NOT_EQUAL, guardedToken); - } - - public EntryRequest withGuardedTokenIn(String... guardedToken){ - return withGuardedToken(Operator.IN, (Object[])guardedToken); - } - - public EntryRequest withGuardedTokenNotIn(String... guardedToken){ - return withGuardedToken(Operator.NOT_IN, (Object[])guardedToken); - } - public EntryRequest withGuardedTokenGreaterThan(String guardedToken){ - return withGuardedToken(Operator.GREATER_THAN, guardedToken); - } - - public EntryRequest withGuardedTokenGreaterThanOrEqualTo(String guardedToken){ - return withGuardedToken(Operator.GREATER_THAN_OR_EQUAL, guardedToken); - } - - public EntryRequest withGuardedTokenLessThan(String guardedToken){ - return withGuardedToken(Operator.LESS_THAN, guardedToken); - } - - public EntryRequest withGuardedTokenLessThanOrEqualTo(String guardedToken){ - return withGuardedToken(Operator.LESS_THAN_OR_EQUAL, guardedToken); - } - - public EntryRequest withGuardedTokenBetween(String startOfGuardedToken, String endOfGuardedToken){ - return withGuardedToken(Operator.BETWEEN, startOfGuardedToken, endOfGuardedToken); - } - public EntryRequest withGuardedTokenStartingWith(String guardedToken){ - return withGuardedToken(Operator.BEGIN_WITH, guardedToken); - } - public EntryRequest withGuardedTokenContaining(String guardedToken){ - return withGuardedToken(Operator.CONTAIN, guardedToken); - } - - public EntryRequest withGuardedTokenNotContaining(String guardedToken){ - return withGuardedToken(Operator.NOT_CONTAIN, guardedToken); - } - - public EntryRequest withGuardedTokenNotStartingWith(String guardedToken){ - return withGuardedToken(Operator.NOT_BEGIN_WITH, guardedToken); - } - - public EntryRequest withGuardedTokenEndingWith(String guardedToken){ - return withGuardedToken(Operator.END_WITH, guardedToken); - } - - public EntryRequest withGuardedTokenNotEndingWith(String guardedToken){ - return withGuardedToken(Operator.NOT_END_WITH, guardedToken); - } - - public EntryRequest withGuardedTokenIs(String guardedToken){ - return withGuardedToken(Operator.EQUAL, guardedToken); - } - - public EntryRequest withGuardedTokenSoundingLike(String guardedToken){ - return withGuardedToken(Operator.SOUNDS_LIKE, guardedToken); - } - - - - public EntryRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public EntryRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public EntryRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public EntryRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.VERSION_PROPERTY, operator, values); - } - - public EntryRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public EntryRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public EntryRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public EntryRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public EntryRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public EntryRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public EntryRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public EntryRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public EntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public EntryRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public EntryRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public EntryRequest groupByCatalogWithDetails(){ - return groupByCatalogWithDetails(Q.catalogs().unlimited()); - } - - public EntryRequest groupByCatalogWithDetails(CatalogRequest subRequest){ - aggregate(Entry.CATALOG_PROPERTY, subRequest); - return this; - } - - - - - - - - - - - - public EntryRequest groupById(){ - groupBy(Entry.ID_PROPERTY); - return this; - } - - public EntryRequest groupByIdAs(String retName){ - groupBy(retName, Entry.ID_PROPERTY); - return this; - } - - public EntryRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.ID_PROPERTY, function); - return this; - } - public EntryRequest groupByCatalogWith(CatalogRequest subRequest){ - groupBy(Entry.CATALOG_PROPERTY, subRequest); - return this; - } - public EntryRequest groupByCatalog(){ - groupBy(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest groupByCatalogAs(String retName){ - groupBy(retName, Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest groupByCatalogWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.CATALOG_PROPERTY, function); - return this; - } - - public EntryRequest groupByName(){ - groupBy(Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest groupByNameAs(String retName){ - groupBy(retName, Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.NAME_PROPERTY, function); - return this; - } - - public EntryRequest groupByBornAt(){ - groupBy(Entry.BORN_AT_PROPERTY); - return this; - } - - public EntryRequest groupByBornAtAs(String retName){ - groupBy(retName, Entry.BORN_AT_PROPERTY); - return this; - } - - public EntryRequest groupByBornAtWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.BORN_AT_PROPERTY, function); - return this; - } - - public EntryRequest groupByTouchedAt(){ - groupBy(Entry.TOUCHED_AT_PROPERTY); - return this; - } - - public EntryRequest groupByTouchedAtAs(String retName){ - groupBy(retName, Entry.TOUCHED_AT_PROPERTY); - return this; - } - - public EntryRequest groupByTouchedAtWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.TOUCHED_AT_PROPERTY, function); - return this; - } - - public EntryRequest groupBySourceIp(){ - groupBy(Entry.SOURCE_IP_PROPERTY); - return this; - } - - public EntryRequest groupBySourceIpAs(String retName){ - groupBy(retName, Entry.SOURCE_IP_PROPERTY); - return this; - } - - public EntryRequest groupBySourceIpWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.SOURCE_IP_PROPERTY, function); - return this; - } - - public EntryRequest groupByLastIp(){ - groupBy(Entry.LAST_IP_PROPERTY); - return this; - } - - public EntryRequest groupByLastIpAs(String retName){ - groupBy(retName, Entry.LAST_IP_PROPERTY); - return this; - } - - public EntryRequest groupByLastIpWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.LAST_IP_PROPERTY, function); - return this; - } - - public EntryRequest groupByOpenedBy(){ - groupBy(Entry.OPENED_BY_PROPERTY); - return this; - } - - public EntryRequest groupByOpenedByAs(String retName){ - groupBy(retName, Entry.OPENED_BY_PROPERTY); - return this; - } - - public EntryRequest groupByOpenedByWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.OPENED_BY_PROPERTY, function); - return this; - } - - public EntryRequest groupByChangedBy(){ - groupBy(Entry.CHANGED_BY_PROPERTY); - return this; - } - - public EntryRequest groupByChangedByAs(String retName){ - groupBy(retName, Entry.CHANGED_BY_PROPERTY); - return this; - } - - public EntryRequest groupByChangedByWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.CHANGED_BY_PROPERTY, function); - return this; - } - - public EntryRequest groupByGuardedToken(){ - groupBy(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - - public EntryRequest groupByGuardedTokenAs(String retName){ - groupBy(retName, Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - - public EntryRequest groupByGuardedTokenWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.GUARDED_TOKEN_PROPERTY, function); - return this; - } - - public EntryRequest groupByVersion(){ - groupBy(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest groupByVersionAs(String retName){ - groupBy(retName, Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.VERSION_PROPERTY, function); - return this; - } - - - - public EntryRequest orderByIdAscending(){ - addOrderByAscending(Entry.ID_PROPERTY); - return this; - } - - public EntryRequest orderByIdDescending(){ - addOrderByDescending(Entry.ID_PROPERTY); - return this; - } - - public EntryRequest orderByCatalogAscending(){ - addOrderByAscending(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest orderByCatalogDescending(){ - addOrderByDescending(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest orderByNameAscending(){ - addOrderByAscending(Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest orderByNameDescending(){ - addOrderByDescending(Entry.NAME_PROPERTY); - return this; - } - public EntryRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.NAME_PROPERTY); - return this; - } - public EntryRequest orderByBornAtAscending(){ - addOrderByAscending(Entry.BORN_AT_PROPERTY); - return this; - } - - public EntryRequest orderByBornAtDescending(){ - addOrderByDescending(Entry.BORN_AT_PROPERTY); - return this; - } - - public EntryRequest orderByTouchedAtAscending(){ - addOrderByAscending(Entry.TOUCHED_AT_PROPERTY); - return this; - } - - public EntryRequest orderByTouchedAtDescending(){ - addOrderByDescending(Entry.TOUCHED_AT_PROPERTY); - return this; - } - - public EntryRequest orderBySourceIpAscending(){ - addOrderByAscending(Entry.SOURCE_IP_PROPERTY); - return this; - } - - public EntryRequest orderBySourceIpDescending(){ - addOrderByDescending(Entry.SOURCE_IP_PROPERTY); - return this; - } - public EntryRequest orderBySourceIpAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.SOURCE_IP_PROPERTY); - return this; - } - - public EntryRequest orderBySourceIpDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.SOURCE_IP_PROPERTY); - return this; - } - public EntryRequest orderByLastIpAscending(){ - addOrderByAscending(Entry.LAST_IP_PROPERTY); - return this; - } - - public EntryRequest orderByLastIpDescending(){ - addOrderByDescending(Entry.LAST_IP_PROPERTY); - return this; - } - public EntryRequest orderByLastIpAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.LAST_IP_PROPERTY); - return this; - } - - public EntryRequest orderByLastIpDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.LAST_IP_PROPERTY); - return this; - } - public EntryRequest orderByOpenedByAscending(){ - addOrderByAscending(Entry.OPENED_BY_PROPERTY); - return this; - } - - public EntryRequest orderByOpenedByDescending(){ - addOrderByDescending(Entry.OPENED_BY_PROPERTY); - return this; - } - public EntryRequest orderByOpenedByAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.OPENED_BY_PROPERTY); - return this; - } - - public EntryRequest orderByOpenedByDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.OPENED_BY_PROPERTY); - return this; - } - public EntryRequest orderByChangedByAscending(){ - addOrderByAscending(Entry.CHANGED_BY_PROPERTY); - return this; - } - - public EntryRequest orderByChangedByDescending(){ - addOrderByDescending(Entry.CHANGED_BY_PROPERTY); - return this; - } - public EntryRequest orderByChangedByAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.CHANGED_BY_PROPERTY); - return this; - } - - public EntryRequest orderByChangedByDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.CHANGED_BY_PROPERTY); - return this; - } - public EntryRequest orderByGuardedTokenAscending(){ - addOrderByAscending(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - - public EntryRequest orderByGuardedTokenDescending(){ - addOrderByDescending(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - public EntryRequest orderByGuardedTokenAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - - public EntryRequest orderByGuardedTokenDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.GUARDED_TOKEN_PROPERTY); - return this; - } - public EntryRequest orderByVersionAscending(){ - addOrderByAscending(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest orderByVersionDescending(){ - addOrderByDescending(Entry.VERSION_PROPERTY); - return this; - } - - - public CatalogRequest rollUpToCatalog(){ - CatalogRequest catalog = Q.catalogs().unlimited(); - this.withCatalogMatching(catalog) - .groupByCatalogWith(catalog); - return catalog; - } - - - - - - - - - - - - public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog){ - return facetByCatalogAs(facetName, catalog, true); - } - - public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog, boolean includeAllFacets){ - addFacet(facetName, Entry.CATALOG_PROPERTY, catalog, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCatalogAs", facetName, Entry.CATALOG_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public EntryRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public EntryRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public EntryRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public EntryRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public EntryRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public EntryRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java b/examples/conformance/context-derived/java-app-console/lib/src/main/java/com/example/contextfixservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 5da6f9001..000000000 --- a/examples/conformance/context-derived/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.contextfixservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/context-derived/showcase.json b/examples/conformance/context-derived/showcase.json index 8e21a00b5..41e5c16a1 100644 --- a/examples/conformance/context-derived/showcase.json +++ b/examples/conformance/context-derived/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "eb0ca431c33d68437fa9acf909d95825b07f9788f1b60597b1e7242dfe934383", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/conformance/java-app-console/lib/pom.xml b/examples/conformance/java-app-console/lib/pom.xml deleted file mode 100644 index db3c36e66..000000000 --- a/examples/conformance/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - runtime-example-conformance-service-core - 1.0.0 - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java deleted file mode 100644 index 6086e2f88..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice; - -import com.teaql.runtimeexampleconformanceservice.platform.Platform; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java deleted file mode 100644 index 68fd537c5..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice; - -import com.teaql.runtimeexampleconformanceservice.platform.Platform; -import com.teaql.runtimeexampleconformanceservice.platform.PlatformExpression; -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static WorkItemExpression workItem(WorkItem workItem){ - return new WorkItemExpression(new ValueExpression(workItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.workItem()")); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java deleted file mode 100644 index 4f01a8f47..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/EntityMetaRegistry.java +++ /dev/null @@ -1,300 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerWorkItem(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.teaql.runtimeexampleconformanceservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.runtimeexampleconformanceservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.runtimeexampleconformanceservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.teaql.runtimeexampleconformanceservice.platform.Platform::new); - entityDescriptor.with("name", "Platform") - - .with("module", "Example") - - .with("module_key", "example") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Runtime Example") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerWorkItem() { - FieldLayout.installGenerated(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class); - entityDescriptor.setEntitySupplier(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem::new); - entityDescriptor.with("name", "Work Item") - - .with("module", "Example") - - .with("module_key", "example") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY, Long.class) - ; - PropertyDescriptor title = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY, String.class) - ; - PropertyDescriptor description = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.DESCRIPTION_PROPERTY, String.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.PLATFORM_PROPERTY, com.teaql.runtimeexampleconformanceservice.platform.Platform.INTERNAL_TYPE, com.teaql.runtimeexampleconformanceservice.platform.Platform.WORK_ITEM_LIST_PROPERTY, com.teaql.runtimeexampleconformanceservice.platform.Platform.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.TITLE_PROPERTY).with("isPassword", "false") - - .with("max", "80") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("min", "1") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.DESCRIPTION_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java deleted file mode 100644 index 4a8cb2488..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.teaql.runtimeexampleconformanceservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.runtimeexampleconformanceservice.platform.PlatformChecker(), new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:f026153870cc54db18171cbbe02db1db174f3dea513e9d21e0ffe8af787ebaed\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]},{\"name\":\"work_item_list\",\"targetType\":\"WorkItem\",\"labels\":{\"en\":\"Work Item\"},\"aliases\":[\"WorkItemList\",\"workItemList\"]}]},\"WorkItem\":{\"labels\":{\"en\":\"Work Item\"},\"fields\":[{\"name\":\"description\",\"labels\":{\"en\":\"description\"},\"aliases\":[\"Description\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"title\",\"labels\":{\"en\":\"title\"},\"aliases\":[\"Title\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("WorkItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("title", "title"), java.util.Map.entry("description", "description"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.runtimeexampleconformanceservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.runtimeexampleconformanceservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Runtime Example"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - } -} diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java deleted file mode 100644 index 488630449..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Q.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest platforms(){ - return new com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest(com.teaql.runtimeexampleconformanceservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest(com.teaql.runtimeexampleconformanceservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest workItems(){ - return new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest workItemsWithMinimalFields(){ - return new com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest(com.teaql.runtimeexampleconformanceservice.workitem.WorkItem.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java deleted file mode 100644 index 45d540e79..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/RuntimeExampleConformanceServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice; - -import io.teaql.core.UserContext; -public interface RuntimeExampleConformanceServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java deleted file mode 100644 index b65672c65..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/Platform.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.platform; - -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e5c9f1d176ea19c50ebeacae413fa8885a3403d4d9ac9775fe79aecd0d931638"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "work_item_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String WORK_ITEM_LIST_PROPERTY = "work_item_list"; - private String name; - - private SmartList workItemList; - - public String getName(){ - return this.name; - } - - public SmartList getWorkItemList(){ - return this.workItemList == null ? SmartList.unloaded() : this.workItemList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform addWorkItem(WorkItem workItem){ - if (workItem == null){ - return this; - } - - if(null == this.workItemList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.workItemList = teaqlUnloadedItems.map(value -> value); - } - - this.workItemList.add(workItem); - workItem.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "work_item_list": this.workItemList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "work_item_list": return this.workItemList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java deleted file mode 100644 index 54ee11319..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.platform; - -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; platform.getWorkItemList() != null && i < platform.getWorkItemList().size(); i++){ - WorkItem workItem = platform.getWorkItemList().get(i); - new WorkItemChecker().checkAndFix(_context, workItem, newLocation(_parentLocation, "work_item_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java deleted file mode 100644 index 4622a5e9d..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.platform; - -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public WorkItemListExpression getWorkItemList(){ - return new WorkItemListExpression(loaded("work_item_list", "getWorkItemList", Platform::getWorkItemList)); - } - public PlatformExpression addWorkItem(WorkItem workItem){ - return new PlatformExpression(this, $it -> ((Platform)$it).addWorkItem(workItem)); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java deleted file mode 100644 index f9aba731e..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java deleted file mode 100644 index 0c64a37b9..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/platform/PlatformRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.platform; - -import com.teaql.runtimeexampleconformanceservice.Q; -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItem; -import com.teaql.runtimeexampleconformanceservice.workitem.WorkItemRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectWorkItemList(); - return selectId().selectName().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectWorkItemList(){ - return selectWorkItemListWith(Q.workItems().selectSelf()); - } - - public PlatformRequest selectWorkItemListWith(WorkItemRequest workItemList){ - enhanceRelation(Platform.WORK_ITEM_LIST_PROPERTY, workItemList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectWorkItemListWith", null, Platform.WORK_ITEM_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withWorkItemListMatching(WorkItemRequest workItemRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, workItemRequest, WorkItem.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutWorkItemListMatching(WorkItemRequest workItemRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, workItemRequest, WorkItem.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveWorkItems(){ - return withWorkItemListMatching(Q.workItems().unlimited()); - } - - public PlatformRequest haveNoWorkItems(){ - return withoutWorkItemListMatching(Q.workItems().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupByWorkItemsWithDetails(WorkItemRequest subRequest){ - aggregate(Platform.WORK_ITEM_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromWorkItemsAs(String name, WorkItemRequest subRequest){ - return statsFromWorkItemsAs(name, subRequest, false); - } - - public PlatformRequest statsFromWorkItemsAs(String name, WorkItemRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, WorkItem.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromWorkItemsAs", name, Platform.WORK_ITEM_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromWorkItems(WorkItemRequest subRequest){ - return statsFromWorkItemsAs(REFINEMENTS, subRequest); - } - public PlatformRequest countWorkItems(){ - addRelationCount("Count", Q.workItems().unlimited(), WorkItem.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItems", null, Platform.WORK_ITEM_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countWorkItemsAs(String name){ - addRelationCount(name, Q.workItems().unlimited(), WorkItem.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItemsAs", name, Platform.WORK_ITEM_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countWorkItemsWith(String name, WorkItemRequest subRequest){ - addRelationCount(name, subRequest, WorkItem.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countWorkItemsWith", name, Platform.WORK_ITEM_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java deleted file mode 100644 index e558c6cca..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItem.java +++ /dev/null @@ -1,149 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.workitem; - -import com.teaql.runtimeexampleconformanceservice.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class WorkItem extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "WorkItem"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "ff6df6930613256f676f63204201b7b20d7ecd9fa363bae51492c66e562f023c"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("title", 1), java.util.Map.entry("description", 2), java.util.Map.entry("platform", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("title", java.util.List.of("title", "title")), java.util.Map.entry("description", java.util.List.of("description", "description")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - WorkItem.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String TITLE_PROPERTY = "title"; - public static final String DESCRIPTION_PROPERTY = "description"; - public static final String PLATFORM_PROPERTY = "platform"; - private String title; - - private String description; - - private Platform platform; - - - public String getTitle(){ - return this.title; - } - - public String getDescription(){ - return this.description; - } - - public Platform getPlatform(){ - return this.platform; - } - - public WorkItem updateTitle(String title){ - title = (title == null ? null : title.trim()); - if(isPropertyLoaded(TITLE_PROPERTY) && Objects.equals(this.title, title)){ - return this; - } - handleUpdate(TITLE_PROPERTY, getTitle(), title); - this.title = title; - return this; - } - - public WorkItem updateDescription(String description){ - description = (description == null ? null : description.trim()); - if(isPropertyLoaded(DESCRIPTION_PROPERTY) && Objects.equals(this.description, description)){ - return this; - } - handleUpdate(DESCRIPTION_PROPERTY, getDescription(), description); - this.description = description; - return this; - } - - public WorkItem updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - - public static WorkItem refer(Long id){ - WorkItem refer = new WorkItem(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public WorkItem comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "title": this.title = (value == null ? null : ((String)value).trim()); break; - - case "description": this.description = (value == null ? null : ((String)value).trim()); break; - - case "platform": this.platform = (Platform) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "title": return this.title; - case "description": return this.description; - case "platform": return this.platform; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "title": return this.title; - case "description": return this.description; - case "platform": return this.platform; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java deleted file mode 100644 index bddd860d4..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemChecker.java +++ /dev/null @@ -1,71 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.workitem; - -import com.teaql.runtimeexampleconformanceservice.platform.Platform; -import com.teaql.runtimeexampleconformanceservice.platform.PlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class WorkItemChecker implements Checker{ - - public String type(){ - return WorkItem.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, WorkItem workItem, ObjectLocation _parentLocation){ - if(needCheck(_context, workItem)){ - markAsChecked(_context, workItem); - doCheck(_context, workItem, _parentLocation); - } - } - - public void doCheck(UserContext _context, WorkItem workItem, ObjectLocation _parentLocation){ - if((workItem == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, workItem); - if(workItem.needPersist()){ - } - if(workItem.newItem()){ - }else if(workItem.updateItem()){ - if(!workItem.isPropertyLoaded("title")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "title"), "Mutation requires a fully loaded entity"); - } - if(!workItem.isPropertyLoaded("description")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "description"), "Mutation requires a fully loaded entity"); - } - if(!workItem.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - - } - checkTitle(_context, workItem.getProperty(WorkItem.TITLE_PROPERTY), newLocation(_parentLocation, "title")); - checkDescription(_context, workItem.getProperty(WorkItem.DESCRIPTION_PROPERTY), newLocation(_parentLocation, "description")); - checkPlatform(_context, workItem.getProperty(WorkItem.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - } - - public void checkTitle(UserContext _context, String title, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, title); - if((title == null)){ - return; - } - minStringCheck(_context, _parentLocation, 1, title); - maxStringCheck(_context, _parentLocation, 80, title); - - } - public void checkDescription(UserContext _context, String description, ObjectLocation _parentLocation){ - if((description == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, description); - - } - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java deleted file mode 100644 index 89a84b043..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemExpression.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.workitem; - -import com.teaql.runtimeexampleconformanceservice.platform.Platform; -import com.teaql.runtimeexampleconformanceservice.platform.PlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class WorkItemExpression extends ExpressionAdaptor implements BaseEntityExpression { - public WorkItemExpression(Expression expression){ - super(expression); - } - - public WorkItemExpression(Expression expression, Function function){ - super(expression, function); - } - - public WorkItemExpression updateId(Long id){ - return new WorkItemExpression(this, $it -> {((WorkItem)$it).__internalSet("id", id); return this;}); - } - - public WorkItemExpression save(UserContext userContext){ - return new WorkItemExpression(this, $it -> ((WorkItem)$it).auditAs("Saved by Expression").save(userContext)); - } - - public WorkItemExpression save(String intent, UserContext userContext){ - return new WorkItemExpression(this, $it -> ((WorkItem)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getTitle(){ - return loaded("title", "getTitle", WorkItem::getTitle); - } - public WorkItemExpression updateTitle(String title){ - return new WorkItemExpression(this, $it -> ((WorkItem)$it).updateTitle(title)); - } - - public Expression getDescription(){ - return loaded("description", "getDescription", WorkItem::getDescription); - } - public WorkItemExpression updateDescription(String description){ - return new WorkItemExpression(this, $it -> ((WorkItem)$it).updateDescription(description)); - } - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", WorkItem::getPlatform)); - } - - public WorkItemExpression updatePlatform(Platform platform){ - return new WorkItemExpression(this, $it -> ((WorkItem)$it).updatePlatform(platform)); - } - -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java deleted file mode 100644 index 6fa79a9d2..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.workitem; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class WorkItemListExpression extends SmartListExpression { - public WorkItemListExpression(Expression> expression){ - super(expression); - } - - public WorkItemListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public WorkItemExpression first() { - return new WorkItemExpression(super.first()); - } - - public WorkItemExpression get(int index) { - return new WorkItemExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java b/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java deleted file mode 100644 index fdbdc329c..000000000 --- a/examples/conformance/java-app-console/lib/src/main/java/com/teaql/runtimeexampleconformanceservice/workitem/WorkItemRequest.java +++ /dev/null @@ -1,832 +0,0 @@ - -package com.teaql.runtimeexampleconformanceservice.workitem; - -import com.teaql.runtimeexampleconformanceservice.Q; -import com.teaql.runtimeexampleconformanceservice.platform.Platform; -import com.teaql.runtimeexampleconformanceservice.platform.PlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class WorkItemRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public WorkItemRequest(Class returnType){ - this(returnType, () -> (T) new WorkItem()); - } - - protected WorkItemRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public WorkItemRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public WorkItemRequest copy(){ - return (WorkItemRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new WorkItemRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public WorkItemRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public WorkItemRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public WorkItemRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public WorkItemRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public WorkItemRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public WorkItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public WorkItemRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public WorkItemRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public WorkItemRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public WorkItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (WorkItemRequest)super.appendSearchCriteria(searchCriteria); - } - - public WorkItemRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public WorkItemRequest matchingAnyOf(WorkItemRequest workItem){ - super.internalMatchAny(workItem); - return this; - } - - public WorkItemRequest matchingIdsOf(WorkItemRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - WorkItem.ID_PROPERTY, request, WorkItem.ID_PROPERTY)); - } - - public WorkItemRequest enhanceChildrenIfNeeded(){ - return this; - } - - public WorkItemRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public WorkItemRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public WorkItemRequest selectSelf(){ - super.selectSelf(); - return selectId().selectTitle().selectDescription().selectPlatformIdOnly().selectVersion(); - } - - public WorkItemRequest selectSelfFields(){ - return selectSelf(); - } - - public WorkItemRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(WorkItem.ID_PROPERTY); - selectProperty(WorkItem.TITLE_PROPERTY); - selectProperty(WorkItem.DESCRIPTION_PROPERTY); - selectProperty(WorkItem.PLATFORM_PROPERTY); - selectProperty(WorkItem.VERSION_PROPERTY); - return this; - } - - public WorkItemRequest selectAll(){ - super.selectAll(); - return selectId().selectTitle().selectDescription().selectPlatform().selectVersion(); - } - - public WorkItemRequest selectChildren(){ - super.selectAny(); - return selectId().selectTitle().selectDescription().selectPlatform().selectVersion(); - } - - - public WorkItemRequest selectId(){ - selectProperty(WorkItem.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public WorkItemRequest unselectId(){ - unselectProperty(WorkItem.ID_PROPERTY); - return this; - } - public WorkItemRequest selectTitle(){ - selectProperty(WorkItem.TITLE_PROPERTY); - return this; - } - - /** - * fill the title with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS title) to fetch title property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public WorkItemRequest unselectTitle(){ - unselectProperty(WorkItem.TITLE_PROPERTY); - return this; - } - public WorkItemRequest selectDescription(){ - selectProperty(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - - /** - * fill the description with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS description) to fetch description property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public WorkItemRequest unselectDescription(){ - unselectProperty(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - public WorkItemRequest selectPlatformIdOnly(){ - selectProperty(WorkItem.PLATFORM_PROPERTY); - return this; - } - - public WorkItemRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public WorkItemRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(WorkItem.PLATFORM_PROPERTY); - enhanceRelation(WorkItem.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, WorkItem.PLATFORM_PROPERTY)); - return this; - } - - public WorkItemRequest unselectPlatform(){ - unselectProperty(WorkItem.PLATFORM_PROPERTY); - return this; - } - public WorkItemRequest selectVersion(){ - selectProperty(WorkItem.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public WorkItemRequest unselectVersion(){ - unselectProperty(WorkItem.VERSION_PROPERTY); - return this; - } - - public WorkItemRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(WorkItem.ID_PROPERTY, operator, values); - } - - public WorkItemRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public WorkItemRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public WorkItemRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public WorkItemRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public WorkItemRequest filterByTitle(String... title){ - if (title == null || title.length == 0) { - throw new IllegalArgumentException("filterByTitle parameter title cannot be empty"); - } - return appendSearchCriteria(createTitleCriteria(Operator.EQUAL, (Object[])title)); - } - - public WorkItemRequest withTitle(Operator operator, Object... values){ - return appendSearchCriteria(createTitleCriteria(operator, values)); - } - - public WorkItemRequest withTitleIsUnknown(){ - return withTitle(Operator.IS_NULL); - } - - public WorkItemRequest withTitleIsKnown(){ - return withTitle(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTitleCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(WorkItem.TITLE_PROPERTY, operator, values); - } - - public WorkItemRequest withTitleIsNot(String title){ - return withTitle(Operator.NOT_EQUAL, title); - } - - public WorkItemRequest withTitleIn(String... title){ - return withTitle(Operator.IN, (Object[])title); - } - - public WorkItemRequest withTitleNotIn(String... title){ - return withTitle(Operator.NOT_IN, (Object[])title); - } - public WorkItemRequest withTitleGreaterThan(String title){ - return withTitle(Operator.GREATER_THAN, title); - } - - public WorkItemRequest withTitleGreaterThanOrEqualTo(String title){ - return withTitle(Operator.GREATER_THAN_OR_EQUAL, title); - } - - public WorkItemRequest withTitleLessThan(String title){ - return withTitle(Operator.LESS_THAN, title); - } - - public WorkItemRequest withTitleLessThanOrEqualTo(String title){ - return withTitle(Operator.LESS_THAN_OR_EQUAL, title); - } - - public WorkItemRequest withTitleBetween(String startOfTitle, String endOfTitle){ - return withTitle(Operator.BETWEEN, startOfTitle, endOfTitle); - } - public WorkItemRequest withTitleStartingWith(String title){ - return withTitle(Operator.BEGIN_WITH, title); - } - public WorkItemRequest withTitleContaining(String title){ - return withTitle(Operator.CONTAIN, title); - } - - public WorkItemRequest withTitleNotContaining(String title){ - return withTitle(Operator.NOT_CONTAIN, title); - } - - public WorkItemRequest withTitleNotStartingWith(String title){ - return withTitle(Operator.NOT_BEGIN_WITH, title); - } - - public WorkItemRequest withTitleEndingWith(String title){ - return withTitle(Operator.END_WITH, title); - } - - public WorkItemRequest withTitleNotEndingWith(String title){ - return withTitle(Operator.NOT_END_WITH, title); - } - - public WorkItemRequest withTitleIs(String title){ - return withTitle(Operator.EQUAL, title); - } - - public WorkItemRequest withTitleSoundingLike(String title){ - return withTitle(Operator.SOUNDS_LIKE, title); - } - - - - public WorkItemRequest filterByDescription(String... description){ - if (description == null || description.length == 0) { - throw new IllegalArgumentException("filterByDescription parameter description cannot be empty"); - } - return appendSearchCriteria(createDescriptionCriteria(Operator.EQUAL, (Object[])description)); - } - - public WorkItemRequest withDescription(Operator operator, Object... values){ - return appendSearchCriteria(createDescriptionCriteria(operator, values)); - } - - public WorkItemRequest withDescriptionIsUnknown(){ - return withDescription(Operator.IS_NULL); - } - - public WorkItemRequest withDescriptionIsKnown(){ - return withDescription(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDescriptionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(WorkItem.DESCRIPTION_PROPERTY, operator, values); - } - - public WorkItemRequest withDescriptionIsNot(String description){ - return withDescription(Operator.NOT_EQUAL, description); - } - - public WorkItemRequest withDescriptionIn(String... description){ - return withDescription(Operator.IN, (Object[])description); - } - - public WorkItemRequest withDescriptionNotIn(String... description){ - return withDescription(Operator.NOT_IN, (Object[])description); - } - public WorkItemRequest withDescriptionGreaterThan(String description){ - return withDescription(Operator.GREATER_THAN, description); - } - - public WorkItemRequest withDescriptionGreaterThanOrEqualTo(String description){ - return withDescription(Operator.GREATER_THAN_OR_EQUAL, description); - } - - public WorkItemRequest withDescriptionLessThan(String description){ - return withDescription(Operator.LESS_THAN, description); - } - - public WorkItemRequest withDescriptionLessThanOrEqualTo(String description){ - return withDescription(Operator.LESS_THAN_OR_EQUAL, description); - } - - public WorkItemRequest withDescriptionBetween(String startOfDescription, String endOfDescription){ - return withDescription(Operator.BETWEEN, startOfDescription, endOfDescription); - } - public WorkItemRequest withDescriptionStartingWith(String description){ - return withDescription(Operator.BEGIN_WITH, description); - } - public WorkItemRequest withDescriptionContaining(String description){ - return withDescription(Operator.CONTAIN, description); - } - - public WorkItemRequest withDescriptionNotContaining(String description){ - return withDescription(Operator.NOT_CONTAIN, description); - } - - public WorkItemRequest withDescriptionNotStartingWith(String description){ - return withDescription(Operator.NOT_BEGIN_WITH, description); - } - - public WorkItemRequest withDescriptionEndingWith(String description){ - return withDescription(Operator.END_WITH, description); - } - - public WorkItemRequest withDescriptionNotEndingWith(String description){ - return withDescription(Operator.NOT_END_WITH, description); - } - - public WorkItemRequest withDescriptionIs(String description){ - return withDescription(Operator.EQUAL, description); - } - - public WorkItemRequest withDescriptionSoundingLike(String description){ - return withDescription(Operator.SOUNDS_LIKE, description); - } - - - - public WorkItemRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public WorkItemRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public WorkItemRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public WorkItemRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(WorkItem.PLATFORM_PROPERTY, operator, values); - } - - public WorkItemRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public WorkItemRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(WorkItem.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public WorkItemRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(WorkItem.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public WorkItemRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public WorkItemRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public WorkItemRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public WorkItemRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(WorkItem.VERSION_PROPERTY, operator, values); - } - - public WorkItemRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public WorkItemRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public WorkItemRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public WorkItemRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public WorkItemRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public WorkItemRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public WorkItemRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public WorkItemRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public WorkItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public WorkItemRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public WorkItemRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public WorkItemRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public WorkItemRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(WorkItem.PLATFORM_PROPERTY, subRequest); - return this; - } - - - public WorkItemRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public WorkItemRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, WorkItem.ID_PROPERTY); - return this; - } - public WorkItemRequest countDistinctTitle(){ - return countDistinctTitleAs("title_distinct_count"); - } - - public WorkItemRequest countDistinctTitleAs(String alias){ - super.countDistinctProperty(alias, WorkItem.TITLE_PROPERTY); - return this; - } - public WorkItemRequest countDistinctDescription(){ - return countDistinctDescriptionAs("description_distinct_count"); - } - - public WorkItemRequest countDistinctDescriptionAs(String alias){ - super.countDistinctProperty(alias, WorkItem.DESCRIPTION_PROPERTY); - return this; - } - public WorkItemRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public WorkItemRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, WorkItem.PLATFORM_PROPERTY); - return this; - } - public WorkItemRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public WorkItemRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, WorkItem.VERSION_PROPERTY); - return this; - } - - public WorkItemRequest groupById(){ - groupBy(WorkItem.ID_PROPERTY); - return this; - } - - public WorkItemRequest groupByIdAs(String retName){ - groupBy(retName, WorkItem.ID_PROPERTY); - return this; - } - - public WorkItemRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, WorkItem.ID_PROPERTY, function); - return this; - } - - public WorkItemRequest groupByTitle(){ - groupBy(WorkItem.TITLE_PROPERTY); - return this; - } - - public WorkItemRequest groupByTitleAs(String retName){ - groupBy(retName, WorkItem.TITLE_PROPERTY); - return this; - } - - public WorkItemRequest groupByTitleWithFunction(String retName, AggrFunction function){ - groupBy(retName, WorkItem.TITLE_PROPERTY, function); - return this; - } - - public WorkItemRequest groupByDescription(){ - groupBy(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - - public WorkItemRequest groupByDescriptionAs(String retName){ - groupBy(retName, WorkItem.DESCRIPTION_PROPERTY); - return this; - } - - public WorkItemRequest groupByDescriptionWithFunction(String retName, AggrFunction function){ - groupBy(retName, WorkItem.DESCRIPTION_PROPERTY, function); - return this; - } - public WorkItemRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(WorkItem.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public WorkItemRequest groupByPlatform(){ - groupBy(WorkItem.PLATFORM_PROPERTY); - return this; - } - - public WorkItemRequest groupByPlatformAs(String retName){ - groupBy(retName, WorkItem.PLATFORM_PROPERTY); - return this; - } - - public WorkItemRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, WorkItem.PLATFORM_PROPERTY, function); - return this; - } - - public WorkItemRequest groupByVersion(){ - groupBy(WorkItem.VERSION_PROPERTY); - return this; - } - - public WorkItemRequest groupByVersionAs(String retName){ - groupBy(retName, WorkItem.VERSION_PROPERTY); - return this; - } - - public WorkItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, WorkItem.VERSION_PROPERTY, function); - return this; - } - - - - public WorkItemRequest orderByIdAscending(){ - addOrderByAscending(WorkItem.ID_PROPERTY); - return this; - } - - public WorkItemRequest orderByIdDescending(){ - addOrderByDescending(WorkItem.ID_PROPERTY); - return this; - } - - public WorkItemRequest orderByTitleAscending(){ - addOrderByAscending(WorkItem.TITLE_PROPERTY); - return this; - } - - public WorkItemRequest orderByTitleDescending(){ - addOrderByDescending(WorkItem.TITLE_PROPERTY); - return this; - } - public WorkItemRequest orderByTitleAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(WorkItem.TITLE_PROPERTY); - return this; - } - - public WorkItemRequest orderByTitleDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(WorkItem.TITLE_PROPERTY); - return this; - } - public WorkItemRequest orderByDescriptionAscending(){ - addOrderByAscending(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - - public WorkItemRequest orderByDescriptionDescending(){ - addOrderByDescending(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - public WorkItemRequest orderByDescriptionAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - - public WorkItemRequest orderByDescriptionDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(WorkItem.DESCRIPTION_PROPERTY); - return this; - } - public WorkItemRequest orderByPlatformAscending(){ - addOrderByAscending(WorkItem.PLATFORM_PROPERTY); - return this; - } - - public WorkItemRequest orderByPlatformDescending(){ - addOrderByDescending(WorkItem.PLATFORM_PROPERTY); - return this; - } - - public WorkItemRequest orderByVersionAscending(){ - addOrderByAscending(WorkItem.VERSION_PROPERTY); - return this; - } - - public WorkItemRequest orderByVersionDescending(){ - addOrderByDescending(WorkItem.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - public WorkItemRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public WorkItemRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, WorkItem.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, WorkItem.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public WorkItemRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public WorkItemRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public WorkItemRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public WorkItemRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public WorkItemRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public WorkItemRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/conformance/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 0414f0d7e..000000000 --- a/examples/conformance/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.runtimeexampleconformanceservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/pom.xml b/examples/conformance/natural-messages/java-app-console/lib/pom.xml deleted file mode 100644 index 940a05399..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - checker-natural-message-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java deleted file mode 100644 index b8ff37b1d..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/CheckerNaturalMessageServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.checkernaturalmessageservice; - -import io.teaql.core.UserContext; -public interface CheckerNaturalMessageServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java deleted file mode 100644 index fe730fc93..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.example.checkernaturalmessageservice; - -import com.example.checkernaturalmessageservice.catalog.Catalog; - -public interface Constants { - public static final long CATALOG_ID = 1l; - public static final Catalog CATALOG = Catalog.refer(CATALOG_ID); -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/E.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/E.java deleted file mode 100644 index 167e0960a..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.example.checkernaturalmessageservice; - -import com.example.checkernaturalmessageservice.catalog.Catalog; -import com.example.checkernaturalmessageservice.catalog.CatalogExpression; -import com.example.checkernaturalmessageservice.entry.Entry; -import com.example.checkernaturalmessageservice.entry.EntryExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static CatalogExpression catalog(Catalog catalog){ - return new CatalogExpression(new ValueExpression(catalog, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.catalog()")); - } - public static EntryExpression entry(Entry entry){ - return new EntryExpression(new ValueExpression(entry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.entry()")); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java deleted file mode 100644 index c10ac24e6..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/EntityMetaRegistry.java +++ /dev/null @@ -1,343 +0,0 @@ - -package com.example.checkernaturalmessageservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.time.LocalDateTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerCatalog(); - registerEntry(); - } - private void registerCatalog() { - FieldLayout.installGenerated(com.example.checkernaturalmessageservice.catalog.Catalog.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.checkernaturalmessageservice.catalog.Catalog.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.checkernaturalmessageservice.catalog.Catalog.class); - entityDescriptor.setEntitySupplier(com.example.checkernaturalmessageservice.catalog.Catalog::new); - entityDescriptor.with("name", "catalog") - - .with("zh_CN", "目录") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Catalog") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("zh_CN", "名称") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.catalog.Catalog.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerEntry() { - FieldLayout.installGenerated(com.example.checkernaturalmessageservice.entry.Entry.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.checkernaturalmessageservice.entry.Entry.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.checkernaturalmessageservice.entry.Entry.class); - entityDescriptor.setEntitySupplier(com.example.checkernaturalmessageservice.entry.Entry::new); - entityDescriptor.with("name", "entry") - - .with("zh_CN", "明细") - - .with("audit_mask_fields", "name") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY, Long.class) - ; - PropertyDescriptor catalog = - entityDescriptor.addObjectProperty($factory, com.example.checkernaturalmessageservice.entry.Entry.CATALOG_PROPERTY, com.example.checkernaturalmessageservice.catalog.Catalog.INTERNAL_TYPE, com.example.checkernaturalmessageservice.catalog.Catalog.ENTRY_LIST_PROPERTY, com.example.checkernaturalmessageservice.catalog.Catalog.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY, String.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CATALOG_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("zh_CN", "名称") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.checkernaturalmessageservice.entry.Entry.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java deleted file mode 100644 index 7fd451161..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.checkernaturalmessageservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.checkernaturalmessageservice.catalog.CatalogChecker(), new com.example.checkernaturalmessageservice.entry.EntryChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:9ea98ce6f86d4528fa8abed527685e55e825dcb5a695c61871b7aeab0eba3967\",\"entities\":{\"Catalog\":{\"labels\":{\"en\":\"catalog\",\"zh-CN\":\"目录\"},\"fields\":[{\"name\":\"entry_list\",\"targetType\":\"Entry\",\"labels\":{\"en\":\"entry\",\"zh-CN\":\"明细\"},\"aliases\":[\"EntryList\",\"entryList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\",\"zh-CN\":\"名称\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Entry\":{\"labels\":{\"en\":\"entry\",\"zh-CN\":\"明细\"},\"fields\":[{\"name\":\"catalog\",\"targetType\":\"Catalog\",\"labels\":{\"en\":\"catalog\",\"zh-CN\":\"目录\"},\"aliases\":[\"Catalog\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\",\"zh-CN\":\"名称\"},\"aliases\":[\"Name\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Catalog", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Entry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("catalog", "catalog"), java.util.Map.entry("name", "name"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.catalogs().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.checkernaturalmessageservice.catalog.Catalog domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.checkernaturalmessageservice.catalog.Catalog(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Catalog"); - domainRoot.auditAs("create generated Domain Root Catalog").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Catalog", domainRoot.getId())); - } -} diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java deleted file mode 100644 index 1a74d86e8..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Q.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.checkernaturalmessageservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.checkernaturalmessageservice.catalog.CatalogRequest catalogs(){ - return new com.example.checkernaturalmessageservice.catalog.CatalogRequest(com.example.checkernaturalmessageservice.catalog.Catalog.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.checkernaturalmessageservice.catalog.CatalogRequest catalogsWithMinimalFields(){ - return new com.example.checkernaturalmessageservice.catalog.CatalogRequest(com.example.checkernaturalmessageservice.catalog.Catalog.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.checkernaturalmessageservice.entry.EntryRequest entries(){ - return new com.example.checkernaturalmessageservice.entry.EntryRequest(com.example.checkernaturalmessageservice.entry.Entry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.checkernaturalmessageservice.entry.EntryRequest entriesWithMinimalFields(){ - return new com.example.checkernaturalmessageservice.entry.EntryRequest(com.example.checkernaturalmessageservice.entry.Entry.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java deleted file mode 100644 index a7070458c..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/Catalog.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.example.checkernaturalmessageservice.catalog; - -import com.example.checkernaturalmessageservice.entry.Entry; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Catalog extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Catalog"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "17d8d23d986f660e08bbf4204a52837ff356311f48de5ad8046528786b1394bb"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "entry_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Catalog.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String ENTRY_LIST_PROPERTY = "entry_list"; - private String name; - - private SmartList entryList; - - public String getName(){ - return this.name; - } - - public SmartList getEntryList(){ - return this.entryList == null ? SmartList.unloaded() : this.entryList; - } - public Catalog updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Catalog addEntry(Entry entry){ - if (entry == null){ - return this; - } - - if(null == this.entryList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.entryList = teaqlUnloadedItems.map(value -> value); - } - - this.entryList.add(entry); - entry.updateCatalog(this); - return this; - } - - public static Catalog refer(Long id){ - Catalog refer = new Catalog(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Catalog comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "entry_list": this.entryList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "entry_list": return this.entryList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java deleted file mode 100644 index 760afc099..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.example.checkernaturalmessageservice.catalog; - -import com.example.checkernaturalmessageservice.entry.Entry; -import com.example.checkernaturalmessageservice.entry.EntryChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CatalogChecker implements Checker{ - - public String type(){ - return Catalog.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ - if(needCheck(_context, catalog)){ - markAsChecked(_context, catalog); - doCheck(_context, catalog, _parentLocation); - } - } - - public void doCheck(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ - if((catalog == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, catalog); - if(catalog.needPersist()){ - } - if(catalog.newItem()){ - }else if(catalog.updateItem()){ - if(!catalog.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, catalog.getProperty(Catalog.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; catalog.getEntryList() != null && i < catalog.getEntryList().size(); i++){ - Entry entry = catalog.getEntryList().get(i); - new EntryChecker().checkAndFix(_context, entry, newLocation(_parentLocation, "entry_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java deleted file mode 100644 index 502db83b9..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.example.checkernaturalmessageservice.catalog; - -import com.example.checkernaturalmessageservice.entry.Entry; -import com.example.checkernaturalmessageservice.entry.EntryListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CatalogExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CatalogExpression(Expression expression){ - super(expression); - } - - public CatalogExpression(Expression expression, Function function){ - super(expression, function); - } - - public CatalogExpression updateId(Long id){ - return new CatalogExpression(this, $it -> {((Catalog)$it).__internalSet("id", id); return this;}); - } - - public CatalogExpression save(UserContext userContext){ - return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CatalogExpression save(String intent, UserContext userContext){ - return new CatalogExpression(this, $it -> ((Catalog)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Catalog::getName); - } - public CatalogExpression updateName(String name){ - return new CatalogExpression(this, $it -> ((Catalog)$it).updateName(name)); - } - - public EntryListExpression getEntryList(){ - return new EntryListExpression(loaded("entry_list", "getEntryList", Catalog::getEntryList)); - } - public CatalogExpression addEntry(Entry entry){ - return new CatalogExpression(this, $it -> ((Catalog)$it).addEntry(entry)); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java deleted file mode 100644 index e58cf190b..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.checkernaturalmessageservice.catalog; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CatalogListExpression extends SmartListExpression { - public CatalogListExpression(Expression> expression){ - super(expression); - } - - public CatalogListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CatalogExpression first() { - return new CatalogExpression(super.first()); - } - - public CatalogExpression get(int index) { - return new CatalogExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java deleted file mode 100644 index 475feb3c0..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/catalog/CatalogRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.example.checkernaturalmessageservice.catalog; - -import com.example.checkernaturalmessageservice.Q; -import com.example.checkernaturalmessageservice.entry.Entry; -import com.example.checkernaturalmessageservice.entry.EntryRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CatalogRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CatalogRequest(Class returnType){ - this(returnType, () -> (T) new Catalog()); - } - - protected CatalogRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CatalogRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CatalogRequest copy(){ - return (CatalogRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CatalogRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CatalogRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CatalogRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CatalogRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CatalogRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CatalogRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CatalogRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CatalogRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CatalogRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CatalogRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CatalogRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CatalogRequest)super.appendSearchCriteria(searchCriteria); - } - - public CatalogRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CatalogRequest matchingAnyOf(CatalogRequest catalog){ - super.internalMatchAny(catalog); - return this; - } - - public CatalogRequest matchingIdsOf(CatalogRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Catalog.ID_PROPERTY, request, Catalog.ID_PROPERTY)); - } - - public CatalogRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CatalogRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CatalogRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CatalogRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public CatalogRequest selectSelfFields(){ - return selectSelf(); - } - - public CatalogRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Catalog.ID_PROPERTY); - selectProperty(Catalog.NAME_PROPERTY); - selectProperty(Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public CatalogRequest selectChildren(){ - super.selectAny(); - selectEntryList(); - return selectId().selectName().selectVersion(); - } - - - public CatalogRequest selectId(){ - selectProperty(Catalog.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CatalogRequest unselectId(){ - unselectProperty(Catalog.ID_PROPERTY); - return this; - } - public CatalogRequest selectName(){ - selectProperty(Catalog.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CatalogRequest unselectName(){ - unselectProperty(Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest selectVersion(){ - selectProperty(Catalog.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CatalogRequest unselectVersion(){ - unselectProperty(Catalog.VERSION_PROPERTY); - return this; - } - public CatalogRequest selectEntryList(){ - return selectEntryListWith(Q.entries().selectSelf()); - } - - public CatalogRequest selectEntryListWith(EntryRequest entryList){ - enhanceRelation(Catalog.ENTRY_LIST_PROPERTY, entryList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectEntryListWith", null, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Catalog.ID_PROPERTY, operator, values); - } - - public CatalogRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CatalogRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CatalogRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CatalogRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CatalogRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public CatalogRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public CatalogRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public CatalogRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Catalog.NAME_PROPERTY, operator, values); - } - - public CatalogRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public CatalogRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public CatalogRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public CatalogRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public CatalogRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public CatalogRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public CatalogRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public CatalogRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public CatalogRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public CatalogRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public CatalogRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public CatalogRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public CatalogRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public CatalogRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public CatalogRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public CatalogRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public CatalogRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CatalogRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CatalogRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CatalogRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Catalog.VERSION_PROPERTY, operator, values); - } - - public CatalogRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CatalogRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CatalogRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CatalogRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CatalogRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CatalogRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CatalogRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CatalogRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CatalogRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CatalogRequest withEntryListMatching(EntryRequest entryRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY)); - } - - public CatalogRequest withoutEntryListMatching(EntryRequest entryRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Catalog.ID_PROPERTY, entryRequest, Entry.CATALOG_PROPERTY))); - } - - public CatalogRequest haveEntries(){ - return withEntryListMatching(Q.entries().unlimited()); - } - - public CatalogRequest haveNoEntries(){ - return withoutEntryListMatching(Q.entries().unlimited()); - } - - public CatalogRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CatalogRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CatalogRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CatalogRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Catalog.ID_PROPERTY); - return this; - } - public CatalogRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public CatalogRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CatalogRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Catalog.VERSION_PROPERTY); - return this; - } - public CatalogRequest groupByEntriesWithDetails(EntryRequest subRequest){ - aggregate(Catalog.ENTRY_LIST_PROPERTY, subRequest); - return this; - } - - public CatalogRequest groupById(){ - groupBy(Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest groupByIdAs(String retName){ - groupBy(retName, Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Catalog.ID_PROPERTY, function); - return this; - } - - public CatalogRequest groupByName(){ - groupBy(Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest groupByNameAs(String retName){ - groupBy(retName, Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Catalog.NAME_PROPERTY, function); - return this; - } - - public CatalogRequest groupByVersion(){ - groupBy(Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest groupByVersionAs(String retName){ - groupBy(retName, Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Catalog.VERSION_PROPERTY, function); - return this; - } - - - - public CatalogRequest orderByIdAscending(){ - addOrderByAscending(Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest orderByIdDescending(){ - addOrderByDescending(Catalog.ID_PROPERTY); - return this; - } - - public CatalogRequest orderByNameAscending(){ - addOrderByAscending(Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest orderByNameDescending(){ - addOrderByDescending(Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Catalog.NAME_PROPERTY); - return this; - } - - public CatalogRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Catalog.NAME_PROPERTY); - return this; - } - public CatalogRequest orderByVersionAscending(){ - addOrderByAscending(Catalog.VERSION_PROPERTY); - return this; - } - - public CatalogRequest orderByVersionDescending(){ - addOrderByDescending(Catalog.VERSION_PROPERTY); - return this; - } - - - public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest){ - return statsFromEntriesAs(name, subRequest, false); - } - - public CatalogRequest statsFromEntriesAs(String name, EntryRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Entry.CATALOG_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest statsFromEntries(EntryRequest subRequest){ - return statsFromEntriesAs(REFINEMENTS, subRequest); - } - public CatalogRequest countEntries(){ - addRelationCount("Count", Q.entries().unlimited(), Entry.CATALOG_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntries", null, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest countEntriesAs(String name){ - addRelationCount(name, Q.entries().unlimited(), Entry.CATALOG_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesAs", name, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - public CatalogRequest countEntriesWith(String name, EntryRequest subRequest){ - addRelationCount(name, subRequest, Entry.CATALOG_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countEntriesWith", name, Catalog.ENTRY_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public CatalogRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CatalogRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CatalogRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CatalogRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CatalogRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CatalogRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java deleted file mode 100644 index 8e6dfc21f..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/Entry.java +++ /dev/null @@ -1,169 +0,0 @@ - -package com.example.checkernaturalmessageservice.entry; - -import com.example.checkernaturalmessageservice.catalog.Catalog; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Entry extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Entry"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8e34a18976365b7e707005f06d9441ba9a12b1923c7f21baf92af523ac70a9db"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("catalog", 1), java.util.Map.entry("name", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("catalog", java.util.List.of("catalog", "catalog")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Entry.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CATALOG_PROPERTY = "catalog"; - public static final String NAME_PROPERTY = "name"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - private Catalog catalog; - - private String name; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - - public Catalog getCatalog(){ - return this.catalog; - } - - public String getName(){ - return this.name; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public Entry updateCatalog(Catalog catalog){ - if(isPropertyLoaded(CATALOG_PROPERTY) && Objects.equals(this.catalog, catalog)){ - return this; - } - handleUpdate(CATALOG_PROPERTY, getCatalog(), catalog); - this.catalog = catalog; - return this; - } - - public Entry updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Entry updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public Entry updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - - public static Entry refer(Long id){ - Entry refer = new Entry(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Entry comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "catalog": this.catalog = (Catalog) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "catalog": return this.catalog; - case "name": return this.name; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "catalog": return this.catalog; - case "name": return this.name; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java deleted file mode 100644 index b173894ed..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryChecker.java +++ /dev/null @@ -1,103 +0,0 @@ - -package com.example.checkernaturalmessageservice.entry; - -import com.example.checkernaturalmessageservice.catalog.Catalog; -import com.example.checkernaturalmessageservice.catalog.CatalogChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class EntryChecker implements Checker{ - - public String type(){ - return Entry.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Entry entry, ObjectLocation _parentLocation){ - if(needCheck(_context, entry)){ - markAsChecked(_context, entry); - doCheck(_context, entry, _parentLocation); - } - } - - public void doCheck(UserContext _context, Entry entry, ObjectLocation _parentLocation){ - if((entry == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, entry); - if(entry.needPersist()){ - } - if(entry.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - entry.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - entry.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(entry.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - entry.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!entry.isPropertyLoaded("catalog")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "catalog"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!entry.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkCatalog(_context, entry.getProperty(Entry.CATALOG_PROPERTY), newLocation(_parentLocation, "catalog")); - checkName(_context, entry.getProperty(Entry.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCreateTime(_context, entry.getProperty(Entry.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, entry.getProperty(Entry.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - } - - public void checkCatalog(UserContext _context, Catalog catalog, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, catalog); - if((catalog == null)){ - return; - } - new CatalogChecker().checkAndFix(_context, catalog, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java deleted file mode 100644 index 671981367..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryExpression.java +++ /dev/null @@ -1,68 +0,0 @@ - -package com.example.checkernaturalmessageservice.entry; - -import com.example.checkernaturalmessageservice.catalog.Catalog; -import com.example.checkernaturalmessageservice.catalog.CatalogExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class EntryExpression extends ExpressionAdaptor implements BaseEntityExpression { - public EntryExpression(Expression expression){ - super(expression); - } - - public EntryExpression(Expression expression, Function function){ - super(expression, function); - } - - public EntryExpression updateId(Long id){ - return new EntryExpression(this, $it -> {((Entry)$it).__internalSet("id", id); return this;}); - } - - public EntryExpression save(UserContext userContext){ - return new EntryExpression(this, $it -> ((Entry)$it).auditAs("Saved by Expression").save(userContext)); - } - - public EntryExpression save(String intent, UserContext userContext){ - return new EntryExpression(this, $it -> ((Entry)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CatalogExpression getCatalog(){ - return new CatalogExpression(loaded("catalog", "getCatalog", Entry::getCatalog)); - } - - public EntryExpression updateCatalog(Catalog catalog){ - return new EntryExpression(this, $it -> ((Entry)$it).updateCatalog(catalog)); - } - - public Expression getName(){ - return loaded("name", "getName", Entry::getName); - } - public EntryExpression updateName(String name){ - return new EntryExpression(this, $it -> ((Entry)$it).updateName(name)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", Entry::getCreateTime); - } - public EntryExpression updateCreateTime(LocalDateTime createTime){ - return new EntryExpression(this, $it -> ((Entry)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", Entry::getUpdateTime); - } - public EntryExpression updateUpdateTime(LocalDateTime updateTime){ - return new EntryExpression(this, $it -> ((Entry)$it).updateUpdateTime(updateTime)); - } - -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java deleted file mode 100644 index 5d46271ad..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.checkernaturalmessageservice.entry; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class EntryListExpression extends SmartListExpression { - public EntryListExpression(Expression> expression){ - super(expression); - } - - public EntryListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public EntryExpression first() { - return new EntryExpression(super.first()); - } - - public EntryExpression get(int index) { - return new EntryExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java deleted file mode 100644 index 8363f39bd..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/entry/EntryRequest.java +++ /dev/null @@ -1,957 +0,0 @@ - -package com.example.checkernaturalmessageservice.entry; - -import com.example.checkernaturalmessageservice.Q; -import com.example.checkernaturalmessageservice.catalog.Catalog; -import com.example.checkernaturalmessageservice.catalog.CatalogRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class EntryRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public EntryRequest(Class returnType){ - this(returnType, () -> (T) new Entry()); - } - - protected EntryRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public EntryRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public EntryRequest copy(){ - return (EntryRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new EntryRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public EntryRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public EntryRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public EntryRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public EntryRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public EntryRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public EntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public EntryRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public EntryRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public EntryRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public EntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (EntryRequest)super.appendSearchCriteria(searchCriteria); - } - - public EntryRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public EntryRequest matchingAnyOf(EntryRequest entry){ - super.internalMatchAny(entry); - return this; - } - - public EntryRequest matchingIdsOf(EntryRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Entry.ID_PROPERTY, request, Entry.ID_PROPERTY)); - } - - public EntryRequest enhanceChildrenIfNeeded(){ - return this; - } - - public EntryRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public EntryRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public EntryRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCatalogIdOnly().selectName().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public EntryRequest selectSelfFields(){ - return selectSelf(); - } - - public EntryRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Entry.ID_PROPERTY); - selectProperty(Entry.CATALOG_PROPERTY); - selectProperty(Entry.NAME_PROPERTY); - selectProperty(Entry.CREATE_TIME_PROPERTY); - selectProperty(Entry.UPDATE_TIME_PROPERTY); - selectProperty(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest selectAll(){ - super.selectAll(); - return selectId().selectCatalog().selectName().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public EntryRequest selectChildren(){ - super.selectAny(); - return selectId().selectCatalog().selectName().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public EntryRequest selectId(){ - selectProperty(Entry.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectId(){ - unselectProperty(Entry.ID_PROPERTY); - return this; - } - public EntryRequest selectCatalogIdOnly(){ - selectProperty(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest selectCatalog(){ - return selectCatalogWith(Q.catalogs().unlimited().selectSelf()); - } - - public EntryRequest selectCatalogWith(CatalogRequest catalog){ - selectProperty(Entry.CATALOG_PROPERTY); - enhanceRelation(Entry.CATALOG_PROPERTY, catalog, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCatalogWith", null, Entry.CATALOG_PROPERTY)); - return this; - } - - public EntryRequest unselectCatalog(){ - unselectProperty(Entry.CATALOG_PROPERTY); - return this; - } - public EntryRequest selectName(){ - selectProperty(Entry.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectName(){ - unselectProperty(Entry.NAME_PROPERTY); - return this; - } - public EntryRequest selectCreateTime(){ - selectProperty(Entry.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectCreateTime(){ - unselectProperty(Entry.CREATE_TIME_PROPERTY); - return this; - } - public EntryRequest selectUpdateTime(){ - selectProperty(Entry.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectUpdateTime(){ - unselectProperty(Entry.UPDATE_TIME_PROPERTY); - return this; - } - public EntryRequest selectVersion(){ - selectProperty(Entry.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public EntryRequest unselectVersion(){ - unselectProperty(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.ID_PROPERTY, operator, values); - } - - public EntryRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public EntryRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public EntryRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public EntryRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public EntryRequest filterByCatalog(Catalog... catalog){ - if (catalog == null || catalog.length == 0) { - throw new IllegalArgumentException("filterByCatalog parameter catalog cannot be empty"); - } - return appendSearchCriteria(createCatalogCriteria(Operator.EQUAL, (Object[])catalog)); - } - - public EntryRequest withCatalog(Operator operator, Object... values){ - return appendSearchCriteria(createCatalogCriteria(operator, values)); - } - - public EntryRequest withCatalogIsUnknown(){ - return withCatalog(Operator.IS_NULL); - } - - public EntryRequest withCatalogIsKnown(){ - return withCatalog(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCatalogCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.CATALOG_PROPERTY, operator, values); - } - - public EntryRequest filterByCatalog(Long catalog){ - if(catalog == null){ - return this; - } - return withCatalog(Operator.EQUAL, catalog); - } - public EntryRequest withCatalogMatching(CatalogRequest catalog){ - return appendSearchCriteria(new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY)); - } - - public EntryRequest withoutCatalogMatching(CatalogRequest catalog){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Entry.CATALOG_PROPERTY, catalog, Catalog.ID_PROPERTY))); - } - - public EntryRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public EntryRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public EntryRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public EntryRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.NAME_PROPERTY, operator, values); - } - - public EntryRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public EntryRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public EntryRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public EntryRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public EntryRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public EntryRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public EntryRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public EntryRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public EntryRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public EntryRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public EntryRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public EntryRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public EntryRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public EntryRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public EntryRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public EntryRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public EntryRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public EntryRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public EntryRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public EntryRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.CREATE_TIME_PROPERTY, operator, values); - } - - public EntryRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public EntryRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public EntryRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public EntryRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public EntryRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public EntryRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public EntryRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public EntryRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public EntryRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public EntryRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public EntryRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public EntryRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public EntryRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public EntryRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public EntryRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public EntryRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public EntryRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public EntryRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.UPDATE_TIME_PROPERTY, operator, values); - } - - public EntryRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public EntryRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public EntryRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public EntryRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public EntryRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public EntryRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public EntryRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public EntryRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public EntryRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public EntryRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public EntryRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public EntryRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public EntryRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public EntryRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public EntryRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public EntryRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public EntryRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public EntryRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Entry.VERSION_PROPERTY, operator, values); - } - - public EntryRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public EntryRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public EntryRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public EntryRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public EntryRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public EntryRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public EntryRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public EntryRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public EntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public EntryRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public EntryRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public EntryRequest groupByCatalogWithDetails(){ - return groupByCatalogWithDetails(Q.catalogs().unlimited()); - } - - public EntryRequest groupByCatalogWithDetails(CatalogRequest subRequest){ - aggregate(Entry.CATALOG_PROPERTY, subRequest); - return this; - } - - - - - - public EntryRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public EntryRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Entry.ID_PROPERTY); - return this; - } - public EntryRequest countDistinctCatalog(){ - return countDistinctCatalogAs("catalog_distinct_count"); - } - - public EntryRequest countDistinctCatalogAs(String alias){ - super.countDistinctProperty(alias, Entry.CATALOG_PROPERTY); - return this; - } - public EntryRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public EntryRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Entry.NAME_PROPERTY); - return this; - } - public EntryRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public EntryRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, Entry.CREATE_TIME_PROPERTY); - return this; - } - public EntryRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public EntryRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, Entry.UPDATE_TIME_PROPERTY); - return this; - } - public EntryRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public EntryRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest groupById(){ - groupBy(Entry.ID_PROPERTY); - return this; - } - - public EntryRequest groupByIdAs(String retName){ - groupBy(retName, Entry.ID_PROPERTY); - return this; - } - - public EntryRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.ID_PROPERTY, function); - return this; - } - public EntryRequest groupByCatalogWith(CatalogRequest subRequest){ - groupBy(Entry.CATALOG_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCatalogWith", null, "catalog")); - return this; - } - public EntryRequest groupByCatalog(){ - groupBy(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest groupByCatalogAs(String retName){ - groupBy(retName, Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest groupByCatalogWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.CATALOG_PROPERTY, function); - return this; - } - - public EntryRequest groupByName(){ - groupBy(Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest groupByNameAs(String retName){ - groupBy(retName, Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.NAME_PROPERTY, function); - return this; - } - - public EntryRequest groupByCreateTime(){ - groupBy(Entry.CREATE_TIME_PROPERTY); - return this; - } - - public EntryRequest groupByCreateTimeAs(String retName){ - groupBy(retName, Entry.CREATE_TIME_PROPERTY); - return this; - } - - public EntryRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.CREATE_TIME_PROPERTY, function); - return this; - } - - public EntryRequest groupByUpdateTime(){ - groupBy(Entry.UPDATE_TIME_PROPERTY); - return this; - } - - public EntryRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, Entry.UPDATE_TIME_PROPERTY); - return this; - } - - public EntryRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.UPDATE_TIME_PROPERTY, function); - return this; - } - - public EntryRequest groupByVersion(){ - groupBy(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest groupByVersionAs(String retName){ - groupBy(retName, Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Entry.VERSION_PROPERTY, function); - return this; - } - - - - public EntryRequest orderByIdAscending(){ - addOrderByAscending(Entry.ID_PROPERTY); - return this; - } - - public EntryRequest orderByIdDescending(){ - addOrderByDescending(Entry.ID_PROPERTY); - return this; - } - - public EntryRequest orderByCatalogAscending(){ - addOrderByAscending(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest orderByCatalogDescending(){ - addOrderByDescending(Entry.CATALOG_PROPERTY); - return this; - } - - public EntryRequest orderByNameAscending(){ - addOrderByAscending(Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest orderByNameDescending(){ - addOrderByDescending(Entry.NAME_PROPERTY); - return this; - } - public EntryRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Entry.NAME_PROPERTY); - return this; - } - - public EntryRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Entry.NAME_PROPERTY); - return this; - } - public EntryRequest orderByCreateTimeAscending(){ - addOrderByAscending(Entry.CREATE_TIME_PROPERTY); - return this; - } - - public EntryRequest orderByCreateTimeDescending(){ - addOrderByDescending(Entry.CREATE_TIME_PROPERTY); - return this; - } - - public EntryRequest orderByUpdateTimeAscending(){ - addOrderByAscending(Entry.UPDATE_TIME_PROPERTY); - return this; - } - - public EntryRequest orderByUpdateTimeDescending(){ - addOrderByDescending(Entry.UPDATE_TIME_PROPERTY); - return this; - } - - public EntryRequest orderByVersionAscending(){ - addOrderByAscending(Entry.VERSION_PROPERTY); - return this; - } - - public EntryRequest orderByVersionDescending(){ - addOrderByDescending(Entry.VERSION_PROPERTY); - return this; - } - - - public CatalogRequest rollUpToCatalog(){ - CatalogRequest catalog = Q.catalogs().unlimited(); - this.internalRollUpTo("catalog", catalog, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCatalog", null, "catalog")); - return catalog; - } - - - - - - - public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog){ - return facetByCatalogAs(facetName, catalog, true); - } - - public EntryRequest facetByCatalogAs(String facetName, CatalogRequest catalog, boolean includeAllFacets){ - addFacet(facetName, Entry.CATALOG_PROPERTY, catalog, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCatalogAs", facetName, Entry.CATALOG_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public EntryRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public EntryRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public EntryRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public EntryRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public EntryRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public EntryRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java b/examples/conformance/natural-messages/java-app-console/lib/src/main/java/com/example/checkernaturalmessageservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/conformance/natural-messages/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/conformance/natural-messages/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 57a8cdc0e..000000000 --- a/examples/conformance/natural-messages/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.checkernaturalmessageservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/conformance/natural-messages/showcase.json b/examples/conformance/natural-messages/showcase.json index 8de1b90a0..22eaf9119 100644 --- a/examples/conformance/natural-messages/showcase.json +++ b/examples/conformance/natural-messages/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "4c158e97fa019cace80ded4119dcc0fa26c4dc397ac1e6f2d78ff32389bafa6a", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/conformance/showcase.json b/examples/conformance/showcase.json index 25622d2de..902c1fd90 100644 --- a/examples/conformance/showcase.json +++ b/examples/conformance/showcase.json @@ -52,6 +52,7 @@ ], "generatedFilesManifestSHA256": "da19ce1214da1fee5a30f8b68d6a9c51cca7ce30adf6297f15d0f2619b0de254", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/exact-decimal/java-app-console/lib/pom.xml b/examples/exact-decimal/java-app-console/lib/pom.xml deleted file mode 100644 index 0db98813e..000000000 --- a/examples/exact-decimal/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - exact-decimal-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Checkers.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java deleted file mode 100644 index d17d4e4c3..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.example.exactdecimalservice; - -import com.example.exactdecimalservice.platform.Platform; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java deleted file mode 100644 index 26ec00ba1..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.example.exactdecimalservice; - -import com.example.exactdecimalservice.decimalentry.DecimalEntry; -import com.example.exactdecimalservice.decimalentry.DecimalEntryExpression; -import com.example.exactdecimalservice.platform.Platform; -import com.example.exactdecimalservice.platform.PlatformExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static DecimalEntryExpression decimalEntry(DecimalEntry decimalEntry){ - return new DecimalEntryExpression(new ValueExpression(decimalEntry, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.decimalEntry()")); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java deleted file mode 100644 index 73e93117f..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/EntityMetaRegistry.java +++ /dev/null @@ -1,300 +0,0 @@ - -package com.example.exactdecimalservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerDecimalEntry(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.example.exactdecimalservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.exactdecimalservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.exactdecimalservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.example.exactdecimalservice.platform.Platform::new); - entityDescriptor.with("name", "Platform") - - .with("module", "Organization") - - .with("module_key", "organization") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Settlement Quote Ledger") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerDecimalEntry() { - FieldLayout.installGenerated(com.example.exactdecimalservice.decimalentry.DecimalEntry.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.exactdecimalservice.decimalentry.DecimalEntry.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.exactdecimalservice.decimalentry.DecimalEntry.class); - entityDescriptor.setEntitySupplier(com.example.exactdecimalservice.decimalentry.DecimalEntry::new); - entityDescriptor.with("name", "Settlement Quote") - - .with("module", "Ledger") - - .with("module_key", "ledger") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.exactdecimalservice.decimalentry.DecimalEntry.PLATFORM_PROPERTY, com.example.exactdecimalservice.platform.Platform.INTERNAL_TYPE, com.example.exactdecimalservice.platform.Platform.DECIMAL_ENTRY_LIST_PROPERTY, com.example.exactdecimalservice.platform.Platform.class) - ; - PropertyDescriptor label = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY, String.class) - ; - PropertyDescriptor amount = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.LABEL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.AMOUNT_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.exactdecimalservice.decimalentry.DecimalEntry.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java deleted file mode 100644 index c399c232d..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/ExactDecimalServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.exactdecimalservice; - -import io.teaql.core.UserContext; -public interface ExactDecimalServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java deleted file mode 100644 index 731febe8c..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.exactdecimalservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.exactdecimalservice.platform.PlatformChecker(), new com.example.exactdecimalservice.decimalentry.DecimalEntryChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:91221f5024a3f4a9fb2107c03a7807ea332b6a396a608b76abb394898177c010\",\"entities\":{\"DecimalEntry\":{\"labels\":{\"en\":\"Settlement Quote\"},\"fields\":[{\"name\":\"amount\",\"labels\":{\"en\":\"amount\"},\"aliases\":[\"Amount\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"label\",\"labels\":{\"en\":\"label\"},\"aliases\":[\"Label\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"decimal_entry_list\",\"targetType\":\"DecimalEntry\",\"labels\":{\"en\":\"Settlement Quote\"},\"aliases\":[\"DecimalEntryList\",\"decimalEntryList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("DecimalEntry", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("label", "label"), java.util.Map.entry("amount", "amount"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.exactdecimalservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.exactdecimalservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Settlement Quote Ledger"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - } -} diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java deleted file mode 100644 index 0bf183acf..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Q.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.exactdecimalservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.exactdecimalservice.platform.PlatformRequest platforms(){ - return new com.example.exactdecimalservice.platform.PlatformRequest(com.example.exactdecimalservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.exactdecimalservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.example.exactdecimalservice.platform.PlatformRequest(com.example.exactdecimalservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.exactdecimalservice.decimalentry.DecimalEntryRequest decimalEntries(){ - return new com.example.exactdecimalservice.decimalentry.DecimalEntryRequest(com.example.exactdecimalservice.decimalentry.DecimalEntry.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.exactdecimalservice.decimalentry.DecimalEntryRequest decimalEntriesWithMinimalFields(){ - return new com.example.exactdecimalservice.decimalentry.DecimalEntryRequest(com.example.exactdecimalservice.decimalentry.DecimalEntry.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Repositories.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java deleted file mode 100644 index 43909a4f7..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntry.java +++ /dev/null @@ -1,149 +0,0 @@ - -package com.example.exactdecimalservice.decimalentry; - -import com.example.exactdecimalservice.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class DecimalEntry extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "DecimalEntry"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "46367c1f6d22180cb63ea4bcac6772b4e507f4ef69000bb272b73de3ab179c0f"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("label", 2), java.util.Map.entry("amount", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("label", java.util.List.of("label", "label")), java.util.Map.entry("amount", java.util.List.of("amount", "amount")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - DecimalEntry.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String LABEL_PROPERTY = "label"; - public static final String AMOUNT_PROPERTY = "amount"; - private Platform platform; - - private String label; - - private BigDecimal amount; - - - public Platform getPlatform(){ - return this.platform; - } - - public String getLabel(){ - return this.label; - } - - public BigDecimal getAmount(){ - return this.amount; - } - - public DecimalEntry updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public DecimalEntry updateLabel(String label){ - label = (label == null ? null : label.trim()); - if(isPropertyLoaded(LABEL_PROPERTY) && Objects.equals(this.label, label)){ - return this; - } - handleUpdate(LABEL_PROPERTY, getLabel(), label); - this.label = label; - return this; - } - - public DecimalEntry updateAmount(BigDecimal amount){ - if(isPropertyLoaded(AMOUNT_PROPERTY) && Objects.equals(this.amount, amount)){ - return this; - } - handleUpdate(AMOUNT_PROPERTY, getAmount(), amount); - this.amount = amount; - return this; - } - - - public static DecimalEntry refer(Long id){ - DecimalEntry refer = new DecimalEntry(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public DecimalEntry comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "label": this.label = (value == null ? null : ((String)value).trim()); break; - - case "amount": this.amount = (BigDecimal) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "label": return this.label; - case "amount": return this.amount; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "label": return this.label; - case "amount": return this.amount; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java deleted file mode 100644 index d8d1ed9f9..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryChecker.java +++ /dev/null @@ -1,70 +0,0 @@ - -package com.example.exactdecimalservice.decimalentry; - -import com.example.exactdecimalservice.platform.Platform; -import com.example.exactdecimalservice.platform.PlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; - -public class DecimalEntryChecker implements Checker{ - - public String type(){ - return DecimalEntry.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, DecimalEntry decimalEntry, ObjectLocation _parentLocation){ - if(needCheck(_context, decimalEntry)){ - markAsChecked(_context, decimalEntry); - doCheck(_context, decimalEntry, _parentLocation); - } - } - - public void doCheck(UserContext _context, DecimalEntry decimalEntry, ObjectLocation _parentLocation){ - if((decimalEntry == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, decimalEntry); - if(decimalEntry.needPersist()){ - } - if(decimalEntry.newItem()){ - }else if(decimalEntry.updateItem()){ - if(!decimalEntry.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!decimalEntry.isPropertyLoaded("label")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "label"), "Mutation requires a fully loaded entity"); - } - if(!decimalEntry.isPropertyLoaded("amount")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "amount"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, decimalEntry.getProperty(DecimalEntry.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkLabel(_context, decimalEntry.getProperty(DecimalEntry.LABEL_PROPERTY), newLocation(_parentLocation, "label")); - checkAmount(_context, decimalEntry.getProperty(DecimalEntry.AMOUNT_PROPERTY), newLocation(_parentLocation, "amount")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkLabel(UserContext _context, String label, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, label); - if((label == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, label); - - } - public void checkAmount(UserContext _context, BigDecimal amount, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, amount); - if((amount == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java deleted file mode 100644 index f82745853..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.example.exactdecimalservice.decimalentry; - -import com.example.exactdecimalservice.platform.Platform; -import com.example.exactdecimalservice.platform.PlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.util.function.Function; - -public class DecimalEntryExpression extends ExpressionAdaptor implements BaseEntityExpression { - public DecimalEntryExpression(Expression expression){ - super(expression); - } - - public DecimalEntryExpression(Expression expression, Function function){ - super(expression, function); - } - - public DecimalEntryExpression updateId(Long id){ - return new DecimalEntryExpression(this, $it -> {((DecimalEntry)$it).__internalSet("id", id); return this;}); - } - - public DecimalEntryExpression save(UserContext userContext){ - return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).auditAs("Saved by Expression").save(userContext)); - } - - public DecimalEntryExpression save(String intent, UserContext userContext){ - return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", DecimalEntry::getPlatform)); - } - - public DecimalEntryExpression updatePlatform(Platform platform){ - return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updatePlatform(platform)); - } - - public Expression getLabel(){ - return loaded("label", "getLabel", DecimalEntry::getLabel); - } - public DecimalEntryExpression updateLabel(String label){ - return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updateLabel(label)); - } - - public Expression getAmount(){ - return loaded("amount", "getAmount", DecimalEntry::getAmount); - } - public DecimalEntryExpression updateAmount(BigDecimal amount){ - return new DecimalEntryExpression(this, $it -> ((DecimalEntry)$it).updateAmount(amount)); - } - -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java deleted file mode 100644 index b0a309601..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.exactdecimalservice.decimalentry; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class DecimalEntryListExpression extends SmartListExpression { - public DecimalEntryListExpression(Expression> expression){ - super(expression); - } - - public DecimalEntryListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public DecimalEntryExpression first() { - return new DecimalEntryExpression(super.first()); - } - - public DecimalEntryExpression get(int index) { - return new DecimalEntryExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java deleted file mode 100644 index ac7ccfed1..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/decimalentry/DecimalEntryRequest.java +++ /dev/null @@ -1,875 +0,0 @@ - -package com.example.exactdecimalservice.decimalentry; - -import com.example.exactdecimalservice.Q; -import com.example.exactdecimalservice.platform.Platform; -import com.example.exactdecimalservice.platform.PlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.util.Objects; - -public class DecimalEntryRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public DecimalEntryRequest(Class returnType){ - this(returnType, () -> (T) new DecimalEntry()); - } - - protected DecimalEntryRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public DecimalEntryRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public DecimalEntryRequest copy(){ - return (DecimalEntryRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new DecimalEntryRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public DecimalEntryRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public DecimalEntryRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public DecimalEntryRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public DecimalEntryRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public DecimalEntryRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public DecimalEntryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public DecimalEntryRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public DecimalEntryRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public DecimalEntryRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public DecimalEntryRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (DecimalEntryRequest)super.appendSearchCriteria(searchCriteria); - } - - public DecimalEntryRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public DecimalEntryRequest matchingAnyOf(DecimalEntryRequest decimalEntry){ - super.internalMatchAny(decimalEntry); - return this; - } - - public DecimalEntryRequest matchingIdsOf(DecimalEntryRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - DecimalEntry.ID_PROPERTY, request, DecimalEntry.ID_PROPERTY)); - } - - public DecimalEntryRequest enhanceChildrenIfNeeded(){ - return this; - } - - public DecimalEntryRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public DecimalEntryRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public DecimalEntryRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectLabel().selectAmount().selectVersion(); - } - - public DecimalEntryRequest selectSelfFields(){ - return selectSelf(); - } - - public DecimalEntryRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(DecimalEntry.ID_PROPERTY); - selectProperty(DecimalEntry.PLATFORM_PROPERTY); - selectProperty(DecimalEntry.LABEL_PROPERTY); - selectProperty(DecimalEntry.AMOUNT_PROPERTY); - selectProperty(DecimalEntry.VERSION_PROPERTY); - return this; - } - - public DecimalEntryRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectLabel().selectAmount().selectVersion(); - } - - public DecimalEntryRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectLabel().selectAmount().selectVersion(); - } - - - public DecimalEntryRequest selectId(){ - selectProperty(DecimalEntry.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public DecimalEntryRequest unselectId(){ - unselectProperty(DecimalEntry.ID_PROPERTY); - return this; - } - public DecimalEntryRequest selectPlatformIdOnly(){ - selectProperty(DecimalEntry.PLATFORM_PROPERTY); - return this; - } - - public DecimalEntryRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public DecimalEntryRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(DecimalEntry.PLATFORM_PROPERTY); - enhanceRelation(DecimalEntry.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, DecimalEntry.PLATFORM_PROPERTY)); - return this; - } - - public DecimalEntryRequest unselectPlatform(){ - unselectProperty(DecimalEntry.PLATFORM_PROPERTY); - return this; - } - public DecimalEntryRequest selectLabel(){ - selectProperty(DecimalEntry.LABEL_PROPERTY); - return this; - } - - /** - * fill the label with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS label) to fetch label property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public DecimalEntryRequest unselectLabel(){ - unselectProperty(DecimalEntry.LABEL_PROPERTY); - return this; - } - public DecimalEntryRequest selectAmount(){ - selectProperty(DecimalEntry.AMOUNT_PROPERTY); - return this; - } - - /** - * fill the amount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS amount) to fetch amount property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the amount with customized aggrFunction, TEAQL uses ({aggrFunction}(amount) AS amount to fetch amount property. - * @param aggrFunction aggrFunction - */ - public DecimalEntryRequest selectAmount(AggrFunction aggrFunction){ - selectProperty(DecimalEntry.AMOUNT_PROPERTY, aggrFunction); - return this; - } - - - public DecimalEntryRequest unselectAmount(){ - unselectProperty(DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest selectVersion(){ - selectProperty(DecimalEntry.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public DecimalEntryRequest unselectVersion(){ - unselectProperty(DecimalEntry.VERSION_PROPERTY); - return this; - } - - public DecimalEntryRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(DecimalEntry.ID_PROPERTY, operator, values); - } - - public DecimalEntryRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public DecimalEntryRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public DecimalEntryRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public DecimalEntryRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public DecimalEntryRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public DecimalEntryRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public DecimalEntryRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public DecimalEntryRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(DecimalEntry.PLATFORM_PROPERTY, operator, values); - } - - public DecimalEntryRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public DecimalEntryRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(DecimalEntry.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public DecimalEntryRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(DecimalEntry.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public DecimalEntryRequest filterByLabel(String... label){ - if (label == null || label.length == 0) { - throw new IllegalArgumentException("filterByLabel parameter label cannot be empty"); - } - return appendSearchCriteria(createLabelCriteria(Operator.EQUAL, (Object[])label)); - } - - public DecimalEntryRequest withLabel(Operator operator, Object... values){ - return appendSearchCriteria(createLabelCriteria(operator, values)); - } - - public DecimalEntryRequest withLabelIsUnknown(){ - return withLabel(Operator.IS_NULL); - } - - public DecimalEntryRequest withLabelIsKnown(){ - return withLabel(Operator.IS_NOT_NULL); - } - - public SearchCriteria createLabelCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(DecimalEntry.LABEL_PROPERTY, operator, values); - } - - public DecimalEntryRequest withLabelIsNot(String label){ - return withLabel(Operator.NOT_EQUAL, label); - } - - public DecimalEntryRequest withLabelIn(String... label){ - return withLabel(Operator.IN, (Object[])label); - } - - public DecimalEntryRequest withLabelNotIn(String... label){ - return withLabel(Operator.NOT_IN, (Object[])label); - } - public DecimalEntryRequest withLabelGreaterThan(String label){ - return withLabel(Operator.GREATER_THAN, label); - } - - public DecimalEntryRequest withLabelGreaterThanOrEqualTo(String label){ - return withLabel(Operator.GREATER_THAN_OR_EQUAL, label); - } - - public DecimalEntryRequest withLabelLessThan(String label){ - return withLabel(Operator.LESS_THAN, label); - } - - public DecimalEntryRequest withLabelLessThanOrEqualTo(String label){ - return withLabel(Operator.LESS_THAN_OR_EQUAL, label); - } - - public DecimalEntryRequest withLabelBetween(String startOfLabel, String endOfLabel){ - return withLabel(Operator.BETWEEN, startOfLabel, endOfLabel); - } - public DecimalEntryRequest withLabelStartingWith(String label){ - return withLabel(Operator.BEGIN_WITH, label); - } - public DecimalEntryRequest withLabelContaining(String label){ - return withLabel(Operator.CONTAIN, label); - } - - public DecimalEntryRequest withLabelNotContaining(String label){ - return withLabel(Operator.NOT_CONTAIN, label); - } - - public DecimalEntryRequest withLabelNotStartingWith(String label){ - return withLabel(Operator.NOT_BEGIN_WITH, label); - } - - public DecimalEntryRequest withLabelEndingWith(String label){ - return withLabel(Operator.END_WITH, label); - } - - public DecimalEntryRequest withLabelNotEndingWith(String label){ - return withLabel(Operator.NOT_END_WITH, label); - } - - public DecimalEntryRequest withLabelIs(String label){ - return withLabel(Operator.EQUAL, label); - } - - public DecimalEntryRequest withLabelSoundingLike(String label){ - return withLabel(Operator.SOUNDS_LIKE, label); - } - - - - public DecimalEntryRequest filterByAmount(BigDecimal... amount){ - if (amount == null || amount.length == 0) { - throw new IllegalArgumentException("filterByAmount parameter amount cannot be empty"); - } - return appendSearchCriteria(createAmountCriteria(Operator.EQUAL, (Object[])amount)); - } - - public DecimalEntryRequest withAmount(Operator operator, Object... values){ - return appendSearchCriteria(createAmountCriteria(operator, values)); - } - - public DecimalEntryRequest withAmountIsUnknown(){ - return withAmount(Operator.IS_NULL); - } - - public DecimalEntryRequest withAmountIsKnown(){ - return withAmount(Operator.IS_NOT_NULL); - } - - public SearchCriteria createAmountCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(DecimalEntry.AMOUNT_PROPERTY, operator, values); - } - - public DecimalEntryRequest withAmountIs(BigDecimal amount){ - return withAmount(Operator.EQUAL, amount); - } - - public DecimalEntryRequest withAmountIsNot(BigDecimal amount){ - return withAmount(Operator.NOT_EQUAL, amount); - } - - public DecimalEntryRequest withAmountIn(BigDecimal... amount){ - return withAmount(Operator.IN, (Object[])amount); - } - - public DecimalEntryRequest withAmountNotIn(BigDecimal... amount){ - return withAmount(Operator.NOT_IN, (Object[])amount); - } - public DecimalEntryRequest withAmountGreaterThan(BigDecimal amount){ - return withAmount(Operator.GREATER_THAN, amount); - } - - public DecimalEntryRequest withAmountGreaterThanOrEqualTo(BigDecimal amount){ - return withAmount(Operator.GREATER_THAN_OR_EQUAL, amount); - } - - public DecimalEntryRequest withAmountLessThan(BigDecimal amount){ - return withAmount(Operator.LESS_THAN, amount); - } - - public DecimalEntryRequest withAmountLessThanOrEqualTo(BigDecimal amount){ - return withAmount(Operator.LESS_THAN_OR_EQUAL, amount); - } - - public DecimalEntryRequest withAmountBetween(BigDecimal startOfAmount, BigDecimal endOfAmount){ - return withAmount(Operator.BETWEEN, startOfAmount, endOfAmount); - } - - - - public DecimalEntryRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public DecimalEntryRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public DecimalEntryRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public DecimalEntryRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(DecimalEntry.VERSION_PROPERTY, operator, values); - } - - public DecimalEntryRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public DecimalEntryRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public DecimalEntryRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public DecimalEntryRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public DecimalEntryRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public DecimalEntryRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public DecimalEntryRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public DecimalEntryRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public DecimalEntryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public DecimalEntryRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public DecimalEntryRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public DecimalEntryRequest minAmount(){ - return minAmountAs(prefix("minOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest minAmountAs(String retName){ - super.min(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest maxAmount(){ - return maxAmountAs(prefix("maxOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest maxAmountAs(String retName){ - super.max(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest sumAmount(){ - return sumAmountAs(prefix("sumOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest sumAmountAs(String retName){ - super.sum(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest avgAmount(){ - return avgAmountAs(prefix("avgOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest avgAmountAs(String retName){ - super.avg(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest standardDeviationAmount(){ - return standardDeviationAmountAs(prefix("standardDeviationOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest standardDeviationAmountAs(String retName){ - super.standardDeviation(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest squareRootOfPopulationStandardDeviationAmount(){ - return squareRootOfPopulationStandardDeviationAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest squareRootOfPopulationStandardDeviationAmountAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest sampleVarianceAmount(){ - return sampleVarianceAmountAs(prefix("sampleVarianceOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest sampleVarianceAmountAs(String retName){ - super.sampleVariance(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest samplePopulationVarianceAmount(){ - return samplePopulationVarianceAmountAs(prefix("samplePopulationVarianceOf",DecimalEntry.AMOUNT_PROPERTY)); - } - - public DecimalEntryRequest samplePopulationVarianceAmountAs(String retName){ - super.samplePopulationVariance(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public DecimalEntryRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(DecimalEntry.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public DecimalEntryRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public DecimalEntryRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, DecimalEntry.ID_PROPERTY); - return this; - } - public DecimalEntryRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public DecimalEntryRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, DecimalEntry.PLATFORM_PROPERTY); - return this; - } - public DecimalEntryRequest countDistinctLabel(){ - return countDistinctLabelAs("label_distinct_count"); - } - - public DecimalEntryRequest countDistinctLabelAs(String alias){ - super.countDistinctProperty(alias, DecimalEntry.LABEL_PROPERTY); - return this; - } - public DecimalEntryRequest countDistinctAmount(){ - return countDistinctAmountAs("amount_distinct_count"); - } - - public DecimalEntryRequest countDistinctAmountAs(String alias){ - super.countDistinctProperty(alias, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - public DecimalEntryRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public DecimalEntryRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, DecimalEntry.VERSION_PROPERTY); - return this; - } - - public DecimalEntryRequest groupById(){ - groupBy(DecimalEntry.ID_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByIdAs(String retName){ - groupBy(retName, DecimalEntry.ID_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, DecimalEntry.ID_PROPERTY, function); - return this; - } - public DecimalEntryRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(DecimalEntry.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public DecimalEntryRequest groupByPlatform(){ - groupBy(DecimalEntry.PLATFORM_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByPlatformAs(String retName){ - groupBy(retName, DecimalEntry.PLATFORM_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, DecimalEntry.PLATFORM_PROPERTY, function); - return this; - } - - public DecimalEntryRequest groupByLabel(){ - groupBy(DecimalEntry.LABEL_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByLabelAs(String retName){ - groupBy(retName, DecimalEntry.LABEL_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByLabelWithFunction(String retName, AggrFunction function){ - groupBy(retName, DecimalEntry.LABEL_PROPERTY, function); - return this; - } - - public DecimalEntryRequest groupByAmount(){ - groupBy(DecimalEntry.AMOUNT_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByAmountAs(String retName){ - groupBy(retName, DecimalEntry.AMOUNT_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByAmountWithFunction(String retName, AggrFunction function){ - groupBy(retName, DecimalEntry.AMOUNT_PROPERTY, function); - return this; - } - - public DecimalEntryRequest groupByVersion(){ - groupBy(DecimalEntry.VERSION_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByVersionAs(String retName){ - groupBy(retName, DecimalEntry.VERSION_PROPERTY); - return this; - } - - public DecimalEntryRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, DecimalEntry.VERSION_PROPERTY, function); - return this; - } - - - - public DecimalEntryRequest orderByIdAscending(){ - addOrderByAscending(DecimalEntry.ID_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByIdDescending(){ - addOrderByDescending(DecimalEntry.ID_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByPlatformAscending(){ - addOrderByAscending(DecimalEntry.PLATFORM_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByPlatformDescending(){ - addOrderByDescending(DecimalEntry.PLATFORM_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByLabelAscending(){ - addOrderByAscending(DecimalEntry.LABEL_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByLabelDescending(){ - addOrderByDescending(DecimalEntry.LABEL_PROPERTY); - return this; - } - public DecimalEntryRequest orderByLabelAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(DecimalEntry.LABEL_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByLabelDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(DecimalEntry.LABEL_PROPERTY); - return this; - } - public DecimalEntryRequest orderByAmountAscending(){ - addOrderByAscending(DecimalEntry.AMOUNT_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByAmountDescending(){ - addOrderByDescending(DecimalEntry.AMOUNT_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByVersionAscending(){ - addOrderByAscending(DecimalEntry.VERSION_PROPERTY); - return this; - } - - public DecimalEntryRequest orderByVersionDescending(){ - addOrderByDescending(DecimalEntry.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - public DecimalEntryRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public DecimalEntryRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, DecimalEntry.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, DecimalEntry.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public DecimalEntryRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public DecimalEntryRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public DecimalEntryRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public DecimalEntryRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public DecimalEntryRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public DecimalEntryRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java deleted file mode 100644 index 068e5825c..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/Platform.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.example.exactdecimalservice.platform; - -import com.example.exactdecimalservice.decimalentry.DecimalEntry; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "41daef4cd31b0d2446142c4e2de17ed30f1cc3fd56cbd671ec26e0bad3ef5734"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "decimal_entry_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String DECIMAL_ENTRY_LIST_PROPERTY = "decimal_entry_list"; - private String name; - - private SmartList decimalEntryList; - - public String getName(){ - return this.name; - } - - public SmartList getDecimalEntryList(){ - return this.decimalEntryList == null ? SmartList.unloaded() : this.decimalEntryList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform addDecimalEntry(DecimalEntry decimalEntry){ - if (decimalEntry == null){ - return this; - } - - if(null == this.decimalEntryList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.decimalEntryList = teaqlUnloadedItems.map(value -> value); - } - - this.decimalEntryList.add(decimalEntry); - decimalEntry.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "decimal_entry_list": this.decimalEntryList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "decimal_entry_list": return this.decimalEntryList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java deleted file mode 100644 index e247d04f2..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.example.exactdecimalservice.platform; - -import com.example.exactdecimalservice.decimalentry.DecimalEntry; -import com.example.exactdecimalservice.decimalentry.DecimalEntryChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; platform.getDecimalEntryList() != null && i < platform.getDecimalEntryList().size(); i++){ - DecimalEntry decimalEntry = platform.getDecimalEntryList().get(i); - new DecimalEntryChecker().checkAndFix(_context, decimalEntry, newLocation(_parentLocation, "decimal_entry_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java deleted file mode 100644 index 6a15a11bf..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.example.exactdecimalservice.platform; - -import com.example.exactdecimalservice.decimalentry.DecimalEntry; -import com.example.exactdecimalservice.decimalentry.DecimalEntryListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public DecimalEntryListExpression getDecimalEntryList(){ - return new DecimalEntryListExpression(loaded("decimal_entry_list", "getDecimalEntryList", Platform::getDecimalEntryList)); - } - public PlatformExpression addDecimalEntry(DecimalEntry decimalEntry){ - return new PlatformExpression(this, $it -> ((Platform)$it).addDecimalEntry(decimalEntry)); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java deleted file mode 100644 index f19338f41..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.exactdecimalservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java deleted file mode 100644 index b9bf27617..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/platform/PlatformRequest.java +++ /dev/null @@ -1,775 +0,0 @@ - -package com.example.exactdecimalservice.platform; - -import com.example.exactdecimalservice.Q; -import com.example.exactdecimalservice.decimalentry.DecimalEntry; -import com.example.exactdecimalservice.decimalentry.DecimalEntryRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectDecimalEntryList(); - return selectId().selectName().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectDecimalEntryList(){ - return selectDecimalEntryListWith(Q.decimalEntries().selectSelf()); - } - - public PlatformRequest selectDecimalEntryListWith(DecimalEntryRequest decimalEntryList){ - enhanceRelation(Platform.DECIMAL_ENTRY_LIST_PROPERTY, decimalEntryList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectDecimalEntryListWith", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withDecimalEntryListMatching(DecimalEntryRequest decimalEntryRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, decimalEntryRequest, DecimalEntry.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutDecimalEntryListMatching(DecimalEntryRequest decimalEntryRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, decimalEntryRequest, DecimalEntry.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveDecimalEntries(){ - return withDecimalEntryListMatching(Q.decimalEntries().unlimited()); - } - - public PlatformRequest haveNoDecimalEntries(){ - return withoutDecimalEntryListMatching(Q.decimalEntries().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupByDecimalEntriesWithDetails(DecimalEntryRequest subRequest){ - aggregate(Platform.DECIMAL_ENTRY_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - return statsFromDecimalEntriesAs(name, subRequest, false); - } - - public PlatformRequest statsFromDecimalEntriesAs(String name, DecimalEntryRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromDecimalEntries(DecimalEntryRequest subRequest){ - return statsFromDecimalEntriesAs(REFINEMENTS, subRequest); - } - public PlatformRequest countDecimalEntries(){ - addRelationCount("Count", Q.decimalEntries().unlimited(), DecimalEntry.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countDecimalEntriesAs(String name){ - addRelationCount(name, Q.decimalEntries().unlimited(), DecimalEntry.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countDecimalEntriesWith(String name, DecimalEntryRequest subRequest){ - addRelationCount(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countDecimalEntriesWith", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest minAmountOfDecimalEntries(){ - addRelationScalarAggregate("minAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minAmountOfDecimalEntriesAs(String name){ - return minAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest minAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxAmountOfDecimalEntries(){ - addRelationScalarAggregate("maxAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxAmountOfDecimalEntriesAs(String name){ - return maxAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest maxAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumAmountOfDecimalEntries(){ - addRelationScalarAggregate("sumAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumAmountOfDecimalEntriesAs(String name){ - return sumAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest sumAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgAmountOfDecimalEntries(){ - addRelationScalarAggregate("avgAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgAmountOfDecimalEntriesAs(String name){ - return avgAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest avgAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationAmountOfDecimalEntries(){ - addRelationScalarAggregate("stdDevAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationAmountOfDecimalEntriesAs(String name){ - return standardDeviationAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest standardDeviationAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntries(){ - addRelationScalarAggregate("stdDevPopAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(String name){ - return squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceAmountOfDecimalEntries(){ - addRelationScalarAggregate("varSampAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceAmountOfDecimalEntriesAs(String name){ - return sampleVarianceAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest sampleVarianceAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceAmountOfDecimalEntries(){ - addRelationScalarAggregate("varPopAmountOfDecimalEntries", Q.decimalEntries().unlimited(), - DecimalEntry.PLATFORM_PROPERTY, DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfDecimalEntries", null, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceAmountOfDecimalEntriesAs(String name){ - return samplePopulationVarianceAmountOfDecimalEntriesAs(name, Q.decimalEntries().unlimited()); - } - - public PlatformRequest samplePopulationVarianceAmountOfDecimalEntriesAs(String name, DecimalEntryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, DecimalEntry.PLATFORM_PROPERTY, - DecimalEntry.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfDecimalEntriesAs", name, Platform.DECIMAL_ENTRY_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java b/examples/exact-decimal/java-app-console/lib/src/main/java/com/example/exactdecimalservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 905bf682c..000000000 --- a/examples/exact-decimal/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.exactdecimalservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/exact-decimal/showcase.json b/examples/exact-decimal/showcase.json index 988a08a1e..e2d6886da 100644 --- a/examples/exact-decimal/showcase.json +++ b/examples/exact-decimal/showcase.json @@ -44,6 +44,7 @@ ], "generatedFilesManifestSHA256": "32b7b30df0b016e6ca704ec9fc7058a5554c3b4de03cf55e9d001c5319351eac", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/fix-e-alignment/java-app-console/lib/pom.xml b/examples/fix-e-alignment/java-app-console/lib/pom.xml deleted file mode 100644 index 6dd4b0584..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - checker-fix-advanced-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java deleted file mode 100644 index 43c910926..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/CheckerFixAdvancedUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.checkerfixadvanced; - -import io.teaql.core.UserContext; -public interface CheckerFixAdvancedUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java deleted file mode 100644 index 6862c47e3..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.checkerfixadvanced; - -import com.teaql.checkerfixadvanced.tenant.Tenant; - -public interface Constants { - public static final long TENANT_ID = 1l; - public static final Tenant TENANT = Tenant.refer(TENANT_ID); -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/E.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/E.java deleted file mode 100644 index 307aeb458..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/E.java +++ /dev/null @@ -1,23 +0,0 @@ - -package com.teaql.checkerfixadvanced; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemExpression; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderExpression; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static TenantExpression tenant(Tenant tenant){ - return new TenantExpression(new ValueExpression(tenant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.tenant()")); - } - public static PurchaseOrderExpression purchaseOrder(PurchaseOrder purchaseOrder){ - return new PurchaseOrderExpression(new ValueExpression(purchaseOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.purchaseOrder()")); - } - public static OrderItemExpression orderItem(OrderItem orderItem){ - return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java deleted file mode 100644 index b173f7b31..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/EntityMetaRegistry.java +++ /dev/null @@ -1,610 +0,0 @@ - -package com.teaql.checkerfixadvanced; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerTenant(); - registerPurchaseOrder(); - registerOrderItem(); - } - private void registerTenant() { - FieldLayout.installGenerated(com.teaql.checkerfixadvanced.tenant.Tenant.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.tenant.Tenant.class); - entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.tenant.Tenant::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "80") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Tenant Name") - - .with("sqlType", "VARCHAR()") - - .with("min", "1") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.tenant.Tenant.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerPurchaseOrder() { - FieldLayout.installGenerated(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor tenant = - entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE, com.teaql.checkerfixadvanced.tenant.Tenant.PURCHASE_ORDER_LIST_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.class) - ; - PropertyDescriptor contactPhone = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY, String.class) - ; - PropertyDescriptor internalNote = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY, String.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.TENANT_PROPERTY).with("contextRoot", "true") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CONTACT_PHONE_PROPERTY).with("isPassword", "false") - - .with("max", "32") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("min", "1") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_NOTE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderItem() { - FieldLayout.installGenerated(com.teaql.checkerfixadvanced.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.checkerfixadvanced.orderitem.OrderItem.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.checkerfixadvanced.orderitem.OrderItem.class); - entityDescriptor.setEntitySupplier(com.teaql.checkerfixadvanced.orderitem.OrderItem::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY, Long.class) - ; - PropertyDescriptor purchaseOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.INTERNAL_TYPE, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class) - ; - PropertyDescriptor tenant = - entityDescriptor.addObjectProperty($factory, com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.INTERNAL_TYPE, com.teaql.checkerfixadvanced.tenant.Tenant.ORDER_ITEM_LIST_PROPERTY, com.teaql.checkerfixadvanced.tenant.Tenant.class) - ; - PropertyDescriptor productName = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY, String.class) - ; - PropertyDescriptor unitPrice = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PURCHASE_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.TENANT_PROPERTY).with("contextRoot", "true") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") - - .with("max", "80") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("min", "1") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") - - .with("max", "1000000") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("sqlType", "NUMERIC(19,7)") - - .with("min", "0.01") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.checkerfixadvanced.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java deleted file mode 100644 index 5a86c62ad..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/GeneratedRuntimeModule.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.teaql.checkerfixadvanced; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.checkerfixadvanced.tenant.TenantChecker(), new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker(), new com.teaql.checkerfixadvanced.orderitem.OrderItemChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:cbc03c71084d5ff17fe312ca583e790e692d2ecb065fe3a55ec2398eb9189248\",\"entities\":{\"OrderItem\":{\"labels\":{\"en\":\"order item\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"purchase_order\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrder\",\"purchaseOrder\"]},{\"name\":\"tenant\",\"targetType\":\"Tenant\",\"labels\":{\"en\":\"tenant\"},\"aliases\":[\"Tenant\"]},{\"name\":\"unit_price\",\"labels\":{\"en\":\"unit price\"},\"aliases\":[\"UnitPrice\",\"unitPrice\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PurchaseOrder\":{\"labels\":{\"en\":\"purchase order\"},\"fields\":[{\"name\":\"contact_phone\",\"labels\":{\"en\":\"contact phone\"},\"aliases\":[\"ContactPhone\",\"contactPhone\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"internal_note\",\"labels\":{\"en\":\"internal note\"},\"aliases\":[\"InternalNote\",\"internalNote\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"tenant\",\"targetType\":\"Tenant\",\"labels\":{\"en\":\"tenant\"},\"aliases\":[\"Tenant\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Tenant\":{\"labels\":{\"en\":\"tenant\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"purchase_order_list\",\"targetType\":\"PurchaseOrder\",\"labels\":{\"en\":\"purchase order\"},\"aliases\":[\"PurchaseOrderList\",\"purchaseOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Tenant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("PurchaseOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("tenant", "tenant"), java.util.Map.entry("contact_phone", "contactPhone"), java.util.Map.entry("internal_note", "internalNote"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("purchase_order", "purchaseOrder"), java.util.Map.entry("tenant", "tenant"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("unit_price", "unitPrice"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.tenants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.checkerfixadvanced.tenant.Tenant domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.checkerfixadvanced.tenant.Tenant(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Tenant Name"); - domainRoot.auditAs("create generated Domain Root Tenant").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Tenant", domainRoot.getId())); - } -} diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java deleted file mode 100644 index cc57960a1..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Q.java +++ /dev/null @@ -1,34 +0,0 @@ - -package com.teaql.checkerfixadvanced; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.checkerfixadvanced.tenant.TenantRequest tenants(){ - return new com.teaql.checkerfixadvanced.tenant.TenantRequest(com.teaql.checkerfixadvanced.tenant.Tenant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.checkerfixadvanced.tenant.TenantRequest tenantsWithMinimalFields(){ - return new com.teaql.checkerfixadvanced.tenant.TenantRequest(com.teaql.checkerfixadvanced.tenant.Tenant.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest purchaseOrders(){ - return new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest purchaseOrdersWithMinimalFields(){ - return new com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest(com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.checkerfixadvanced.orderitem.OrderItemRequest orderItems(){ - return new com.teaql.checkerfixadvanced.orderitem.OrderItemRequest(com.teaql.checkerfixadvanced.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.checkerfixadvanced.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ - return new com.teaql.checkerfixadvanced.orderitem.OrderItemRequest(com.teaql.checkerfixadvanced.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java deleted file mode 100644 index 894c1a9aa..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItem.java +++ /dev/null @@ -1,211 +0,0 @@ - -package com.teaql.checkerfixadvanced.orderitem; - -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderItem extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderItem"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7d17fd30f99ff7729c89502083418f85d482d6c6b7448972408e96e73ae79d75"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("purchase_order", 1), java.util.Map.entry("tenant", 2), java.util.Map.entry("product_name", 3), java.util.Map.entry("unit_price", 4), java.util.Map.entry("create_time", 5), java.util.Map.entry("update_time", 6), java.util.Map.entry("version", 7)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("purchase_order", java.util.List.of("purchaseOrder", "purchase_order")), java.util.Map.entry("tenant", java.util.List.of("tenant", "tenant")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("unit_price", java.util.List.of("unitPrice", "unit_price")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PURCHASE_ORDER_PROPERTY = "purchase_order"; - public static final String TENANT_PROPERTY = "tenant"; - public static final String PRODUCT_NAME_PROPERTY = "product_name"; - public static final String UNIT_PRICE_PROPERTY = "unit_price"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - private PurchaseOrder purchaseOrder; - - private Tenant tenant; - - private String productName; - - private BigDecimal unitPrice; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - - public PurchaseOrder getPurchaseOrder(){ - return this.purchaseOrder; - } - - public Tenant getTenant(){ - return this.tenant; - } - - public String getProductName(){ - return this.productName; - } - - public BigDecimal getUnitPrice(){ - return this.unitPrice; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public OrderItem updatePurchaseOrder(PurchaseOrder purchaseOrder){ - if(isPropertyLoaded(PURCHASE_ORDER_PROPERTY) && Objects.equals(this.purchaseOrder, purchaseOrder)){ - return this; - } - handleUpdate(PURCHASE_ORDER_PROPERTY, getPurchaseOrder(), purchaseOrder); - this.purchaseOrder = purchaseOrder; - return this; - } - - OrderItem updateTenant(Tenant tenant){ - if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ - return this; - } - handleUpdate(TENANT_PROPERTY, getTenant(), tenant); - this.tenant = tenant; - return this; - } - - public OrderItem updateProductName(String productName){ - productName = (productName == null ? null : productName.trim()); - if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ - return this; - } - handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); - this.productName = productName; - return this; - } - - public OrderItem updateUnitPrice(BigDecimal unitPrice){ - if(isPropertyLoaded(UNIT_PRICE_PROPERTY) && Objects.equals(this.unitPrice, unitPrice)){ - return this; - } - handleUpdate(UNIT_PRICE_PROPERTY, getUnitPrice(), unitPrice); - this.unitPrice = unitPrice; - return this; - } - - public OrderItem updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public OrderItem updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - - public static OrderItem refer(Long id){ - OrderItem refer = new OrderItem(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderItem comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "purchase_order": this.purchaseOrder = (PurchaseOrder) value; break; - - case "tenant": this.tenant = (Tenant) value; break; - - case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; - - case "unit_price": this.unitPrice = (BigDecimal) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "purchase_order": return this.purchaseOrder; - case "tenant": return this.tenant; - case "product_name": return this.productName; - case "unit_price": return this.unitPrice; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "purchaseOrder": return this.purchaseOrder; - case "tenant": return this.tenant; - case "productName": return this.productName; - case "unitPrice": return this.unitPrice; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java deleted file mode 100644 index 03b568650..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemChecker.java +++ /dev/null @@ -1,139 +0,0 @@ - -package com.teaql.checkerfixadvanced.orderitem; - -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -public class OrderItemChecker implements Checker{ - - public String type(){ - return OrderItem.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if(needCheck(_context, orderItem)){ - markAsChecked(_context, orderItem); - doCheck(_context, orderItem, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if((orderItem == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderItem); - if(orderItem.needPersist()){ - verifyContextRoot(_context, orderItem, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); - - } - if(orderItem.newItem()){ - if(orderItem.getTenant() == null){ - orderItem.updateTenant(Tenant.refer(_context.requireActiveRoot("Tenant").id())); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "tenant", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "activeRoot:Tenant")); - }else{ - _context.verifyActiveRoot("Tenant", orderItem.getTenant().getId()); - } - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - orderItem.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - orderItem.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(orderItem.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - orderItem.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!orderItem.isPropertyLoaded("purchase_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "purchase_order"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("tenant")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("product_name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("unit_price")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "unit_price"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkPurchaseOrder(_context, orderItem.getProperty(OrderItem.PURCHASE_ORDER_PROPERTY), newLocation(_parentLocation, "purchase_order")); - checkTenant(_context, orderItem.getProperty(OrderItem.TENANT_PROPERTY), newLocation(_parentLocation, "tenant")); - checkProductName(_context, orderItem.getProperty(OrderItem.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); - checkUnitPrice(_context, orderItem.getProperty(OrderItem.UNIT_PRICE_PROPERTY), newLocation(_parentLocation, "unit_price")); - checkCreateTime(_context, orderItem.getProperty(OrderItem.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, orderItem.getProperty(OrderItem.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - } - - public void checkPurchaseOrder(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, purchaseOrder); - if((purchaseOrder == null)){ - return; - } - new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, _parentLocation); - } - public void checkTenant(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, tenant); - if((tenant == null)){ - return; - } - new TenantChecker().checkAndFix(_context, tenant, _parentLocation); - } - public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, productName); - if((productName == null)){ - return; - } - minStringCheck(_context, _parentLocation, 1, productName); - maxStringCheck(_context, _parentLocation, 80, productName); - - } - public void checkUnitPrice(UserContext _context, BigDecimal unitPrice, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, unitPrice); - if((unitPrice == null)){ - return; - } - minNumberCheck(_context, _parentLocation, 0.01, unitPrice); - maxNumberCheck(_context, _parentLocation, 1000000, unitPrice); - - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java deleted file mode 100644 index 282d0ad15..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemExpression.java +++ /dev/null @@ -1,86 +0,0 @@ - -package com.teaql.checkerfixadvanced.orderitem; - -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderExpression; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderItemExpression(Expression expression){ - super(expression); - } - - public OrderItemExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderItemExpression updateId(Long id){ - return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); - } - - public OrderItemExpression save(UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderItemExpression save(String intent, UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PurchaseOrderExpression getPurchaseOrder(){ - return new PurchaseOrderExpression(loaded("purchase_order", "getPurchaseOrder", OrderItem::getPurchaseOrder)); - } - - public OrderItemExpression updatePurchaseOrder(PurchaseOrder purchaseOrder){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updatePurchaseOrder(purchaseOrder)); - } - - public TenantExpression getTenant(){ - return new TenantExpression(loaded("tenant", "getTenant", OrderItem::getTenant)); - } - - public OrderItemExpression updateTenant(Tenant tenant){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateTenant(tenant)); - } - - public Expression getProductName(){ - return loaded("product_name", "getProductName", OrderItem::getProductName); - } - public OrderItemExpression updateProductName(String productName){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateProductName(productName)); - } - - public Expression getUnitPrice(){ - return loaded("unit_price", "getUnitPrice", OrderItem::getUnitPrice); - } - public OrderItemExpression updateUnitPrice(BigDecimal unitPrice){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUnitPrice(unitPrice)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", OrderItem::getCreateTime); - } - public OrderItemExpression updateCreateTime(LocalDateTime createTime){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", OrderItem::getUpdateTime); - } - public OrderItemExpression updateUpdateTime(LocalDateTime updateTime){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUpdateTime(updateTime)); - } - -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java deleted file mode 100644 index d1274ee3d..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.checkerfixadvanced.orderitem; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderItemListExpression extends SmartListExpression { - public OrderItemListExpression(Expression> expression){ - super(expression); - } - - public OrderItemListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderItemExpression first() { - return new OrderItemExpression(super.first()); - } - - public OrderItemExpression get(int index) { - return new OrderItemExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java deleted file mode 100644 index 16b7677f5..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/orderitem/OrderItemRequest.java +++ /dev/null @@ -1,1266 +0,0 @@ - -package com.teaql.checkerfixadvanced.orderitem; - -import com.teaql.checkerfixadvanced.Q; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class OrderItemRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderItemRequest(Class returnType){ - this(returnType, () -> (T) new OrderItem()); - } - - protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderItemRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderItemRequest copy(){ - return (OrderItemRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderItemRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderItemRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderItemRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderItemRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderItemRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ - super.internalMatchAny(orderItem); - return this; - } - - public OrderItemRequest matchingIdsOf(OrderItemRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); - } - - public OrderItemRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderItemRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderItemRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderItemRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPurchaseOrderIdOnly().selectTenantIdOnly().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public OrderItemRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderItemRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderItem.ID_PROPERTY); - selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); - selectProperty(OrderItem.TENANT_PROPERTY); - selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); - selectProperty(OrderItem.UNIT_PRICE_PROPERTY); - selectProperty(OrderItem.CREATE_TIME_PROPERTY); - selectProperty(OrderItem.UPDATE_TIME_PROPERTY); - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest selectAll(){ - super.selectAll(); - return selectId().selectPurchaseOrder().selectTenant().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public OrderItemRequest selectChildren(){ - super.selectAny(); - return selectId().selectPurchaseOrder().selectTenant().selectProductName().selectUnitPrice().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public OrderItemRequest selectId(){ - selectProperty(OrderItem.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectId(){ - unselectProperty(OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest selectPurchaseOrderIdOnly(){ - selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest selectPurchaseOrder(){ - return selectPurchaseOrderWith(Q.purchaseOrders().unlimited().selectSelf()); - } - - public OrderItemRequest selectPurchaseOrderWith(PurchaseOrderRequest purchaseOrder){ - selectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); - enhanceRelation(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderWith", null, OrderItem.PURCHASE_ORDER_PROPERTY)); - return this; - } - - public OrderItemRequest unselectPurchaseOrder(){ - unselectProperty(OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - public OrderItemRequest selectTenantIdOnly(){ - selectProperty(OrderItem.TENANT_PROPERTY); - return this; - } - - public OrderItemRequest selectTenant(){ - return selectTenantWith(Q.tenants().unlimited().selectSelf()); - } - - public OrderItemRequest selectTenantWith(TenantRequest tenant){ - selectProperty(OrderItem.TENANT_PROPERTY); - enhanceRelation(OrderItem.TENANT_PROPERTY, tenant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTenantWith", null, OrderItem.TENANT_PROPERTY)); - return this; - } - - public OrderItemRequest unselectTenant(){ - unselectProperty(OrderItem.TENANT_PROPERTY); - return this; - } - public OrderItemRequest selectProductName(){ - selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - /** - * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectProductName(){ - unselectProperty(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest selectUnitPrice(){ - selectProperty(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - /** - * fill the unitPrice with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS unitPrice) to fetch unitPrice property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the unitPrice with customized aggrFunction, TEAQL uses ({aggrFunction}(unitPrice) AS unitPrice to fetch unitPrice property. - * @param aggrFunction aggrFunction - */ - public OrderItemRequest selectUnitPrice(AggrFunction aggrFunction){ - selectProperty(OrderItem.UNIT_PRICE_PROPERTY, aggrFunction); - return this; - } - - - public OrderItemRequest unselectUnitPrice(){ - unselectProperty(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest selectCreateTime(){ - selectProperty(OrderItem.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectCreateTime(){ - unselectProperty(OrderItem.CREATE_TIME_PROPERTY); - return this; - } - public OrderItemRequest selectUpdateTime(){ - selectProperty(OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectUpdateTime(){ - unselectProperty(OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - public OrderItemRequest selectVersion(){ - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectVersion(){ - unselectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); - } - - public OrderItemRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderItemRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderItemRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderItemRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderItemRequest filterByPurchaseOrder(PurchaseOrder... purchaseOrder){ - if (purchaseOrder == null || purchaseOrder.length == 0) { - throw new IllegalArgumentException("filterByPurchaseOrder parameter purchaseOrder cannot be empty"); - } - return appendSearchCriteria(createPurchaseOrderCriteria(Operator.EQUAL, (Object[])purchaseOrder)); - } - - public OrderItemRequest withPurchaseOrder(Operator operator, Object... values){ - return appendSearchCriteria(createPurchaseOrderCriteria(operator, values)); - } - - public OrderItemRequest withPurchaseOrderIsUnknown(){ - return withPurchaseOrder(Operator.IS_NULL); - } - - public OrderItemRequest withPurchaseOrderIsKnown(){ - return withPurchaseOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPurchaseOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, operator, values); - } - - public OrderItemRequest filterByPurchaseOrder(Long purchaseOrder){ - if(purchaseOrder == null){ - return this; - } - return withPurchaseOrder(Operator.EQUAL, purchaseOrder); - } - public OrderItemRequest withPurchaseOrderMatching(PurchaseOrderRequest purchaseOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, PurchaseOrder.ID_PROPERTY)); - } - - public OrderItemRequest withoutPurchaseOrderMatching(PurchaseOrderRequest purchaseOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, PurchaseOrder.ID_PROPERTY))); - } - - public OrderItemRequest filterByTenant(Tenant... tenant){ - if (tenant == null || tenant.length == 0) { - throw new IllegalArgumentException("filterByTenant parameter tenant cannot be empty"); - } - return appendSearchCriteria(createTenantCriteria(Operator.EQUAL, (Object[])tenant)); - } - - public OrderItemRequest withTenant(Operator operator, Object... values){ - return appendSearchCriteria(createTenantCriteria(operator, values)); - } - - public OrderItemRequest withTenantIsUnknown(){ - return withTenant(Operator.IS_NULL); - } - - public OrderItemRequest withTenantIsKnown(){ - return withTenant(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTenantCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.TENANT_PROPERTY, operator, values); - } - - public OrderItemRequest filterByTenant(Long tenant){ - if(tenant == null){ - return this; - } - return withTenant(Operator.EQUAL, tenant); - } - public OrderItemRequest withTenantMatching(TenantRequest tenant){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY)); - } - - public OrderItemRequest withoutTenantMatching(TenantRequest tenant){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderItem.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY))); - } - - public OrderItemRequest filterByProductName(String... productName){ - if (productName == null || productName.length == 0) { - throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); - } - return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); - } - - public OrderItemRequest withProductName(Operator operator, Object... values){ - return appendSearchCriteria(createProductNameCriteria(operator, values)); - } - - public OrderItemRequest withProductNameIsUnknown(){ - return withProductName(Operator.IS_NULL); - } - - public OrderItemRequest withProductNameIsKnown(){ - return withProductName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.PRODUCT_NAME_PROPERTY, operator, values); - } - - public OrderItemRequest withProductNameIsNot(String productName){ - return withProductName(Operator.NOT_EQUAL, productName); - } - - public OrderItemRequest withProductNameIn(String... productName){ - return withProductName(Operator.IN, (Object[])productName); - } - - public OrderItemRequest withProductNameNotIn(String... productName){ - return withProductName(Operator.NOT_IN, (Object[])productName); - } - public OrderItemRequest withProductNameGreaterThan(String productName){ - return withProductName(Operator.GREATER_THAN, productName); - } - - public OrderItemRequest withProductNameGreaterThanOrEqualTo(String productName){ - return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); - } - - public OrderItemRequest withProductNameLessThan(String productName){ - return withProductName(Operator.LESS_THAN, productName); - } - - public OrderItemRequest withProductNameLessThanOrEqualTo(String productName){ - return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); - } - - public OrderItemRequest withProductNameBetween(String startOfProductName, String endOfProductName){ - return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); - } - public OrderItemRequest withProductNameStartingWith(String productName){ - return withProductName(Operator.BEGIN_WITH, productName); - } - public OrderItemRequest withProductNameContaining(String productName){ - return withProductName(Operator.CONTAIN, productName); - } - - public OrderItemRequest withProductNameNotContaining(String productName){ - return withProductName(Operator.NOT_CONTAIN, productName); - } - - public OrderItemRequest withProductNameNotStartingWith(String productName){ - return withProductName(Operator.NOT_BEGIN_WITH, productName); - } - - public OrderItemRequest withProductNameEndingWith(String productName){ - return withProductName(Operator.END_WITH, productName); - } - - public OrderItemRequest withProductNameNotEndingWith(String productName){ - return withProductName(Operator.NOT_END_WITH, productName); - } - - public OrderItemRequest withProductNameIs(String productName){ - return withProductName(Operator.EQUAL, productName); - } - - public OrderItemRequest withProductNameSoundingLike(String productName){ - return withProductName(Operator.SOUNDS_LIKE, productName); - } - - - - public OrderItemRequest filterByUnitPrice(BigDecimal... unitPrice){ - if (unitPrice == null || unitPrice.length == 0) { - throw new IllegalArgumentException("filterByUnitPrice parameter unitPrice cannot be empty"); - } - return appendSearchCriteria(createUnitPriceCriteria(Operator.EQUAL, (Object[])unitPrice)); - } - - public OrderItemRequest withUnitPrice(Operator operator, Object... values){ - return appendSearchCriteria(createUnitPriceCriteria(operator, values)); - } - - public OrderItemRequest withUnitPriceIsUnknown(){ - return withUnitPrice(Operator.IS_NULL); - } - - public OrderItemRequest withUnitPriceIsKnown(){ - return withUnitPrice(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUnitPriceCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.UNIT_PRICE_PROPERTY, operator, values); - } - - public OrderItemRequest withUnitPriceIs(BigDecimal unitPrice){ - return withUnitPrice(Operator.EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceIsNot(BigDecimal unitPrice){ - return withUnitPrice(Operator.NOT_EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceIn(BigDecimal... unitPrice){ - return withUnitPrice(Operator.IN, (Object[])unitPrice); - } - - public OrderItemRequest withUnitPriceNotIn(BigDecimal... unitPrice){ - return withUnitPrice(Operator.NOT_IN, (Object[])unitPrice); - } - public OrderItemRequest withUnitPriceGreaterThan(BigDecimal unitPrice){ - return withUnitPrice(Operator.GREATER_THAN, unitPrice); - } - - public OrderItemRequest withUnitPriceGreaterThanOrEqualTo(BigDecimal unitPrice){ - return withUnitPrice(Operator.GREATER_THAN_OR_EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceLessThan(BigDecimal unitPrice){ - return withUnitPrice(Operator.LESS_THAN, unitPrice); - } - - public OrderItemRequest withUnitPriceLessThanOrEqualTo(BigDecimal unitPrice){ - return withUnitPrice(Operator.LESS_THAN_OR_EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceBetween(BigDecimal startOfUnitPrice, BigDecimal endOfUnitPrice){ - return withUnitPrice(Operator.BETWEEN, startOfUnitPrice, endOfUnitPrice); - } - - - - public OrderItemRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public OrderItemRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public OrderItemRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public OrderItemRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.CREATE_TIME_PROPERTY, operator, values); - } - - public OrderItemRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public OrderItemRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public OrderItemRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public OrderItemRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public OrderItemRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderItemRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public OrderItemRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderItemRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public OrderItemRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public OrderItemRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderItemRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderItemRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderItemRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderItemRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public OrderItemRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public OrderItemRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public OrderItemRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public OrderItemRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.UPDATE_TIME_PROPERTY, operator, values); - } - - public OrderItemRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public OrderItemRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public OrderItemRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public OrderItemRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public OrderItemRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public OrderItemRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public OrderItemRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public OrderItemRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public OrderItemRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public OrderItemRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public OrderItemRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public OrderItemRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public OrderItemRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public OrderItemRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public OrderItemRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderItemRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderItemRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderItemRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); - } - - public OrderItemRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderItemRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderItemRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderItemRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderItemRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderItemRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderItemRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderItemRequest minUnitPrice(){ - return minUnitPriceAs(prefix("minOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest minUnitPriceAs(String retName){ - super.min(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest maxUnitPrice(){ - return maxUnitPriceAs(prefix("maxOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest maxUnitPriceAs(String retName){ - super.max(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest sumUnitPrice(){ - return sumUnitPriceAs(prefix("sumOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest sumUnitPriceAs(String retName){ - super.sum(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest avgUnitPrice(){ - return avgUnitPriceAs(prefix("avgOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest avgUnitPriceAs(String retName){ - super.avg(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest standardDeviationUnitPrice(){ - return standardDeviationUnitPriceAs(prefix("standardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest standardDeviationUnitPriceAs(String retName){ - super.standardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPrice(){ - return squareRootOfPopulationStandardDeviationUnitPriceAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPriceAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest sampleVarianceUnitPrice(){ - return sampleVarianceUnitPriceAs(prefix("sampleVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest sampleVarianceUnitPriceAs(String retName){ - super.sampleVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest samplePopulationVarianceUnitPrice(){ - return samplePopulationVarianceUnitPriceAs(prefix("samplePopulationVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest samplePopulationVarianceUnitPriceAs(String retName){ - super.samplePopulationVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest groupByPurchaseOrderWithDetails(){ - return groupByPurchaseOrderWithDetails(Q.purchaseOrders().unlimited()); - } - - public OrderItemRequest groupByPurchaseOrderWithDetails(PurchaseOrderRequest subRequest){ - aggregate(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest); - return this; - } - - public OrderItemRequest groupByTenantWithDetails(){ - return groupByTenantWithDetails(Q.tenants().unlimited()); - } - - public OrderItemRequest groupByTenantWithDetails(TenantRequest subRequest){ - aggregate(OrderItem.TENANT_PROPERTY, subRequest); - return this; - } - - - - - - - public OrderItemRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderItemRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest countDistinctPurchaseOrder(){ - return countDistinctPurchaseOrderAs("purchase_order_distinct_count"); - } - - public OrderItemRequest countDistinctPurchaseOrderAs(String alias){ - super.countDistinctProperty(alias, OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - public OrderItemRequest countDistinctTenant(){ - return countDistinctTenantAs("tenant_distinct_count"); - } - - public OrderItemRequest countDistinctTenantAs(String alias){ - super.countDistinctProperty(alias, OrderItem.TENANT_PROPERTY); - return this; - } - public OrderItemRequest countDistinctProductName(){ - return countDistinctProductNameAs("product_name_distinct_count"); - } - - public OrderItemRequest countDistinctProductNameAs(String alias){ - super.countDistinctProperty(alias, OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest countDistinctUnitPrice(){ - return countDistinctUnitPriceAs("unit_price_distinct_count"); - } - - public OrderItemRequest countDistinctUnitPriceAs(String alias){ - super.countDistinctProperty(alias, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public OrderItemRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, OrderItem.CREATE_TIME_PROPERTY); - return this; - } - public OrderItemRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public OrderItemRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - public OrderItemRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderItemRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupById(){ - groupBy(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdAs(String retName){ - groupBy(retName, OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.ID_PROPERTY, function); - return this; - } - public OrderItemRequest groupByPurchaseOrderWith(PurchaseOrderRequest subRequest){ - groupBy(OrderItem.PURCHASE_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPurchaseOrderWith", null, "purchase_order")); - return this; - } - public OrderItemRequest groupByPurchaseOrder(){ - groupBy(OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupByPurchaseOrderAs(String retName){ - groupBy(retName, OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupByPurchaseOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.PURCHASE_ORDER_PROPERTY, function); - return this; - } - public OrderItemRequest groupByTenantWith(TenantRequest subRequest){ - groupBy(OrderItem.TENANT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTenantWith", null, "tenant")); - return this; - } - public OrderItemRequest groupByTenant(){ - groupBy(OrderItem.TENANT_PROPERTY); - return this; - } - - public OrderItemRequest groupByTenantAs(String retName){ - groupBy(retName, OrderItem.TENANT_PROPERTY); - return this; - } - - public OrderItemRequest groupByTenantWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.TENANT_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByProductName(){ - groupBy(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest groupByProductNameAs(String retName){ - groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest groupByProductNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByUnitPrice(){ - groupBy(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest groupByUnitPriceAs(String retName){ - groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest groupByUnitPriceWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByCreateTime(){ - groupBy(OrderItem.CREATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest groupByCreateTimeAs(String retName){ - groupBy(retName, OrderItem.CREATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.CREATE_TIME_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByUpdateTime(){ - groupBy(OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.UPDATE_TIME_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByVersion(){ - groupBy(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionAs(String retName){ - groupBy(retName, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.VERSION_PROPERTY, function); - return this; - } - - - - public OrderItemRequest orderByIdAscending(){ - addOrderByAscending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByIdDescending(){ - addOrderByDescending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByPurchaseOrderAscending(){ - addOrderByAscending(OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderByPurchaseOrderDescending(){ - addOrderByDescending(OrderItem.PURCHASE_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderByTenantAscending(){ - addOrderByAscending(OrderItem.TENANT_PROPERTY); - return this; - } - - public OrderItemRequest orderByTenantDescending(){ - addOrderByDescending(OrderItem.TENANT_PROPERTY); - return this; - } - - public OrderItemRequest orderByProductNameAscending(){ - addOrderByAscending(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest orderByProductNameDescending(){ - addOrderByDescending(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest orderByProductNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest orderByProductNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest orderByUnitPriceAscending(){ - addOrderByAscending(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest orderByUnitPriceDescending(){ - addOrderByDescending(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest orderByCreateTimeAscending(){ - addOrderByAscending(OrderItem.CREATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest orderByCreateTimeDescending(){ - addOrderByDescending(OrderItem.CREATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest orderByUpdateTimeAscending(){ - addOrderByAscending(OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest orderByUpdateTimeDescending(){ - addOrderByDescending(OrderItem.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionAscending(){ - addOrderByAscending(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionDescending(){ - addOrderByDescending(OrderItem.VERSION_PROPERTY); - return this; - } - - - public PurchaseOrderRequest rollUpToPurchaseOrder(){ - PurchaseOrderRequest purchaseOrder = Q.purchaseOrders().unlimited(); - this.internalRollUpTo("purchase_order", purchaseOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPurchaseOrder", null, "purchase_order")); - return purchaseOrder; - } - - public TenantRequest rollUpToTenant(){ - TenantRequest tenant = Q.tenants().unlimited(); - this.internalRollUpTo("tenant", tenant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTenant", null, "tenant")); - return tenant; - } - - - - - - - - public OrderItemRequest facetByPurchaseOrderAs(String facetName, PurchaseOrderRequest purchaseOrder){ - return facetByPurchaseOrderAs(facetName, purchaseOrder, true); - } - - public OrderItemRequest facetByPurchaseOrderAs(String facetName, PurchaseOrderRequest purchaseOrder, boolean includeAllFacets){ - addFacet(facetName, OrderItem.PURCHASE_ORDER_PROPERTY, purchaseOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPurchaseOrderAs", facetName, OrderItem.PURCHASE_ORDER_PROPERTY)); - return this; - } - public OrderItemRequest facetByTenantAs(String facetName, TenantRequest tenant){ - return facetByTenantAs(facetName, tenant, true); - } - - public OrderItemRequest facetByTenantAs(String facetName, TenantRequest tenant, boolean includeAllFacets){ - addFacet(facetName, OrderItem.TENANT_PROPERTY, tenant, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTenantAs", facetName, OrderItem.TENANT_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderItemRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderItemRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderItemRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderItemRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderItemRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderItemRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java deleted file mode 100644 index c6a8dee57..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrder.java +++ /dev/null @@ -1,213 +0,0 @@ - -package com.teaql.checkerfixadvanced.purchaseorder; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class PurchaseOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "PurchaseOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "fc779222657a345b62cacc08e4beb1351e6097a5fd25927366703543a4afdd39"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("tenant", 1), java.util.Map.entry("contact_phone", 2), java.util.Map.entry("internal_note", 3), java.util.Map.entry("create_time", 4), java.util.Map.entry("update_time", 5), java.util.Map.entry("version", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("tenant", java.util.List.of("tenant", "tenant")), java.util.Map.entry("contact_phone", java.util.List.of("contactPhone", "contact_phone")), java.util.Map.entry("internal_note", java.util.List.of("internalNote", "internal_note")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_item_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - PurchaseOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String TENANT_PROPERTY = "tenant"; - public static final String CONTACT_PHONE_PROPERTY = "contact_phone"; - public static final String INTERNAL_NOTE_PROPERTY = "internal_note"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; - private Tenant tenant; - - private String contactPhone; - - private String internalNote; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList orderItemList; - - public Tenant getTenant(){ - return this.tenant; - } - - public String getContactPhone(){ - return this.contactPhone; - } - - public String getInternalNote(){ - return this.internalNote; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getOrderItemList(){ - return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; - } - PurchaseOrder updateTenant(Tenant tenant){ - if(isPropertyLoaded(TENANT_PROPERTY) && Objects.equals(this.tenant, tenant)){ - return this; - } - handleUpdate(TENANT_PROPERTY, getTenant(), tenant); - this.tenant = tenant; - return this; - } - - public PurchaseOrder updateContactPhone(String contactPhone){ - contactPhone = (contactPhone == null ? null : contactPhone.trim()); - if(isPropertyLoaded(CONTACT_PHONE_PROPERTY) && Objects.equals(this.contactPhone, contactPhone)){ - return this; - } - handleUpdate(CONTACT_PHONE_PROPERTY, getContactPhone(), contactPhone); - this.contactPhone = contactPhone; - return this; - } - - public PurchaseOrder updateInternalNote(String internalNote){ - internalNote = (internalNote == null ? null : internalNote.trim()); - if(isPropertyLoaded(INTERNAL_NOTE_PROPERTY) && Objects.equals(this.internalNote, internalNote)){ - return this; - } - handleUpdate(INTERNAL_NOTE_PROPERTY, getInternalNote(), internalNote); - this.internalNote = internalNote; - return this; - } - - public PurchaseOrder updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public PurchaseOrder updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public PurchaseOrder addOrderItem(OrderItem orderItem){ - if (orderItem == null){ - return this; - } - - if(null == this.orderItemList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderItemList = teaqlUnloadedItems.map(value -> value); - } - - this.orderItemList.add(orderItem); - orderItem.updatePurchaseOrder(this); - return this; - } - - public static PurchaseOrder refer(Long id){ - PurchaseOrder refer = new PurchaseOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public PurchaseOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "tenant": this.tenant = (Tenant) value; break; - - case "contact_phone": this.contactPhone = (value == null ? null : ((String)value).trim()); break; - - case "internal_note": this.internalNote = (value == null ? null : ((String)value).trim()); break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "order_item_list": this.orderItemList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "tenant": return this.tenant; - case "contact_phone": return this.contactPhone; - case "internal_note": return this.internalNote; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "order_item_list": return this.orderItemList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "tenant": return this.tenant; - case "contactPhone": return this.contactPhone; - case "internalNote": return this.internalNote; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java deleted file mode 100644 index 8b7a23cb1..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderChecker.java +++ /dev/null @@ -1,129 +0,0 @@ - -package com.teaql.checkerfixadvanced.purchaseorder; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemChecker; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class PurchaseOrderChecker implements Checker{ - - public String type(){ - return PurchaseOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, purchaseOrder)){ - markAsChecked(_context, purchaseOrder); - doCheck(_context, purchaseOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, PurchaseOrder purchaseOrder, ObjectLocation _parentLocation){ - if((purchaseOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, purchaseOrder); - if(purchaseOrder.needPersist()){ - verifyContextRoot(_context, purchaseOrder, "tenant", "Tenant", newLocation(_parentLocation, "tenant")); - - } - if(purchaseOrder.newItem()){ - if(purchaseOrder.getTenant() == null){ - purchaseOrder.updateTenant(Tenant.refer(_context.requireActiveRoot("Tenant").id())); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "tenant", io.teaql.core.checker.FixEvidence.Source.CONTEXT, "activeRoot:Tenant")); - }else{ - _context.verifyActiveRoot("Tenant", purchaseOrder.getTenant().getId()); - } - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - purchaseOrder.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - purchaseOrder.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(purchaseOrder.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - purchaseOrder.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!purchaseOrder.isPropertyLoaded("tenant")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "tenant"), "Mutation requires a fully loaded entity"); - } - if(!purchaseOrder.isPropertyLoaded("contact_phone")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "contact_phone"), "Mutation requires a fully loaded entity"); - } - if(!purchaseOrder.isPropertyLoaded("internal_note")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "internal_note"), "Mutation requires a fully loaded entity"); - } - if(!purchaseOrder.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!purchaseOrder.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkTenant(_context, purchaseOrder.getProperty(PurchaseOrder.TENANT_PROPERTY), newLocation(_parentLocation, "tenant")); - checkContactPhone(_context, purchaseOrder.getProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY), newLocation(_parentLocation, "contact_phone")); - checkInternalNote(_context, purchaseOrder.getProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY), newLocation(_parentLocation, "internal_note")); - checkCreateTime(_context, purchaseOrder.getProperty(PurchaseOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, purchaseOrder.getProperty(PurchaseOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; purchaseOrder.getOrderItemList() != null && i < purchaseOrder.getOrderItemList().size(); i++){ - OrderItem orderItem = purchaseOrder.getOrderItemList().get(i); - new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); - } - } - - public void checkTenant(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, tenant); - if((tenant == null)){ - return; - } - new TenantChecker().checkAndFix(_context, tenant, _parentLocation); - } - public void checkContactPhone(UserContext _context, String contactPhone, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, contactPhone); - if((contactPhone == null)){ - return; - } - minStringCheck(_context, _parentLocation, 1, contactPhone); - maxStringCheck(_context, _parentLocation, 32, contactPhone); - - } - public void checkInternalNote(UserContext _context, String internalNote, ObjectLocation _parentLocation){ - if((internalNote == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, internalNote); - - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java deleted file mode 100644 index 0bd20c34e..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderExpression.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.teaql.checkerfixadvanced.purchaseorder; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemListExpression; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class PurchaseOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PurchaseOrderExpression(Expression expression){ - super(expression); - } - - public PurchaseOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public PurchaseOrderExpression updateId(Long id){ - return new PurchaseOrderExpression(this, $it -> {((PurchaseOrder)$it).__internalSet("id", id); return this;}); - } - - public PurchaseOrderExpression save(UserContext userContext){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PurchaseOrderExpression save(String intent, UserContext userContext){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public TenantExpression getTenant(){ - return new TenantExpression(loaded("tenant", "getTenant", PurchaseOrder::getTenant)); - } - - public PurchaseOrderExpression updateTenant(Tenant tenant){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateTenant(tenant)); - } - - public Expression getContactPhone(){ - return loaded("contact_phone", "getContactPhone", PurchaseOrder::getContactPhone); - } - public PurchaseOrderExpression updateContactPhone(String contactPhone){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateContactPhone(contactPhone)); - } - - public Expression getInternalNote(){ - return loaded("internal_note", "getInternalNote", PurchaseOrder::getInternalNote); - } - public PurchaseOrderExpression updateInternalNote(String internalNote){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateInternalNote(internalNote)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", PurchaseOrder::getCreateTime); - } - public PurchaseOrderExpression updateCreateTime(LocalDateTime createTime){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", PurchaseOrder::getUpdateTime); - } - public PurchaseOrderExpression updateUpdateTime(LocalDateTime updateTime){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).updateUpdateTime(updateTime)); - } - - public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", PurchaseOrder::getOrderItemList)); - } - public PurchaseOrderExpression addOrderItem(OrderItem orderItem){ - return new PurchaseOrderExpression(this, $it -> ((PurchaseOrder)$it).addOrderItem(orderItem)); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java deleted file mode 100644 index 89d8bd843..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.checkerfixadvanced.purchaseorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PurchaseOrderListExpression extends SmartListExpression { - public PurchaseOrderListExpression(Expression> expression){ - super(expression); - } - - public PurchaseOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PurchaseOrderExpression first() { - return new PurchaseOrderExpression(super.first()); - } - - public PurchaseOrderExpression get(int index) { - return new PurchaseOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java deleted file mode 100644 index f3b954456..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/purchaseorder/PurchaseOrderRequest.java +++ /dev/null @@ -1,1317 +0,0 @@ - -package com.teaql.checkerfixadvanced.purchaseorder; - -import com.teaql.checkerfixadvanced.Q; -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemRequest; -import com.teaql.checkerfixadvanced.tenant.Tenant; -import com.teaql.checkerfixadvanced.tenant.TenantRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class PurchaseOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PurchaseOrderRequest(Class returnType){ - this(returnType, () -> (T) new PurchaseOrder()); - } - - protected PurchaseOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PurchaseOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PurchaseOrderRequest copy(){ - return (PurchaseOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PurchaseOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PurchaseOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PurchaseOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PurchaseOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PurchaseOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PurchaseOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PurchaseOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PurchaseOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PurchaseOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PurchaseOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PurchaseOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PurchaseOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public PurchaseOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PurchaseOrderRequest matchingAnyOf(PurchaseOrderRequest purchaseOrder){ - super.internalMatchAny(purchaseOrder); - return this; - } - - public PurchaseOrderRequest matchingIdsOf(PurchaseOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - PurchaseOrder.ID_PROPERTY, request, PurchaseOrder.ID_PROPERTY)); - } - - public PurchaseOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PurchaseOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PurchaseOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PurchaseOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectTenantIdOnly().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public PurchaseOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public PurchaseOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(PurchaseOrder.ID_PROPERTY); - selectProperty(PurchaseOrder.TENANT_PROPERTY); - selectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); - selectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - selectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); - selectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); - selectProperty(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectTenant().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public PurchaseOrderRequest selectChildren(){ - super.selectAny(); - selectOrderItemList(); - return selectId().selectTenant().selectContactPhone().selectInternalNote().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public PurchaseOrderRequest selectId(){ - selectProperty(PurchaseOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectId(){ - unselectProperty(PurchaseOrder.ID_PROPERTY); - return this; - } - public PurchaseOrderRequest selectTenantIdOnly(){ - selectProperty(PurchaseOrder.TENANT_PROPERTY); - return this; - } - - public PurchaseOrderRequest selectTenant(){ - return selectTenantWith(Q.tenants().unlimited().selectSelf()); - } - - public PurchaseOrderRequest selectTenantWith(TenantRequest tenant){ - selectProperty(PurchaseOrder.TENANT_PROPERTY); - enhanceRelation(PurchaseOrder.TENANT_PROPERTY, tenant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectTenantWith", null, PurchaseOrder.TENANT_PROPERTY)); - return this; - } - - public PurchaseOrderRequest unselectTenant(){ - unselectProperty(PurchaseOrder.TENANT_PROPERTY); - return this; - } - public PurchaseOrderRequest selectContactPhone(){ - selectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - - /** - * fill the contactPhone with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contactPhone) to fetch contactPhone property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectContactPhone(){ - unselectProperty(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - public PurchaseOrderRequest selectInternalNote(){ - selectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - - /** - * fill the internalNote with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS internalNote) to fetch internalNote property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectInternalNote(){ - unselectProperty(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - public PurchaseOrderRequest selectCreateTime(){ - selectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectCreateTime(){ - unselectProperty(PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - public PurchaseOrderRequest selectUpdateTime(){ - selectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectUpdateTime(){ - unselectProperty(PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - public PurchaseOrderRequest selectVersion(){ - selectProperty(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PurchaseOrderRequest unselectVersion(){ - unselectProperty(PurchaseOrder.VERSION_PROPERTY); - return this; - } - public PurchaseOrderRequest selectOrderItemList(){ - return selectOrderItemListWith(Q.orderItems().selectSelf()); - } - - public PurchaseOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ - enhanceRelation(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.ID_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PurchaseOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PurchaseOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PurchaseOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PurchaseOrderRequest filterByTenant(Tenant... tenant){ - if (tenant == null || tenant.length == 0) { - throw new IllegalArgumentException("filterByTenant parameter tenant cannot be empty"); - } - return appendSearchCriteria(createTenantCriteria(Operator.EQUAL, (Object[])tenant)); - } - - public PurchaseOrderRequest withTenant(Operator operator, Object... values){ - return appendSearchCriteria(createTenantCriteria(operator, values)); - } - - public PurchaseOrderRequest withTenantIsUnknown(){ - return withTenant(Operator.IS_NULL); - } - - public PurchaseOrderRequest withTenantIsKnown(){ - return withTenant(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTenantCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.TENANT_PROPERTY, operator, values); - } - - public PurchaseOrderRequest filterByTenant(Long tenant){ - if(tenant == null){ - return this; - } - return withTenant(Operator.EQUAL, tenant); - } - public PurchaseOrderRequest withTenantMatching(TenantRequest tenant){ - return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY)); - } - - public PurchaseOrderRequest withoutTenantMatching(TenantRequest tenant){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(PurchaseOrder.TENANT_PROPERTY, tenant, Tenant.ID_PROPERTY))); - } - - public PurchaseOrderRequest filterByContactPhone(String... contactPhone){ - if (contactPhone == null || contactPhone.length == 0) { - throw new IllegalArgumentException("filterByContactPhone parameter contactPhone cannot be empty"); - } - return appendSearchCriteria(createContactPhoneCriteria(Operator.EQUAL, (Object[])contactPhone)); - } - - public PurchaseOrderRequest withContactPhone(Operator operator, Object... values){ - return appendSearchCriteria(createContactPhoneCriteria(operator, values)); - } - - public PurchaseOrderRequest withContactPhoneIsUnknown(){ - return withContactPhone(Operator.IS_NULL); - } - - public PurchaseOrderRequest withContactPhoneIsKnown(){ - return withContactPhone(Operator.IS_NOT_NULL); - } - - public SearchCriteria createContactPhoneCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.CONTACT_PHONE_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withContactPhoneIsNot(String contactPhone){ - return withContactPhone(Operator.NOT_EQUAL, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneIn(String... contactPhone){ - return withContactPhone(Operator.IN, (Object[])contactPhone); - } - - public PurchaseOrderRequest withContactPhoneNotIn(String... contactPhone){ - return withContactPhone(Operator.NOT_IN, (Object[])contactPhone); - } - public PurchaseOrderRequest withContactPhoneGreaterThan(String contactPhone){ - return withContactPhone(Operator.GREATER_THAN, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneGreaterThanOrEqualTo(String contactPhone){ - return withContactPhone(Operator.GREATER_THAN_OR_EQUAL, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneLessThan(String contactPhone){ - return withContactPhone(Operator.LESS_THAN, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneLessThanOrEqualTo(String contactPhone){ - return withContactPhone(Operator.LESS_THAN_OR_EQUAL, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneBetween(String startOfContactPhone, String endOfContactPhone){ - return withContactPhone(Operator.BETWEEN, startOfContactPhone, endOfContactPhone); - } - public PurchaseOrderRequest withContactPhoneStartingWith(String contactPhone){ - return withContactPhone(Operator.BEGIN_WITH, contactPhone); - } - public PurchaseOrderRequest withContactPhoneContaining(String contactPhone){ - return withContactPhone(Operator.CONTAIN, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneNotContaining(String contactPhone){ - return withContactPhone(Operator.NOT_CONTAIN, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneNotStartingWith(String contactPhone){ - return withContactPhone(Operator.NOT_BEGIN_WITH, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneEndingWith(String contactPhone){ - return withContactPhone(Operator.END_WITH, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneNotEndingWith(String contactPhone){ - return withContactPhone(Operator.NOT_END_WITH, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneIs(String contactPhone){ - return withContactPhone(Operator.EQUAL, contactPhone); - } - - public PurchaseOrderRequest withContactPhoneSoundingLike(String contactPhone){ - return withContactPhone(Operator.SOUNDS_LIKE, contactPhone); - } - - - - public PurchaseOrderRequest filterByInternalNote(String... internalNote){ - if (internalNote == null || internalNote.length == 0) { - throw new IllegalArgumentException("filterByInternalNote parameter internalNote cannot be empty"); - } - return appendSearchCriteria(createInternalNoteCriteria(Operator.EQUAL, (Object[])internalNote)); - } - - public PurchaseOrderRequest withInternalNote(Operator operator, Object... values){ - return appendSearchCriteria(createInternalNoteCriteria(operator, values)); - } - - public PurchaseOrderRequest withInternalNoteIsUnknown(){ - return withInternalNote(Operator.IS_NULL); - } - - public PurchaseOrderRequest withInternalNoteIsKnown(){ - return withInternalNote(Operator.IS_NOT_NULL); - } - - public SearchCriteria createInternalNoteCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.INTERNAL_NOTE_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withInternalNoteIsNot(String internalNote){ - return withInternalNote(Operator.NOT_EQUAL, internalNote); - } - - public PurchaseOrderRequest withInternalNoteIn(String... internalNote){ - return withInternalNote(Operator.IN, (Object[])internalNote); - } - - public PurchaseOrderRequest withInternalNoteNotIn(String... internalNote){ - return withInternalNote(Operator.NOT_IN, (Object[])internalNote); - } - public PurchaseOrderRequest withInternalNoteGreaterThan(String internalNote){ - return withInternalNote(Operator.GREATER_THAN, internalNote); - } - - public PurchaseOrderRequest withInternalNoteGreaterThanOrEqualTo(String internalNote){ - return withInternalNote(Operator.GREATER_THAN_OR_EQUAL, internalNote); - } - - public PurchaseOrderRequest withInternalNoteLessThan(String internalNote){ - return withInternalNote(Operator.LESS_THAN, internalNote); - } - - public PurchaseOrderRequest withInternalNoteLessThanOrEqualTo(String internalNote){ - return withInternalNote(Operator.LESS_THAN_OR_EQUAL, internalNote); - } - - public PurchaseOrderRequest withInternalNoteBetween(String startOfInternalNote, String endOfInternalNote){ - return withInternalNote(Operator.BETWEEN, startOfInternalNote, endOfInternalNote); - } - public PurchaseOrderRequest withInternalNoteStartingWith(String internalNote){ - return withInternalNote(Operator.BEGIN_WITH, internalNote); - } - public PurchaseOrderRequest withInternalNoteContaining(String internalNote){ - return withInternalNote(Operator.CONTAIN, internalNote); - } - - public PurchaseOrderRequest withInternalNoteNotContaining(String internalNote){ - return withInternalNote(Operator.NOT_CONTAIN, internalNote); - } - - public PurchaseOrderRequest withInternalNoteNotStartingWith(String internalNote){ - return withInternalNote(Operator.NOT_BEGIN_WITH, internalNote); - } - - public PurchaseOrderRequest withInternalNoteEndingWith(String internalNote){ - return withInternalNote(Operator.END_WITH, internalNote); - } - - public PurchaseOrderRequest withInternalNoteNotEndingWith(String internalNote){ - return withInternalNote(Operator.NOT_END_WITH, internalNote); - } - - public PurchaseOrderRequest withInternalNoteIs(String internalNote){ - return withInternalNote(Operator.EQUAL, internalNote); - } - - public PurchaseOrderRequest withInternalNoteSoundingLike(String internalNote){ - return withInternalNote(Operator.SOUNDS_LIKE, internalNote); - } - - - - public PurchaseOrderRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public PurchaseOrderRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public PurchaseOrderRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public PurchaseOrderRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.CREATE_TIME_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public PurchaseOrderRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public PurchaseOrderRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public PurchaseOrderRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public PurchaseOrderRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PurchaseOrderRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public PurchaseOrderRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PurchaseOrderRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public PurchaseOrderRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public PurchaseOrderRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PurchaseOrderRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PurchaseOrderRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PurchaseOrderRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PurchaseOrderRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public PurchaseOrderRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public PurchaseOrderRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public PurchaseOrderRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public PurchaseOrderRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.UPDATE_TIME_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public PurchaseOrderRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public PurchaseOrderRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public PurchaseOrderRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PurchaseOrderRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public PurchaseOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PurchaseOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PurchaseOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PurchaseOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PurchaseOrder.VERSION_PROPERTY, operator, values); - } - - public PurchaseOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PurchaseOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PurchaseOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PurchaseOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PurchaseOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PurchaseOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PurchaseOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PurchaseOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PurchaseOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PurchaseOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(PurchaseOrder.ID_PROPERTY, orderItemRequest, OrderItem.PURCHASE_ORDER_PROPERTY)); - } - - public PurchaseOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(PurchaseOrder.ID_PROPERTY, orderItemRequest, OrderItem.PURCHASE_ORDER_PROPERTY))); - } - - public PurchaseOrderRequest haveOrderItems(){ - return withOrderItemListMatching(Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest haveNoOrderItems(){ - return withoutOrderItemListMatching(Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PurchaseOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PurchaseOrderRequest groupByTenantWithDetails(){ - return groupByTenantWithDetails(Q.tenants().unlimited()); - } - - public PurchaseOrderRequest groupByTenantWithDetails(TenantRequest subRequest){ - aggregate(PurchaseOrder.TENANT_PROPERTY, subRequest); - return this; - } - - - - - - - public PurchaseOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PurchaseOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.ID_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctTenant(){ - return countDistinctTenantAs("tenant_distinct_count"); - } - - public PurchaseOrderRequest countDistinctTenantAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.TENANT_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctContactPhone(){ - return countDistinctContactPhoneAs("contact_phone_distinct_count"); - } - - public PurchaseOrderRequest countDistinctContactPhoneAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctInternalNote(){ - return countDistinctInternalNoteAs("internal_note_distinct_count"); - } - - public PurchaseOrderRequest countDistinctInternalNoteAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public PurchaseOrderRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public PurchaseOrderRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - public PurchaseOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PurchaseOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, PurchaseOrder.VERSION_PROPERTY); - return this; - } - public PurchaseOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ - aggregate(PurchaseOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); - return this; - } - - public PurchaseOrderRequest groupById(){ - groupBy(PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByIdAs(String retName){ - groupBy(retName, PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.ID_PROPERTY, function); - return this; - } - public PurchaseOrderRequest groupByTenantWith(TenantRequest subRequest){ - groupBy(PurchaseOrder.TENANT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByTenantWith", null, "tenant")); - return this; - } - public PurchaseOrderRequest groupByTenant(){ - groupBy(PurchaseOrder.TENANT_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByTenantAs(String retName){ - groupBy(retName, PurchaseOrder.TENANT_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByTenantWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.TENANT_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByContactPhone(){ - groupBy(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByContactPhoneAs(String retName){ - groupBy(retName, PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByContactPhoneWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.CONTACT_PHONE_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByInternalNote(){ - groupBy(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByInternalNoteAs(String retName){ - groupBy(retName, PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByInternalNoteWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.INTERNAL_NOTE_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByCreateTime(){ - groupBy(PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByCreateTimeAs(String retName){ - groupBy(retName, PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.CREATE_TIME_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByUpdateTime(){ - groupBy(PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.UPDATE_TIME_PROPERTY, function); - return this; - } - - public PurchaseOrderRequest groupByVersion(){ - groupBy(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByVersionAs(String retName){ - groupBy(retName, PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, PurchaseOrder.VERSION_PROPERTY, function); - return this; - } - - - - public PurchaseOrderRequest orderByIdAscending(){ - addOrderByAscending(PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByIdDescending(){ - addOrderByDescending(PurchaseOrder.ID_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByTenantAscending(){ - addOrderByAscending(PurchaseOrder.TENANT_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByTenantDescending(){ - addOrderByDescending(PurchaseOrder.TENANT_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByContactPhoneAscending(){ - addOrderByAscending(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByContactPhoneDescending(){ - addOrderByDescending(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByContactPhoneAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByContactPhoneDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(PurchaseOrder.CONTACT_PHONE_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByInternalNoteAscending(){ - addOrderByAscending(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByInternalNoteDescending(){ - addOrderByDescending(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByInternalNoteAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByInternalNoteDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(PurchaseOrder.INTERNAL_NOTE_PROPERTY); - return this; - } - public PurchaseOrderRequest orderByCreateTimeAscending(){ - addOrderByAscending(PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByCreateTimeDescending(){ - addOrderByDescending(PurchaseOrder.CREATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByUpdateTimeAscending(){ - addOrderByAscending(PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByUpdateTimeDescending(){ - addOrderByDescending(PurchaseOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByVersionAscending(){ - addOrderByAscending(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - public PurchaseOrderRequest orderByVersionDescending(){ - addOrderByDescending(PurchaseOrder.VERSION_PROPERTY); - return this; - } - - - public PurchaseOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ - return statsFromOrderItemsAs(name, subRequest, false); - } - - public PurchaseOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ - return statsFromOrderItemsAs(REFINEMENTS, subRequest); - } - public TenantRequest rollUpToTenant(){ - TenantRequest tenant = Q.tenants().unlimited(); - this.internalRollUpTo("tenant", tenant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToTenant", null, "tenant")); - return tenant; - } - - - - - - - public PurchaseOrderRequest countOrderItems(){ - addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.PURCHASE_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest countOrderItemsAs(String name){ - addRelationCount(name, Q.orderItems().unlimited(), OrderItem.PURCHASE_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ - addRelationCount(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest minUnitPriceOfOrderItems(){ - addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest minUnitPriceOfOrderItemsAs(String name){ - return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest maxUnitPriceOfOrderItems(){ - addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest maxUnitPriceOfOrderItemsAs(String name){ - return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest sumUnitPriceOfOrderItems(){ - addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest sumUnitPriceOfOrderItemsAs(String name){ - return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest avgUnitPriceOfOrderItems(){ - addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest avgUnitPriceOfOrderItemsAs(String name){ - return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItems(){ - addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ - return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ - addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ - return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItems(){ - addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ - return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItems(){ - addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.PURCHASE_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ - return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public PurchaseOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.PURCHASE_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, PurchaseOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public PurchaseOrderRequest facetByTenantAs(String facetName, TenantRequest tenant){ - return facetByTenantAs(facetName, tenant, true); - } - - public PurchaseOrderRequest facetByTenantAs(String facetName, TenantRequest tenant, boolean includeAllFacets){ - addFacet(facetName, PurchaseOrder.TENANT_PROPERTY, tenant, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByTenantAs", facetName, PurchaseOrder.TENANT_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public PurchaseOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PurchaseOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PurchaseOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PurchaseOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PurchaseOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PurchaseOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java deleted file mode 100644 index 34e03207b..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/Tenant.java +++ /dev/null @@ -1,152 +0,0 @@ - -package com.teaql.checkerfixadvanced.tenant; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Tenant extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Tenant"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "85c7e7a1c8e2088fabba9ff66843736d36af1abc05a96ca7c72123129cf55183"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "purchase_order_list", "order_item_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Tenant.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String PURCHASE_ORDER_LIST_PROPERTY = "purchase_order_list"; - public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; - private String name; - - private SmartList purchaseOrderList; - private SmartList orderItemList; - - public String getName(){ - return this.name; - } - - public SmartList getPurchaseOrderList(){ - return this.purchaseOrderList == null ? SmartList.unloaded() : this.purchaseOrderList; - } - public SmartList getOrderItemList(){ - return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; - } - public Tenant updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Tenant addPurchaseOrder(PurchaseOrder purchaseOrder){ - if (purchaseOrder == null){ - return this; - } - - if(null == this.purchaseOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.purchaseOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.purchaseOrderList.add(purchaseOrder); - purchaseOrder.cacheRelation(PurchaseOrder.TENANT_PROPERTY, this); - return this; - } - public Tenant addOrderItem(OrderItem orderItem){ - if (orderItem == null){ - return this; - } - - if(null == this.orderItemList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderItemList = teaqlUnloadedItems.map(value -> value); - } - - this.orderItemList.add(orderItem); - orderItem.cacheRelation(OrderItem.TENANT_PROPERTY, this); - return this; - } - - public static Tenant refer(Long id){ - Tenant refer = new Tenant(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Tenant comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "purchase_order_list": this.purchaseOrderList = (SmartList) value; break; - case "order_item_list": this.orderItemList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "purchase_order_list": return this.purchaseOrderList; - case "order_item_list": return this.orderItemList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java deleted file mode 100644 index bdbdfcfdc..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantChecker.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.teaql.checkerfixadvanced.tenant; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemChecker; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class TenantChecker implements Checker{ - - public String type(){ - return Tenant.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ - if(needCheck(_context, tenant)){ - markAsChecked(_context, tenant); - doCheck(_context, tenant, _parentLocation); - } - } - - public void doCheck(UserContext _context, Tenant tenant, ObjectLocation _parentLocation){ - if((tenant == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, tenant); - if(tenant.needPersist()){ - } - if(tenant.newItem()){ - }else if(tenant.updateItem()){ - if(!tenant.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, tenant.getProperty(Tenant.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; tenant.getPurchaseOrderList() != null && i < tenant.getPurchaseOrderList().size(); i++){ - PurchaseOrder purchaseOrder = tenant.getPurchaseOrderList().get(i); - new PurchaseOrderChecker().checkAndFix(_context, purchaseOrder, newLocation(_parentLocation, "purchase_order_list", i)); - } - for(int i = 0; tenant.getOrderItemList() != null && i < tenant.getOrderItemList().size(); i++){ - OrderItem orderItem = tenant.getOrderItemList().get(i); - new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - minStringCheck(_context, _parentLocation, 1, name); - maxStringCheck(_context, _parentLocation, 80, name); - - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java deleted file mode 100644 index 1f1109d3b..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantExpression.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.teaql.checkerfixadvanced.tenant; - -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemListExpression; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class TenantExpression extends ExpressionAdaptor implements BaseEntityExpression { - public TenantExpression(Expression expression){ - super(expression); - } - - public TenantExpression(Expression expression, Function function){ - super(expression, function); - } - - public TenantExpression updateId(Long id){ - return new TenantExpression(this, $it -> {((Tenant)$it).__internalSet("id", id); return this;}); - } - - public TenantExpression save(UserContext userContext){ - return new TenantExpression(this, $it -> ((Tenant)$it).auditAs("Saved by Expression").save(userContext)); - } - - public TenantExpression save(String intent, UserContext userContext){ - return new TenantExpression(this, $it -> ((Tenant)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Tenant::getName); - } - public TenantExpression updateName(String name){ - return new TenantExpression(this, $it -> ((Tenant)$it).updateName(name)); - } - - public PurchaseOrderListExpression getPurchaseOrderList(){ - return new PurchaseOrderListExpression(loaded("purchase_order_list", "getPurchaseOrderList", Tenant::getPurchaseOrderList)); - } - public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", Tenant::getOrderItemList)); - } - public TenantExpression addPurchaseOrder(PurchaseOrder purchaseOrder){ - return new TenantExpression(this, $it -> ((Tenant)$it).addPurchaseOrder(purchaseOrder)); - } - public TenantExpression addOrderItem(OrderItem orderItem){ - return new TenantExpression(this, $it -> ((Tenant)$it).addOrderItem(orderItem)); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java deleted file mode 100644 index e808ab0ae..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.checkerfixadvanced.tenant; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class TenantListExpression extends SmartListExpression { - public TenantListExpression(Expression> expression){ - super(expression); - } - - public TenantListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public TenantExpression first() { - return new TenantExpression(super.first()); - } - - public TenantExpression get(int index) { - return new TenantExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java b/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java deleted file mode 100644 index 4a339d57f..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/java/com/teaql/checkerfixadvanced/tenant/TenantRequest.java +++ /dev/null @@ -1,835 +0,0 @@ - -package com.teaql.checkerfixadvanced.tenant; - -import com.teaql.checkerfixadvanced.Q; -import com.teaql.checkerfixadvanced.orderitem.OrderItem; -import com.teaql.checkerfixadvanced.orderitem.OrderItemRequest; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrder; -import com.teaql.checkerfixadvanced.purchaseorder.PurchaseOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class TenantRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public TenantRequest(Class returnType){ - this(returnType, () -> (T) new Tenant()); - } - - protected TenantRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public TenantRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public TenantRequest copy(){ - return (TenantRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new TenantRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public TenantRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public TenantRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public TenantRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public TenantRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public TenantRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public TenantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public TenantRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public TenantRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public TenantRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public TenantRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (TenantRequest)super.appendSearchCriteria(searchCriteria); - } - - public TenantRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public TenantRequest matchingAnyOf(TenantRequest tenant){ - super.internalMatchAny(tenant); - return this; - } - - public TenantRequest matchingIdsOf(TenantRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Tenant.ID_PROPERTY, request, Tenant.ID_PROPERTY)); - } - - public TenantRequest enhanceChildrenIfNeeded(){ - return this; - } - - public TenantRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public TenantRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public TenantRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public TenantRequest selectSelfFields(){ - return selectSelf(); - } - - public TenantRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Tenant.ID_PROPERTY); - selectProperty(Tenant.NAME_PROPERTY); - selectProperty(Tenant.VERSION_PROPERTY); - return this; - } - - public TenantRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public TenantRequest selectChildren(){ - super.selectAny(); - selectPurchaseOrderList().selectOrderItemList(); - return selectId().selectName().selectVersion(); - } - - - public TenantRequest selectId(){ - selectProperty(Tenant.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TenantRequest unselectId(){ - unselectProperty(Tenant.ID_PROPERTY); - return this; - } - public TenantRequest selectName(){ - selectProperty(Tenant.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TenantRequest unselectName(){ - unselectProperty(Tenant.NAME_PROPERTY); - return this; - } - public TenantRequest selectVersion(){ - selectProperty(Tenant.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TenantRequest unselectVersion(){ - unselectProperty(Tenant.VERSION_PROPERTY); - return this; - } - public TenantRequest selectPurchaseOrderList(){ - return selectPurchaseOrderListWith(Q.purchaseOrders().selectSelf()); - } - - public TenantRequest selectPurchaseOrderListWith(PurchaseOrderRequest purchaseOrderList){ - enhanceRelation(Tenant.PURCHASE_ORDER_LIST_PROPERTY, purchaseOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPurchaseOrderListWith", null, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - public TenantRequest selectOrderItemList(){ - return selectOrderItemListWith(Q.orderItems().selectSelf()); - } - - public TenantRequest selectOrderItemListWith(OrderItemRequest orderItemList){ - enhanceRelation(Tenant.ORDER_ITEM_LIST_PROPERTY, orderItemList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Tenant.ID_PROPERTY, operator, values); - } - - public TenantRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public TenantRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public TenantRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public TenantRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public TenantRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public TenantRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public TenantRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public TenantRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Tenant.NAME_PROPERTY, operator, values); - } - - public TenantRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public TenantRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public TenantRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public TenantRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public TenantRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public TenantRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public TenantRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public TenantRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public TenantRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public TenantRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public TenantRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public TenantRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public TenantRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public TenantRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public TenantRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public TenantRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public TenantRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public TenantRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public TenantRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public TenantRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Tenant.VERSION_PROPERTY, operator, values); - } - - public TenantRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public TenantRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public TenantRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public TenantRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public TenantRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public TenantRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public TenantRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public TenantRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public TenantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public TenantRequest withPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.TENANT_PROPERTY)); - } - - public TenantRequest withoutPurchaseOrderListMatching(PurchaseOrderRequest purchaseOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, purchaseOrderRequest, PurchaseOrder.TENANT_PROPERTY))); - } - - public TenantRequest havePurchaseOrders(){ - return withPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); - } - - public TenantRequest haveNoPurchaseOrders(){ - return withoutPurchaseOrderListMatching(Q.purchaseOrders().unlimited()); - } - public TenantRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, orderItemRequest, OrderItem.TENANT_PROPERTY)); - } - - public TenantRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Tenant.ID_PROPERTY, orderItemRequest, OrderItem.TENANT_PROPERTY))); - } - - public TenantRequest haveOrderItems(){ - return withOrderItemListMatching(Q.orderItems().unlimited()); - } - - public TenantRequest haveNoOrderItems(){ - return withoutOrderItemListMatching(Q.orderItems().unlimited()); - } - - public TenantRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public TenantRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public TenantRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public TenantRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Tenant.ID_PROPERTY); - return this; - } - public TenantRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public TenantRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Tenant.NAME_PROPERTY); - return this; - } - public TenantRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public TenantRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Tenant.VERSION_PROPERTY); - return this; - } - public TenantRequest groupByPurchaseOrdersWithDetails(PurchaseOrderRequest subRequest){ - aggregate(Tenant.PURCHASE_ORDER_LIST_PROPERTY, subRequest); - return this; - } - public TenantRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ - aggregate(Tenant.ORDER_ITEM_LIST_PROPERTY, subRequest); - return this; - } - - public TenantRequest groupById(){ - groupBy(Tenant.ID_PROPERTY); - return this; - } - - public TenantRequest groupByIdAs(String retName){ - groupBy(retName, Tenant.ID_PROPERTY); - return this; - } - - public TenantRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Tenant.ID_PROPERTY, function); - return this; - } - - public TenantRequest groupByName(){ - groupBy(Tenant.NAME_PROPERTY); - return this; - } - - public TenantRequest groupByNameAs(String retName){ - groupBy(retName, Tenant.NAME_PROPERTY); - return this; - } - - public TenantRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Tenant.NAME_PROPERTY, function); - return this; - } - - public TenantRequest groupByVersion(){ - groupBy(Tenant.VERSION_PROPERTY); - return this; - } - - public TenantRequest groupByVersionAs(String retName){ - groupBy(retName, Tenant.VERSION_PROPERTY); - return this; - } - - public TenantRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Tenant.VERSION_PROPERTY, function); - return this; - } - - - - public TenantRequest orderByIdAscending(){ - addOrderByAscending(Tenant.ID_PROPERTY); - return this; - } - - public TenantRequest orderByIdDescending(){ - addOrderByDescending(Tenant.ID_PROPERTY); - return this; - } - - public TenantRequest orderByNameAscending(){ - addOrderByAscending(Tenant.NAME_PROPERTY); - return this; - } - - public TenantRequest orderByNameDescending(){ - addOrderByDescending(Tenant.NAME_PROPERTY); - return this; - } - public TenantRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Tenant.NAME_PROPERTY); - return this; - } - - public TenantRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Tenant.NAME_PROPERTY); - return this; - } - public TenantRequest orderByVersionAscending(){ - addOrderByAscending(Tenant.VERSION_PROPERTY); - return this; - } - - public TenantRequest orderByVersionDescending(){ - addOrderByDescending(Tenant.VERSION_PROPERTY); - return this; - } - - - public TenantRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest){ - return statsFromPurchaseOrdersAs(name, subRequest, false); - } - - public TenantRequest statsFromPurchaseOrdersAs(String name, PurchaseOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, PurchaseOrder.TENANT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPurchaseOrdersAs", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public TenantRequest statsFromPurchaseOrders(PurchaseOrderRequest subRequest){ - return statsFromPurchaseOrdersAs(REFINEMENTS, subRequest); - } - public TenantRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ - return statsFromOrderItemsAs(name, subRequest, false); - } - - public TenantRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest statsFromOrderItems(OrderItemRequest subRequest){ - return statsFromOrderItemsAs(REFINEMENTS, subRequest); - } - public TenantRequest countPurchaseOrders(){ - addRelationCount("Count", Q.purchaseOrders().unlimited(), PurchaseOrder.TENANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrders", null, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public TenantRequest countPurchaseOrdersAs(String name){ - addRelationCount(name, Q.purchaseOrders().unlimited(), PurchaseOrder.TENANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersAs", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - - public TenantRequest countPurchaseOrdersWith(String name, PurchaseOrderRequest subRequest){ - addRelationCount(name, subRequest, PurchaseOrder.TENANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPurchaseOrdersWith", name, Tenant.PURCHASE_ORDER_LIST_PROPERTY)); - return this; - } - public TenantRequest countOrderItems(){ - addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.TENANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest countOrderItemsAs(String name){ - addRelationCount(name, Q.orderItems().unlimited(), OrderItem.TENANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ - addRelationCount(name, subRequest, OrderItem.TENANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest minUnitPriceOfOrderItems(){ - addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest minUnitPriceOfOrderItemsAs(String name){ - return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest maxUnitPriceOfOrderItems(){ - addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest maxUnitPriceOfOrderItemsAs(String name){ - return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest sumUnitPriceOfOrderItems(){ - addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest sumUnitPriceOfOrderItemsAs(String name){ - return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest avgUnitPriceOfOrderItems(){ - addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest avgUnitPriceOfOrderItemsAs(String name){ - return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest standardDeviationUnitPriceOfOrderItems(){ - addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ - return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ - addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ - return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest sampleVarianceUnitPriceOfOrderItems(){ - addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ - return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public TenantRequest samplePopulationVarianceUnitPriceOfOrderItems(){ - addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.TENANT_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public TenantRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ - return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public TenantRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.TENANT_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, Tenant.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public TenantRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public TenantRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public TenantRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public TenantRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public TenantRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public TenantRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/fix-e-alignment/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/fix-e-alignment/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index bba37cf30..000000000 --- a/examples/fix-e-alignment/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.checkerfixadvanced.EntityMetaRegistry \ No newline at end of file diff --git a/examples/fix-e-alignment/showcase.json b/examples/fix-e-alignment/showcase.json index a93c5bcec..b184e316d 100644 --- a/examples/fix-e-alignment/showcase.json +++ b/examples/fix-e-alignment/showcase.json @@ -60,6 +60,7 @@ ], "generatedFilesManifestSHA256": "392d8007c9b153e118e0615ea854f9feebf073cd17ebbdd755ac925850e4d116", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/http-resilience/java-app-console/lib/pom.xml b/examples/http-resilience/java-app-console/lib/pom.xml deleted file mode 100644 index c9e2217f5..000000000 --- a/examples/http-resilience/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - supplier-order-sync-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java deleted file mode 100644 index 0fb961888..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.supplierordersyncservice; - -import com.teaql.supplierordersyncservice.supplier.Supplier; - -public interface Constants { - public static final long SUPPLIER_ID = 1l; - public static final Supplier SUPPLIER = Supplier.refer(SUPPLIER_ID); -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java deleted file mode 100644 index 93485513e..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.teaql.supplierordersyncservice; - -import com.teaql.supplierordersyncservice.supplier.Supplier; -import com.teaql.supplierordersyncservice.supplier.SupplierExpression; -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static SupplierExpression supplier(Supplier supplier){ - return new SupplierExpression(new ValueExpression(supplier, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.supplier()")); - } - public static SupplierOrderExpression supplierOrder(SupplierOrder supplierOrder){ - return new SupplierOrderExpression(new ValueExpression(supplierOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.supplierOrder()")); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java deleted file mode 100644 index eed1abe4a..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/EntityMetaRegistry.java +++ /dev/null @@ -1,297 +0,0 @@ - -package com.teaql.supplierordersyncservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerSupplier(); - registerSupplierOrder(); - } - private void registerSupplier() { - FieldLayout.installGenerated(com.teaql.supplierordersyncservice.supplier.Supplier.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.supplierordersyncservice.supplier.Supplier.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.supplierordersyncservice.supplier.Supplier.class); - entityDescriptor.setEntitySupplier(com.teaql.supplierordersyncservice.supplier.Supplier::new); - entityDescriptor.with("name", "Supplier") - - .with("module", "Procurement") - - .with("module_key", "procurement") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Regional Supply Co") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplier.Supplier.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSupplierOrder() { - FieldLayout.installGenerated(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder::new); - entityDescriptor.with("name", "Supplier Order") - - .with("module", "Procurement") - - .with("module_key", "procurement") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor supplier = - entityDescriptor.addObjectProperty($factory, com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SUPPLIER_PROPERTY, com.teaql.supplierordersyncservice.supplier.Supplier.INTERNAL_TYPE, com.teaql.supplierordersyncservice.supplier.Supplier.SUPPLIER_ORDER_LIST_PROPERTY, com.teaql.supplierordersyncservice.supplier.Supplier.class) - ; - PropertyDescriptor externalReference = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, String.class) - ; - PropertyDescriptor syncStatus = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SUPPLIER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.EXTERNAL_REFERENCE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.SYNC_STATUS_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java deleted file mode 100644 index 807a48c11..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.teaql.supplierordersyncservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.supplierordersyncservice.supplier.SupplierChecker(), new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:e586b81a9295abcb4491692dac6cf1ef33839a688fea9a396db189f87f7120c5\",\"entities\":{\"Supplier\":{\"labels\":{\"en\":\"Supplier\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"supplier_order_list\",\"targetType\":\"SupplierOrder\",\"labels\":{\"en\":\"Supplier Order\"},\"aliases\":[\"SupplierOrderList\",\"supplierOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SupplierOrder\":{\"labels\":{\"en\":\"Supplier Order\"},\"fields\":[{\"name\":\"external_reference\",\"labels\":{\"en\":\"external reference\"},\"aliases\":[\"ExternalReference\",\"externalReference\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"supplier\",\"targetType\":\"Supplier\",\"labels\":{\"en\":\"Supplier\"},\"aliases\":[\"Supplier\"]},{\"name\":\"sync_status\",\"labels\":{\"en\":\"sync status\"},\"aliases\":[\"SyncStatus\",\"syncStatus\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Supplier", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("SupplierOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("supplier", "supplier"), java.util.Map.entry("external_reference", "externalReference"), java.util.Map.entry("sync_status", "syncStatus"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.suppliers().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.supplierordersyncservice.supplier.Supplier domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.supplierordersyncservice.supplier.Supplier(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Regional Supply Co"); - domainRoot.auditAs("create generated Domain Root Supplier").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Supplier", domainRoot.getId())); - } -} diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java deleted file mode 100644 index f3b2f6042..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Q.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.supplierordersyncservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.supplierordersyncservice.supplier.SupplierRequest suppliers(){ - return new com.teaql.supplierordersyncservice.supplier.SupplierRequest(com.teaql.supplierordersyncservice.supplier.Supplier.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.supplierordersyncservice.supplier.SupplierRequest suppliersWithMinimalFields(){ - return new com.teaql.supplierordersyncservice.supplier.SupplierRequest(com.teaql.supplierordersyncservice.supplier.Supplier.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest supplierOrders(){ - return new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest supplierOrdersWithMinimalFields(){ - return new com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest(com.teaql.supplierordersyncservice.supplierorder.SupplierOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java deleted file mode 100644 index 6ef861b4e..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/SupplierOrderSyncServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.supplierordersyncservice; - -import io.teaql.core.UserContext; -public interface SupplierOrderSyncServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java deleted file mode 100644 index 7b9fd781b..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/Supplier.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplier; - -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Supplier extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Supplier"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "235b3035c863f7dc4a320bb8cc07e1eb0f61b36fab66ddcf3dc268357a9d89e8"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "supplier_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Supplier.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String SUPPLIER_ORDER_LIST_PROPERTY = "supplier_order_list"; - private String name; - - private SmartList supplierOrderList; - - public String getName(){ - return this.name; - } - - public SmartList getSupplierOrderList(){ - return this.supplierOrderList == null ? SmartList.unloaded() : this.supplierOrderList; - } - public Supplier updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Supplier addSupplierOrder(SupplierOrder supplierOrder){ - if (supplierOrder == null){ - return this; - } - - if(null == this.supplierOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.supplierOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.supplierOrderList.add(supplierOrder); - supplierOrder.updateSupplier(this); - return this; - } - - public static Supplier refer(Long id){ - Supplier refer = new Supplier(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Supplier comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "supplier_order_list": this.supplierOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "supplier_order_list": return this.supplierOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java deleted file mode 100644 index 29015ca4d..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplier; - -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class SupplierChecker implements Checker{ - - public String type(){ - return Supplier.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ - if(needCheck(_context, supplier)){ - markAsChecked(_context, supplier); - doCheck(_context, supplier, _parentLocation); - } - } - - public void doCheck(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ - if((supplier == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, supplier); - if(supplier.needPersist()){ - } - if(supplier.newItem()){ - }else if(supplier.updateItem()){ - if(!supplier.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, supplier.getProperty(Supplier.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; supplier.getSupplierOrderList() != null && i < supplier.getSupplierOrderList().size(); i++){ - SupplierOrder supplierOrder = supplier.getSupplierOrderList().get(i); - new SupplierOrderChecker().checkAndFix(_context, supplierOrder, newLocation(_parentLocation, "supplier_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java deleted file mode 100644 index c5287235b..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplier; - -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class SupplierExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SupplierExpression(Expression expression){ - super(expression); - } - - public SupplierExpression(Expression expression, Function function){ - super(expression, function); - } - - public SupplierExpression updateId(Long id){ - return new SupplierExpression(this, $it -> {((Supplier)$it).__internalSet("id", id); return this;}); - } - - public SupplierExpression save(UserContext userContext){ - return new SupplierExpression(this, $it -> ((Supplier)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SupplierExpression save(String intent, UserContext userContext){ - return new SupplierExpression(this, $it -> ((Supplier)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Supplier::getName); - } - public SupplierExpression updateName(String name){ - return new SupplierExpression(this, $it -> ((Supplier)$it).updateName(name)); - } - - public SupplierOrderListExpression getSupplierOrderList(){ - return new SupplierOrderListExpression(loaded("supplier_order_list", "getSupplierOrderList", Supplier::getSupplierOrderList)); - } - public SupplierExpression addSupplierOrder(SupplierOrder supplierOrder){ - return new SupplierExpression(this, $it -> ((Supplier)$it).addSupplierOrder(supplierOrder)); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java deleted file mode 100644 index da446b513..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplier; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SupplierListExpression extends SmartListExpression { - public SupplierListExpression(Expression> expression){ - super(expression); - } - - public SupplierListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SupplierExpression first() { - return new SupplierExpression(super.first()); - } - - public SupplierExpression get(int index) { - return new SupplierExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java deleted file mode 100644 index 6de102641..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplier/SupplierRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplier; - -import com.teaql.supplierordersyncservice.Q; -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrder; -import com.teaql.supplierordersyncservice.supplierorder.SupplierOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class SupplierRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SupplierRequest(Class returnType){ - this(returnType, () -> (T) new Supplier()); - } - - protected SupplierRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SupplierRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SupplierRequest copy(){ - return (SupplierRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SupplierRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SupplierRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SupplierRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SupplierRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SupplierRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SupplierRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SupplierRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SupplierRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SupplierRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SupplierRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SupplierRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SupplierRequest)super.appendSearchCriteria(searchCriteria); - } - - public SupplierRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SupplierRequest matchingAnyOf(SupplierRequest supplier){ - super.internalMatchAny(supplier); - return this; - } - - public SupplierRequest matchingIdsOf(SupplierRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Supplier.ID_PROPERTY, request, Supplier.ID_PROPERTY)); - } - - public SupplierRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SupplierRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SupplierRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SupplierRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public SupplierRequest selectSelfFields(){ - return selectSelf(); - } - - public SupplierRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Supplier.ID_PROPERTY); - selectProperty(Supplier.NAME_PROPERTY); - selectProperty(Supplier.VERSION_PROPERTY); - return this; - } - - public SupplierRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public SupplierRequest selectChildren(){ - super.selectAny(); - selectSupplierOrderList(); - return selectId().selectName().selectVersion(); - } - - - public SupplierRequest selectId(){ - selectProperty(Supplier.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierRequest unselectId(){ - unselectProperty(Supplier.ID_PROPERTY); - return this; - } - public SupplierRequest selectName(){ - selectProperty(Supplier.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierRequest unselectName(){ - unselectProperty(Supplier.NAME_PROPERTY); - return this; - } - public SupplierRequest selectVersion(){ - selectProperty(Supplier.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierRequest unselectVersion(){ - unselectProperty(Supplier.VERSION_PROPERTY); - return this; - } - public SupplierRequest selectSupplierOrderList(){ - return selectSupplierOrderListWith(Q.supplierOrders().selectSelf()); - } - - public SupplierRequest selectSupplierOrderListWith(SupplierOrderRequest supplierOrderList){ - enhanceRelation(Supplier.SUPPLIER_ORDER_LIST_PROPERTY, supplierOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSupplierOrderListWith", null, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); - return this; - } - - public SupplierRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Supplier.ID_PROPERTY, operator, values); - } - - public SupplierRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SupplierRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SupplierRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SupplierRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SupplierRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SupplierRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SupplierRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SupplierRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Supplier.NAME_PROPERTY, operator, values); - } - - public SupplierRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SupplierRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SupplierRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SupplierRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SupplierRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SupplierRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SupplierRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SupplierRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SupplierRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SupplierRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SupplierRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SupplierRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SupplierRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SupplierRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SupplierRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SupplierRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SupplierRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SupplierRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SupplierRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SupplierRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Supplier.VERSION_PROPERTY, operator, values); - } - - public SupplierRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SupplierRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SupplierRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SupplierRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SupplierRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SupplierRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SupplierRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SupplierRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SupplierRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public SupplierRequest withSupplierOrderListMatching(SupplierOrderRequest supplierOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Supplier.ID_PROPERTY, supplierOrderRequest, SupplierOrder.SUPPLIER_PROPERTY)); - } - - public SupplierRequest withoutSupplierOrderListMatching(SupplierOrderRequest supplierOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Supplier.ID_PROPERTY, supplierOrderRequest, SupplierOrder.SUPPLIER_PROPERTY))); - } - - public SupplierRequest haveSupplierOrders(){ - return withSupplierOrderListMatching(Q.supplierOrders().unlimited()); - } - - public SupplierRequest haveNoSupplierOrders(){ - return withoutSupplierOrderListMatching(Q.supplierOrders().unlimited()); - } - - public SupplierRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SupplierRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SupplierRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SupplierRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Supplier.ID_PROPERTY); - return this; - } - public SupplierRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SupplierRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Supplier.NAME_PROPERTY); - return this; - } - public SupplierRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SupplierRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Supplier.VERSION_PROPERTY); - return this; - } - public SupplierRequest groupBySupplierOrdersWithDetails(SupplierOrderRequest subRequest){ - aggregate(Supplier.SUPPLIER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public SupplierRequest groupById(){ - groupBy(Supplier.ID_PROPERTY); - return this; - } - - public SupplierRequest groupByIdAs(String retName){ - groupBy(retName, Supplier.ID_PROPERTY); - return this; - } - - public SupplierRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Supplier.ID_PROPERTY, function); - return this; - } - - public SupplierRequest groupByName(){ - groupBy(Supplier.NAME_PROPERTY); - return this; - } - - public SupplierRequest groupByNameAs(String retName){ - groupBy(retName, Supplier.NAME_PROPERTY); - return this; - } - - public SupplierRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Supplier.NAME_PROPERTY, function); - return this; - } - - public SupplierRequest groupByVersion(){ - groupBy(Supplier.VERSION_PROPERTY); - return this; - } - - public SupplierRequest groupByVersionAs(String retName){ - groupBy(retName, Supplier.VERSION_PROPERTY); - return this; - } - - public SupplierRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Supplier.VERSION_PROPERTY, function); - return this; - } - - - - public SupplierRequest orderByIdAscending(){ - addOrderByAscending(Supplier.ID_PROPERTY); - return this; - } - - public SupplierRequest orderByIdDescending(){ - addOrderByDescending(Supplier.ID_PROPERTY); - return this; - } - - public SupplierRequest orderByNameAscending(){ - addOrderByAscending(Supplier.NAME_PROPERTY); - return this; - } - - public SupplierRequest orderByNameDescending(){ - addOrderByDescending(Supplier.NAME_PROPERTY); - return this; - } - public SupplierRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Supplier.NAME_PROPERTY); - return this; - } - - public SupplierRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Supplier.NAME_PROPERTY); - return this; - } - public SupplierRequest orderByVersionAscending(){ - addOrderByAscending(Supplier.VERSION_PROPERTY); - return this; - } - - public SupplierRequest orderByVersionDescending(){ - addOrderByDescending(Supplier.VERSION_PROPERTY); - return this; - } - - - public SupplierRequest statsFromSupplierOrdersAs(String name, SupplierOrderRequest subRequest){ - return statsFromSupplierOrdersAs(name, subRequest, false); - } - - public SupplierRequest statsFromSupplierOrdersAs(String name, SupplierOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, SupplierOrder.SUPPLIER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSupplierOrdersAs", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); - return this; - } - - public SupplierRequest statsFromSupplierOrders(SupplierOrderRequest subRequest){ - return statsFromSupplierOrdersAs(REFINEMENTS, subRequest); - } - public SupplierRequest countSupplierOrders(){ - addRelationCount("Count", Q.supplierOrders().unlimited(), SupplierOrder.SUPPLIER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrders", null, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); - return this; - } - - public SupplierRequest countSupplierOrdersAs(String name){ - addRelationCount(name, Q.supplierOrders().unlimited(), SupplierOrder.SUPPLIER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrdersAs", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); - return this; - } - - public SupplierRequest countSupplierOrdersWith(String name, SupplierOrderRequest subRequest){ - addRelationCount(name, subRequest, SupplierOrder.SUPPLIER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSupplierOrdersWith", name, Supplier.SUPPLIER_ORDER_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public SupplierRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SupplierRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SupplierRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SupplierRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SupplierRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SupplierRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java deleted file mode 100644 index 46e89b872..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrder.java +++ /dev/null @@ -1,149 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplierorder; - -import com.teaql.supplierordersyncservice.supplier.Supplier; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class SupplierOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "SupplierOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c0177bc460393fa876fee1a230cdfe3c9269b316b16a102e12484e7b39e1a67f"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("supplier", 1), java.util.Map.entry("external_reference", 2), java.util.Map.entry("sync_status", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("supplier", java.util.List.of("supplier", "supplier")), java.util.Map.entry("external_reference", java.util.List.of("externalReference", "external_reference")), java.util.Map.entry("sync_status", java.util.List.of("syncStatus", "sync_status")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - SupplierOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String SUPPLIER_PROPERTY = "supplier"; - public static final String EXTERNAL_REFERENCE_PROPERTY = "external_reference"; - public static final String SYNC_STATUS_PROPERTY = "sync_status"; - private Supplier supplier; - - private String externalReference; - - private String syncStatus; - - - public Supplier getSupplier(){ - return this.supplier; - } - - public String getExternalReference(){ - return this.externalReference; - } - - public String getSyncStatus(){ - return this.syncStatus; - } - - public SupplierOrder updateSupplier(Supplier supplier){ - if(isPropertyLoaded(SUPPLIER_PROPERTY) && Objects.equals(this.supplier, supplier)){ - return this; - } - handleUpdate(SUPPLIER_PROPERTY, getSupplier(), supplier); - this.supplier = supplier; - return this; - } - - public SupplierOrder updateExternalReference(String externalReference){ - externalReference = (externalReference == null ? null : externalReference.trim()); - if(isPropertyLoaded(EXTERNAL_REFERENCE_PROPERTY) && Objects.equals(this.externalReference, externalReference)){ - return this; - } - handleUpdate(EXTERNAL_REFERENCE_PROPERTY, getExternalReference(), externalReference); - this.externalReference = externalReference; - return this; - } - - public SupplierOrder updateSyncStatus(String syncStatus){ - syncStatus = (syncStatus == null ? null : syncStatus.trim()); - if(isPropertyLoaded(SYNC_STATUS_PROPERTY) && Objects.equals(this.syncStatus, syncStatus)){ - return this; - } - handleUpdate(SYNC_STATUS_PROPERTY, getSyncStatus(), syncStatus); - this.syncStatus = syncStatus; - return this; - } - - - public static SupplierOrder refer(Long id){ - SupplierOrder refer = new SupplierOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public SupplierOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "supplier": this.supplier = (Supplier) value; break; - - case "external_reference": this.externalReference = (value == null ? null : ((String)value).trim()); break; - - case "sync_status": this.syncStatus = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "supplier": return this.supplier; - case "external_reference": return this.externalReference; - case "sync_status": return this.syncStatus; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "supplier": return this.supplier; - case "externalReference": return this.externalReference; - case "syncStatus": return this.syncStatus; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java deleted file mode 100644 index 3ae0777a2..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderChecker.java +++ /dev/null @@ -1,71 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplierorder; - -import com.teaql.supplierordersyncservice.supplier.Supplier; -import com.teaql.supplierordersyncservice.supplier.SupplierChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class SupplierOrderChecker implements Checker{ - - public String type(){ - return SupplierOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, SupplierOrder supplierOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, supplierOrder)){ - markAsChecked(_context, supplierOrder); - doCheck(_context, supplierOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, SupplierOrder supplierOrder, ObjectLocation _parentLocation){ - if((supplierOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, supplierOrder); - if(supplierOrder.needPersist()){ - } - if(supplierOrder.newItem()){ - }else if(supplierOrder.updateItem()){ - if(!supplierOrder.isPropertyLoaded("supplier")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "supplier"), "Mutation requires a fully loaded entity"); - } - if(!supplierOrder.isPropertyLoaded("external_reference")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "external_reference"), "Mutation requires a fully loaded entity"); - } - if(!supplierOrder.isPropertyLoaded("sync_status")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "sync_status"), "Mutation requires a fully loaded entity"); - } - - } - checkSupplier(_context, supplierOrder.getProperty(SupplierOrder.SUPPLIER_PROPERTY), newLocation(_parentLocation, "supplier")); - checkExternalReference(_context, supplierOrder.getProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY), newLocation(_parentLocation, "external_reference")); - checkSyncStatus(_context, supplierOrder.getProperty(SupplierOrder.SYNC_STATUS_PROPERTY), newLocation(_parentLocation, "sync_status")); - } - - public void checkSupplier(UserContext _context, Supplier supplier, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, supplier); - if((supplier == null)){ - return; - } - new SupplierChecker().checkAndFix(_context, supplier, _parentLocation); - } - public void checkExternalReference(UserContext _context, String externalReference, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, externalReference); - if((externalReference == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, externalReference); - - } - public void checkSyncStatus(UserContext _context, String syncStatus, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, syncStatus); - if((syncStatus == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, syncStatus); - - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java deleted file mode 100644 index b4f7739d3..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderExpression.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplierorder; - -import com.teaql.supplierordersyncservice.supplier.Supplier; -import com.teaql.supplierordersyncservice.supplier.SupplierExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class SupplierOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SupplierOrderExpression(Expression expression){ - super(expression); - } - - public SupplierOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public SupplierOrderExpression updateId(Long id){ - return new SupplierOrderExpression(this, $it -> {((SupplierOrder)$it).__internalSet("id", id); return this;}); - } - - public SupplierOrderExpression save(UserContext userContext){ - return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SupplierOrderExpression save(String intent, UserContext userContext){ - return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public SupplierExpression getSupplier(){ - return new SupplierExpression(loaded("supplier", "getSupplier", SupplierOrder::getSupplier)); - } - - public SupplierOrderExpression updateSupplier(Supplier supplier){ - return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateSupplier(supplier)); - } - - public Expression getExternalReference(){ - return loaded("external_reference", "getExternalReference", SupplierOrder::getExternalReference); - } - public SupplierOrderExpression updateExternalReference(String externalReference){ - return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateExternalReference(externalReference)); - } - - public Expression getSyncStatus(){ - return loaded("sync_status", "getSyncStatus", SupplierOrder::getSyncStatus); - } - public SupplierOrderExpression updateSyncStatus(String syncStatus){ - return new SupplierOrderExpression(this, $it -> ((SupplierOrder)$it).updateSyncStatus(syncStatus)); - } - -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java deleted file mode 100644 index 7d3b6d399..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplierorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SupplierOrderListExpression extends SmartListExpression { - public SupplierOrderListExpression(Expression> expression){ - super(expression); - } - - public SupplierOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SupplierOrderExpression first() { - return new SupplierOrderExpression(super.first()); - } - - public SupplierOrderExpression get(int index) { - return new SupplierOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java b/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java deleted file mode 100644 index 080da4fc8..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/java/com/teaql/supplierordersyncservice/supplierorder/SupplierOrderRequest.java +++ /dev/null @@ -1,836 +0,0 @@ - -package com.teaql.supplierordersyncservice.supplierorder; - -import com.teaql.supplierordersyncservice.Q; -import com.teaql.supplierordersyncservice.supplier.Supplier; -import com.teaql.supplierordersyncservice.supplier.SupplierRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class SupplierOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SupplierOrderRequest(Class returnType){ - this(returnType, () -> (T) new SupplierOrder()); - } - - protected SupplierOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SupplierOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SupplierOrderRequest copy(){ - return (SupplierOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SupplierOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SupplierOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SupplierOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SupplierOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SupplierOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SupplierOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SupplierOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SupplierOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SupplierOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SupplierOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SupplierOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SupplierOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public SupplierOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SupplierOrderRequest matchingAnyOf(SupplierOrderRequest supplierOrder){ - super.internalMatchAny(supplierOrder); - return this; - } - - public SupplierOrderRequest matchingIdsOf(SupplierOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - SupplierOrder.ID_PROPERTY, request, SupplierOrder.ID_PROPERTY)); - } - - public SupplierOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SupplierOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SupplierOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SupplierOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectSupplierIdOnly().selectExternalReference().selectSyncStatus().selectVersion(); - } - - public SupplierOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public SupplierOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(SupplierOrder.ID_PROPERTY); - selectProperty(SupplierOrder.SUPPLIER_PROPERTY); - selectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - selectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); - selectProperty(SupplierOrder.VERSION_PROPERTY); - return this; - } - - public SupplierOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectSupplier().selectExternalReference().selectSyncStatus().selectVersion(); - } - - public SupplierOrderRequest selectChildren(){ - super.selectAny(); - return selectId().selectSupplier().selectExternalReference().selectSyncStatus().selectVersion(); - } - - - public SupplierOrderRequest selectId(){ - selectProperty(SupplierOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierOrderRequest unselectId(){ - unselectProperty(SupplierOrder.ID_PROPERTY); - return this; - } - public SupplierOrderRequest selectSupplierIdOnly(){ - selectProperty(SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - - public SupplierOrderRequest selectSupplier(){ - return selectSupplierWith(Q.suppliers().unlimited().selectSelf()); - } - - public SupplierOrderRequest selectSupplierWith(SupplierRequest supplier){ - selectProperty(SupplierOrder.SUPPLIER_PROPERTY); - enhanceRelation(SupplierOrder.SUPPLIER_PROPERTY, supplier, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSupplierWith", null, SupplierOrder.SUPPLIER_PROPERTY)); - return this; - } - - public SupplierOrderRequest unselectSupplier(){ - unselectProperty(SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - public SupplierOrderRequest selectExternalReference(){ - selectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - - /** - * fill the externalReference with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS externalReference) to fetch externalReference property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierOrderRequest unselectExternalReference(){ - unselectProperty(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - public SupplierOrderRequest selectSyncStatus(){ - selectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - - /** - * fill the syncStatus with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS syncStatus) to fetch syncStatus property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierOrderRequest unselectSyncStatus(){ - unselectProperty(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - public SupplierOrderRequest selectVersion(){ - selectProperty(SupplierOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SupplierOrderRequest unselectVersion(){ - unselectProperty(SupplierOrder.VERSION_PROPERTY); - return this; - } - - public SupplierOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SupplierOrder.ID_PROPERTY, operator, values); - } - - public SupplierOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SupplierOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SupplierOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SupplierOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SupplierOrderRequest filterBySupplier(Supplier... supplier){ - if (supplier == null || supplier.length == 0) { - throw new IllegalArgumentException("filterBySupplier parameter supplier cannot be empty"); - } - return appendSearchCriteria(createSupplierCriteria(Operator.EQUAL, (Object[])supplier)); - } - - public SupplierOrderRequest withSupplier(Operator operator, Object... values){ - return appendSearchCriteria(createSupplierCriteria(operator, values)); - } - - public SupplierOrderRequest withSupplierIsUnknown(){ - return withSupplier(Operator.IS_NULL); - } - - public SupplierOrderRequest withSupplierIsKnown(){ - return withSupplier(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSupplierCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, operator, values); - } - - public SupplierOrderRequest filterBySupplier(Long supplier){ - if(supplier == null){ - return this; - } - return withSupplier(Operator.EQUAL, supplier); - } - public SupplierOrderRequest withSupplierMatching(SupplierRequest supplier){ - return appendSearchCriteria(new SubQuerySearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, supplier, Supplier.ID_PROPERTY)); - } - - public SupplierOrderRequest withoutSupplierMatching(SupplierRequest supplier){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(SupplierOrder.SUPPLIER_PROPERTY, supplier, Supplier.ID_PROPERTY))); - } - - public SupplierOrderRequest filterByExternalReference(String... externalReference){ - if (externalReference == null || externalReference.length == 0) { - throw new IllegalArgumentException("filterByExternalReference parameter externalReference cannot be empty"); - } - return appendSearchCriteria(createExternalReferenceCriteria(Operator.EQUAL, (Object[])externalReference)); - } - - public SupplierOrderRequest withExternalReference(Operator operator, Object... values){ - return appendSearchCriteria(createExternalReferenceCriteria(operator, values)); - } - - public SupplierOrderRequest withExternalReferenceIsUnknown(){ - return withExternalReference(Operator.IS_NULL); - } - - public SupplierOrderRequest withExternalReferenceIsKnown(){ - return withExternalReference(Operator.IS_NOT_NULL); - } - - public SearchCriteria createExternalReferenceCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, operator, values); - } - - public SupplierOrderRequest withExternalReferenceIsNot(String externalReference){ - return withExternalReference(Operator.NOT_EQUAL, externalReference); - } - - public SupplierOrderRequest withExternalReferenceIn(String... externalReference){ - return withExternalReference(Operator.IN, (Object[])externalReference); - } - - public SupplierOrderRequest withExternalReferenceNotIn(String... externalReference){ - return withExternalReference(Operator.NOT_IN, (Object[])externalReference); - } - public SupplierOrderRequest withExternalReferenceGreaterThan(String externalReference){ - return withExternalReference(Operator.GREATER_THAN, externalReference); - } - - public SupplierOrderRequest withExternalReferenceGreaterThanOrEqualTo(String externalReference){ - return withExternalReference(Operator.GREATER_THAN_OR_EQUAL, externalReference); - } - - public SupplierOrderRequest withExternalReferenceLessThan(String externalReference){ - return withExternalReference(Operator.LESS_THAN, externalReference); - } - - public SupplierOrderRequest withExternalReferenceLessThanOrEqualTo(String externalReference){ - return withExternalReference(Operator.LESS_THAN_OR_EQUAL, externalReference); - } - - public SupplierOrderRequest withExternalReferenceBetween(String startOfExternalReference, String endOfExternalReference){ - return withExternalReference(Operator.BETWEEN, startOfExternalReference, endOfExternalReference); - } - public SupplierOrderRequest withExternalReferenceStartingWith(String externalReference){ - return withExternalReference(Operator.BEGIN_WITH, externalReference); - } - public SupplierOrderRequest withExternalReferenceContaining(String externalReference){ - return withExternalReference(Operator.CONTAIN, externalReference); - } - - public SupplierOrderRequest withExternalReferenceNotContaining(String externalReference){ - return withExternalReference(Operator.NOT_CONTAIN, externalReference); - } - - public SupplierOrderRequest withExternalReferenceNotStartingWith(String externalReference){ - return withExternalReference(Operator.NOT_BEGIN_WITH, externalReference); - } - - public SupplierOrderRequest withExternalReferenceEndingWith(String externalReference){ - return withExternalReference(Operator.END_WITH, externalReference); - } - - public SupplierOrderRequest withExternalReferenceNotEndingWith(String externalReference){ - return withExternalReference(Operator.NOT_END_WITH, externalReference); - } - - public SupplierOrderRequest withExternalReferenceIs(String externalReference){ - return withExternalReference(Operator.EQUAL, externalReference); - } - - public SupplierOrderRequest withExternalReferenceSoundingLike(String externalReference){ - return withExternalReference(Operator.SOUNDS_LIKE, externalReference); - } - - - - public SupplierOrderRequest filterBySyncStatus(String... syncStatus){ - if (syncStatus == null || syncStatus.length == 0) { - throw new IllegalArgumentException("filterBySyncStatus parameter syncStatus cannot be empty"); - } - return appendSearchCriteria(createSyncStatusCriteria(Operator.EQUAL, (Object[])syncStatus)); - } - - public SupplierOrderRequest withSyncStatus(Operator operator, Object... values){ - return appendSearchCriteria(createSyncStatusCriteria(operator, values)); - } - - public SupplierOrderRequest withSyncStatusIsUnknown(){ - return withSyncStatus(Operator.IS_NULL); - } - - public SupplierOrderRequest withSyncStatusIsKnown(){ - return withSyncStatus(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSyncStatusCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SupplierOrder.SYNC_STATUS_PROPERTY, operator, values); - } - - public SupplierOrderRequest withSyncStatusIsNot(String syncStatus){ - return withSyncStatus(Operator.NOT_EQUAL, syncStatus); - } - - public SupplierOrderRequest withSyncStatusIn(String... syncStatus){ - return withSyncStatus(Operator.IN, (Object[])syncStatus); - } - - public SupplierOrderRequest withSyncStatusNotIn(String... syncStatus){ - return withSyncStatus(Operator.NOT_IN, (Object[])syncStatus); - } - public SupplierOrderRequest withSyncStatusGreaterThan(String syncStatus){ - return withSyncStatus(Operator.GREATER_THAN, syncStatus); - } - - public SupplierOrderRequest withSyncStatusGreaterThanOrEqualTo(String syncStatus){ - return withSyncStatus(Operator.GREATER_THAN_OR_EQUAL, syncStatus); - } - - public SupplierOrderRequest withSyncStatusLessThan(String syncStatus){ - return withSyncStatus(Operator.LESS_THAN, syncStatus); - } - - public SupplierOrderRequest withSyncStatusLessThanOrEqualTo(String syncStatus){ - return withSyncStatus(Operator.LESS_THAN_OR_EQUAL, syncStatus); - } - - public SupplierOrderRequest withSyncStatusBetween(String startOfSyncStatus, String endOfSyncStatus){ - return withSyncStatus(Operator.BETWEEN, startOfSyncStatus, endOfSyncStatus); - } - public SupplierOrderRequest withSyncStatusStartingWith(String syncStatus){ - return withSyncStatus(Operator.BEGIN_WITH, syncStatus); - } - public SupplierOrderRequest withSyncStatusContaining(String syncStatus){ - return withSyncStatus(Operator.CONTAIN, syncStatus); - } - - public SupplierOrderRequest withSyncStatusNotContaining(String syncStatus){ - return withSyncStatus(Operator.NOT_CONTAIN, syncStatus); - } - - public SupplierOrderRequest withSyncStatusNotStartingWith(String syncStatus){ - return withSyncStatus(Operator.NOT_BEGIN_WITH, syncStatus); - } - - public SupplierOrderRequest withSyncStatusEndingWith(String syncStatus){ - return withSyncStatus(Operator.END_WITH, syncStatus); - } - - public SupplierOrderRequest withSyncStatusNotEndingWith(String syncStatus){ - return withSyncStatus(Operator.NOT_END_WITH, syncStatus); - } - - public SupplierOrderRequest withSyncStatusIs(String syncStatus){ - return withSyncStatus(Operator.EQUAL, syncStatus); - } - - public SupplierOrderRequest withSyncStatusSoundingLike(String syncStatus){ - return withSyncStatus(Operator.SOUNDS_LIKE, syncStatus); - } - - - - public SupplierOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SupplierOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SupplierOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SupplierOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SupplierOrder.VERSION_PROPERTY, operator, values); - } - - public SupplierOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SupplierOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SupplierOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SupplierOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SupplierOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SupplierOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SupplierOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SupplierOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SupplierOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public SupplierOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SupplierOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SupplierOrderRequest groupBySupplierWithDetails(){ - return groupBySupplierWithDetails(Q.suppliers().unlimited()); - } - - public SupplierOrderRequest groupBySupplierWithDetails(SupplierRequest subRequest){ - aggregate(SupplierOrder.SUPPLIER_PROPERTY, subRequest); - return this; - } - - - - - public SupplierOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SupplierOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, SupplierOrder.ID_PROPERTY); - return this; - } - public SupplierOrderRequest countDistinctSupplier(){ - return countDistinctSupplierAs("supplier_distinct_count"); - } - - public SupplierOrderRequest countDistinctSupplierAs(String alias){ - super.countDistinctProperty(alias, SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - public SupplierOrderRequest countDistinctExternalReference(){ - return countDistinctExternalReferenceAs("external_reference_distinct_count"); - } - - public SupplierOrderRequest countDistinctExternalReferenceAs(String alias){ - super.countDistinctProperty(alias, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - public SupplierOrderRequest countDistinctSyncStatus(){ - return countDistinctSyncStatusAs("sync_status_distinct_count"); - } - - public SupplierOrderRequest countDistinctSyncStatusAs(String alias){ - super.countDistinctProperty(alias, SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - public SupplierOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SupplierOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, SupplierOrder.VERSION_PROPERTY); - return this; - } - - public SupplierOrderRequest groupById(){ - groupBy(SupplierOrder.ID_PROPERTY); - return this; - } - - public SupplierOrderRequest groupByIdAs(String retName){ - groupBy(retName, SupplierOrder.ID_PROPERTY); - return this; - } - - public SupplierOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, SupplierOrder.ID_PROPERTY, function); - return this; - } - public SupplierOrderRequest groupBySupplierWith(SupplierRequest subRequest){ - groupBy(SupplierOrder.SUPPLIER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySupplierWith", null, "supplier")); - return this; - } - public SupplierOrderRequest groupBySupplier(){ - groupBy(SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - - public SupplierOrderRequest groupBySupplierAs(String retName){ - groupBy(retName, SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - - public SupplierOrderRequest groupBySupplierWithFunction(String retName, AggrFunction function){ - groupBy(retName, SupplierOrder.SUPPLIER_PROPERTY, function); - return this; - } - - public SupplierOrderRequest groupByExternalReference(){ - groupBy(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - - public SupplierOrderRequest groupByExternalReferenceAs(String retName){ - groupBy(retName, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - - public SupplierOrderRequest groupByExternalReferenceWithFunction(String retName, AggrFunction function){ - groupBy(retName, SupplierOrder.EXTERNAL_REFERENCE_PROPERTY, function); - return this; - } - - public SupplierOrderRequest groupBySyncStatus(){ - groupBy(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - - public SupplierOrderRequest groupBySyncStatusAs(String retName){ - groupBy(retName, SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - - public SupplierOrderRequest groupBySyncStatusWithFunction(String retName, AggrFunction function){ - groupBy(retName, SupplierOrder.SYNC_STATUS_PROPERTY, function); - return this; - } - - public SupplierOrderRequest groupByVersion(){ - groupBy(SupplierOrder.VERSION_PROPERTY); - return this; - } - - public SupplierOrderRequest groupByVersionAs(String retName){ - groupBy(retName, SupplierOrder.VERSION_PROPERTY); - return this; - } - - public SupplierOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, SupplierOrder.VERSION_PROPERTY, function); - return this; - } - - - - public SupplierOrderRequest orderByIdAscending(){ - addOrderByAscending(SupplierOrder.ID_PROPERTY); - return this; - } - - public SupplierOrderRequest orderByIdDescending(){ - addOrderByDescending(SupplierOrder.ID_PROPERTY); - return this; - } - - public SupplierOrderRequest orderBySupplierAscending(){ - addOrderByAscending(SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - - public SupplierOrderRequest orderBySupplierDescending(){ - addOrderByDescending(SupplierOrder.SUPPLIER_PROPERTY); - return this; - } - - public SupplierOrderRequest orderByExternalReferenceAscending(){ - addOrderByAscending(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - - public SupplierOrderRequest orderByExternalReferenceDescending(){ - addOrderByDescending(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - public SupplierOrderRequest orderByExternalReferenceAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - - public SupplierOrderRequest orderByExternalReferenceDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SupplierOrder.EXTERNAL_REFERENCE_PROPERTY); - return this; - } - public SupplierOrderRequest orderBySyncStatusAscending(){ - addOrderByAscending(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - - public SupplierOrderRequest orderBySyncStatusDescending(){ - addOrderByDescending(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - public SupplierOrderRequest orderBySyncStatusAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - - public SupplierOrderRequest orderBySyncStatusDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SupplierOrder.SYNC_STATUS_PROPERTY); - return this; - } - public SupplierOrderRequest orderByVersionAscending(){ - addOrderByAscending(SupplierOrder.VERSION_PROPERTY); - return this; - } - - public SupplierOrderRequest orderByVersionDescending(){ - addOrderByDescending(SupplierOrder.VERSION_PROPERTY); - return this; - } - - - public SupplierRequest rollUpToSupplier(){ - SupplierRequest supplier = Q.suppliers().unlimited(); - this.internalRollUpTo("supplier", supplier, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSupplier", null, "supplier")); - return supplier; - } - - - - - - public SupplierOrderRequest facetBySupplierAs(String facetName, SupplierRequest supplier){ - return facetBySupplierAs(facetName, supplier, true); - } - - public SupplierOrderRequest facetBySupplierAs(String facetName, SupplierRequest supplier, boolean includeAllFacets){ - addFacet(facetName, SupplierOrder.SUPPLIER_PROPERTY, supplier, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySupplierAs", facetName, SupplierOrder.SUPPLIER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SupplierOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SupplierOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SupplierOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SupplierOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SupplierOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SupplierOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 0fd6fbfda..000000000 --- a/examples/http-resilience/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.supplierordersyncservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/http-resilience/showcase.json b/examples/http-resilience/showcase.json index 5c980fb2a..92e08a974 100644 --- a/examples/http-resilience/showcase.json +++ b/examples/http-resilience/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "e3eb258f2b8cdf6fec76425ed308d03b9f2193632ba785b1d558a80cf76b6dca", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/inheritance-save/java-app-console/lib/pom.xml b/examples/inheritance-save/java-app-console/lib/pom.xml deleted file mode 100644 index 317b64c83..000000000 --- a/examples/inheritance-save/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - inheritance-matching-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Constants.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Constants.java deleted file mode 100644 index f49fc64d6..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Constants.java +++ /dev/null @@ -1,13 +0,0 @@ - -package com.example.inheritancematchingservice; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.schooltype.SchoolType; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); - public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; - public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; - public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/E.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/E.java deleted file mode 100644 index d60a64aec..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/E.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.example.inheritancematchingservice; - -import com.example.inheritancematchingservice.academy.Academy; -import com.example.inheritancematchingservice.academy.AcademyExpression; -import com.example.inheritancematchingservice.college.College; -import com.example.inheritancematchingservice.college.CollegeExpression; -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformExpression; -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolExpression; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeExpression; -import com.example.inheritancematchingservice.trainingacademy.TrainingAcademy; -import com.example.inheritancematchingservice.trainingacademy.TrainingAcademyExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static SchoolTypeExpression schoolType(SchoolType schoolType){ - return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); - } - public static SchoolExpression school(School school){ - return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); - } - public static AcademyExpression academy(Academy academy){ - return new AcademyExpression(new ValueExpression(academy, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.academy()")); - } - public static TrainingAcademyExpression trainingAcademy(TrainingAcademy trainingAcademy){ - return new TrainingAcademyExpression(new ValueExpression(trainingAcademy, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.trainingAcademy()")); - } - public static CollegeExpression college(College college){ - return new CollegeExpression(new ValueExpression(college, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.college()")); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java deleted file mode 100644 index bb71dcdbf..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/EntityMetaRegistry.java +++ /dev/null @@ -1,777 +0,0 @@ - -package com.example.inheritancematchingservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerSchoolType(); - registerSchool(); - registerAcademy(); - registerTrainingAcademy(); - registerCollege(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.example.inheritancematchingservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.inheritancematchingservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.inheritancematchingservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.platform.Platform::new); - entityDescriptor.with("name", "Platform") - - .with("module", "Organization") - - .with("module_key", "organization") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor baseUrl = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.BASE_URL_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Inheritance Campus") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "https://inheritance.example.com") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchoolType() { - FieldLayout.installGenerated(com.example.inheritancematchingservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.inheritancematchingservice.schooltype.SchoolType.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.inheritancematchingservice.schooltype.SchoolType.class); - entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.schooltype.SchoolType::new); - entityDescriptor.with("name", "School Type") - - .with("module", "Academics") - - .with("module_key", "academics") - - .with("constant", "true") - - .with("identifier", "code") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.inheritancematchingservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.inheritancematchingservice.platform.Platform.INTERNAL_TYPE, com.example.inheritancematchingservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.inheritancematchingservice.platform.Platform.class) - ; - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.NAME_PROPERTY, String.class) - ; - PropertyDescriptor code = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.CODE_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("candidates", "1001,1002") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Primary,Secondary") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") - - .with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "PRIMARY,SECONDARY") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchool() { - FieldLayout.installGenerated(com.example.inheritancematchingservice.school.School.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.inheritancematchingservice.school.School.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.inheritancematchingservice.school.School.class); - entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.school.School::new); - entityDescriptor.with("name", "School") - - .with("module", "Academics") - - .with("module_key", "academics") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.inheritancematchingservice.school.School.PLATFORM_PROPERTY, com.example.inheritancematchingservice.platform.Platform.INTERNAL_TYPE, com.example.inheritancematchingservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.inheritancematchingservice.platform.Platform.class) - ; - PropertyDescriptor schoolType = - entityDescriptor.addObjectProperty($factory, com.example.inheritancematchingservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.inheritancematchingservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.inheritancematchingservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.inheritancematchingservice.schooltype.SchoolType.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.NAME_PROPERTY, String.class) - ; - PropertyDescriptor studentCapacity = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.school.School.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.school.School.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerAcademy() { - FieldLayout.installGenerated(com.example.inheritancematchingservice.academy.Academy.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.inheritancematchingservice.academy.Academy.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.inheritancematchingservice.academy.Academy.class); - entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.academy.Academy::new); - entityDescriptor.with("name", "Academy") - - .with("module", "Academics") - - .with("module_key", "academics") - - .with("parent", "school") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.academy.Academy.ID_PROPERTY, Long.class) - ; - PropertyDescriptor campusCode = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.academy.Academy.CAMPUS_CODE_PROPERTY, String.class) - ; - entityDescriptor.setParent($factory.resolveEntityDescriptor(com.example.inheritancematchingservice.school.School.INTERNAL_TYPE)); - entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.CAMPUS_CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.academy.Academy.CAMPUS_CODE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerTrainingAcademy() { - FieldLayout.installGenerated(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class); - entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy::new); - entityDescriptor.with("name", "Training Academy") - - .with("module", "Academics") - - .with("module_key", "academics") - - .with("parent", "academy") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.ID_PROPERTY, Long.class) - ; - PropertyDescriptor specialty = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.SPECIALTY_PROPERTY, String.class) - ; - entityDescriptor.setParent($factory.resolveEntityDescriptor(com.example.inheritancematchingservice.academy.Academy.INTERNAL_TYPE)); - entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.SPECIALTY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.SPECIALTY_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCollege() { - FieldLayout.installGenerated(com.example.inheritancematchingservice.college.College.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.inheritancematchingservice.college.College.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.inheritancematchingservice.college.College.class); - entityDescriptor.setEntitySupplier(com.example.inheritancematchingservice.college.College::new); - entityDescriptor.with("name", "College") - - .with("module", "Academics") - - .with("module_key", "academics") - - .with("parent", "school") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.college.College.ID_PROPERTY, Long.class) - ; - PropertyDescriptor degreeLevel = - entityDescriptor.addSimpleProperty(com.example.inheritancematchingservice.college.College.DEGREE_LEVEL_PROPERTY, String.class) - ; - entityDescriptor.setParent($factory.resolveEntityDescriptor(com.example.inheritancematchingservice.school.School.INTERNAL_TYPE)); - entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.DEGREE_LEVEL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.inheritancematchingservice.college.College.DEGREE_LEVEL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java deleted file mode 100644 index b7a4cb471..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.example.inheritancematchingservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.inheritancematchingservice.platform.PlatformChecker(), new com.example.inheritancematchingservice.schooltype.SchoolTypeChecker(), new com.example.inheritancematchingservice.school.SchoolChecker(), new com.example.inheritancematchingservice.academy.AcademyChecker(), new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyChecker(), new com.example.inheritancematchingservice.college.CollegeChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:43a0ab45b8baa27dfb7d9eccaf6f8ac33e36491d16f13a7817729d8673c0b53a\",\"entities\":{\"Academy\":{\"labels\":{\"en\":\"Academy\"},\"fields\":[{\"name\":\"campus_code\",\"labels\":{\"en\":\"campus code\"},\"aliases\":[\"CampusCode\",\"campusCode\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]}]},\"College\":{\"labels\":{\"en\":\"College\"},\"fields\":[{\"name\":\"degree_level\",\"labels\":{\"en\":\"degree level\"},\"aliases\":[\"DegreeLevel\",\"degreeLevel\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"School\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"School Type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"TrainingAcademy\":{\"labels\":{\"en\":\"Training Academy\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"specialty\",\"labels\":{\"en\":\"specialty\"},\"aliases\":[\"Specialty\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Academy", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("campus_code", "campusCode"))), - java.util.Map.entry("TrainingAcademy", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("specialty", "specialty"))), - java.util.Map.entry("College", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("degree_level", "degreeLevel"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.inheritancematchingservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.inheritancematchingservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Inheritance Campus"); - domainRoot.updateBaseUrl("https://inheritance.example.com"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantSchoolType1001Rows.isEmpty()) { - com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1001 = new com.example.inheritancematchingservice.schooltype.SchoolType(); - constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); - constantSchoolType1001.updatePlatform(domainRoot); - constantSchoolType1001.updateName("Primary"); - constantSchoolType1001.updateCode("PRIMARY"); - constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); - } else { - com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } - if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); - } - var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantSchoolType1002Rows.isEmpty()) { - com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1002 = new com.example.inheritancematchingservice.schooltype.SchoolType(); - constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); - constantSchoolType1002.updatePlatform(domainRoot); - constantSchoolType1002.updateName("Secondary"); - constantSchoolType1002.updateCode("SECONDARY"); - constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); - } else { - com.example.inheritancematchingservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } - if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); - } - } -} diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java deleted file mode 100644 index 4a92c7681..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/InheritanceMatchingServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.inheritancematchingservice; - -import io.teaql.core.UserContext; -public interface InheritanceMatchingServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Q.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Q.java deleted file mode 100644 index 879107e45..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Q.java +++ /dev/null @@ -1,78 +0,0 @@ - -package com.example.inheritancematchingservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.inheritancematchingservice.platform.PlatformRequest platforms(){ - return new com.example.inheritancematchingservice.platform.PlatformRequest(com.example.inheritancematchingservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.inheritancematchingservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.example.inheritancematchingservice.platform.PlatformRequest(com.example.inheritancematchingservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.inheritancematchingservice.schooltype.SchoolTypeRequest schoolTypes(){ - return new com.example.inheritancematchingservice.schooltype.SchoolTypeRequest(com.example.inheritancematchingservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.inheritancematchingservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ - return new com.example.inheritancematchingservice.schooltype.SchoolTypeRequest(com.example.inheritancematchingservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.inheritancematchingservice.school.SchoolRequest schools(){ - return new com.example.inheritancematchingservice.school.SchoolRequest(com.example.inheritancematchingservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.inheritancematchingservice.school.SchoolRequest schoolsWithMinimalFields(){ - return new com.example.inheritancematchingservice.school.SchoolRequest(com.example.inheritancematchingservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - public static com.example.inheritancematchingservice.school.SchoolRequest schoolsWithChildren(){ - com.example.inheritancematchingservice.school.SchoolRequest school = new com.example.inheritancematchingservice.school.SchoolRequest(com.example.inheritancematchingservice.school.School.class).unselectVersion().unlimited().selectSelfFields(); - school.enhanceChild( - academiesWithChildren() - ); - school.enhanceChild( - new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).unselectVersion().unlimited().selectSelfFields() - ); - return school; - } - - public static com.example.inheritancematchingservice.academy.AcademyRequest academies(){ - return new com.example.inheritancematchingservice.academy.AcademyRequest(com.example.inheritancematchingservice.academy.Academy.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.inheritancematchingservice.academy.AcademyRequest academiesWithMinimalFields(){ - return new com.example.inheritancematchingservice.academy.AcademyRequest(com.example.inheritancematchingservice.academy.Academy.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - public static com.example.inheritancematchingservice.academy.AcademyRequest academiesWithChildren(){ - com.example.inheritancematchingservice.academy.AcademyRequest academy = new com.example.inheritancematchingservice.academy.AcademyRequest(com.example.inheritancematchingservice.academy.Academy.class).unselectVersion().unlimited().selectSelfFields(); - academy.enhanceChild( - new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).unselectVersion().unlimited().selectSelfFields() - ); - return academy; - } - - public static com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest trainingAcademies(){ - return new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest trainingAcademiesWithMinimalFields(){ - return new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.inheritancematchingservice.college.CollegeRequest colleges(){ - return new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.inheritancematchingservice.college.CollegeRequest collegesWithMinimalFields(){ - return new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java deleted file mode 100644 index 4113fda2b..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/Academy.java +++ /dev/null @@ -1,132 +0,0 @@ - -package com.example.inheritancematchingservice.academy; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.school.School; -import io.teaql.core.Audited; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Academy extends School implements RemoteInput { - public static String INTERNAL_TYPE = "Academy"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "042b18ec3ea3b22c05808e3810639d71dca129f54216d83d86b7b5b85841cc0f"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("campus_code", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "campus_code"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Academy.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CAMPUS_CODE_PROPERTY = "campus_code"; - private String campusCode; - - - public String getCampusCode(){ - return this.campusCode; - } - - public Academy updateCampusCode(String campusCode){ - campusCode = (campusCode == null ? null : campusCode.trim()); - if(isPropertyLoaded(CAMPUS_CODE_PROPERTY) && Objects.equals(this.campusCode, campusCode)){ - return this; - } - handleUpdate(CAMPUS_CODE_PROPERTY, getCampusCode(), campusCode); - this.campusCode = campusCode; - return this; - } - - public Academy updatePlatform(Platform platform){ - super.updatePlatform(platform); - return this; - } - - public Academy updateSchoolTypeToPrimary(){ - super.updateSchoolTypeToPrimary(); - return this; - } - public Academy updateSchoolTypeToSecondary(){ - super.updateSchoolTypeToSecondary(); - return this; - } - - public Academy updateName(String name){ - super.updateName(name); - return this; - } - - public Academy updateStudentCapacity(Integer studentCapacity){ - super.updateStudentCapacity(studentCapacity); - return this; - } - - - public static Academy refer(Long id){ - Academy refer = new Academy(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Academy comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "campus_code": this.campusCode = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "campus_code": return this.campusCode; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "campusCode": return this.campusCode; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java deleted file mode 100644 index e25259399..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyChecker.java +++ /dev/null @@ -1,49 +0,0 @@ - -package com.example.inheritancematchingservice.academy; - -import com.example.inheritancematchingservice.school.SchoolChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class AcademyChecker implements Checker{ - - public String type(){ - return Academy.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Academy academy, ObjectLocation _parentLocation){ - if(needCheck(_context, academy)){ - markAsChecked(_context, academy); - new SchoolChecker().doCheck(_context, academy, _parentLocation); - - doCheck(_context, academy, _parentLocation); - } - } - - public void doCheck(UserContext _context, Academy academy, ObjectLocation _parentLocation){ - if((academy == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, academy); - if(academy.needPersist()){ - } - if(academy.newItem()){ - }else if(academy.updateItem()){ - if(!academy.isPropertyLoaded("campus_code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "campus_code"), "Mutation requires a fully loaded entity"); - } - - } - checkCampusCode(_context, academy.getProperty(Academy.CAMPUS_CODE_PROPERTY), newLocation(_parentLocation, "campus_code")); - } - - public void checkCampusCode(UserContext _context, String campusCode, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, campusCode); - if((campusCode == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, campusCode); - - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java deleted file mode 100644 index e96e73ae3..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyExpression.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.example.inheritancematchingservice.academy; - -import com.example.inheritancematchingservice.school.SchoolExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import java.util.function.Function; - -public class AcademyExpression extends SchoolExpression implements BaseEntityExpression { - public AcademyExpression(Expression expression){ - super(expression); - } - - public AcademyExpression(Expression expression, Function function){ - super(expression, function); - } - - public AcademyExpression updateId(Long id){ - return new AcademyExpression(this, $it -> {((Academy)$it).__internalSet("id", id); return this;}); - } - - public AcademyExpression save(UserContext userContext){ - return new AcademyExpression(this, $it -> ((Academy)$it).auditAs("Saved by Expression").save(userContext)); - } - - public AcademyExpression save(String intent, UserContext userContext){ - return new AcademyExpression(this, $it -> ((Academy)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getCampusCode(){ - return loaded("campus_code", "getCampusCode", Academy::getCampusCode); - } - public AcademyExpression updateCampusCode(String campusCode){ - return new AcademyExpression(this, $it -> ((Academy)$it).updateCampusCode(campusCode)); - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java deleted file mode 100644 index 0f349aa3f..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.inheritancematchingservice.academy; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class AcademyListExpression extends SmartListExpression { - public AcademyListExpression(Expression> expression){ - super(expression); - } - - public AcademyListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public AcademyExpression first() { - return new AcademyExpression(super.first()); - } - - public AcademyExpression get(int index) { - return new AcademyExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java deleted file mode 100644 index 57d1b0d78..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/academy/AcademyRequest.java +++ /dev/null @@ -1,970 +0,0 @@ - -package com.example.inheritancematchingservice.academy; - -import cn.hutool.core.util.ObjectUtil; -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformRequest; -import com.example.inheritancematchingservice.school.SchoolRequest; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; -import com.example.inheritancematchingservice.trainingacademy.TrainingAcademy; -import io.teaql.core.AggrFunction; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -public class AcademyRequest extends SchoolRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public AcademyRequest(Class returnType){ - this(returnType, () -> (T) new Academy()); - } - - protected AcademyRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public AcademyRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public AcademyRequest copy(){ - return (AcademyRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new AcademyRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public AcademyRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public AcademyRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public AcademyRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public AcademyRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public AcademyRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public AcademyRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public AcademyRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public AcademyRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public AcademyRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public AcademyRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (AcademyRequest)super.appendSearchCriteria(searchCriteria); - } - - public AcademyRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public AcademyRequest matchingAnyOf(AcademyRequest... academies){ - if(ObjectUtil.isEmpty(academies)){ - return this; - } - List l = new ArrayList(); - for(AcademyRequest academy:academies){ - l.add(new SubQuerySearchCriteria(Academy.ID_PROPERTY, academy, Academy.ID_PROPERTY)); - } - return appendSearchCriteria(SearchCriteria.or(l.toArray(new SearchCriteria[l.size()]))); - } - - public AcademyRequest enhanceChild(AcademyRequest academy){ - super.enhanceSelf(academy); - return this; - } - public AcademyRequest matchingIdsOf(AcademyRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Academy.ID_PROPERTY, request, Academy.ID_PROPERTY)); - } - - public AcademyRequest enhanceChildrenIfNeeded(){ - this.enhanceChild( -new com.example.inheritancematchingservice.trainingacademy.TrainingAcademyRequest(com.example.inheritancematchingservice.trainingacademy.TrainingAcademy.class).unlimited().selectSelfWithoutParent() -); - return this; - } - - public AcademyRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public AcademyRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public AcademyRequest selectSelf(){ - super.selectSelf(); - return selectCampusCode(); - } - - public AcademyRequest selectSelfFields(){ - return selectSelf(); - } - - public AcademyRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - - public AcademyRequest selectAll(){ - super.selectAll(); - return selectCampusCode(); - } - - public AcademyRequest selectChildren(){ - super.selectAny(); - return selectCampusCode(); - } - - - public AcademyRequest selectCampusCode(){ - selectProperty(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - - /** - * fill the campusCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS campusCode) to fetch campusCode property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public AcademyRequest unselectCampusCode(){ - unselectProperty(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - public AcademyRequest selectPlatformIdOnly(){ - super.selectPlatformIdOnly(); - return this; - } - - public AcademyRequest selectPlatform(){ - super.selectPlatform(); - return this; - } - - public AcademyRequest selectPlatformWith(PlatformRequest platform){ - super.selectPlatformWith(platform); - return this; - } - - public AcademyRequest unselectPlatform(){ - super.unselectPlatform(); - return this; - } - public AcademyRequest selectSchoolTypeIdOnly(){ - super.selectSchoolTypeIdOnly(); - return this; - } - - public AcademyRequest selectSchoolType(){ - super.selectSchoolType(); - return this; - } - - public AcademyRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ - super.selectSchoolTypeWith(schoolType); - return this; - } - - public AcademyRequest unselectSchoolType(){ - super.unselectSchoolType(); - return this; - } - public AcademyRequest selectName(){ - super.selectName(); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public AcademyRequest unselectName(){ - super.unselectName(); - return this; - } - public AcademyRequest selectStudentCapacity(){ - super.selectStudentCapacity(); - return this; - } - - /** - * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. - * @param aggrFunction aggrFunction - */ - public AcademyRequest selectStudentCapacity(AggrFunction aggrFunction){ - super.selectStudentCapacity(aggrFunction); - return this; - } - - - public AcademyRequest unselectStudentCapacity(){ - super.unselectStudentCapacity(); - return this; - } - public AcademyRequest selectVersion(){ - super.selectVersion(); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public AcademyRequest unselectVersion(){ - super.unselectVersion(); - return this; - } - public AcademyRequest selectId(){ - super.selectId(); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public AcademyRequest unselectId(){ - super.unselectId(); - return this; - } - - public AcademyRequest isTrainingAcademy(){ - return matchTypes(TrainingAcademy.INTERNAL_TYPE); - } - - public AcademyRequest matchTypes(String... types){ - super.matchType(types); - return this; - } - - public AcademyRequest withTypeGroup(){ - super.withTypeGroup(); - return this; - } - - public AcademyRequest filterByCampusCode(String... campusCode){ - if (campusCode == null || campusCode.length == 0) { - throw new IllegalArgumentException("filterByCampusCode parameter campusCode cannot be empty"); - } - return appendSearchCriteria(createCampusCodeCriteria(Operator.EQUAL, (Object[])campusCode)); - } - - public AcademyRequest withCampusCode(Operator operator, Object... values){ - return appendSearchCriteria(createCampusCodeCriteria(operator, values)); - } - - public AcademyRequest withCampusCodeIsUnknown(){ - return withCampusCode(Operator.IS_NULL); - } - - public AcademyRequest withCampusCodeIsKnown(){ - return withCampusCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCampusCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Academy.CAMPUS_CODE_PROPERTY, operator, values); - } - - public AcademyRequest withCampusCodeIsNot(String campusCode){ - return withCampusCode(Operator.NOT_EQUAL, campusCode); - } - - public AcademyRequest withCampusCodeIn(String... campusCode){ - return withCampusCode(Operator.IN, (Object[])campusCode); - } - - public AcademyRequest withCampusCodeNotIn(String... campusCode){ - return withCampusCode(Operator.NOT_IN, (Object[])campusCode); - } - public AcademyRequest withCampusCodeGreaterThan(String campusCode){ - return withCampusCode(Operator.GREATER_THAN, campusCode); - } - - public AcademyRequest withCampusCodeGreaterThanOrEqualTo(String campusCode){ - return withCampusCode(Operator.GREATER_THAN_OR_EQUAL, campusCode); - } - - public AcademyRequest withCampusCodeLessThan(String campusCode){ - return withCampusCode(Operator.LESS_THAN, campusCode); - } - - public AcademyRequest withCampusCodeLessThanOrEqualTo(String campusCode){ - return withCampusCode(Operator.LESS_THAN_OR_EQUAL, campusCode); - } - - public AcademyRequest withCampusCodeBetween(String startOfCampusCode, String endOfCampusCode){ - return withCampusCode(Operator.BETWEEN, startOfCampusCode, endOfCampusCode); - } - public AcademyRequest withCampusCodeStartingWith(String campusCode){ - return withCampusCode(Operator.BEGIN_WITH, campusCode); - } - public AcademyRequest withCampusCodeContaining(String campusCode){ - return withCampusCode(Operator.CONTAIN, campusCode); - } - - public AcademyRequest withCampusCodeNotContaining(String campusCode){ - return withCampusCode(Operator.NOT_CONTAIN, campusCode); - } - - public AcademyRequest withCampusCodeNotStartingWith(String campusCode){ - return withCampusCode(Operator.NOT_BEGIN_WITH, campusCode); - } - - public AcademyRequest withCampusCodeEndingWith(String campusCode){ - return withCampusCode(Operator.END_WITH, campusCode); - } - - public AcademyRequest withCampusCodeNotEndingWith(String campusCode){ - return withCampusCode(Operator.NOT_END_WITH, campusCode); - } - - public AcademyRequest withCampusCodeIs(String campusCode){ - return withCampusCode(Operator.EQUAL, campusCode); - } - - public AcademyRequest withCampusCodeSoundingLike(String campusCode){ - return withCampusCode(Operator.SOUNDS_LIKE, campusCode); - } - - - - public AcademyRequest filterByPlatform(Platform platform){ - return (AcademyRequest)super.filterByPlatform(platform); - } - - public AcademyRequest withPlatform(Operator operator, Object... values){ - return (AcademyRequest)super.withPlatform(operator, values); - } - - public AcademyRequest withPlatformIsUnknown(){ - return (AcademyRequest)super.withPlatformIsUnknown(); - } - - public AcademyRequest withPlatformIsKnown(){ - return (AcademyRequest)super.withPlatformIsKnown(); - } - - public AcademyRequest filterByPlatform(Long platform){ - return (AcademyRequest)super.filterByPlatform(platform); - } - - public AcademyRequest withPlatformMatching(PlatformRequest platform){ - return (AcademyRequest)super.withPlatformMatching(platform); - } - - public AcademyRequest filterBySchoolType(SchoolType schoolType){ - return (AcademyRequest)super.filterBySchoolType(schoolType); - } - - public AcademyRequest withSchoolType(Operator operator, Object... values){ - return (AcademyRequest)super.withSchoolType(operator, values); - } - - public AcademyRequest withSchoolTypeIsUnknown(){ - return (AcademyRequest)super.withSchoolTypeIsUnknown(); - } - - public AcademyRequest withSchoolTypeIsKnown(){ - return (AcademyRequest)super.withSchoolTypeIsKnown(); - } - - public AcademyRequest filterBySchoolType(Long schoolType){ - return (AcademyRequest)super.filterBySchoolType(schoolType); - } - - public AcademyRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ - return (AcademyRequest)super.withSchoolTypeMatching(schoolType); - } - - public AcademyRequest filterByName(String name){ - return (AcademyRequest)super.filterByName(name); - } - - public AcademyRequest withName(Operator operator, Object... values){ - return (AcademyRequest)super.withName(operator, values); - } - - public AcademyRequest withNameIsUnknown(){ - return (AcademyRequest)super.withNameIsUnknown(); - } - - public AcademyRequest withNameIsKnown(){ - return (AcademyRequest)super.withNameIsKnown(); - } - - public AcademyRequest withNameStartingWith(String Name){ - return (AcademyRequest)super.withNameStartingWith(Name); - } - public AcademyRequest withNameContaining(String Name){ - return (AcademyRequest)super.withNameContaining(Name); - } - - public AcademyRequest withNameEndingWith(String Name){ - return (AcademyRequest)super.withNameEndingWith(Name); - } - - - public AcademyRequest filterByStudentCapacity(Integer studentCapacity){ - return (AcademyRequest)super.filterByStudentCapacity(studentCapacity); - } - - public AcademyRequest withStudentCapacity(Operator operator, Object... values){ - return (AcademyRequest)super.withStudentCapacity(operator, values); - } - - public AcademyRequest withStudentCapacityIsUnknown(){ - return (AcademyRequest)super.withStudentCapacityIsUnknown(); - } - - public AcademyRequest withStudentCapacityIsKnown(){ - return (AcademyRequest)super.withStudentCapacityIsKnown(); - } - - public AcademyRequest withStudentCapacityGreaterThan(Integer studentCapacity){ - return (AcademyRequest)super.withStudentCapacityGreaterThan(studentCapacity); - } - - public AcademyRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ - return (AcademyRequest)super.withStudentCapacityGreaterThanOrEqualTo(studentCapacity); - } - - public AcademyRequest withStudentCapacityLessThan(Integer studentCapacity){ - return (AcademyRequest)super.withStudentCapacityLessThan(studentCapacity); - } - - public AcademyRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ - return (AcademyRequest)super.withStudentCapacityLessThanOrEqualTo(studentCapacity); - } - - public AcademyRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ - return (AcademyRequest)super.withStudentCapacityBetween(startOfStudentCapacity, endOfStudentCapacity); - } - - - public AcademyRequest filterByVersion(Long version){ - return (AcademyRequest)super.filterByVersion(version); - } - - public AcademyRequest withVersion(Operator operator, Object... values){ - return (AcademyRequest)super.withVersion(operator, values); - } - - public AcademyRequest withVersionIsUnknown(){ - return (AcademyRequest)super.withVersionIsUnknown(); - } - - public AcademyRequest withVersionIsKnown(){ - return (AcademyRequest)super.withVersionIsKnown(); - } - - - public AcademyRequest withIdIs(Long value){ - return (AcademyRequest)super.withIdIs(value); - } - - public AcademyRequest withId(Operator operator, Object... values){ - return (AcademyRequest)super.withId(operator, values); - } - - - public AcademyRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public AcademyRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public AcademyRequest minStudentCapacity(){ - super.minStudentCapacity(); - return this; - } - - public AcademyRequest minStudentCapacityAs(String retName){ - super.minStudentCapacityAs(retName); - return this; - } - public AcademyRequest maxStudentCapacity(){ - super.maxStudentCapacity(); - return this; - } - - public AcademyRequest maxStudentCapacityAs(String retName){ - super.maxStudentCapacityAs(retName); - return this; - } - public AcademyRequest sumStudentCapacity(){ - super.sumStudentCapacity(); - return this; - } - - public AcademyRequest sumStudentCapacityAs(String retName){ - super.sumStudentCapacityAs(retName); - return this; - } - public AcademyRequest avgStudentCapacity(){ - super.avgStudentCapacity(); - return this; - } - - public AcademyRequest avgStudentCapacityAs(String retName){ - super.avgStudentCapacityAs(retName); - return this; - } - public AcademyRequest stddevStudentCapacity(){ - super.standardDeviationStudentCapacity(); - return this; - } - - public AcademyRequest stddevStudentCapacityAs(String retName){ - super.standardDeviationStudentCapacityAs(retName); - return this; - } - public AcademyRequest stddev_popStudentCapacity(){ - super.squareRootOfPopulationStandardDeviationStudentCapacity(); - return this; - } - - public AcademyRequest stddev_popStudentCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviationStudentCapacityAs(retName); - return this; - } - public AcademyRequest var_sampStudentCapacity(){ - super.sampleVarianceStudentCapacity(); - return this; - } - - public AcademyRequest var_sampStudentCapacityAs(String retName){ - super.sampleVarianceStudentCapacityAs(retName); - return this; - } - public AcademyRequest var_popStudentCapacity(){ - super.samplePopulationVarianceStudentCapacity(); - return this; - } - - public AcademyRequest var_popStudentCapacityAs(String retName){ - super.samplePopulationVarianceStudentCapacityAs(retName); - return this; - } - public AcademyRequest groupByPlatformWithDetails(){ - super.groupByPlatformWithDetails(); - return this; - } - - public AcademyRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - super.groupByPlatformWithDetails(subRequest); - return this; - } - - public AcademyRequest groupBySchoolTypeWithDetails(){ - super.groupBySchoolTypeWithDetails(); - return this; - } - - public AcademyRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ - super.groupBySchoolTypeWithDetails(subRequest); - return this; - } - - - - - - public AcademyRequest countDistinctCampusCode(){ - return countDistinctCampusCodeAs("campus_code_distinct_count"); - } - - public AcademyRequest countDistinctCampusCodeAs(String alias){ - super.countDistinctProperty(alias, Academy.CAMPUS_CODE_PROPERTY); - return this; - } - public AcademyRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public AcademyRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, Academy.PLATFORM_PROPERTY); - return this; - } - public AcademyRequest countDistinctSchoolType(){ - return countDistinctSchoolTypeAs("school_type_distinct_count"); - } - - public AcademyRequest countDistinctSchoolTypeAs(String alias){ - super.countDistinctProperty(alias, Academy.SCHOOL_TYPE_PROPERTY); - return this; - } - public AcademyRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public AcademyRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Academy.NAME_PROPERTY); - return this; - } - public AcademyRequest countDistinctStudentCapacity(){ - return countDistinctStudentCapacityAs("student_capacity_distinct_count"); - } - - public AcademyRequest countDistinctStudentCapacityAs(String alias){ - super.countDistinctProperty(alias, Academy.STUDENT_CAPACITY_PROPERTY); - return this; - } - public AcademyRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public AcademyRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Academy.VERSION_PROPERTY); - return this; - } - public AcademyRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public AcademyRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Academy.ID_PROPERTY); - return this; - } - - public AcademyRequest groupByCampusCode(){ - groupBy(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - - public AcademyRequest groupByCampusCodeAs(String retName){ - groupBy(retName, Academy.CAMPUS_CODE_PROPERTY); - return this; - } - - public AcademyRequest groupByCampusCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Academy.CAMPUS_CODE_PROPERTY, function); - return this; - } - - - public AcademyRequest groupByPlatformWith(PlatformRequest subRequest){ - super.groupByPlatformWith(subRequest); - return this; - } - public AcademyRequest groupByPlatform(){ - super.groupByPlatform(); - return this; - } - - public AcademyRequest groupByPlatformAs(String retName){ - super.groupByPlatformAs(retName); - return this; - } - - public AcademyRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - super.groupByPlatformWithFunction(retName, function); - return this; - } - public AcademyRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - super.groupBySchoolTypeWith(subRequest); - return this; - } - public AcademyRequest groupBySchoolType(){ - super.groupBySchoolType(); - return this; - } - - public AcademyRequest groupBySchoolTypeAs(String retName){ - super.groupBySchoolTypeAs(retName); - return this; - } - - public AcademyRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ - super.groupBySchoolTypeWithFunction(retName, function); - return this; - } - - public AcademyRequest groupByName(){ - super.groupByName(); - return this; - } - - public AcademyRequest groupByNameAs(String retName){ - super.groupByNameAs(retName); - return this; - } - - public AcademyRequest groupByNameWithFunction(String retName, AggrFunction function){ - super.groupByNameWithFunction(retName, function); - return this; - } - - public AcademyRequest groupByStudentCapacity(){ - super.groupByStudentCapacity(); - return this; - } - - public AcademyRequest groupByStudentCapacityAs(String retName){ - super.groupByStudentCapacityAs(retName); - return this; - } - - public AcademyRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ - super.groupByStudentCapacityWithFunction(retName, function); - return this; - } - - public AcademyRequest groupByVersion(){ - super.groupByVersion(); - return this; - } - - public AcademyRequest groupByVersionAs(String retName){ - super.groupByVersionAs(retName); - return this; - } - - public AcademyRequest groupByVersionWithFunction(String retName, AggrFunction function){ - super.groupByVersionWithFunction(retName, function); - return this; - } - - public AcademyRequest groupById(){ - super.groupById(); - return this; - } - - public AcademyRequest groupByIdAs(String retName){ - super.groupByIdAs(retName); - return this; - } - - public AcademyRequest groupByIdWithFunction(String retName, AggrFunction function){ - super.groupByIdWithFunction(retName, function); - return this; - } - - public AcademyRequest orderByCampusCodeAscending(){ - addOrderByAscending(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - - public AcademyRequest orderByCampusCodeDescending(){ - addOrderByDescending(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - public AcademyRequest orderByCampusCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - - public AcademyRequest orderByCampusCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Academy.CAMPUS_CODE_PROPERTY); - return this; - } - public AcademyRequest orderByPlatformAscending(){ - super.orderByPlatformAscending(); - return this; - } - - public AcademyRequest orderByPlatformDescending(){ - super.orderByPlatformDescending(); - return this; - } - - public AcademyRequest orderBySchoolTypeAscending(){ - super.orderBySchoolTypeAscending(); - return this; - } - - public AcademyRequest orderBySchoolTypeDescending(){ - super.orderBySchoolTypeDescending(); - return this; - } - - public AcademyRequest orderByNameAscending(){ - super.orderByNameAscending(); - return this; - } - - public AcademyRequest orderByNameDescending(){ - super.orderByNameDescending(); - return this; - } - public AcademyRequest orderByNameAscendingUsingGBK(){ - super.orderByNameAscendingUsingGBK(); - return this; - } - - public AcademyRequest orderByNameDescendingUsingGBK(){ - super.orderByNameDescendingUsingGBK(); - return this; - } - public AcademyRequest orderByStudentCapacityAscending(){ - super.orderByStudentCapacityAscending(); - return this; - } - - public AcademyRequest orderByStudentCapacityDescending(){ - super.orderByStudentCapacityDescending(); - return this; - } - - public AcademyRequest orderByVersionAscending(){ - super.orderByVersionAscending(); - return this; - } - - public AcademyRequest orderByVersionDescending(){ - super.orderByVersionDescending(); - return this; - } - - public AcademyRequest orderByIdAscending(){ - super.orderByIdAscending(); - return this; - } - - public AcademyRequest orderByIdDescending(){ - super.orderByIdDescending(); - return this; - } - - - - - - /** - * get topN records - * @param topN records number - */ - public AcademyRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public AcademyRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public AcademyRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public AcademyRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public AcademyRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public AcademyRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/College.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/College.java deleted file mode 100644 index e00f1ef19..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/College.java +++ /dev/null @@ -1,132 +0,0 @@ - -package com.example.inheritancematchingservice.college; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.school.School; -import io.teaql.core.Audited; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class College extends School implements RemoteInput { - public static String INTERNAL_TYPE = "College"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "992021f4267b1280cc0bfbc2f71330457b7b5f1549e06205c85c0db79c2ac489"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("degree_level", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("degree_level", java.util.List.of("degreeLevel", "degree_level"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - College.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String DEGREE_LEVEL_PROPERTY = "degree_level"; - private String degreeLevel; - - - public String getDegreeLevel(){ - return this.degreeLevel; - } - - public College updateDegreeLevel(String degreeLevel){ - degreeLevel = (degreeLevel == null ? null : degreeLevel.trim()); - if(isPropertyLoaded(DEGREE_LEVEL_PROPERTY) && Objects.equals(this.degreeLevel, degreeLevel)){ - return this; - } - handleUpdate(DEGREE_LEVEL_PROPERTY, getDegreeLevel(), degreeLevel); - this.degreeLevel = degreeLevel; - return this; - } - - public College updatePlatform(Platform platform){ - super.updatePlatform(platform); - return this; - } - - public College updateSchoolTypeToPrimary(){ - super.updateSchoolTypeToPrimary(); - return this; - } - public College updateSchoolTypeToSecondary(){ - super.updateSchoolTypeToSecondary(); - return this; - } - - public College updateName(String name){ - super.updateName(name); - return this; - } - - public College updateStudentCapacity(Integer studentCapacity){ - super.updateStudentCapacity(studentCapacity); - return this; - } - - - public static College refer(Long id){ - College refer = new College(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public College comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "degree_level": this.degreeLevel = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "degree_level": return this.degreeLevel; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "degreeLevel": return this.degreeLevel; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java deleted file mode 100644 index 83d57ae45..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeChecker.java +++ /dev/null @@ -1,49 +0,0 @@ - -package com.example.inheritancematchingservice.college; - -import com.example.inheritancematchingservice.school.SchoolChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CollegeChecker implements Checker{ - - public String type(){ - return College.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, College college, ObjectLocation _parentLocation){ - if(needCheck(_context, college)){ - markAsChecked(_context, college); - new SchoolChecker().doCheck(_context, college, _parentLocation); - - doCheck(_context, college, _parentLocation); - } - } - - public void doCheck(UserContext _context, College college, ObjectLocation _parentLocation){ - if((college == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, college); - if(college.needPersist()){ - } - if(college.newItem()){ - }else if(college.updateItem()){ - if(!college.isPropertyLoaded("degree_level")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "degree_level"), "Mutation requires a fully loaded entity"); - } - - } - checkDegreeLevel(_context, college.getProperty(College.DEGREE_LEVEL_PROPERTY), newLocation(_parentLocation, "degree_level")); - } - - public void checkDegreeLevel(UserContext _context, String degreeLevel, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, degreeLevel); - if((degreeLevel == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, degreeLevel); - - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java deleted file mode 100644 index 2df72960d..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeExpression.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.example.inheritancematchingservice.college; - -import com.example.inheritancematchingservice.school.SchoolExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import java.util.function.Function; - -public class CollegeExpression extends SchoolExpression implements BaseEntityExpression { - public CollegeExpression(Expression expression){ - super(expression); - } - - public CollegeExpression(Expression expression, Function function){ - super(expression, function); - } - - public CollegeExpression updateId(Long id){ - return new CollegeExpression(this, $it -> {((College)$it).__internalSet("id", id); return this;}); - } - - public CollegeExpression save(UserContext userContext){ - return new CollegeExpression(this, $it -> ((College)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CollegeExpression save(String intent, UserContext userContext){ - return new CollegeExpression(this, $it -> ((College)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getDegreeLevel(){ - return loaded("degree_level", "getDegreeLevel", College::getDegreeLevel); - } - public CollegeExpression updateDegreeLevel(String degreeLevel){ - return new CollegeExpression(this, $it -> ((College)$it).updateDegreeLevel(degreeLevel)); - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java deleted file mode 100644 index a4442c5b7..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.inheritancematchingservice.college; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CollegeListExpression extends SmartListExpression { - public CollegeListExpression(Expression> expression){ - super(expression); - } - - public CollegeListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CollegeExpression first() { - return new CollegeExpression(super.first()); - } - - public CollegeExpression get(int index) { - return new CollegeExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java deleted file mode 100644 index fd542aff0..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/college/CollegeRequest.java +++ /dev/null @@ -1,939 +0,0 @@ - -package com.example.inheritancematchingservice.college; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformRequest; -import com.example.inheritancematchingservice.school.SchoolRequest; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CollegeRequest extends SchoolRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CollegeRequest(Class returnType){ - this(returnType, () -> (T) new College()); - } - - protected CollegeRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CollegeRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CollegeRequest copy(){ - return (CollegeRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CollegeRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CollegeRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CollegeRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CollegeRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CollegeRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CollegeRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CollegeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CollegeRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CollegeRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CollegeRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CollegeRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CollegeRequest)super.appendSearchCriteria(searchCriteria); - } - - public CollegeRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CollegeRequest matchingAnyOf(CollegeRequest college){ - super.internalMatchAny(college); - return this; - } - - public CollegeRequest matchingIdsOf(CollegeRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - College.ID_PROPERTY, request, College.ID_PROPERTY)); - } - - public CollegeRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CollegeRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CollegeRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CollegeRequest selectSelf(){ - super.selectSelf(); - return selectDegreeLevel(); - } - - public CollegeRequest selectSelfFields(){ - return selectSelf(); - } - - public CollegeRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(College.DEGREE_LEVEL_PROPERTY); - return this; - } - - public CollegeRequest selectAll(){ - super.selectAll(); - return selectDegreeLevel(); - } - - public CollegeRequest selectChildren(){ - super.selectAny(); - return selectDegreeLevel(); - } - - - public CollegeRequest selectDegreeLevel(){ - selectProperty(College.DEGREE_LEVEL_PROPERTY); - return this; - } - - /** - * fill the degreeLevel with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS degreeLevel) to fetch degreeLevel property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CollegeRequest unselectDegreeLevel(){ - unselectProperty(College.DEGREE_LEVEL_PROPERTY); - return this; - } - public CollegeRequest selectPlatformIdOnly(){ - super.selectPlatformIdOnly(); - return this; - } - - public CollegeRequest selectPlatform(){ - super.selectPlatform(); - return this; - } - - public CollegeRequest selectPlatformWith(PlatformRequest platform){ - super.selectPlatformWith(platform); - return this; - } - - public CollegeRequest unselectPlatform(){ - super.unselectPlatform(); - return this; - } - public CollegeRequest selectSchoolTypeIdOnly(){ - super.selectSchoolTypeIdOnly(); - return this; - } - - public CollegeRequest selectSchoolType(){ - super.selectSchoolType(); - return this; - } - - public CollegeRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ - super.selectSchoolTypeWith(schoolType); - return this; - } - - public CollegeRequest unselectSchoolType(){ - super.unselectSchoolType(); - return this; - } - public CollegeRequest selectName(){ - super.selectName(); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CollegeRequest unselectName(){ - super.unselectName(); - return this; - } - public CollegeRequest selectStudentCapacity(){ - super.selectStudentCapacity(); - return this; - } - - /** - * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. - * @param aggrFunction aggrFunction - */ - public CollegeRequest selectStudentCapacity(AggrFunction aggrFunction){ - super.selectStudentCapacity(aggrFunction); - return this; - } - - - public CollegeRequest unselectStudentCapacity(){ - super.unselectStudentCapacity(); - return this; - } - public CollegeRequest selectVersion(){ - super.selectVersion(); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CollegeRequest unselectVersion(){ - super.unselectVersion(); - return this; - } - public CollegeRequest selectId(){ - super.selectId(); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CollegeRequest unselectId(){ - super.unselectId(); - return this; - } - - public CollegeRequest filterByDegreeLevel(String... degreeLevel){ - if (degreeLevel == null || degreeLevel.length == 0) { - throw new IllegalArgumentException("filterByDegreeLevel parameter degreeLevel cannot be empty"); - } - return appendSearchCriteria(createDegreeLevelCriteria(Operator.EQUAL, (Object[])degreeLevel)); - } - - public CollegeRequest withDegreeLevel(Operator operator, Object... values){ - return appendSearchCriteria(createDegreeLevelCriteria(operator, values)); - } - - public CollegeRequest withDegreeLevelIsUnknown(){ - return withDegreeLevel(Operator.IS_NULL); - } - - public CollegeRequest withDegreeLevelIsKnown(){ - return withDegreeLevel(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDegreeLevelCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(College.DEGREE_LEVEL_PROPERTY, operator, values); - } - - public CollegeRequest withDegreeLevelIsNot(String degreeLevel){ - return withDegreeLevel(Operator.NOT_EQUAL, degreeLevel); - } - - public CollegeRequest withDegreeLevelIn(String... degreeLevel){ - return withDegreeLevel(Operator.IN, (Object[])degreeLevel); - } - - public CollegeRequest withDegreeLevelNotIn(String... degreeLevel){ - return withDegreeLevel(Operator.NOT_IN, (Object[])degreeLevel); - } - public CollegeRequest withDegreeLevelGreaterThan(String degreeLevel){ - return withDegreeLevel(Operator.GREATER_THAN, degreeLevel); - } - - public CollegeRequest withDegreeLevelGreaterThanOrEqualTo(String degreeLevel){ - return withDegreeLevel(Operator.GREATER_THAN_OR_EQUAL, degreeLevel); - } - - public CollegeRequest withDegreeLevelLessThan(String degreeLevel){ - return withDegreeLevel(Operator.LESS_THAN, degreeLevel); - } - - public CollegeRequest withDegreeLevelLessThanOrEqualTo(String degreeLevel){ - return withDegreeLevel(Operator.LESS_THAN_OR_EQUAL, degreeLevel); - } - - public CollegeRequest withDegreeLevelBetween(String startOfDegreeLevel, String endOfDegreeLevel){ - return withDegreeLevel(Operator.BETWEEN, startOfDegreeLevel, endOfDegreeLevel); - } - public CollegeRequest withDegreeLevelStartingWith(String degreeLevel){ - return withDegreeLevel(Operator.BEGIN_WITH, degreeLevel); - } - public CollegeRequest withDegreeLevelContaining(String degreeLevel){ - return withDegreeLevel(Operator.CONTAIN, degreeLevel); - } - - public CollegeRequest withDegreeLevelNotContaining(String degreeLevel){ - return withDegreeLevel(Operator.NOT_CONTAIN, degreeLevel); - } - - public CollegeRequest withDegreeLevelNotStartingWith(String degreeLevel){ - return withDegreeLevel(Operator.NOT_BEGIN_WITH, degreeLevel); - } - - public CollegeRequest withDegreeLevelEndingWith(String degreeLevel){ - return withDegreeLevel(Operator.END_WITH, degreeLevel); - } - - public CollegeRequest withDegreeLevelNotEndingWith(String degreeLevel){ - return withDegreeLevel(Operator.NOT_END_WITH, degreeLevel); - } - - public CollegeRequest withDegreeLevelIs(String degreeLevel){ - return withDegreeLevel(Operator.EQUAL, degreeLevel); - } - - public CollegeRequest withDegreeLevelSoundingLike(String degreeLevel){ - return withDegreeLevel(Operator.SOUNDS_LIKE, degreeLevel); - } - - - - public CollegeRequest filterByPlatform(Platform platform){ - return (CollegeRequest)super.filterByPlatform(platform); - } - - public CollegeRequest withPlatform(Operator operator, Object... values){ - return (CollegeRequest)super.withPlatform(operator, values); - } - - public CollegeRequest withPlatformIsUnknown(){ - return (CollegeRequest)super.withPlatformIsUnknown(); - } - - public CollegeRequest withPlatformIsKnown(){ - return (CollegeRequest)super.withPlatformIsKnown(); - } - - public CollegeRequest filterByPlatform(Long platform){ - return (CollegeRequest)super.filterByPlatform(platform); - } - - public CollegeRequest withPlatformMatching(PlatformRequest platform){ - return (CollegeRequest)super.withPlatformMatching(platform); - } - - public CollegeRequest filterBySchoolType(SchoolType schoolType){ - return (CollegeRequest)super.filterBySchoolType(schoolType); - } - - public CollegeRequest withSchoolType(Operator operator, Object... values){ - return (CollegeRequest)super.withSchoolType(operator, values); - } - - public CollegeRequest withSchoolTypeIsUnknown(){ - return (CollegeRequest)super.withSchoolTypeIsUnknown(); - } - - public CollegeRequest withSchoolTypeIsKnown(){ - return (CollegeRequest)super.withSchoolTypeIsKnown(); - } - - public CollegeRequest filterBySchoolType(Long schoolType){ - return (CollegeRequest)super.filterBySchoolType(schoolType); - } - - public CollegeRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ - return (CollegeRequest)super.withSchoolTypeMatching(schoolType); - } - - public CollegeRequest filterByName(String name){ - return (CollegeRequest)super.filterByName(name); - } - - public CollegeRequest withName(Operator operator, Object... values){ - return (CollegeRequest)super.withName(operator, values); - } - - public CollegeRequest withNameIsUnknown(){ - return (CollegeRequest)super.withNameIsUnknown(); - } - - public CollegeRequest withNameIsKnown(){ - return (CollegeRequest)super.withNameIsKnown(); - } - - public CollegeRequest withNameStartingWith(String Name){ - return (CollegeRequest)super.withNameStartingWith(Name); - } - public CollegeRequest withNameContaining(String Name){ - return (CollegeRequest)super.withNameContaining(Name); - } - - public CollegeRequest withNameEndingWith(String Name){ - return (CollegeRequest)super.withNameEndingWith(Name); - } - - - public CollegeRequest filterByStudentCapacity(Integer studentCapacity){ - return (CollegeRequest)super.filterByStudentCapacity(studentCapacity); - } - - public CollegeRequest withStudentCapacity(Operator operator, Object... values){ - return (CollegeRequest)super.withStudentCapacity(operator, values); - } - - public CollegeRequest withStudentCapacityIsUnknown(){ - return (CollegeRequest)super.withStudentCapacityIsUnknown(); - } - - public CollegeRequest withStudentCapacityIsKnown(){ - return (CollegeRequest)super.withStudentCapacityIsKnown(); - } - - public CollegeRequest withStudentCapacityGreaterThan(Integer studentCapacity){ - return (CollegeRequest)super.withStudentCapacityGreaterThan(studentCapacity); - } - - public CollegeRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ - return (CollegeRequest)super.withStudentCapacityGreaterThanOrEqualTo(studentCapacity); - } - - public CollegeRequest withStudentCapacityLessThan(Integer studentCapacity){ - return (CollegeRequest)super.withStudentCapacityLessThan(studentCapacity); - } - - public CollegeRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ - return (CollegeRequest)super.withStudentCapacityLessThanOrEqualTo(studentCapacity); - } - - public CollegeRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ - return (CollegeRequest)super.withStudentCapacityBetween(startOfStudentCapacity, endOfStudentCapacity); - } - - - public CollegeRequest filterByVersion(Long version){ - return (CollegeRequest)super.filterByVersion(version); - } - - public CollegeRequest withVersion(Operator operator, Object... values){ - return (CollegeRequest)super.withVersion(operator, values); - } - - public CollegeRequest withVersionIsUnknown(){ - return (CollegeRequest)super.withVersionIsUnknown(); - } - - public CollegeRequest withVersionIsKnown(){ - return (CollegeRequest)super.withVersionIsKnown(); - } - - - public CollegeRequest withIdIs(Long value){ - return (CollegeRequest)super.withIdIs(value); - } - - public CollegeRequest withId(Operator operator, Object... values){ - return (CollegeRequest)super.withId(operator, values); - } - - - public CollegeRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CollegeRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CollegeRequest minStudentCapacity(){ - super.minStudentCapacity(); - return this; - } - - public CollegeRequest minStudentCapacityAs(String retName){ - super.minStudentCapacityAs(retName); - return this; - } - public CollegeRequest maxStudentCapacity(){ - super.maxStudentCapacity(); - return this; - } - - public CollegeRequest maxStudentCapacityAs(String retName){ - super.maxStudentCapacityAs(retName); - return this; - } - public CollegeRequest sumStudentCapacity(){ - super.sumStudentCapacity(); - return this; - } - - public CollegeRequest sumStudentCapacityAs(String retName){ - super.sumStudentCapacityAs(retName); - return this; - } - public CollegeRequest avgStudentCapacity(){ - super.avgStudentCapacity(); - return this; - } - - public CollegeRequest avgStudentCapacityAs(String retName){ - super.avgStudentCapacityAs(retName); - return this; - } - public CollegeRequest stddevStudentCapacity(){ - super.standardDeviationStudentCapacity(); - return this; - } - - public CollegeRequest stddevStudentCapacityAs(String retName){ - super.standardDeviationStudentCapacityAs(retName); - return this; - } - public CollegeRequest stddev_popStudentCapacity(){ - super.squareRootOfPopulationStandardDeviationStudentCapacity(); - return this; - } - - public CollegeRequest stddev_popStudentCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviationStudentCapacityAs(retName); - return this; - } - public CollegeRequest var_sampStudentCapacity(){ - super.sampleVarianceStudentCapacity(); - return this; - } - - public CollegeRequest var_sampStudentCapacityAs(String retName){ - super.sampleVarianceStudentCapacityAs(retName); - return this; - } - public CollegeRequest var_popStudentCapacity(){ - super.samplePopulationVarianceStudentCapacity(); - return this; - } - - public CollegeRequest var_popStudentCapacityAs(String retName){ - super.samplePopulationVarianceStudentCapacityAs(retName); - return this; - } - public CollegeRequest groupByPlatformWithDetails(){ - super.groupByPlatformWithDetails(); - return this; - } - - public CollegeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - super.groupByPlatformWithDetails(subRequest); - return this; - } - - public CollegeRequest groupBySchoolTypeWithDetails(){ - super.groupBySchoolTypeWithDetails(); - return this; - } - - public CollegeRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ - super.groupBySchoolTypeWithDetails(subRequest); - return this; - } - - - - - - public CollegeRequest countDistinctDegreeLevel(){ - return countDistinctDegreeLevelAs("degree_level_distinct_count"); - } - - public CollegeRequest countDistinctDegreeLevelAs(String alias){ - super.countDistinctProperty(alias, College.DEGREE_LEVEL_PROPERTY); - return this; - } - public CollegeRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public CollegeRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, College.PLATFORM_PROPERTY); - return this; - } - public CollegeRequest countDistinctSchoolType(){ - return countDistinctSchoolTypeAs("school_type_distinct_count"); - } - - public CollegeRequest countDistinctSchoolTypeAs(String alias){ - super.countDistinctProperty(alias, College.SCHOOL_TYPE_PROPERTY); - return this; - } - public CollegeRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public CollegeRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, College.NAME_PROPERTY); - return this; - } - public CollegeRequest countDistinctStudentCapacity(){ - return countDistinctStudentCapacityAs("student_capacity_distinct_count"); - } - - public CollegeRequest countDistinctStudentCapacityAs(String alias){ - super.countDistinctProperty(alias, College.STUDENT_CAPACITY_PROPERTY); - return this; - } - public CollegeRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CollegeRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, College.VERSION_PROPERTY); - return this; - } - public CollegeRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CollegeRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, College.ID_PROPERTY); - return this; - } - - public CollegeRequest groupByDegreeLevel(){ - groupBy(College.DEGREE_LEVEL_PROPERTY); - return this; - } - - public CollegeRequest groupByDegreeLevelAs(String retName){ - groupBy(retName, College.DEGREE_LEVEL_PROPERTY); - return this; - } - - public CollegeRequest groupByDegreeLevelWithFunction(String retName, AggrFunction function){ - groupBy(retName, College.DEGREE_LEVEL_PROPERTY, function); - return this; - } - - - public CollegeRequest groupByPlatformWith(PlatformRequest subRequest){ - super.groupByPlatformWith(subRequest); - return this; - } - public CollegeRequest groupByPlatform(){ - super.groupByPlatform(); - return this; - } - - public CollegeRequest groupByPlatformAs(String retName){ - super.groupByPlatformAs(retName); - return this; - } - - public CollegeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - super.groupByPlatformWithFunction(retName, function); - return this; - } - public CollegeRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - super.groupBySchoolTypeWith(subRequest); - return this; - } - public CollegeRequest groupBySchoolType(){ - super.groupBySchoolType(); - return this; - } - - public CollegeRequest groupBySchoolTypeAs(String retName){ - super.groupBySchoolTypeAs(retName); - return this; - } - - public CollegeRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ - super.groupBySchoolTypeWithFunction(retName, function); - return this; - } - - public CollegeRequest groupByName(){ - super.groupByName(); - return this; - } - - public CollegeRequest groupByNameAs(String retName){ - super.groupByNameAs(retName); - return this; - } - - public CollegeRequest groupByNameWithFunction(String retName, AggrFunction function){ - super.groupByNameWithFunction(retName, function); - return this; - } - - public CollegeRequest groupByStudentCapacity(){ - super.groupByStudentCapacity(); - return this; - } - - public CollegeRequest groupByStudentCapacityAs(String retName){ - super.groupByStudentCapacityAs(retName); - return this; - } - - public CollegeRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ - super.groupByStudentCapacityWithFunction(retName, function); - return this; - } - - public CollegeRequest groupByVersion(){ - super.groupByVersion(); - return this; - } - - public CollegeRequest groupByVersionAs(String retName){ - super.groupByVersionAs(retName); - return this; - } - - public CollegeRequest groupByVersionWithFunction(String retName, AggrFunction function){ - super.groupByVersionWithFunction(retName, function); - return this; - } - - public CollegeRequest groupById(){ - super.groupById(); - return this; - } - - public CollegeRequest groupByIdAs(String retName){ - super.groupByIdAs(retName); - return this; - } - - public CollegeRequest groupByIdWithFunction(String retName, AggrFunction function){ - super.groupByIdWithFunction(retName, function); - return this; - } - - public CollegeRequest orderByDegreeLevelAscending(){ - addOrderByAscending(College.DEGREE_LEVEL_PROPERTY); - return this; - } - - public CollegeRequest orderByDegreeLevelDescending(){ - addOrderByDescending(College.DEGREE_LEVEL_PROPERTY); - return this; - } - public CollegeRequest orderByDegreeLevelAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(College.DEGREE_LEVEL_PROPERTY); - return this; - } - - public CollegeRequest orderByDegreeLevelDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(College.DEGREE_LEVEL_PROPERTY); - return this; - } - public CollegeRequest orderByPlatformAscending(){ - super.orderByPlatformAscending(); - return this; - } - - public CollegeRequest orderByPlatformDescending(){ - super.orderByPlatformDescending(); - return this; - } - - public CollegeRequest orderBySchoolTypeAscending(){ - super.orderBySchoolTypeAscending(); - return this; - } - - public CollegeRequest orderBySchoolTypeDescending(){ - super.orderBySchoolTypeDescending(); - return this; - } - - public CollegeRequest orderByNameAscending(){ - super.orderByNameAscending(); - return this; - } - - public CollegeRequest orderByNameDescending(){ - super.orderByNameDescending(); - return this; - } - public CollegeRequest orderByNameAscendingUsingGBK(){ - super.orderByNameAscendingUsingGBK(); - return this; - } - - public CollegeRequest orderByNameDescendingUsingGBK(){ - super.orderByNameDescendingUsingGBK(); - return this; - } - public CollegeRequest orderByStudentCapacityAscending(){ - super.orderByStudentCapacityAscending(); - return this; - } - - public CollegeRequest orderByStudentCapacityDescending(){ - super.orderByStudentCapacityDescending(); - return this; - } - - public CollegeRequest orderByVersionAscending(){ - super.orderByVersionAscending(); - return this; - } - - public CollegeRequest orderByVersionDescending(){ - super.orderByVersionDescending(); - return this; - } - - public CollegeRequest orderByIdAscending(){ - super.orderByIdAscending(); - return this; - } - - public CollegeRequest orderByIdDescending(){ - super.orderByIdDescending(); - return this; - } - - - - - - /** - * get topN records - * @param topN records number - */ - public CollegeRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CollegeRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CollegeRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CollegeRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CollegeRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CollegeRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java deleted file mode 100644 index db2a9a7ca..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/Platform.java +++ /dev/null @@ -1,173 +0,0 @@ - -package com.example.inheritancematchingservice.platform; - -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "fb6f885aa255ea9a640abdacbfd75ce6a8def1126fdd5125a9de45c533c26d44"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "school_type_list", "school_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String BASE_URL_PROPERTY = "base_url"; - public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; - public static final String SCHOOL_LIST_PROPERTY = "school_list"; - private String name; - - private String baseUrl; - - private SmartList schoolTypeList; - private SmartList schoolList; - - public String getName(){ - return this.name; - } - - public String getBaseUrl(){ - return this.baseUrl; - } - - public SmartList getSchoolTypeList(){ - return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; - } - public SmartList getSchoolList(){ - return this.schoolList == null ? SmartList.unloaded() : this.schoolList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform updateBaseUrl(String baseUrl){ - baseUrl = (baseUrl == null ? null : baseUrl.trim()); - if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ - return this; - } - handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); - this.baseUrl = baseUrl; - return this; - } - - public Platform addSchoolType(SchoolType schoolType){ - if (schoolType == null){ - return this; - } - - if(null == this.schoolTypeList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolTypeList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolTypeList.add(schoolType); - schoolType.updatePlatform(this); - return this; - } - public Platform addSchool(School school){ - if (school == null){ - return this; - } - - if(null == this.schoolList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolList.add(school); - school.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; - - case "school_type_list": this.schoolTypeList = (SmartList) value; break; - case "school_list": this.schoolList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "base_url": return this.baseUrl; - case "school_type_list": return this.schoolTypeList; - case "school_list": return this.schoolList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "baseUrl": return this.baseUrl; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java deleted file mode 100644 index da7313686..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformChecker.java +++ /dev/null @@ -1,70 +0,0 @@ - -package com.example.inheritancematchingservice.platform; - -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolChecker; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("base_url")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); - for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ - SchoolType schoolType = platform.getSchoolTypeList().get(i); - new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); - } - for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ - School school = platform.getSchoolList().get(i); - new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, baseUrl); - if((baseUrl == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, baseUrl); - - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java deleted file mode 100644 index 739be6bf5..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformExpression.java +++ /dev/null @@ -1,66 +0,0 @@ - -package com.example.inheritancematchingservice.platform; - -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolListExpression; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public Expression getBaseUrl(){ - return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); - } - public PlatformExpression updateBaseUrl(String baseUrl){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); - } - - public SchoolTypeListExpression getSchoolTypeList(){ - return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); - } - public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); - } - public PlatformExpression addSchoolType(SchoolType schoolType){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); - } - public PlatformExpression addSchool(School school){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java deleted file mode 100644 index 7722b7b89..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.inheritancematchingservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java deleted file mode 100644 index 97090dd96..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/platform/PlatformRequest.java +++ /dev/null @@ -1,980 +0,0 @@ - -package com.example.inheritancematchingservice.platform; - -import com.example.inheritancematchingservice.Q; -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolRequest; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectBaseUrl().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.BASE_URL_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectBaseUrl().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectSchoolTypeList().selectSchoolList(); - return selectId().selectName().selectBaseUrl().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectBaseUrl(){ - selectProperty(Platform.BASE_URL_PROPERTY); - return this; - } - - /** - * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectBaseUrl(){ - unselectProperty(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectSchoolTypeList(){ - return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); - } - - public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ - enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest selectSchoolList(){ - return selectSchoolListWith(Q.schools().selectSelf()); - } - - public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByBaseUrl(String... baseUrl){ - if (baseUrl == null || baseUrl.length == 0) { - throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); - } - return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); - } - - public PlatformRequest withBaseUrl(Operator operator, Object... values){ - return appendSearchCriteria(createBaseUrlCriteria(operator, values)); - } - - public PlatformRequest withBaseUrlIsUnknown(){ - return withBaseUrl(Operator.IS_NULL); - } - - public PlatformRequest withBaseUrlIsKnown(){ - return withBaseUrl(Operator.IS_NOT_NULL); - } - - public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); - } - - public PlatformRequest withBaseUrlIsNot(String baseUrl){ - return withBaseUrl(Operator.NOT_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlIn(String... baseUrl){ - return withBaseUrl(Operator.IN, (Object[])baseUrl); - } - - public PlatformRequest withBaseUrlNotIn(String... baseUrl){ - return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); - } - public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ - return withBaseUrl(Operator.GREATER_THAN, baseUrl); - } - - public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ - return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlLessThan(String baseUrl){ - return withBaseUrl(Operator.LESS_THAN, baseUrl); - } - - public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ - return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ - return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); - } - public PlatformRequest withBaseUrlStartingWith(String baseUrl){ - return withBaseUrl(Operator.BEGIN_WITH, baseUrl); - } - public PlatformRequest withBaseUrlContaining(String baseUrl){ - return withBaseUrl(Operator.CONTAIN, baseUrl); - } - - public PlatformRequest withBaseUrlNotContaining(String baseUrl){ - return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); - } - - public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ - return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlEndingWith(String baseUrl){ - return withBaseUrl(Operator.END_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ - return withBaseUrl(Operator.NOT_END_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlIs(String baseUrl){ - return withBaseUrl(Operator.EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ - return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchoolTypes(){ - return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); - } - - public PlatformRequest haveNoSchoolTypes(){ - return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); - } - public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchools(){ - return withSchoolListMatching(Q.schools().unlimited()); - } - - public PlatformRequest haveNoSchools(){ - return withoutSchoolListMatching(Q.schools().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctBaseUrl(){ - return countDistinctBaseUrlAs("base_url_distinct_count"); - } - - public PlatformRequest countDistinctBaseUrlAs(String alias){ - super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ - aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); - return this; - } - public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ - aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByBaseUrl(){ - groupBy(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest groupByBaseUrlAs(String retName){ - groupBy(retName, Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.BASE_URL_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByBaseUrlAscending(){ - addOrderByAscending(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest orderByBaseUrlDescending(){ - addOrderByDescending(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(REFINEMENTS, subRequest); - } - public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchools(SchoolRequest subRequest){ - return statsFromSchoolsAs(REFINEMENTS, subRequest); - } - public PlatformRequest countSchoolTypes(){ - addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolTypesAs(String name){ - addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ - addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest countSchools(){ - addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolsAs(String name){ - addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ - addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest minStudentCapacityOfSchools(){ - addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ - return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxStudentCapacityOfSchools(){ - addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ - return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumStudentCapacityOfSchools(){ - addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ - return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgStudentCapacityOfSchools(){ - addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ - return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ - return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ - return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/School.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/School.java deleted file mode 100644 index 9d4e5bdcc..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/School.java +++ /dev/null @@ -1,184 +0,0 @@ - -package com.example.inheritancematchingservice.school; - -import com.example.inheritancematchingservice.Constants; -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class School extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "School"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "23ce18d8c80d8d15fa2363ed814bde7c8f04861a2547ac0a722514c1626da577"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - School.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String SCHOOL_TYPE_PROPERTY = "school_type"; - public static final String NAME_PROPERTY = "name"; - public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; - private Platform platform; - - private SchoolType schoolType; - - private String name; - - private Integer studentCapacity; - - - public Platform getPlatform(){ - return this.platform; - } - - public SchoolType getSchoolType(){ - return this.schoolType; - } - - public String getName(){ - return this.name; - } - - public Integer getStudentCapacity(){ - return this.studentCapacity; - } - - public School updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - protected School updateSchoolType(SchoolType schoolType){ - if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ - return this; - } - handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); - this.schoolType = schoolType; - return this; - } - - public School updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public School updateStudentCapacity(Integer studentCapacity){ - if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ - return this; - } - handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); - this.studentCapacity = studentCapacity; - return this; - } - - public boolean isSchoolTypePrimary(){ - return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); - } - - public School updateSchoolTypeToPrimary(){ - return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); - } - public boolean isSchoolTypeSecondary(){ - return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); - } - - public School updateSchoolTypeToSecondary(){ - return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); - } - - public static School refer(Long id){ - School refer = new School(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public School comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "school_type": this.schoolType = (SchoolType) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "student_capacity": this.studentCapacity = (Integer) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "school_type": return this.schoolType; - case "name": return this.name; - case "student_capacity": return this.studentCapacity; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "schoolType": return this.schoolType; - case "name": return this.name; - case "studentCapacity": return this.studentCapacity; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java deleted file mode 100644 index a78eb9f31..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolChecker.java +++ /dev/null @@ -1,82 +0,0 @@ - -package com.example.inheritancematchingservice.school; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformChecker; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class SchoolChecker implements Checker{ - - public String type(){ - return School.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ - if(needCheck(_context, school)){ - markAsChecked(_context, school); - doCheck(_context, school, _parentLocation); - } - } - - public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ - if((school == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, school); - if(school.needPersist()){ - } - if(school.newItem()){ - }else if(school.updateItem()){ - if(!school.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("school_type")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("student_capacity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); - checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, schoolType); - if((schoolType == null)){ - return; - } - new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, studentCapacity); - if((studentCapacity == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java deleted file mode 100644 index a61cc398d..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolExpression.java +++ /dev/null @@ -1,73 +0,0 @@ - -package com.example.inheritancematchingservice.school; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformExpression; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolExpression(Expression expression){ - super(expression); - } - - public SchoolExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolExpression updateId(Long id){ - return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); - } - - public SchoolExpression save(UserContext userContext){ - return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolExpression save(String intent, UserContext userContext){ - return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); - } - - public SchoolExpression updatePlatform(Platform platform){ - return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); - } - - public SchoolTypeExpression getSchoolType(){ - return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); - } - - public SchoolExpression updateSchoolTypeToPrimary(){ - return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); - } - public SchoolExpression updateSchoolTypeToSecondary(){ - return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); - } - - public Expression getName(){ - return loaded("name", "getName", School::getName); - } - public SchoolExpression updateName(String name){ - return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); - } - - public Expression getStudentCapacity(){ - return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); - } - public SchoolExpression updateStudentCapacity(Integer studentCapacity){ - return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java deleted file mode 100644 index 0756f9a1c..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.inheritancematchingservice.school; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolListExpression extends SmartListExpression { - public SchoolListExpression(Expression> expression){ - super(expression); - } - - public SchoolListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolExpression first() { - return new SchoolExpression(super.first()); - } - - public SchoolExpression get(int index) { - return new SchoolExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java deleted file mode 100644 index 689122a2a..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/school/SchoolRequest.java +++ /dev/null @@ -1,1046 +0,0 @@ - -package com.example.inheritancematchingservice.school; - -import cn.hutool.core.util.ObjectUtil; -import com.example.inheritancematchingservice.Q; -import com.example.inheritancematchingservice.academy.Academy; -import com.example.inheritancematchingservice.college.College; -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformRequest; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -public class SchoolRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolRequest(Class returnType){ - this(returnType, () -> (T) new School()); - } - - protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolRequest copy(){ - return (SchoolRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolRequest matchingAnyOf(SchoolRequest... schools){ - if(ObjectUtil.isEmpty(schools)){ - return this; - } - List l = new ArrayList(); - for(SchoolRequest school:schools){ - l.add(new SubQuerySearchCriteria(School.ID_PROPERTY, school, School.ID_PROPERTY)); - } - return appendSearchCriteria(SearchCriteria.or(l.toArray(new SearchCriteria[l.size()]))); - } - - public SchoolRequest enhanceChild(SchoolRequest school){ - super.enhanceSelf(school); - return this; - } - public SchoolRequest matchingIdsOf(SchoolRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - School.ID_PROPERTY, request, School.ID_PROPERTY)); - } - - public SchoolRequest enhanceChildrenIfNeeded(){ - this.enhanceChild( -Q.academiesWithChildren() -).enhanceChild( -new com.example.inheritancematchingservice.college.CollegeRequest(com.example.inheritancematchingservice.college.College.class).unlimited().selectSelfWithoutParent() -); - return this; - } - - public SchoolRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectStudentCapacity().selectVersion(); - } - - public SchoolRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(School.ID_PROPERTY); - selectProperty(School.PLATFORM_PROPERTY); - selectProperty(School.SCHOOL_TYPE_PROPERTY); - selectProperty(School.NAME_PROPERTY); - selectProperty(School.STUDENT_CAPACITY_PROPERTY); - selectProperty(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectSchoolType().selectName().selectStudentCapacity().selectVersion(); - } - - public SchoolRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectSchoolType().selectName().selectStudentCapacity().selectVersion(); - } - - - public SchoolRequest selectId(){ - selectProperty(School.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectId(){ - unselectProperty(School.ID_PROPERTY); - return this; - } - public SchoolRequest selectPlatformIdOnly(){ - selectProperty(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(School.PLATFORM_PROPERTY); - enhanceRelation(School.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); - return this; - } - - public SchoolRequest unselectPlatform(){ - unselectProperty(School.PLATFORM_PROPERTY); - return this; - } - public SchoolRequest selectSchoolTypeIdOnly(){ - selectProperty(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest selectSchoolType(){ - return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); - } - - public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ - selectProperty(School.SCHOOL_TYPE_PROPERTY); - enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); - return this; - } - - public SchoolRequest unselectSchoolType(){ - unselectProperty(School.SCHOOL_TYPE_PROPERTY); - return this; - } - public SchoolRequest selectName(){ - selectProperty(School.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectName(){ - unselectProperty(School.NAME_PROPERTY); - return this; - } - public SchoolRequest selectStudentCapacity(){ - selectProperty(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - /** - * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. - * @param aggrFunction aggrFunction - */ - public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ - selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); - return this; - } - - - public SchoolRequest unselectStudentCapacity(){ - unselectProperty(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest selectVersion(){ - selectProperty(School.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectVersion(){ - unselectProperty(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest isAcademy(){ - return matchTypes(Academy.INTERNAL_TYPE); - } - public SchoolRequest isCollege(){ - return matchTypes(College.INTERNAL_TYPE); - } - - public SchoolRequest matchTypes(String... types){ - super.matchType(types); - return this; - } - - public SchoolRequest withTypeGroup(){ - super.withTypeGroup(); - return this; - } - - public SchoolRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); - } - - public SchoolRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); - } - - public SchoolRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolRequest filterBySchoolType(SchoolType... schoolType){ - if (schoolType == null || schoolType.length == 0) { - throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); - } - return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); - } - - public SchoolRequest withSchoolType(Operator operator, Object... values){ - return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); - } - - public SchoolRequest withSchoolTypeIsUnknown(){ - return withSchoolType(Operator.IS_NULL); - } - - public SchoolRequest withSchoolTypeIsKnown(){ - return withSchoolType(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); - } - - public SchoolRequest filterBySchoolType(Long schoolType){ - if(schoolType == null){ - return this; - } - return withSchoolType(Operator.EQUAL, schoolType); - } - public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ - return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); - } - - public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); - } - - public SchoolRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); - } - - public SchoolRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ - if (studentCapacity == null || studentCapacity.length == 0) { - throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); - } - return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); - } - - public SchoolRequest withStudentCapacity(Operator operator, Object... values){ - return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); - } - - public SchoolRequest withStudentCapacityIsUnknown(){ - return withStudentCapacity(Operator.IS_NULL); - } - - public SchoolRequest withStudentCapacityIsKnown(){ - return withStudentCapacity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); - } - - public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ - return withStudentCapacity(Operator.EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ - return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ - return withStudentCapacity(Operator.IN, (Object[])studentCapacity); - } - - public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ - return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); - } - public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ - return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); - } - - public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ - return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ - return withStudentCapacity(Operator.LESS_THAN, studentCapacity); - } - - public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ - return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ - return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); - } - - - - public SchoolRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); - } - - public SchoolRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public SchoolRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolRequest minStudentCapacity(){ - return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest minStudentCapacityAs(String retName){ - super.min(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest maxStudentCapacity(){ - return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest maxStudentCapacityAs(String retName){ - super.max(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest sumStudentCapacity(){ - return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest sumStudentCapacityAs(String retName){ - super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest avgStudentCapacity(){ - return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest avgStudentCapacityAs(String retName){ - super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest standardDeviationStudentCapacity(){ - return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest standardDeviationStudentCapacityAs(String retName){ - super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ - return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest sampleVarianceStudentCapacity(){ - return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ - super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest samplePopulationVarianceStudentCapacity(){ - return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ - super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(School.PLATFORM_PROPERTY, subRequest); - return this; - } - - public SchoolRequest groupBySchoolTypeWithDetails(){ - return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); - } - - public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ - aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); - return this; - } - - - - - public SchoolRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, School.ID_PROPERTY); - return this; - } - public SchoolRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); - return this; - } - public SchoolRequest countDistinctSchoolType(){ - return countDistinctSchoolTypeAs("school_type_distinct_count"); - } - - public SchoolRequest countDistinctSchoolTypeAs(String alias){ - super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); - return this; - } - public SchoolRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, School.NAME_PROPERTY); - return this; - } - public SchoolRequest countDistinctStudentCapacity(){ - return countDistinctStudentCapacityAs("student_capacity_distinct_count"); - } - - public SchoolRequest countDistinctStudentCapacityAs(String alias){ - super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupById(){ - groupBy(School.ID_PROPERTY); - return this; - } - - public SchoolRequest groupByIdAs(String retName){ - groupBy(retName, School.ID_PROPERTY); - return this; - } - - public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ID_PROPERTY, function); - return this; - } - public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(School.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolRequest groupByPlatform(){ - groupBy(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest groupByPlatformAs(String retName){ - groupBy(retName, School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.PLATFORM_PROPERTY, function); - return this; - } - public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); - return this; - } - public SchoolRequest groupBySchoolType(){ - groupBy(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest groupBySchoolTypeAs(String retName){ - groupBy(retName, School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByName(){ - groupBy(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest groupByNameAs(String retName){ - groupBy(retName, School.NAME_PROPERTY); - return this; - } - - public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.NAME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByStudentCapacity(){ - groupBy(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest groupByStudentCapacityAs(String retName){ - groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); - return this; - } - - public SchoolRequest groupByVersion(){ - groupBy(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupByVersionAs(String retName){ - groupBy(retName, School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.VERSION_PROPERTY, function); - return this; - } - - public SchoolRequest withSchoolTypeIsPrimary(){ - filterBySchoolType(com.example.inheritancematchingservice.Constants.SCHOOL_TYPE_PRIMARY); - return this; - } - - - public SchoolRequest withSchoolTypeIsSecondary(){ - filterBySchoolType(com.example.inheritancematchingservice.Constants.SCHOOL_TYPE_SECONDARY); - return this; - } - - - - - public SchoolRequest orderByIdAscending(){ - addOrderByAscending(School.ID_PROPERTY); - return this; - } - - public SchoolRequest orderByIdDescending(){ - addOrderByDescending(School.ID_PROPERTY); - return this; - } - - public SchoolRequest orderByPlatformAscending(){ - addOrderByAscending(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest orderByPlatformDescending(){ - addOrderByDescending(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest orderBySchoolTypeAscending(){ - addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest orderBySchoolTypeDescending(){ - addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest orderByNameAscending(){ - addOrderByAscending(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest orderByNameDescending(){ - addOrderByDescending(School.NAME_PROPERTY); - return this; - } - public SchoolRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(School.NAME_PROPERTY); - return this; - } - public SchoolRequest orderByStudentCapacityAscending(){ - addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest orderByStudentCapacityDescending(){ - addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest orderByVersionAscending(){ - addOrderByAscending(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest orderByVersionDescending(){ - addOrderByDescending(School.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - public SchoolTypeRequest rollUpToSchoolType(){ - SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); - this.internalRollUpTo("school_type", schoolType, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); - return schoolType; - } - - - - - - public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); - return this; - } - public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ - return facetBySchoolTypeAs(facetName, schoolType, true); - } - - public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ - addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java deleted file mode 100644 index 87ead0675..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolType.java +++ /dev/null @@ -1,172 +0,0 @@ - -package com.example.inheritancematchingservice.schooltype; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.school.School; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class SchoolType extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "SchoolType"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "595b434cfd28e9e4b60604e6092f6b709bf97fbb85753ad9f93443a203ae2e25"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "school_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String NAME_PROPERTY = "name"; - public static final String CODE_PROPERTY = "code"; - public static final String SCHOOL_LIST_PROPERTY = "school_list"; - private Platform platform; - - private String name; - - private String code; - - private SmartList schoolList; - - public Platform getPlatform(){ - return this.platform; - } - - public String getName(){ - return this.name; - } - - public String getCode(){ - return this.code; - } - - public SmartList getSchoolList(){ - return this.schoolList == null ? SmartList.unloaded() : this.schoolList; - } - public SchoolType updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public SchoolType updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public SchoolType updateCode(String code){ - code = (code == null ? null : code.trim()); - if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ - return this; - } - handleUpdate(CODE_PROPERTY, getCode(), code); - this.code = code; - return this; - } - - public SchoolType addSchool(School school){ - if (school == null){ - return this; - } - - if(null == this.schoolList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolList.add(school); - school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); - return this; - } - - public static SchoolType refer(Long id){ - SchoolType refer = new SchoolType(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public SchoolType comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "code": this.code = (value == null ? null : ((String)value).trim()); break; - - case "school_list": this.schoolList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "school_list": return this.schoolList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java deleted file mode 100644 index 96466d7ed..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeChecker.java +++ /dev/null @@ -1,77 +0,0 @@ - -package com.example.inheritancematchingservice.schooltype; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformChecker; -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class SchoolTypeChecker implements Checker{ - - public String type(){ - return SchoolType.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - if(needCheck(_context, schoolType)){ - markAsChecked(_context, schoolType); - doCheck(_context, schoolType, _parentLocation); - } - } - - public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - if((schoolType == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, schoolType); - if(schoolType.needPersist()){ - } - if(schoolType.newItem()){ - }else if(schoolType.updateItem()){ - if(!schoolType.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); - for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ - School school = schoolType.getSchoolList().get(i); - new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); - } - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, code); - if((code == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, code); - - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java deleted file mode 100644 index 493934427..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeExpression.java +++ /dev/null @@ -1,68 +0,0 @@ - -package com.example.inheritancematchingservice.schooltype; - -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformExpression; -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolTypeExpression(Expression expression){ - super(expression); - } - - public SchoolTypeExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolTypeExpression updateId(Long id){ - return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); - } - - public SchoolTypeExpression save(UserContext userContext){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolTypeExpression save(String intent, UserContext userContext){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); - } - - public SchoolTypeExpression updatePlatform(Platform platform){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); - } - - public Expression getName(){ - return loaded("name", "getName", SchoolType::getName); - } - public SchoolTypeExpression updateName(String name){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); - } - - public Expression getCode(){ - return loaded("code", "getCode", SchoolType::getCode); - } - public SchoolTypeExpression updateCode(String code){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); - } - - public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); - } - public SchoolTypeExpression addSchool(School school){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java deleted file mode 100644 index 1d5de85df..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.inheritancematchingservice.schooltype; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolTypeListExpression extends SmartListExpression { - public SchoolTypeListExpression(Expression> expression){ - super(expression); - } - - public SchoolTypeListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolTypeExpression first() { - return new SchoolTypeExpression(super.first()); - } - - public SchoolTypeExpression get(int index) { - return new SchoolTypeExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java deleted file mode 100644 index 82c7b7e0f..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/schooltype/SchoolTypeRequest.java +++ /dev/null @@ -1,1052 +0,0 @@ - -package com.example.inheritancematchingservice.schooltype; - -import com.example.inheritancematchingservice.Q; -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformRequest; -import com.example.inheritancematchingservice.school.School; -import com.example.inheritancematchingservice.school.SchoolRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class SchoolTypeRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolTypeRequest(Class returnType){ - this(returnType, () -> (T) new SchoolType()); - } - - protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolTypeRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolTypeRequest copy(){ - return (SchoolTypeRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolTypeRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolTypeRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolTypeRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolTypeRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolTypeRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolTypeRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolTypeRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ - super.internalMatchAny(schoolType); - return this; - } - - public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); - } - - public SchoolTypeRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SchoolTypeRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolTypeRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolTypeRequest selectSelf(){ - super.selectSelf(); - return selectPlatformIdOnly().selectId().selectName().selectCode().selectVersion(); - } - - public SchoolTypeRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolTypeRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(SchoolType.PLATFORM_PROPERTY); - selectProperty(SchoolType.ID_PROPERTY); - selectProperty(SchoolType.NAME_PROPERTY); - selectProperty(SchoolType.CODE_PROPERTY); - selectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest selectAll(){ - super.selectAll(); - return selectPlatform().selectId().selectName().selectCode().selectVersion(); - } - - public SchoolTypeRequest selectChildren(){ - super.selectAny(); - selectSchoolList(); - return selectPlatform().selectId().selectName().selectCode().selectVersion(); - } - - - public SchoolTypeRequest selectPlatformIdOnly(){ - selectProperty(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(SchoolType.PLATFORM_PROPERTY); - enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); - return this; - } - - public SchoolTypeRequest unselectPlatform(){ - unselectProperty(SchoolType.PLATFORM_PROPERTY); - return this; - } - public SchoolTypeRequest selectId(){ - selectProperty(SchoolType.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectId(){ - unselectProperty(SchoolType.ID_PROPERTY); - return this; - } - public SchoolTypeRequest selectName(){ - selectProperty(SchoolType.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectName(){ - unselectProperty(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest selectCode(){ - selectProperty(SchoolType.CODE_PROPERTY); - return this; - } - - /** - * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectCode(){ - unselectProperty(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest selectVersion(){ - selectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectVersion(){ - unselectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - public SchoolTypeRequest selectSchoolList(){ - return selectSchoolListWith(Q.schools().selectSelf()); - } - - public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolTypeRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolTypeRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolTypeRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); - } - - public SchoolTypeRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolTypeRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); - } - - public SchoolTypeRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolTypeRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolTypeRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolTypeRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolTypeRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolTypeRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolTypeRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolTypeRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); - } - - public SchoolTypeRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolTypeRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolTypeRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolTypeRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolTypeRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolTypeRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolTypeRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolTypeRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolTypeRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolTypeRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolTypeRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolTypeRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolTypeRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolTypeRequest filterByCode(String... code){ - if (code == null || code.length == 0) { - throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); - } - return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); - } - - public SchoolTypeRequest withCode(Operator operator, Object... values){ - return appendSearchCriteria(createCodeCriteria(operator, values)); - } - - public SchoolTypeRequest withCodeIsUnknown(){ - return withCode(Operator.IS_NULL); - } - - public SchoolTypeRequest withCodeIsKnown(){ - return withCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); - } - - public SchoolTypeRequest withCodeIsNot(String code){ - return withCode(Operator.NOT_EQUAL, code); - } - - public SchoolTypeRequest withCodeIn(String... code){ - return withCode(Operator.IN, (Object[])code); - } - - public SchoolTypeRequest withCodeNotIn(String... code){ - return withCode(Operator.NOT_IN, (Object[])code); - } - public SchoolTypeRequest withCodeGreaterThan(String code){ - return withCode(Operator.GREATER_THAN, code); - } - - public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ - return withCode(Operator.GREATER_THAN_OR_EQUAL, code); - } - - public SchoolTypeRequest withCodeLessThan(String code){ - return withCode(Operator.LESS_THAN, code); - } - - public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ - return withCode(Operator.LESS_THAN_OR_EQUAL, code); - } - - public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ - return withCode(Operator.BETWEEN, startOfCode, endOfCode); - } - public SchoolTypeRequest withCodeStartingWith(String code){ - return withCode(Operator.BEGIN_WITH, code); - } - public SchoolTypeRequest withCodeContaining(String code){ - return withCode(Operator.CONTAIN, code); - } - - public SchoolTypeRequest withCodeNotContaining(String code){ - return withCode(Operator.NOT_CONTAIN, code); - } - - public SchoolTypeRequest withCodeNotStartingWith(String code){ - return withCode(Operator.NOT_BEGIN_WITH, code); - } - - public SchoolTypeRequest withCodeEndingWith(String code){ - return withCode(Operator.END_WITH, code); - } - - public SchoolTypeRequest withCodeNotEndingWith(String code){ - return withCode(Operator.NOT_END_WITH, code); - } - - public SchoolTypeRequest withCodeIs(String code){ - return withCode(Operator.EQUAL, code); - } - - public SchoolTypeRequest withCodeSoundingLike(String code){ - return withCode(Operator.SOUNDS_LIKE, code); - } - - - - public SchoolTypeRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolTypeRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolTypeRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolTypeRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); - } - - public SchoolTypeRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolTypeRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolTypeRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolTypeRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolTypeRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolTypeRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); - } - - public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); - } - - public SchoolTypeRequest haveSchools(){ - return withSchoolListMatching(Q.schools().unlimited()); - } - - public SchoolTypeRequest haveNoSchools(){ - return withoutSchoolListMatching(Q.schools().unlimited()); - } - - public SchoolTypeRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolTypeRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolTypeRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - - public SchoolTypeRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolTypeRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolTypeRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolTypeRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctCode(){ - return countDistinctCodeAs("code_distinct_count"); - } - - public SchoolTypeRequest countDistinctCodeAs(String alias){ - super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolTypeRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); - return this; - } - public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ - aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); - return this; - } - - public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolTypeRequest groupByPlatform(){ - groupBy(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByPlatformAs(String retName){ - groupBy(retName, SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupById(){ - groupBy(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByIdAs(String retName){ - groupBy(retName, SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.ID_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByName(){ - groupBy(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByNameAs(String retName){ - groupBy(retName, SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.NAME_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByCode(){ - groupBy(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByCodeAs(String retName){ - groupBy(retName, SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.CODE_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByVersion(){ - groupBy(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByVersionAs(String retName){ - groupBy(retName, SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.VERSION_PROPERTY, function); - return this; - } - - - - public SchoolTypeRequest orderByPlatformAscending(){ - addOrderByAscending(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByPlatformDescending(){ - addOrderByDescending(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByIdAscending(){ - addOrderByAscending(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByIdDescending(){ - addOrderByDescending(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameAscending(){ - addOrderByAscending(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameDescending(){ - addOrderByDescending(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest orderByCodeAscending(){ - addOrderByAscending(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByCodeDescending(){ - addOrderByDescending(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest orderByVersionAscending(){ - addOrderByAscending(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByVersionDescending(){ - addOrderByDescending(SchoolType.VERSION_PROPERTY); - return this; - } - - - public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest, false); - } - - public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ - return statsFromSchoolsAs(REFINEMENTS, subRequest); - } - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - public SchoolTypeRequest countSchools(){ - addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest countSchoolsAs(String name){ - addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ - addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest minStudentCapacityOfSchools(){ - addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ - return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest maxStudentCapacityOfSchools(){ - addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ - return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest sumStudentCapacityOfSchools(){ - addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ - return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest avgStudentCapacityOfSchools(){ - addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ - return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ - return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ - return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolTypeRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolTypeRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolTypeRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolTypeRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolTypeRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolTypeRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java deleted file mode 100644 index cab9db2a2..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademy.java +++ /dev/null @@ -1,137 +0,0 @@ - -package com.example.inheritancematchingservice.trainingacademy; - -import com.example.inheritancematchingservice.academy.Academy; -import com.example.inheritancematchingservice.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class TrainingAcademy extends Academy implements RemoteInput { - public static String INTERNAL_TYPE = "TrainingAcademy"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "d5c47f287adcf434556be4564044800fdadd56e6914079eb97fedf380ef46cc2"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("student_capacity", 4), java.util.Map.entry("version", 5), java.util.Map.entry("campus_code", 6), java.util.Map.entry("specialty", 7)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("version", java.util.List.of("version", "version")), java.util.Map.entry("campus_code", java.util.List.of("campusCode", "campus_code")), java.util.Map.entry("specialty", java.util.List.of("specialty", "specialty"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - TrainingAcademy.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String SPECIALTY_PROPERTY = "specialty"; - private String specialty; - - - public String getSpecialty(){ - return this.specialty; - } - - public TrainingAcademy updateSpecialty(String specialty){ - specialty = (specialty == null ? null : specialty.trim()); - if(isPropertyLoaded(SPECIALTY_PROPERTY) && Objects.equals(this.specialty, specialty)){ - return this; - } - handleUpdate(SPECIALTY_PROPERTY, getSpecialty(), specialty); - this.specialty = specialty; - return this; - } - - public TrainingAcademy updateCampusCode(String campusCode){ - super.updateCampusCode(campusCode); - return this; - } - - public TrainingAcademy updatePlatform(Platform platform){ - super.updatePlatform(platform); - return this; - } - - public TrainingAcademy updateSchoolTypeToPrimary(){ - super.updateSchoolTypeToPrimary(); - return this; - } - public TrainingAcademy updateSchoolTypeToSecondary(){ - super.updateSchoolTypeToSecondary(); - return this; - } - - public TrainingAcademy updateName(String name){ - super.updateName(name); - return this; - } - - public TrainingAcademy updateStudentCapacity(Integer studentCapacity){ - super.updateStudentCapacity(studentCapacity); - return this; - } - - - public static TrainingAcademy refer(Long id){ - TrainingAcademy refer = new TrainingAcademy(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public TrainingAcademy comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "specialty": this.specialty = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "specialty": return this.specialty; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "specialty": return this.specialty; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java deleted file mode 100644 index bc8629f7a..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyChecker.java +++ /dev/null @@ -1,49 +0,0 @@ - -package com.example.inheritancematchingservice.trainingacademy; - -import com.example.inheritancematchingservice.academy.AcademyChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class TrainingAcademyChecker implements Checker{ - - public String type(){ - return TrainingAcademy.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, TrainingAcademy trainingAcademy, ObjectLocation _parentLocation){ - if(needCheck(_context, trainingAcademy)){ - markAsChecked(_context, trainingAcademy); - new AcademyChecker().doCheck(_context, trainingAcademy, _parentLocation); - - doCheck(_context, trainingAcademy, _parentLocation); - } - } - - public void doCheck(UserContext _context, TrainingAcademy trainingAcademy, ObjectLocation _parentLocation){ - if((trainingAcademy == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, trainingAcademy); - if(trainingAcademy.needPersist()){ - } - if(trainingAcademy.newItem()){ - }else if(trainingAcademy.updateItem()){ - if(!trainingAcademy.isPropertyLoaded("specialty")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "specialty"), "Mutation requires a fully loaded entity"); - } - - } - checkSpecialty(_context, trainingAcademy.getProperty(TrainingAcademy.SPECIALTY_PROPERTY), newLocation(_parentLocation, "specialty")); - } - - public void checkSpecialty(UserContext _context, String specialty, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, specialty); - if((specialty == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, specialty); - - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java deleted file mode 100644 index 2a61e8419..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyExpression.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.example.inheritancematchingservice.trainingacademy; - -import com.example.inheritancematchingservice.academy.AcademyExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import java.util.function.Function; - -public class TrainingAcademyExpression extends AcademyExpression implements BaseEntityExpression { - public TrainingAcademyExpression(Expression expression){ - super(expression); - } - - public TrainingAcademyExpression(Expression expression, Function function){ - super(expression, function); - } - - public TrainingAcademyExpression updateId(Long id){ - return new TrainingAcademyExpression(this, $it -> {((TrainingAcademy)$it).__internalSet("id", id); return this;}); - } - - public TrainingAcademyExpression save(UserContext userContext){ - return new TrainingAcademyExpression(this, $it -> ((TrainingAcademy)$it).auditAs("Saved by Expression").save(userContext)); - } - - public TrainingAcademyExpression save(String intent, UserContext userContext){ - return new TrainingAcademyExpression(this, $it -> ((TrainingAcademy)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getSpecialty(){ - return loaded("specialty", "getSpecialty", TrainingAcademy::getSpecialty); - } - public TrainingAcademyExpression updateSpecialty(String specialty){ - return new TrainingAcademyExpression(this, $it -> ((TrainingAcademy)$it).updateSpecialty(specialty)); - } - -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java deleted file mode 100644 index f96108cb3..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.inheritancematchingservice.trainingacademy; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class TrainingAcademyListExpression extends SmartListExpression { - public TrainingAcademyListExpression(Expression> expression){ - super(expression); - } - - public TrainingAcademyListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public TrainingAcademyExpression first() { - return new TrainingAcademyExpression(super.first()); - } - - public TrainingAcademyExpression get(int index) { - return new TrainingAcademyExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java b/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java deleted file mode 100644 index 511589548..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/java/com/example/inheritancematchingservice/trainingacademy/TrainingAcademyRequest.java +++ /dev/null @@ -1,1024 +0,0 @@ - -package com.example.inheritancematchingservice.trainingacademy; - -import com.example.inheritancematchingservice.academy.AcademyRequest; -import com.example.inheritancematchingservice.platform.Platform; -import com.example.inheritancematchingservice.platform.PlatformRequest; -import com.example.inheritancematchingservice.schooltype.SchoolType; -import com.example.inheritancematchingservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class TrainingAcademyRequest extends AcademyRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public TrainingAcademyRequest(Class returnType){ - this(returnType, () -> (T) new TrainingAcademy()); - } - - protected TrainingAcademyRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public TrainingAcademyRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public TrainingAcademyRequest copy(){ - return (TrainingAcademyRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new TrainingAcademyRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public TrainingAcademyRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public TrainingAcademyRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public TrainingAcademyRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public TrainingAcademyRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public TrainingAcademyRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public TrainingAcademyRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public TrainingAcademyRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public TrainingAcademyRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public TrainingAcademyRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public TrainingAcademyRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (TrainingAcademyRequest)super.appendSearchCriteria(searchCriteria); - } - - public TrainingAcademyRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public TrainingAcademyRequest matchingAnyOf(TrainingAcademyRequest trainingAcademy){ - super.internalMatchAny(trainingAcademy); - return this; - } - - public TrainingAcademyRequest matchingIdsOf(TrainingAcademyRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - TrainingAcademy.ID_PROPERTY, request, TrainingAcademy.ID_PROPERTY)); - } - - public TrainingAcademyRequest enhanceChildrenIfNeeded(){ - return this; - } - - public TrainingAcademyRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public TrainingAcademyRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public TrainingAcademyRequest selectSelf(){ - super.selectSelf(); - return selectSpecialty(); - } - - public TrainingAcademyRequest selectSelfFields(){ - return selectSelf(); - } - - public TrainingAcademyRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - - public TrainingAcademyRequest selectAll(){ - super.selectAll(); - return selectSpecialty(); - } - - public TrainingAcademyRequest selectChildren(){ - super.selectAny(); - return selectSpecialty(); - } - - - public TrainingAcademyRequest selectSpecialty(){ - selectProperty(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - - /** - * fill the specialty with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS specialty) to fetch specialty property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TrainingAcademyRequest unselectSpecialty(){ - unselectProperty(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - public TrainingAcademyRequest selectCampusCode(){ - super.selectCampusCode(); - return this; - } - - /** - * fill the campusCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS campusCode) to fetch campusCode property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TrainingAcademyRequest unselectCampusCode(){ - super.unselectCampusCode(); - return this; - } - public TrainingAcademyRequest selectPlatformIdOnly(){ - super.selectPlatformIdOnly(); - return this; - } - - public TrainingAcademyRequest selectPlatform(){ - super.selectPlatform(); - return this; - } - - public TrainingAcademyRequest selectPlatformWith(PlatformRequest platform){ - super.selectPlatformWith(platform); - return this; - } - - public TrainingAcademyRequest unselectPlatform(){ - super.unselectPlatform(); - return this; - } - public TrainingAcademyRequest selectSchoolTypeIdOnly(){ - super.selectSchoolTypeIdOnly(); - return this; - } - - public TrainingAcademyRequest selectSchoolType(){ - super.selectSchoolType(); - return this; - } - - public TrainingAcademyRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ - super.selectSchoolTypeWith(schoolType); - return this; - } - - public TrainingAcademyRequest unselectSchoolType(){ - super.unselectSchoolType(); - return this; - } - public TrainingAcademyRequest selectName(){ - super.selectName(); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TrainingAcademyRequest unselectName(){ - super.unselectName(); - return this; - } - public TrainingAcademyRequest selectStudentCapacity(){ - super.selectStudentCapacity(); - return this; - } - - /** - * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. - * @param aggrFunction aggrFunction - */ - public TrainingAcademyRequest selectStudentCapacity(AggrFunction aggrFunction){ - super.selectStudentCapacity(aggrFunction); - return this; - } - - - public TrainingAcademyRequest unselectStudentCapacity(){ - super.unselectStudentCapacity(); - return this; - } - public TrainingAcademyRequest selectVersion(){ - super.selectVersion(); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TrainingAcademyRequest unselectVersion(){ - super.unselectVersion(); - return this; - } - public TrainingAcademyRequest selectId(){ - super.selectId(); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public TrainingAcademyRequest unselectId(){ - super.unselectId(); - return this; - } - - public TrainingAcademyRequest filterBySpecialty(String... specialty){ - if (specialty == null || specialty.length == 0) { - throw new IllegalArgumentException("filterBySpecialty parameter specialty cannot be empty"); - } - return appendSearchCriteria(createSpecialtyCriteria(Operator.EQUAL, (Object[])specialty)); - } - - public TrainingAcademyRequest withSpecialty(Operator operator, Object... values){ - return appendSearchCriteria(createSpecialtyCriteria(operator, values)); - } - - public TrainingAcademyRequest withSpecialtyIsUnknown(){ - return withSpecialty(Operator.IS_NULL); - } - - public TrainingAcademyRequest withSpecialtyIsKnown(){ - return withSpecialty(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSpecialtyCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(TrainingAcademy.SPECIALTY_PROPERTY, operator, values); - } - - public TrainingAcademyRequest withSpecialtyIsNot(String specialty){ - return withSpecialty(Operator.NOT_EQUAL, specialty); - } - - public TrainingAcademyRequest withSpecialtyIn(String... specialty){ - return withSpecialty(Operator.IN, (Object[])specialty); - } - - public TrainingAcademyRequest withSpecialtyNotIn(String... specialty){ - return withSpecialty(Operator.NOT_IN, (Object[])specialty); - } - public TrainingAcademyRequest withSpecialtyGreaterThan(String specialty){ - return withSpecialty(Operator.GREATER_THAN, specialty); - } - - public TrainingAcademyRequest withSpecialtyGreaterThanOrEqualTo(String specialty){ - return withSpecialty(Operator.GREATER_THAN_OR_EQUAL, specialty); - } - - public TrainingAcademyRequest withSpecialtyLessThan(String specialty){ - return withSpecialty(Operator.LESS_THAN, specialty); - } - - public TrainingAcademyRequest withSpecialtyLessThanOrEqualTo(String specialty){ - return withSpecialty(Operator.LESS_THAN_OR_EQUAL, specialty); - } - - public TrainingAcademyRequest withSpecialtyBetween(String startOfSpecialty, String endOfSpecialty){ - return withSpecialty(Operator.BETWEEN, startOfSpecialty, endOfSpecialty); - } - public TrainingAcademyRequest withSpecialtyStartingWith(String specialty){ - return withSpecialty(Operator.BEGIN_WITH, specialty); - } - public TrainingAcademyRequest withSpecialtyContaining(String specialty){ - return withSpecialty(Operator.CONTAIN, specialty); - } - - public TrainingAcademyRequest withSpecialtyNotContaining(String specialty){ - return withSpecialty(Operator.NOT_CONTAIN, specialty); - } - - public TrainingAcademyRequest withSpecialtyNotStartingWith(String specialty){ - return withSpecialty(Operator.NOT_BEGIN_WITH, specialty); - } - - public TrainingAcademyRequest withSpecialtyEndingWith(String specialty){ - return withSpecialty(Operator.END_WITH, specialty); - } - - public TrainingAcademyRequest withSpecialtyNotEndingWith(String specialty){ - return withSpecialty(Operator.NOT_END_WITH, specialty); - } - - public TrainingAcademyRequest withSpecialtyIs(String specialty){ - return withSpecialty(Operator.EQUAL, specialty); - } - - public TrainingAcademyRequest withSpecialtySoundingLike(String specialty){ - return withSpecialty(Operator.SOUNDS_LIKE, specialty); - } - - - - public TrainingAcademyRequest filterByCampusCode(String campusCode){ - return (TrainingAcademyRequest)super.filterByCampusCode(campusCode); - } - - public TrainingAcademyRequest withCampusCode(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withCampusCode(operator, values); - } - - public TrainingAcademyRequest withCampusCodeIsUnknown(){ - return (TrainingAcademyRequest)super.withCampusCodeIsUnknown(); - } - - public TrainingAcademyRequest withCampusCodeIsKnown(){ - return (TrainingAcademyRequest)super.withCampusCodeIsKnown(); - } - - public TrainingAcademyRequest withCampusCodeStartingWith(String CampusCode){ - return (TrainingAcademyRequest)super.withCampusCodeStartingWith(CampusCode); - } - public TrainingAcademyRequest withCampusCodeContaining(String CampusCode){ - return (TrainingAcademyRequest)super.withCampusCodeContaining(CampusCode); - } - - public TrainingAcademyRequest withCampusCodeEndingWith(String CampusCode){ - return (TrainingAcademyRequest)super.withCampusCodeEndingWith(CampusCode); - } - - - public TrainingAcademyRequest filterByPlatform(Platform platform){ - return (TrainingAcademyRequest)super.filterByPlatform(platform); - } - - public TrainingAcademyRequest withPlatform(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withPlatform(operator, values); - } - - public TrainingAcademyRequest withPlatformIsUnknown(){ - return (TrainingAcademyRequest)super.withPlatformIsUnknown(); - } - - public TrainingAcademyRequest withPlatformIsKnown(){ - return (TrainingAcademyRequest)super.withPlatformIsKnown(); - } - - public TrainingAcademyRequest filterByPlatform(Long platform){ - return (TrainingAcademyRequest)super.filterByPlatform(platform); - } - - public TrainingAcademyRequest withPlatformMatching(PlatformRequest platform){ - return (TrainingAcademyRequest)super.withPlatformMatching(platform); - } - - public TrainingAcademyRequest filterBySchoolType(SchoolType schoolType){ - return (TrainingAcademyRequest)super.filterBySchoolType(schoolType); - } - - public TrainingAcademyRequest withSchoolType(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withSchoolType(operator, values); - } - - public TrainingAcademyRequest withSchoolTypeIsUnknown(){ - return (TrainingAcademyRequest)super.withSchoolTypeIsUnknown(); - } - - public TrainingAcademyRequest withSchoolTypeIsKnown(){ - return (TrainingAcademyRequest)super.withSchoolTypeIsKnown(); - } - - public TrainingAcademyRequest filterBySchoolType(Long schoolType){ - return (TrainingAcademyRequest)super.filterBySchoolType(schoolType); - } - - public TrainingAcademyRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ - return (TrainingAcademyRequest)super.withSchoolTypeMatching(schoolType); - } - - public TrainingAcademyRequest filterByName(String name){ - return (TrainingAcademyRequest)super.filterByName(name); - } - - public TrainingAcademyRequest withName(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withName(operator, values); - } - - public TrainingAcademyRequest withNameIsUnknown(){ - return (TrainingAcademyRequest)super.withNameIsUnknown(); - } - - public TrainingAcademyRequest withNameIsKnown(){ - return (TrainingAcademyRequest)super.withNameIsKnown(); - } - - public TrainingAcademyRequest withNameStartingWith(String Name){ - return (TrainingAcademyRequest)super.withNameStartingWith(Name); - } - public TrainingAcademyRequest withNameContaining(String Name){ - return (TrainingAcademyRequest)super.withNameContaining(Name); - } - - public TrainingAcademyRequest withNameEndingWith(String Name){ - return (TrainingAcademyRequest)super.withNameEndingWith(Name); - } - - - public TrainingAcademyRequest filterByStudentCapacity(Integer studentCapacity){ - return (TrainingAcademyRequest)super.filterByStudentCapacity(studentCapacity); - } - - public TrainingAcademyRequest withStudentCapacity(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withStudentCapacity(operator, values); - } - - public TrainingAcademyRequest withStudentCapacityIsUnknown(){ - return (TrainingAcademyRequest)super.withStudentCapacityIsUnknown(); - } - - public TrainingAcademyRequest withStudentCapacityIsKnown(){ - return (TrainingAcademyRequest)super.withStudentCapacityIsKnown(); - } - - public TrainingAcademyRequest withStudentCapacityGreaterThan(Integer studentCapacity){ - return (TrainingAcademyRequest)super.withStudentCapacityGreaterThan(studentCapacity); - } - - public TrainingAcademyRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ - return (TrainingAcademyRequest)super.withStudentCapacityGreaterThanOrEqualTo(studentCapacity); - } - - public TrainingAcademyRequest withStudentCapacityLessThan(Integer studentCapacity){ - return (TrainingAcademyRequest)super.withStudentCapacityLessThan(studentCapacity); - } - - public TrainingAcademyRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ - return (TrainingAcademyRequest)super.withStudentCapacityLessThanOrEqualTo(studentCapacity); - } - - public TrainingAcademyRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ - return (TrainingAcademyRequest)super.withStudentCapacityBetween(startOfStudentCapacity, endOfStudentCapacity); - } - - - public TrainingAcademyRequest filterByVersion(Long version){ - return (TrainingAcademyRequest)super.filterByVersion(version); - } - - public TrainingAcademyRequest withVersion(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withVersion(operator, values); - } - - public TrainingAcademyRequest withVersionIsUnknown(){ - return (TrainingAcademyRequest)super.withVersionIsUnknown(); - } - - public TrainingAcademyRequest withVersionIsKnown(){ - return (TrainingAcademyRequest)super.withVersionIsKnown(); - } - - - public TrainingAcademyRequest withIdIs(Long value){ - return (TrainingAcademyRequest)super.withIdIs(value); - } - - public TrainingAcademyRequest withId(Operator operator, Object... values){ - return (TrainingAcademyRequest)super.withId(operator, values); - } - - - public TrainingAcademyRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public TrainingAcademyRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public TrainingAcademyRequest minStudentCapacity(){ - super.minStudentCapacity(); - return this; - } - - public TrainingAcademyRequest minStudentCapacityAs(String retName){ - super.minStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest maxStudentCapacity(){ - super.maxStudentCapacity(); - return this; - } - - public TrainingAcademyRequest maxStudentCapacityAs(String retName){ - super.maxStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest sumStudentCapacity(){ - super.sumStudentCapacity(); - return this; - } - - public TrainingAcademyRequest sumStudentCapacityAs(String retName){ - super.sumStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest avgStudentCapacity(){ - super.avgStudentCapacity(); - return this; - } - - public TrainingAcademyRequest avgStudentCapacityAs(String retName){ - super.avgStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest stddevStudentCapacity(){ - super.standardDeviationStudentCapacity(); - return this; - } - - public TrainingAcademyRequest stddevStudentCapacityAs(String retName){ - super.standardDeviationStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest stddev_popStudentCapacity(){ - super.squareRootOfPopulationStandardDeviationStudentCapacity(); - return this; - } - - public TrainingAcademyRequest stddev_popStudentCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviationStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest var_sampStudentCapacity(){ - super.sampleVarianceStudentCapacity(); - return this; - } - - public TrainingAcademyRequest var_sampStudentCapacityAs(String retName){ - super.sampleVarianceStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest var_popStudentCapacity(){ - super.samplePopulationVarianceStudentCapacity(); - return this; - } - - public TrainingAcademyRequest var_popStudentCapacityAs(String retName){ - super.samplePopulationVarianceStudentCapacityAs(retName); - return this; - } - public TrainingAcademyRequest groupByPlatformWithDetails(){ - super.groupByPlatformWithDetails(); - return this; - } - - public TrainingAcademyRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - super.groupByPlatformWithDetails(subRequest); - return this; - } - - public TrainingAcademyRequest groupBySchoolTypeWithDetails(){ - super.groupBySchoolTypeWithDetails(); - return this; - } - - public TrainingAcademyRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ - super.groupBySchoolTypeWithDetails(subRequest); - return this; - } - - - - - - public TrainingAcademyRequest countDistinctSpecialty(){ - return countDistinctSpecialtyAs("specialty_distinct_count"); - } - - public TrainingAcademyRequest countDistinctSpecialtyAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctCampusCode(){ - return countDistinctCampusCodeAs("campus_code_distinct_count"); - } - - public TrainingAcademyRequest countDistinctCampusCodeAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.CAMPUS_CODE_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public TrainingAcademyRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.PLATFORM_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctSchoolType(){ - return countDistinctSchoolTypeAs("school_type_distinct_count"); - } - - public TrainingAcademyRequest countDistinctSchoolTypeAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.SCHOOL_TYPE_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public TrainingAcademyRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.NAME_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctStudentCapacity(){ - return countDistinctStudentCapacityAs("student_capacity_distinct_count"); - } - - public TrainingAcademyRequest countDistinctStudentCapacityAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.STUDENT_CAPACITY_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public TrainingAcademyRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.VERSION_PROPERTY); - return this; - } - public TrainingAcademyRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public TrainingAcademyRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, TrainingAcademy.ID_PROPERTY); - return this; - } - - public TrainingAcademyRequest groupBySpecialty(){ - groupBy(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - - public TrainingAcademyRequest groupBySpecialtyAs(String retName){ - groupBy(retName, TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - - public TrainingAcademyRequest groupBySpecialtyWithFunction(String retName, AggrFunction function){ - groupBy(retName, TrainingAcademy.SPECIALTY_PROPERTY, function); - return this; - } - - - public TrainingAcademyRequest groupByCampusCode(){ - super.groupByCampusCode(); - return this; - } - - public TrainingAcademyRequest groupByCampusCodeAs(String retName){ - super.groupByCampusCodeAs(retName); - return this; - } - - public TrainingAcademyRequest groupByCampusCodeWithFunction(String retName, AggrFunction function){ - super.groupByCampusCodeWithFunction(retName, function); - return this; - } - public TrainingAcademyRequest groupByPlatformWith(PlatformRequest subRequest){ - super.groupByPlatformWith(subRequest); - return this; - } - public TrainingAcademyRequest groupByPlatform(){ - super.groupByPlatform(); - return this; - } - - public TrainingAcademyRequest groupByPlatformAs(String retName){ - super.groupByPlatformAs(retName); - return this; - } - - public TrainingAcademyRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - super.groupByPlatformWithFunction(retName, function); - return this; - } - public TrainingAcademyRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - super.groupBySchoolTypeWith(subRequest); - return this; - } - public TrainingAcademyRequest groupBySchoolType(){ - super.groupBySchoolType(); - return this; - } - - public TrainingAcademyRequest groupBySchoolTypeAs(String retName){ - super.groupBySchoolTypeAs(retName); - return this; - } - - public TrainingAcademyRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ - super.groupBySchoolTypeWithFunction(retName, function); - return this; - } - - public TrainingAcademyRequest groupByName(){ - super.groupByName(); - return this; - } - - public TrainingAcademyRequest groupByNameAs(String retName){ - super.groupByNameAs(retName); - return this; - } - - public TrainingAcademyRequest groupByNameWithFunction(String retName, AggrFunction function){ - super.groupByNameWithFunction(retName, function); - return this; - } - - public TrainingAcademyRequest groupByStudentCapacity(){ - super.groupByStudentCapacity(); - return this; - } - - public TrainingAcademyRequest groupByStudentCapacityAs(String retName){ - super.groupByStudentCapacityAs(retName); - return this; - } - - public TrainingAcademyRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ - super.groupByStudentCapacityWithFunction(retName, function); - return this; - } - - public TrainingAcademyRequest groupByVersion(){ - super.groupByVersion(); - return this; - } - - public TrainingAcademyRequest groupByVersionAs(String retName){ - super.groupByVersionAs(retName); - return this; - } - - public TrainingAcademyRequest groupByVersionWithFunction(String retName, AggrFunction function){ - super.groupByVersionWithFunction(retName, function); - return this; - } - - public TrainingAcademyRequest groupById(){ - super.groupById(); - return this; - } - - public TrainingAcademyRequest groupByIdAs(String retName){ - super.groupByIdAs(retName); - return this; - } - - public TrainingAcademyRequest groupByIdWithFunction(String retName, AggrFunction function){ - super.groupByIdWithFunction(retName, function); - return this; - } - - public TrainingAcademyRequest orderBySpecialtyAscending(){ - addOrderByAscending(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - - public TrainingAcademyRequest orderBySpecialtyDescending(){ - addOrderByDescending(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - public TrainingAcademyRequest orderBySpecialtyAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - - public TrainingAcademyRequest orderBySpecialtyDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(TrainingAcademy.SPECIALTY_PROPERTY); - return this; - } - public TrainingAcademyRequest orderByCampusCodeAscending(){ - super.orderByCampusCodeAscending(); - return this; - } - - public TrainingAcademyRequest orderByCampusCodeDescending(){ - super.orderByCampusCodeDescending(); - return this; - } - public TrainingAcademyRequest orderByCampusCodeAscendingUsingGBK(){ - super.orderByCampusCodeAscendingUsingGBK(); - return this; - } - - public TrainingAcademyRequest orderByCampusCodeDescendingUsingGBK(){ - super.orderByCampusCodeDescendingUsingGBK(); - return this; - } - public TrainingAcademyRequest orderByPlatformAscending(){ - super.orderByPlatformAscending(); - return this; - } - - public TrainingAcademyRequest orderByPlatformDescending(){ - super.orderByPlatformDescending(); - return this; - } - - public TrainingAcademyRequest orderBySchoolTypeAscending(){ - super.orderBySchoolTypeAscending(); - return this; - } - - public TrainingAcademyRequest orderBySchoolTypeDescending(){ - super.orderBySchoolTypeDescending(); - return this; - } - - public TrainingAcademyRequest orderByNameAscending(){ - super.orderByNameAscending(); - return this; - } - - public TrainingAcademyRequest orderByNameDescending(){ - super.orderByNameDescending(); - return this; - } - public TrainingAcademyRequest orderByNameAscendingUsingGBK(){ - super.orderByNameAscendingUsingGBK(); - return this; - } - - public TrainingAcademyRequest orderByNameDescendingUsingGBK(){ - super.orderByNameDescendingUsingGBK(); - return this; - } - public TrainingAcademyRequest orderByStudentCapacityAscending(){ - super.orderByStudentCapacityAscending(); - return this; - } - - public TrainingAcademyRequest orderByStudentCapacityDescending(){ - super.orderByStudentCapacityDescending(); - return this; - } - - public TrainingAcademyRequest orderByVersionAscending(){ - super.orderByVersionAscending(); - return this; - } - - public TrainingAcademyRequest orderByVersionDescending(){ - super.orderByVersionDescending(); - return this; - } - - public TrainingAcademyRequest orderByIdAscending(){ - super.orderByIdAscending(); - return this; - } - - public TrainingAcademyRequest orderByIdDescending(){ - super.orderByIdDescending(); - return this; - } - - - - - - /** - * get topN records - * @param topN records number - */ - public TrainingAcademyRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public TrainingAcademyRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public TrainingAcademyRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public TrainingAcademyRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public TrainingAcademyRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public TrainingAcademyRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/inheritance-save/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/inheritance-save/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 7ff0f1b51..000000000 --- a/examples/inheritance-save/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.inheritancematchingservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/inheritance-save/showcase.json b/examples/inheritance-save/showcase.json index 18dec5cfc..b331a9a84 100644 --- a/examples/inheritance-save/showcase.json +++ b/examples/inheritance-save/showcase.json @@ -42,6 +42,7 @@ ], "generatedFilesManifestSHA256": "c3cf5b1379d400f885c7926a1d849c3459bfdda20933cf97d4bbaab79babbb13", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/object-storage/java-app-console/lib/pom.xml b/examples/object-storage/java-app-console/lib/pom.xml deleted file mode 100644 index a52d2b079..000000000 --- a/examples/object-storage/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - order-attachment-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java deleted file mode 100644 index d36ec5d66..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.orderattachmentservice; - -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; - -public interface Constants { - public static final long COMMERCE_PLATFORM_ID = 1l; - public static final CommercePlatform COMMERCE_PLATFORM = CommercePlatform.refer(COMMERCE_PLATFORM_ID); -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java deleted file mode 100644 index 53a6d4cc2..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/E.java +++ /dev/null @@ -1,23 +0,0 @@ - -package com.teaql.orderattachmentservice; - -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformExpression; -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderExpression; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static CommercePlatformExpression commercePlatform(CommercePlatform commercePlatform){ - return new CommercePlatformExpression(new ValueExpression(commercePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.commercePlatform()")); - } - public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); - } - public static OrderAttachmentExpression orderAttachment(OrderAttachment orderAttachment){ - return new OrderAttachmentExpression(new ValueExpression(orderAttachment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderAttachment()")); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java deleted file mode 100644 index a22089ee9..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/EntityMetaRegistry.java +++ /dev/null @@ -1,507 +0,0 @@ - -package com.teaql.orderattachmentservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerCommercePlatform(); - registerCustomerOrder(); - registerOrderAttachment(); - } - private void registerCommercePlatform() { - FieldLayout.installGenerated(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class); - entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Order Attachments") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomerOrder() { - FieldLayout.installGenerated(com.teaql.orderattachmentservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.orderattachmentservice.customerorder.CustomerOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.customerorder.CustomerOrder::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.orderattachmentservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderAttachment() { - FieldLayout.installGenerated(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class); - entityDescriptor.setEntitySupplier(com.teaql.orderattachmentservice.orderattachment.OrderAttachment::new); - entityDescriptor.with("audit_mask_fields", "object_key") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customerOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CUSTOMER_ORDER_PROPERTY, com.teaql.orderattachmentservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.orderattachmentservice.customerorder.CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, com.teaql.orderattachmentservice.customerorder.CustomerOrder.class) - ; - PropertyDescriptor fileName = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY, String.class) - ; - PropertyDescriptor contentType = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY, String.class) - ; - PropertyDescriptor contentLength = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY, Integer.class) - ; - PropertyDescriptor contentSha256 = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY, String.class) - ; - PropertyDescriptor objectKey = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.FILE_NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_TYPE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_LENGTH_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.CONTENT_SHA256_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.OBJECT_KEY_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java deleted file mode 100644 index 5eaae4cfb..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.teaql.orderattachmentservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformChecker(), new com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker(), new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:f6fb4b9ca6d876325850fdce5a0d2ab5c57f19c74af6bbffb2b494779e9c27b9\",\"entities\":{\"CommercePlatform\":{\"labels\":{\"en\":\"commerce platform\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"customer order\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_attachment_list\",\"targetType\":\"OrderAttachment\",\"labels\":{\"en\":\"order attachment\"},\"aliases\":[\"OrderAttachmentList\",\"orderAttachmentList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderAttachment\":{\"labels\":{\"en\":\"order attachment\"},\"fields\":[{\"name\":\"content_length\",\"labels\":{\"en\":\"content length\"},\"aliases\":[\"ContentLength\",\"contentLength\"]},{\"name\":\"content_sha256\",\"labels\":{\"en\":\"content sha256\"},\"aliases\":[\"ContentSha256\",\"contentSha256\"]},{\"name\":\"content_type\",\"labels\":{\"en\":\"content type\"},\"aliases\":[\"ContentType\",\"contentType\"]},{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"file_name\",\"labels\":{\"en\":\"file name\"},\"aliases\":[\"FileName\",\"fileName\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"object_key\",\"labels\":{\"en\":\"object key\"},\"aliases\":[\"ObjectKey\",\"objectKey\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("CommercePlatform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderAttachment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("file_name", "fileName"), java.util.Map.entry("content_type", "contentType"), java.util.Map.entry("content_length", "contentLength"), java.util.Map.entry("content_sha256", "contentSha256"), java.util.Map.entry("object_key", "objectKey"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.commercePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.orderattachmentservice.commerceplatform.CommercePlatform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.orderattachmentservice.commerceplatform.CommercePlatform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Order Attachments"); - domainRoot.auditAs("create generated Domain Root CommercePlatform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("CommercePlatform", domainRoot.getId())); - } -} diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java deleted file mode 100644 index 8f2790ae4..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/OrderAttachmentServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.orderattachmentservice; - -import io.teaql.core.UserContext; -public interface OrderAttachmentServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java deleted file mode 100644 index 8140571a8..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Q.java +++ /dev/null @@ -1,34 +0,0 @@ - -package com.teaql.orderattachmentservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest commercePlatforms(){ - return new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest commercePlatformsWithMinimalFields(){ - return new com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest(com.teaql.orderattachmentservice.commerceplatform.CommercePlatform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest customerOrders(){ - return new com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ - return new com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest(com.teaql.orderattachmentservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest orderAttachments(){ - return new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest orderAttachmentsWithMinimalFields(){ - return new com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest(com.teaql.orderattachmentservice.orderattachment.OrderAttachment.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java deleted file mode 100644 index ea18484f9..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatform.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.teaql.orderattachmentservice.commerceplatform; - -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CommercePlatform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CommercePlatform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f218c9feeb79e3ee25bbe5cc22ff2017c941db6ed0e708a35970fd1dcfec84df"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CommercePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private String name; - - private SmartList customerOrderList; - - public String getName(){ - return this.name; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public CommercePlatform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateCommercePlatform(this); - return this; - } - - public static CommercePlatform refer(Long id){ - CommercePlatform refer = new CommercePlatform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CommercePlatform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java deleted file mode 100644 index 235f3133b..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.teaql.orderattachmentservice.commerceplatform; - -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CommercePlatformChecker implements Checker{ - - public String type(){ - return CommercePlatform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - if(needCheck(_context, commercePlatform)){ - markAsChecked(_context, commercePlatform); - doCheck(_context, commercePlatform, _parentLocation); - } - } - - public void doCheck(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - if((commercePlatform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, commercePlatform); - if(commercePlatform.needPersist()){ - } - if(commercePlatform.newItem()){ - }else if(commercePlatform.updateItem()){ - if(!commercePlatform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; commercePlatform.getCustomerOrderList() != null && i < commercePlatform.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = commercePlatform.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java deleted file mode 100644 index 23cba6c0e..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.teaql.orderattachmentservice.commerceplatform; - -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CommercePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CommercePlatformExpression(Expression expression){ - super(expression); - } - - public CommercePlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public CommercePlatformExpression updateId(Long id){ - return new CommercePlatformExpression(this, $it -> {((CommercePlatform)$it).__internalSet("id", id); return this;}); - } - - public CommercePlatformExpression save(UserContext userContext){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CommercePlatformExpression save(String intent, UserContext userContext){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", CommercePlatform::getName); - } - public CommercePlatformExpression updateName(String name){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateName(name)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CommercePlatform::getCustomerOrderList)); - } - public CommercePlatformExpression addCustomerOrder(CustomerOrder customerOrder){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java deleted file mode 100644 index 11881d250..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.orderattachmentservice.commerceplatform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CommercePlatformListExpression extends SmartListExpression { - public CommercePlatformListExpression(Expression> expression){ - super(expression); - } - - public CommercePlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CommercePlatformExpression first() { - return new CommercePlatformExpression(super.first()); - } - - public CommercePlatformExpression get(int index) { - return new CommercePlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java deleted file mode 100644 index 67f989e2a..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/commerceplatform/CommercePlatformRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.teaql.orderattachmentservice.commerceplatform; - -import com.teaql.orderattachmentservice.Q; -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CommercePlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CommercePlatformRequest(Class returnType){ - this(returnType, () -> (T) new CommercePlatform()); - } - - protected CommercePlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CommercePlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CommercePlatformRequest copy(){ - return (CommercePlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CommercePlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CommercePlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CommercePlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CommercePlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CommercePlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CommercePlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CommercePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CommercePlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CommercePlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CommercePlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CommercePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CommercePlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public CommercePlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CommercePlatformRequest matchingAnyOf(CommercePlatformRequest commercePlatform){ - super.internalMatchAny(commercePlatform); - return this; - } - - public CommercePlatformRequest matchingIdsOf(CommercePlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CommercePlatform.ID_PROPERTY, request, CommercePlatform.ID_PROPERTY)); - } - - public CommercePlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CommercePlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CommercePlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CommercePlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public CommercePlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public CommercePlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CommercePlatform.ID_PROPERTY); - selectProperty(CommercePlatform.NAME_PROPERTY); - selectProperty(CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public CommercePlatformRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectId().selectName().selectVersion(); - } - - - public CommercePlatformRequest selectId(){ - selectProperty(CommercePlatform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectId(){ - unselectProperty(CommercePlatform.ID_PROPERTY); - return this; - } - public CommercePlatformRequest selectName(){ - selectProperty(CommercePlatform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectName(){ - unselectProperty(CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest selectVersion(){ - selectProperty(CommercePlatform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectVersion(){ - unselectProperty(CommercePlatform.VERSION_PROPERTY); - return this; - } - public CommercePlatformRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public CommercePlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.ID_PROPERTY, operator, values); - } - - public CommercePlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CommercePlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CommercePlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CommercePlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CommercePlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public CommercePlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public CommercePlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public CommercePlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.NAME_PROPERTY, operator, values); - } - - public CommercePlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public CommercePlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public CommercePlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public CommercePlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public CommercePlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public CommercePlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public CommercePlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public CommercePlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public CommercePlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public CommercePlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public CommercePlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public CommercePlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public CommercePlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public CommercePlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public CommercePlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public CommercePlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public CommercePlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CommercePlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CommercePlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CommercePlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.VERSION_PROPERTY, operator, values); - } - - public CommercePlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CommercePlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CommercePlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CommercePlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CommercePlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CommercePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CommercePlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CommercePlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CommercePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CommercePlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CommercePlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CommercePlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CommercePlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.ID_PROPERTY); - return this; - } - public CommercePlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public CommercePlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CommercePlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.VERSION_PROPERTY); - return this; - } - public CommercePlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public CommercePlatformRequest groupById(){ - groupBy(CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByIdAs(String retName){ - groupBy(retName, CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.ID_PROPERTY, function); - return this; - } - - public CommercePlatformRequest groupByName(){ - groupBy(CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByNameAs(String retName){ - groupBy(retName, CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.NAME_PROPERTY, function); - return this; - } - - public CommercePlatformRequest groupByVersion(){ - groupBy(CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByVersionAs(String retName){ - groupBy(retName, CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.VERSION_PROPERTY, function); - return this; - } - - - - public CommercePlatformRequest orderByIdAscending(){ - addOrderByAscending(CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByIdDescending(){ - addOrderByDescending(CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByNameAscending(){ - addOrderByAscending(CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByNameDescending(){ - addOrderByDescending(CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest orderByVersionAscending(){ - addOrderByAscending(CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByVersionDescending(){ - addOrderByDescending(CommercePlatform.VERSION_PROPERTY); - return this; - } - - - public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public CommercePlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CommercePlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CommercePlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CommercePlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CommercePlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CommercePlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java deleted file mode 100644 index 1587b1fef..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrder.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.teaql.orderattachmentservice.customerorder; - -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CustomerOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CustomerOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "0f43e8a9f92ac574b08050817425a1e7ebc7b9b011cd14c379fdf99b1cc834a0"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("order_number", 1), java.util.Map.entry("commerce_platform", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_attachment_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String ORDER_ATTACHMENT_LIST_PROPERTY = "order_attachment_list"; - private String orderNumber; - - private CommercePlatform commercePlatform; - - private SmartList orderAttachmentList; - - public String getOrderNumber(){ - return this.orderNumber; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public SmartList getOrderAttachmentList(){ - return this.orderAttachmentList == null ? SmartList.unloaded() : this.orderAttachmentList; - } - public CustomerOrder updateOrderNumber(String orderNumber){ - orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); - this.orderNumber = orderNumber; - return this; - } - - public CustomerOrder updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public CustomerOrder addOrderAttachment(OrderAttachment orderAttachment){ - if (orderAttachment == null){ - return this; - } - - if(null == this.orderAttachmentList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderAttachmentList = teaqlUnloadedItems.map(value -> value); - } - - this.orderAttachmentList.add(orderAttachment); - orderAttachment.updateCustomerOrder(this); - return this; - } - - public static CustomerOrder refer(Long id){ - CustomerOrder refer = new CustomerOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CustomerOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "order_attachment_list": this.orderAttachmentList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "order_number": return this.orderNumber; - case "commerce_platform": return this.commercePlatform; - case "order_attachment_list": return this.orderAttachmentList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "orderNumber": return this.orderNumber; - case "commercePlatform": return this.commercePlatform; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java deleted file mode 100644 index eaa9c2278..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderChecker.java +++ /dev/null @@ -1,65 +0,0 @@ - -package com.teaql.orderattachmentservice.customerorder; - -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformChecker; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CustomerOrderChecker implements Checker{ - - public String type(){ - return CustomerOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, customerOrder)){ - markAsChecked(_context, customerOrder); - doCheck(_context, customerOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if((customerOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customerOrder); - if(customerOrder.needPersist()){ - } - if(customerOrder.newItem()){ - }else if(customerOrder.updateItem()){ - if(!customerOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - - } - checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); - checkCommercePlatform(_context, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - for(int i = 0; customerOrder.getOrderAttachmentList() != null && i < customerOrder.getOrderAttachmentList().size(); i++){ - OrderAttachment orderAttachment = customerOrder.getOrderAttachmentList().get(i); - new OrderAttachmentChecker().checkAndFix(_context, orderAttachment, newLocation(_parentLocation, "order_attachment_list", i)); - } - } - - public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, orderNumber); - - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java deleted file mode 100644 index 4ec32fd79..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.teaql.orderattachmentservice.customerorder; - -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformExpression; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerOrderExpression(Expression expression){ - super(expression); - } - - public CustomerOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerOrderExpression updateId(Long id){ - return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); - } - - public CustomerOrderExpression save(UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerOrderExpression save(String intent, UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); - } - public CustomerOrderExpression updateOrderNumber(String orderNumber){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", CustomerOrder::getCommercePlatform)); - } - - public CustomerOrderExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCommercePlatform(commercePlatform)); - } - - public OrderAttachmentListExpression getOrderAttachmentList(){ - return new OrderAttachmentListExpression(loaded("order_attachment_list", "getOrderAttachmentList", CustomerOrder::getOrderAttachmentList)); - } - public CustomerOrderExpression addOrderAttachment(OrderAttachment orderAttachment){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderAttachment(orderAttachment)); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java deleted file mode 100644 index 7975ccd86..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.orderattachmentservice.customerorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerOrderListExpression extends SmartListExpression { - public CustomerOrderListExpression(Expression> expression){ - super(expression); - } - - public CustomerOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerOrderExpression first() { - return new CustomerOrderExpression(super.first()); - } - - public CustomerOrderExpression get(int index) { - return new CustomerOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java deleted file mode 100644 index 962b95968..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/customerorder/CustomerOrderRequest.java +++ /dev/null @@ -1,900 +0,0 @@ - -package com.teaql.orderattachmentservice.customerorder; - -import com.teaql.orderattachmentservice.Q; -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatform; -import com.teaql.orderattachmentservice.commerceplatform.CommercePlatformRequest; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachment; -import com.teaql.orderattachmentservice.orderattachment.OrderAttachmentRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CustomerOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerOrderRequest(Class returnType){ - this(returnType, () -> (T) new CustomerOrder()); - } - - protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerOrderRequest copy(){ - return (CustomerOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ - super.internalMatchAny(customerOrder); - return this; - } - - public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); - } - - public CustomerOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectOrderNumber().selectCommercePlatformIdOnly().selectVersion(); - } - - public CustomerOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CustomerOrder.ID_PROPERTY); - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectOrderNumber().selectCommercePlatform().selectVersion(); - } - - public CustomerOrderRequest selectChildren(){ - super.selectAny(); - selectOrderAttachmentList(); - return selectId().selectOrderNumber().selectCommercePlatform().selectVersion(); - } - - - public CustomerOrderRequest selectId(){ - selectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectId(){ - unselectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderNumber(){ - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderNumber(){ - unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest selectCommercePlatformIdOnly(){ - selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectCommercePlatform(){ - unselectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public CustomerOrderRequest selectVersion(){ - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectVersion(){ - unselectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderAttachmentList(){ - return selectOrderAttachmentListWith(Q.orderAttachments().selectSelf()); - } - - public CustomerOrderRequest selectOrderAttachmentListWith(OrderAttachmentRequest orderAttachmentList){ - enhanceRelation(CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, orderAttachmentList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderAttachmentListWith", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); - } - - public CustomerOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ - if (orderNumber == null || orderNumber.length == 0) { - throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); - } - return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); - } - - public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ - return appendSearchCriteria(createOrderNumberCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderNumberIsUnknown(){ - return withOrderNumber(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderNumberIsKnown(){ - return withOrderNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ - return withOrderNumber(Operator.NOT_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ - return withOrderNumber(Operator.IN, (Object[])orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ - return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); - } - public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ - return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); - } - public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ - return withOrderNumber(Operator.BEGIN_WITH, orderNumber); - } - public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ - return withOrderNumber(Operator.CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ - return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ - return withOrderNumber(Operator.END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIs(String orderNumber){ - return withOrderNumber(Operator.EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ - return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); - } - - - - public CustomerOrderRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public CustomerOrderRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public CustomerOrderRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public CustomerOrderRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public CustomerOrderRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); - } - - public CustomerOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerOrderRequest withOrderAttachmentListMatching(OrderAttachmentRequest orderAttachmentRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderAttachmentRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); - } - - public CustomerOrderRequest withoutOrderAttachmentListMatching(OrderAttachmentRequest orderAttachmentRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderAttachmentRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY))); - } - - public CustomerOrderRequest haveOrderAttachments(){ - return withOrderAttachmentListMatching(Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest haveNoOrderAttachments(){ - return withoutOrderAttachmentListMatching(Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerOrderRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public CustomerOrderRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - public CustomerOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public CustomerOrderRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest groupByOrderAttachmentsWithDetails(OrderAttachmentRequest subRequest){ - aggregate(CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupById(){ - groupBy(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdAs(String retName){ - groupBy(retName, CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ID_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderNumber(){ - groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public CustomerOrderRequest groupByCommercePlatform(){ - groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByVersion(){ - groupBy(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionAs(String retName){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); - return this; - } - - - - public CustomerOrderRequest orderByIdAscending(){ - addOrderByAscending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByIdDescending(){ - addOrderByDescending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByCommercePlatformAscending(){ - addOrderByAscending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCommercePlatformDescending(){ - addOrderByDescending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionAscending(){ - addOrderByAscending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionDescending(){ - addOrderByDescending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest statsFromOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - return statsFromOrderAttachmentsAs(name, subRequest, false); - } - - public CustomerOrderRequest statsFromOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest statsFromOrderAttachments(OrderAttachmentRequest subRequest){ - return statsFromOrderAttachmentsAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - public CustomerOrderRequest countOrderAttachments(){ - addRelationCount("Count", Q.orderAttachments().unlimited(), OrderAttachment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderAttachmentsAs(String name){ - addRelationCount(name, Q.orderAttachments().unlimited(), OrderAttachment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderAttachmentsWith(String name, OrderAttachmentRequest subRequest){ - addRelationCount(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderAttachmentsWith", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest minContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("minContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest minContentLengthOfOrderAttachmentsAs(String name){ - return minContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest minContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest maxContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("maxContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest maxContentLengthOfOrderAttachmentsAs(String name){ - return maxContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest maxContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sumContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("sumContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sumContentLengthOfOrderAttachmentsAs(String name){ - return sumContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest sumContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest avgContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("avgContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest avgContentLengthOfOrderAttachmentsAs(String name){ - return avgContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest avgContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("stdDevContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachmentsAs(String name){ - return standardDeviationContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest standardDeviationContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("stdDevPopContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(String name){ - return squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("varSampContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachmentsAs(String name){ - return sampleVarianceContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest sampleVarianceContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachments(){ - addRelationScalarAggregate("varPopContentLengthOfOrderAttachments", Q.orderAttachments().unlimited(), - OrderAttachment.CUSTOMER_ORDER_PROPERTY, OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceContentLengthOfOrderAttachments", null, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachmentsAs(String name){ - return samplePopulationVarianceContentLengthOfOrderAttachmentsAs(name, Q.orderAttachments().unlimited()); - } - - public CustomerOrderRequest samplePopulationVarianceContentLengthOfOrderAttachmentsAs(String name, OrderAttachmentRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderAttachment.CUSTOMER_ORDER_PROPERTY, - OrderAttachment.CONTENT_LENGTH_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceContentLengthOfOrderAttachmentsAs", name, CustomerOrder.ORDER_ATTACHMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java deleted file mode 100644 index 4f1fcae88..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachment.java +++ /dev/null @@ -1,211 +0,0 @@ - -package com.teaql.orderattachmentservice.orderattachment; - -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderAttachment extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderAttachment"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "1b7e0fc32cc094c60c46058779d5933a02527a724ffa64e3e722a9670f3883aa"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("file_name", 2), java.util.Map.entry("content_type", 3), java.util.Map.entry("content_length", 4), java.util.Map.entry("content_sha256", 5), java.util.Map.entry("object_key", 6), java.util.Map.entry("version", 7)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("file_name", java.util.List.of("fileName", "file_name")), java.util.Map.entry("content_type", java.util.List.of("contentType", "content_type")), java.util.Map.entry("content_length", java.util.List.of("contentLength", "content_length")), java.util.Map.entry("content_sha256", java.util.List.of("contentSha256", "content_sha256")), java.util.Map.entry("object_key", java.util.List.of("objectKey", "object_key")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderAttachment.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; - public static final String FILE_NAME_PROPERTY = "file_name"; - public static final String CONTENT_TYPE_PROPERTY = "content_type"; - public static final String CONTENT_LENGTH_PROPERTY = "content_length"; - public static final String CONTENT_SHA256_PROPERTY = "content_sha256"; - public static final String OBJECT_KEY_PROPERTY = "object_key"; - private CustomerOrder customerOrder; - - private String fileName; - - private String contentType; - - private Integer contentLength; - - private String contentSha256; - - private String objectKey; - - - public CustomerOrder getCustomerOrder(){ - return this.customerOrder; - } - - public String getFileName(){ - return this.fileName; - } - - public String getContentType(){ - return this.contentType; - } - - public Integer getContentLength(){ - return this.contentLength; - } - - public String getContentSha256(){ - return this.contentSha256; - } - - public String getObjectKey(){ - return this.objectKey; - } - - public OrderAttachment updateCustomerOrder(CustomerOrder customerOrder){ - if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ - return this; - } - handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); - this.customerOrder = customerOrder; - return this; - } - - public OrderAttachment updateFileName(String fileName){ - fileName = (fileName == null ? null : fileName.trim()); - if(isPropertyLoaded(FILE_NAME_PROPERTY) && Objects.equals(this.fileName, fileName)){ - return this; - } - handleUpdate(FILE_NAME_PROPERTY, getFileName(), fileName); - this.fileName = fileName; - return this; - } - - public OrderAttachment updateContentType(String contentType){ - contentType = (contentType == null ? null : contentType.trim()); - if(isPropertyLoaded(CONTENT_TYPE_PROPERTY) && Objects.equals(this.contentType, contentType)){ - return this; - } - handleUpdate(CONTENT_TYPE_PROPERTY, getContentType(), contentType); - this.contentType = contentType; - return this; - } - - public OrderAttachment updateContentLength(Integer contentLength){ - if(isPropertyLoaded(CONTENT_LENGTH_PROPERTY) && Objects.equals(this.contentLength, contentLength)){ - return this; - } - handleUpdate(CONTENT_LENGTH_PROPERTY, getContentLength(), contentLength); - this.contentLength = contentLength; - return this; - } - - public OrderAttachment updateContentSha256(String contentSha256){ - contentSha256 = (contentSha256 == null ? null : contentSha256.trim()); - if(isPropertyLoaded(CONTENT_SHA256_PROPERTY) && Objects.equals(this.contentSha256, contentSha256)){ - return this; - } - handleUpdate(CONTENT_SHA256_PROPERTY, getContentSha256(), contentSha256); - this.contentSha256 = contentSha256; - return this; - } - - public OrderAttachment updateObjectKey(String objectKey){ - objectKey = (objectKey == null ? null : objectKey.trim()); - if(isPropertyLoaded(OBJECT_KEY_PROPERTY) && Objects.equals(this.objectKey, objectKey)){ - return this; - } - handleUpdate(OBJECT_KEY_PROPERTY, getObjectKey(), objectKey); - this.objectKey = objectKey; - return this; - } - - - public static OrderAttachment refer(Long id){ - OrderAttachment refer = new OrderAttachment(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderAttachment comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer_order": this.customerOrder = (CustomerOrder) value; break; - - case "file_name": this.fileName = (value == null ? null : ((String)value).trim()); break; - - case "content_type": this.contentType = (value == null ? null : ((String)value).trim()); break; - - case "content_length": this.contentLength = (Integer) value; break; - - case "content_sha256": this.contentSha256 = (value == null ? null : ((String)value).trim()); break; - - case "object_key": this.objectKey = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer_order": return this.customerOrder; - case "file_name": return this.fileName; - case "content_type": return this.contentType; - case "content_length": return this.contentLength; - case "content_sha256": return this.contentSha256; - case "object_key": return this.objectKey; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customerOrder": return this.customerOrder; - case "fileName": return this.fileName; - case "contentType": return this.contentType; - case "contentLength": return this.contentLength; - case "contentSha256": return this.contentSha256; - case "objectKey": return this.objectKey; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java deleted file mode 100644 index 48b076160..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentChecker.java +++ /dev/null @@ -1,105 +0,0 @@ - -package com.teaql.orderattachmentservice.orderattachment; - -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class OrderAttachmentChecker implements Checker{ - - public String type(){ - return OrderAttachment.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderAttachment orderAttachment, ObjectLocation _parentLocation){ - if(needCheck(_context, orderAttachment)){ - markAsChecked(_context, orderAttachment); - doCheck(_context, orderAttachment, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderAttachment orderAttachment, ObjectLocation _parentLocation){ - if((orderAttachment == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderAttachment); - if(orderAttachment.needPersist()){ - } - if(orderAttachment.newItem()){ - }else if(orderAttachment.updateItem()){ - if(!orderAttachment.isPropertyLoaded("customer_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); - } - if(!orderAttachment.isPropertyLoaded("file_name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "file_name"), "Mutation requires a fully loaded entity"); - } - if(!orderAttachment.isPropertyLoaded("content_type")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "content_type"), "Mutation requires a fully loaded entity"); - } - if(!orderAttachment.isPropertyLoaded("content_length")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "content_length"), "Mutation requires a fully loaded entity"); - } - if(!orderAttachment.isPropertyLoaded("content_sha256")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "content_sha256"), "Mutation requires a fully loaded entity"); - } - if(!orderAttachment.isPropertyLoaded("object_key")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "object_key"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomerOrder(_context, orderAttachment.getProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); - checkFileName(_context, orderAttachment.getProperty(OrderAttachment.FILE_NAME_PROPERTY), newLocation(_parentLocation, "file_name")); - checkContentType(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_TYPE_PROPERTY), newLocation(_parentLocation, "content_type")); - checkContentLength(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY), newLocation(_parentLocation, "content_length")); - checkContentSha256(_context, orderAttachment.getProperty(OrderAttachment.CONTENT_SHA256_PROPERTY), newLocation(_parentLocation, "content_sha256")); - checkObjectKey(_context, orderAttachment.getProperty(OrderAttachment.OBJECT_KEY_PROPERTY), newLocation(_parentLocation, "object_key")); - } - - public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerOrder); - if((customerOrder == null)){ - return; - } - new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); - } - public void checkFileName(UserContext _context, String fileName, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, fileName); - if((fileName == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, fileName); - - } - public void checkContentType(UserContext _context, String contentType, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, contentType); - if((contentType == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, contentType); - - } - public void checkContentLength(UserContext _context, Integer contentLength, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, contentLength); - if((contentLength == null)){ - return; - } - } - public void checkContentSha256(UserContext _context, String contentSha256, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, contentSha256); - if((contentSha256 == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, contentSha256); - - } - public void checkObjectKey(UserContext _context, String objectKey, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, objectKey); - if((objectKey == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, objectKey); - - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java deleted file mode 100644 index 8ae231192..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentExpression.java +++ /dev/null @@ -1,81 +0,0 @@ - -package com.teaql.orderattachmentservice.orderattachment; - -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class OrderAttachmentExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderAttachmentExpression(Expression expression){ - super(expression); - } - - public OrderAttachmentExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderAttachmentExpression updateId(Long id){ - return new OrderAttachmentExpression(this, $it -> {((OrderAttachment)$it).__internalSet("id", id); return this;}); - } - - public OrderAttachmentExpression save(UserContext userContext){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderAttachmentExpression save(String intent, UserContext userContext){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderAttachment::getCustomerOrder)); - } - - public OrderAttachmentExpression updateCustomerOrder(CustomerOrder customerOrder){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateCustomerOrder(customerOrder)); - } - - public Expression getFileName(){ - return loaded("file_name", "getFileName", OrderAttachment::getFileName); - } - public OrderAttachmentExpression updateFileName(String fileName){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateFileName(fileName)); - } - - public Expression getContentType(){ - return loaded("content_type", "getContentType", OrderAttachment::getContentType); - } - public OrderAttachmentExpression updateContentType(String contentType){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentType(contentType)); - } - - public Expression getContentLength(){ - return loaded("content_length", "getContentLength", OrderAttachment::getContentLength); - } - public OrderAttachmentExpression updateContentLength(Integer contentLength){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentLength(contentLength)); - } - - public Expression getContentSha256(){ - return loaded("content_sha256", "getContentSha256", OrderAttachment::getContentSha256); - } - public OrderAttachmentExpression updateContentSha256(String contentSha256){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateContentSha256(contentSha256)); - } - - public Expression getObjectKey(){ - return loaded("object_key", "getObjectKey", OrderAttachment::getObjectKey); - } - public OrderAttachmentExpression updateObjectKey(String objectKey){ - return new OrderAttachmentExpression(this, $it -> ((OrderAttachment)$it).updateObjectKey(objectKey)); - } - -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java deleted file mode 100644 index bcdb7e29e..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.orderattachmentservice.orderattachment; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderAttachmentListExpression extends SmartListExpression { - public OrderAttachmentListExpression(Expression> expression){ - super(expression); - } - - public OrderAttachmentListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderAttachmentExpression first() { - return new OrderAttachmentExpression(super.first()); - } - - public OrderAttachmentExpression get(int index) { - return new OrderAttachmentExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java deleted file mode 100644 index ebb47f9cf..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/orderattachment/OrderAttachmentRequest.java +++ /dev/null @@ -1,1315 +0,0 @@ - -package com.teaql.orderattachmentservice.orderattachment; - -import com.teaql.orderattachmentservice.Q; -import com.teaql.orderattachmentservice.customerorder.CustomerOrder; -import com.teaql.orderattachmentservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class OrderAttachmentRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderAttachmentRequest(Class returnType){ - this(returnType, () -> (T) new OrderAttachment()); - } - - protected OrderAttachmentRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderAttachmentRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderAttachmentRequest copy(){ - return (OrderAttachmentRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderAttachmentRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderAttachmentRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderAttachmentRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderAttachmentRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderAttachmentRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderAttachmentRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderAttachmentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderAttachmentRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderAttachmentRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderAttachmentRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderAttachmentRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderAttachmentRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderAttachmentRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderAttachmentRequest matchingAnyOf(OrderAttachmentRequest orderAttachment){ - super.internalMatchAny(orderAttachment); - return this; - } - - public OrderAttachmentRequest matchingIdsOf(OrderAttachmentRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderAttachment.ID_PROPERTY, request, OrderAttachment.ID_PROPERTY)); - } - - public OrderAttachmentRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderAttachmentRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderAttachmentRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderAttachmentRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerOrderIdOnly().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); - } - - public OrderAttachmentRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderAttachmentRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderAttachment.ID_PROPERTY); - selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - selectProperty(OrderAttachment.FILE_NAME_PROPERTY); - selectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); - selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); - selectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); - selectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); - selectProperty(OrderAttachment.VERSION_PROPERTY); - return this; - } - - public OrderAttachmentRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomerOrder().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); - } - - public OrderAttachmentRequest selectChildren(){ - super.selectAny(); - return selectId().selectCustomerOrder().selectFileName().selectContentType().selectContentLength().selectContentSha256().selectObjectKey().selectVersion(); - } - - - public OrderAttachmentRequest selectId(){ - selectProperty(OrderAttachment.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderAttachmentRequest unselectId(){ - unselectProperty(OrderAttachment.ID_PROPERTY); - return this; - } - public OrderAttachmentRequest selectCustomerOrderIdOnly(){ - selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderAttachmentRequest selectCustomerOrder(){ - return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); - } - - public OrderAttachmentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ - selectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - public OrderAttachmentRequest unselectCustomerOrder(){ - unselectProperty(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderAttachmentRequest selectFileName(){ - selectProperty(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - - /** - * fill the fileName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS fileName) to fetch fileName property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderAttachmentRequest unselectFileName(){ - unselectProperty(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - public OrderAttachmentRequest selectContentType(){ - selectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - - /** - * fill the contentType with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentType) to fetch contentType property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderAttachmentRequest unselectContentType(){ - unselectProperty(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - public OrderAttachmentRequest selectContentLength(){ - selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - - /** - * fill the contentLength with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentLength) to fetch contentLength property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the contentLength with customized aggrFunction, TEAQL uses ({aggrFunction}(contentLength) AS contentLength to fetch contentLength property. - * @param aggrFunction aggrFunction - */ - public OrderAttachmentRequest selectContentLength(AggrFunction aggrFunction){ - selectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY, aggrFunction); - return this; - } - - - public OrderAttachmentRequest unselectContentLength(){ - unselectProperty(OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest selectContentSha256(){ - selectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - - /** - * fill the contentSha256 with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS contentSha256) to fetch contentSha256 property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderAttachmentRequest unselectContentSha256(){ - unselectProperty(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - public OrderAttachmentRequest selectObjectKey(){ - selectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - - /** - * fill the objectKey with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS objectKey) to fetch objectKey property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderAttachmentRequest unselectObjectKey(){ - unselectProperty(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - public OrderAttachmentRequest selectVersion(){ - selectProperty(OrderAttachment.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderAttachmentRequest unselectVersion(){ - unselectProperty(OrderAttachment.VERSION_PROPERTY); - return this; - } - - public OrderAttachmentRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.ID_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderAttachmentRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderAttachmentRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderAttachmentRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderAttachmentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ - if (customerOrder == null || customerOrder.length == 0) { - throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); - } - return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); - } - - public OrderAttachmentRequest withCustomerOrder(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); - } - - public OrderAttachmentRequest withCustomerOrderIsUnknown(){ - return withCustomerOrder(Operator.IS_NULL); - } - - public OrderAttachmentRequest withCustomerOrderIsKnown(){ - return withCustomerOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, operator, values); - } - - public OrderAttachmentRequest filterByCustomerOrder(Long customerOrder){ - if(customerOrder == null){ - return this; - } - return withCustomerOrder(Operator.EQUAL, customerOrder); - } - public OrderAttachmentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); - } - - public OrderAttachmentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); - } - - public OrderAttachmentRequest filterByFileName(String... fileName){ - if (fileName == null || fileName.length == 0) { - throw new IllegalArgumentException("filterByFileName parameter fileName cannot be empty"); - } - return appendSearchCriteria(createFileNameCriteria(Operator.EQUAL, (Object[])fileName)); - } - - public OrderAttachmentRequest withFileName(Operator operator, Object... values){ - return appendSearchCriteria(createFileNameCriteria(operator, values)); - } - - public OrderAttachmentRequest withFileNameIsUnknown(){ - return withFileName(Operator.IS_NULL); - } - - public OrderAttachmentRequest withFileNameIsKnown(){ - return withFileName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createFileNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.FILE_NAME_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withFileNameIsNot(String fileName){ - return withFileName(Operator.NOT_EQUAL, fileName); - } - - public OrderAttachmentRequest withFileNameIn(String... fileName){ - return withFileName(Operator.IN, (Object[])fileName); - } - - public OrderAttachmentRequest withFileNameNotIn(String... fileName){ - return withFileName(Operator.NOT_IN, (Object[])fileName); - } - public OrderAttachmentRequest withFileNameGreaterThan(String fileName){ - return withFileName(Operator.GREATER_THAN, fileName); - } - - public OrderAttachmentRequest withFileNameGreaterThanOrEqualTo(String fileName){ - return withFileName(Operator.GREATER_THAN_OR_EQUAL, fileName); - } - - public OrderAttachmentRequest withFileNameLessThan(String fileName){ - return withFileName(Operator.LESS_THAN, fileName); - } - - public OrderAttachmentRequest withFileNameLessThanOrEqualTo(String fileName){ - return withFileName(Operator.LESS_THAN_OR_EQUAL, fileName); - } - - public OrderAttachmentRequest withFileNameBetween(String startOfFileName, String endOfFileName){ - return withFileName(Operator.BETWEEN, startOfFileName, endOfFileName); - } - public OrderAttachmentRequest withFileNameStartingWith(String fileName){ - return withFileName(Operator.BEGIN_WITH, fileName); - } - public OrderAttachmentRequest withFileNameContaining(String fileName){ - return withFileName(Operator.CONTAIN, fileName); - } - - public OrderAttachmentRequest withFileNameNotContaining(String fileName){ - return withFileName(Operator.NOT_CONTAIN, fileName); - } - - public OrderAttachmentRequest withFileNameNotStartingWith(String fileName){ - return withFileName(Operator.NOT_BEGIN_WITH, fileName); - } - - public OrderAttachmentRequest withFileNameEndingWith(String fileName){ - return withFileName(Operator.END_WITH, fileName); - } - - public OrderAttachmentRequest withFileNameNotEndingWith(String fileName){ - return withFileName(Operator.NOT_END_WITH, fileName); - } - - public OrderAttachmentRequest withFileNameIs(String fileName){ - return withFileName(Operator.EQUAL, fileName); - } - - public OrderAttachmentRequest withFileNameSoundingLike(String fileName){ - return withFileName(Operator.SOUNDS_LIKE, fileName); - } - - - - public OrderAttachmentRequest filterByContentType(String... contentType){ - if (contentType == null || contentType.length == 0) { - throw new IllegalArgumentException("filterByContentType parameter contentType cannot be empty"); - } - return appendSearchCriteria(createContentTypeCriteria(Operator.EQUAL, (Object[])contentType)); - } - - public OrderAttachmentRequest withContentType(Operator operator, Object... values){ - return appendSearchCriteria(createContentTypeCriteria(operator, values)); - } - - public OrderAttachmentRequest withContentTypeIsUnknown(){ - return withContentType(Operator.IS_NULL); - } - - public OrderAttachmentRequest withContentTypeIsKnown(){ - return withContentType(Operator.IS_NOT_NULL); - } - - public SearchCriteria createContentTypeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.CONTENT_TYPE_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withContentTypeIsNot(String contentType){ - return withContentType(Operator.NOT_EQUAL, contentType); - } - - public OrderAttachmentRequest withContentTypeIn(String... contentType){ - return withContentType(Operator.IN, (Object[])contentType); - } - - public OrderAttachmentRequest withContentTypeNotIn(String... contentType){ - return withContentType(Operator.NOT_IN, (Object[])contentType); - } - public OrderAttachmentRequest withContentTypeGreaterThan(String contentType){ - return withContentType(Operator.GREATER_THAN, contentType); - } - - public OrderAttachmentRequest withContentTypeGreaterThanOrEqualTo(String contentType){ - return withContentType(Operator.GREATER_THAN_OR_EQUAL, contentType); - } - - public OrderAttachmentRequest withContentTypeLessThan(String contentType){ - return withContentType(Operator.LESS_THAN, contentType); - } - - public OrderAttachmentRequest withContentTypeLessThanOrEqualTo(String contentType){ - return withContentType(Operator.LESS_THAN_OR_EQUAL, contentType); - } - - public OrderAttachmentRequest withContentTypeBetween(String startOfContentType, String endOfContentType){ - return withContentType(Operator.BETWEEN, startOfContentType, endOfContentType); - } - public OrderAttachmentRequest withContentTypeStartingWith(String contentType){ - return withContentType(Operator.BEGIN_WITH, contentType); - } - public OrderAttachmentRequest withContentTypeContaining(String contentType){ - return withContentType(Operator.CONTAIN, contentType); - } - - public OrderAttachmentRequest withContentTypeNotContaining(String contentType){ - return withContentType(Operator.NOT_CONTAIN, contentType); - } - - public OrderAttachmentRequest withContentTypeNotStartingWith(String contentType){ - return withContentType(Operator.NOT_BEGIN_WITH, contentType); - } - - public OrderAttachmentRequest withContentTypeEndingWith(String contentType){ - return withContentType(Operator.END_WITH, contentType); - } - - public OrderAttachmentRequest withContentTypeNotEndingWith(String contentType){ - return withContentType(Operator.NOT_END_WITH, contentType); - } - - public OrderAttachmentRequest withContentTypeIs(String contentType){ - return withContentType(Operator.EQUAL, contentType); - } - - public OrderAttachmentRequest withContentTypeSoundingLike(String contentType){ - return withContentType(Operator.SOUNDS_LIKE, contentType); - } - - - - public OrderAttachmentRequest filterByContentLength(Integer... contentLength){ - if (contentLength == null || contentLength.length == 0) { - throw new IllegalArgumentException("filterByContentLength parameter contentLength cannot be empty"); - } - return appendSearchCriteria(createContentLengthCriteria(Operator.EQUAL, (Object[])contentLength)); - } - - public OrderAttachmentRequest withContentLength(Operator operator, Object... values){ - return appendSearchCriteria(createContentLengthCriteria(operator, values)); - } - - public OrderAttachmentRequest withContentLengthIsUnknown(){ - return withContentLength(Operator.IS_NULL); - } - - public OrderAttachmentRequest withContentLengthIsKnown(){ - return withContentLength(Operator.IS_NOT_NULL); - } - - public SearchCriteria createContentLengthCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.CONTENT_LENGTH_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withContentLengthIs(Integer contentLength){ - return withContentLength(Operator.EQUAL, contentLength); - } - - public OrderAttachmentRequest withContentLengthIsNot(Integer contentLength){ - return withContentLength(Operator.NOT_EQUAL, contentLength); - } - - public OrderAttachmentRequest withContentLengthIn(Integer... contentLength){ - return withContentLength(Operator.IN, (Object[])contentLength); - } - - public OrderAttachmentRequest withContentLengthNotIn(Integer... contentLength){ - return withContentLength(Operator.NOT_IN, (Object[])contentLength); - } - public OrderAttachmentRequest withContentLengthGreaterThan(Integer contentLength){ - return withContentLength(Operator.GREATER_THAN, contentLength); - } - - public OrderAttachmentRequest withContentLengthGreaterThanOrEqualTo(Integer contentLength){ - return withContentLength(Operator.GREATER_THAN_OR_EQUAL, contentLength); - } - - public OrderAttachmentRequest withContentLengthLessThan(Integer contentLength){ - return withContentLength(Operator.LESS_THAN, contentLength); - } - - public OrderAttachmentRequest withContentLengthLessThanOrEqualTo(Integer contentLength){ - return withContentLength(Operator.LESS_THAN_OR_EQUAL, contentLength); - } - - public OrderAttachmentRequest withContentLengthBetween(Integer startOfContentLength, Integer endOfContentLength){ - return withContentLength(Operator.BETWEEN, startOfContentLength, endOfContentLength); - } - - - - public OrderAttachmentRequest filterByContentSha256(String... contentSha256){ - if (contentSha256 == null || contentSha256.length == 0) { - throw new IllegalArgumentException("filterByContentSha256 parameter contentSha256 cannot be empty"); - } - return appendSearchCriteria(createContentSha256Criteria(Operator.EQUAL, (Object[])contentSha256)); - } - - public OrderAttachmentRequest withContentSha256(Operator operator, Object... values){ - return appendSearchCriteria(createContentSha256Criteria(operator, values)); - } - - public OrderAttachmentRequest withContentSha256IsUnknown(){ - return withContentSha256(Operator.IS_NULL); - } - - public OrderAttachmentRequest withContentSha256IsKnown(){ - return withContentSha256(Operator.IS_NOT_NULL); - } - - public SearchCriteria createContentSha256Criteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.CONTENT_SHA256_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withContentSha256IsNot(String contentSha256){ - return withContentSha256(Operator.NOT_EQUAL, contentSha256); - } - - public OrderAttachmentRequest withContentSha256In(String... contentSha256){ - return withContentSha256(Operator.IN, (Object[])contentSha256); - } - - public OrderAttachmentRequest withContentSha256NotIn(String... contentSha256){ - return withContentSha256(Operator.NOT_IN, (Object[])contentSha256); - } - public OrderAttachmentRequest withContentSha256GreaterThan(String contentSha256){ - return withContentSha256(Operator.GREATER_THAN, contentSha256); - } - - public OrderAttachmentRequest withContentSha256GreaterThanOrEqualTo(String contentSha256){ - return withContentSha256(Operator.GREATER_THAN_OR_EQUAL, contentSha256); - } - - public OrderAttachmentRequest withContentSha256LessThan(String contentSha256){ - return withContentSha256(Operator.LESS_THAN, contentSha256); - } - - public OrderAttachmentRequest withContentSha256LessThanOrEqualTo(String contentSha256){ - return withContentSha256(Operator.LESS_THAN_OR_EQUAL, contentSha256); - } - - public OrderAttachmentRequest withContentSha256Between(String startOfContentSha256, String endOfContentSha256){ - return withContentSha256(Operator.BETWEEN, startOfContentSha256, endOfContentSha256); - } - public OrderAttachmentRequest withContentSha256StartingWith(String contentSha256){ - return withContentSha256(Operator.BEGIN_WITH, contentSha256); - } - public OrderAttachmentRequest withContentSha256Containing(String contentSha256){ - return withContentSha256(Operator.CONTAIN, contentSha256); - } - - public OrderAttachmentRequest withContentSha256NotContaining(String contentSha256){ - return withContentSha256(Operator.NOT_CONTAIN, contentSha256); - } - - public OrderAttachmentRequest withContentSha256NotStartingWith(String contentSha256){ - return withContentSha256(Operator.NOT_BEGIN_WITH, contentSha256); - } - - public OrderAttachmentRequest withContentSha256EndingWith(String contentSha256){ - return withContentSha256(Operator.END_WITH, contentSha256); - } - - public OrderAttachmentRequest withContentSha256NotEndingWith(String contentSha256){ - return withContentSha256(Operator.NOT_END_WITH, contentSha256); - } - - public OrderAttachmentRequest withContentSha256Is(String contentSha256){ - return withContentSha256(Operator.EQUAL, contentSha256); - } - - public OrderAttachmentRequest withContentSha256SoundingLike(String contentSha256){ - return withContentSha256(Operator.SOUNDS_LIKE, contentSha256); - } - - - - public OrderAttachmentRequest filterByObjectKey(String... objectKey){ - if (objectKey == null || objectKey.length == 0) { - throw new IllegalArgumentException("filterByObjectKey parameter objectKey cannot be empty"); - } - return appendSearchCriteria(createObjectKeyCriteria(Operator.EQUAL, (Object[])objectKey)); - } - - public OrderAttachmentRequest withObjectKey(Operator operator, Object... values){ - return appendSearchCriteria(createObjectKeyCriteria(operator, values)); - } - - public OrderAttachmentRequest withObjectKeyIsUnknown(){ - return withObjectKey(Operator.IS_NULL); - } - - public OrderAttachmentRequest withObjectKeyIsKnown(){ - return withObjectKey(Operator.IS_NOT_NULL); - } - - public SearchCriteria createObjectKeyCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.OBJECT_KEY_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withObjectKeyIsNot(String objectKey){ - return withObjectKey(Operator.NOT_EQUAL, objectKey); - } - - public OrderAttachmentRequest withObjectKeyIn(String... objectKey){ - return withObjectKey(Operator.IN, (Object[])objectKey); - } - - public OrderAttachmentRequest withObjectKeyNotIn(String... objectKey){ - return withObjectKey(Operator.NOT_IN, (Object[])objectKey); - } - public OrderAttachmentRequest withObjectKeyGreaterThan(String objectKey){ - return withObjectKey(Operator.GREATER_THAN, objectKey); - } - - public OrderAttachmentRequest withObjectKeyGreaterThanOrEqualTo(String objectKey){ - return withObjectKey(Operator.GREATER_THAN_OR_EQUAL, objectKey); - } - - public OrderAttachmentRequest withObjectKeyLessThan(String objectKey){ - return withObjectKey(Operator.LESS_THAN, objectKey); - } - - public OrderAttachmentRequest withObjectKeyLessThanOrEqualTo(String objectKey){ - return withObjectKey(Operator.LESS_THAN_OR_EQUAL, objectKey); - } - - public OrderAttachmentRequest withObjectKeyBetween(String startOfObjectKey, String endOfObjectKey){ - return withObjectKey(Operator.BETWEEN, startOfObjectKey, endOfObjectKey); - } - public OrderAttachmentRequest withObjectKeyStartingWith(String objectKey){ - return withObjectKey(Operator.BEGIN_WITH, objectKey); - } - public OrderAttachmentRequest withObjectKeyContaining(String objectKey){ - return withObjectKey(Operator.CONTAIN, objectKey); - } - - public OrderAttachmentRequest withObjectKeyNotContaining(String objectKey){ - return withObjectKey(Operator.NOT_CONTAIN, objectKey); - } - - public OrderAttachmentRequest withObjectKeyNotStartingWith(String objectKey){ - return withObjectKey(Operator.NOT_BEGIN_WITH, objectKey); - } - - public OrderAttachmentRequest withObjectKeyEndingWith(String objectKey){ - return withObjectKey(Operator.END_WITH, objectKey); - } - - public OrderAttachmentRequest withObjectKeyNotEndingWith(String objectKey){ - return withObjectKey(Operator.NOT_END_WITH, objectKey); - } - - public OrderAttachmentRequest withObjectKeyIs(String objectKey){ - return withObjectKey(Operator.EQUAL, objectKey); - } - - public OrderAttachmentRequest withObjectKeySoundingLike(String objectKey){ - return withObjectKey(Operator.SOUNDS_LIKE, objectKey); - } - - - - public OrderAttachmentRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderAttachmentRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderAttachmentRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderAttachmentRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderAttachment.VERSION_PROPERTY, operator, values); - } - - public OrderAttachmentRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderAttachmentRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderAttachmentRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderAttachmentRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderAttachmentRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderAttachmentRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderAttachmentRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderAttachmentRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderAttachmentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderAttachmentRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderAttachmentRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderAttachmentRequest minContentLength(){ - return minContentLengthAs(prefix("minOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest minContentLengthAs(String retName){ - super.min(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest maxContentLength(){ - return maxContentLengthAs(prefix("maxOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest maxContentLengthAs(String retName){ - super.max(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest sumContentLength(){ - return sumContentLengthAs(prefix("sumOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest sumContentLengthAs(String retName){ - super.sum(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest avgContentLength(){ - return avgContentLengthAs(prefix("avgOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest avgContentLengthAs(String retName){ - super.avg(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest standardDeviationContentLength(){ - return standardDeviationContentLengthAs(prefix("standardDeviationOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest standardDeviationContentLengthAs(String retName){ - super.standardDeviation(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest squareRootOfPopulationStandardDeviationContentLength(){ - return squareRootOfPopulationStandardDeviationContentLengthAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest squareRootOfPopulationStandardDeviationContentLengthAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest sampleVarianceContentLength(){ - return sampleVarianceContentLengthAs(prefix("sampleVarianceOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest sampleVarianceContentLengthAs(String retName){ - super.sampleVariance(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest samplePopulationVarianceContentLength(){ - return samplePopulationVarianceContentLengthAs(prefix("samplePopulationVarianceOf",OrderAttachment.CONTENT_LENGTH_PROPERTY)); - } - - public OrderAttachmentRequest samplePopulationVarianceContentLengthAs(String retName){ - super.samplePopulationVariance(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest groupByCustomerOrderWithDetails(){ - return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); - } - - public OrderAttachmentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ - aggregate(OrderAttachment.CUSTOMER_ORDER_PROPERTY, subRequest); - return this; - } - - - - - - - - public OrderAttachmentRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderAttachmentRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.ID_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctCustomerOrder(){ - return countDistinctCustomerOrderAs("customer_order_distinct_count"); - } - - public OrderAttachmentRequest countDistinctCustomerOrderAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctFileName(){ - return countDistinctFileNameAs("file_name_distinct_count"); - } - - public OrderAttachmentRequest countDistinctFileNameAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctContentType(){ - return countDistinctContentTypeAs("content_type_distinct_count"); - } - - public OrderAttachmentRequest countDistinctContentTypeAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctContentLength(){ - return countDistinctContentLengthAs("content_length_distinct_count"); - } - - public OrderAttachmentRequest countDistinctContentLengthAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctContentSha256(){ - return countDistinctContentSha256As("content_sha256_distinct_count"); - } - - public OrderAttachmentRequest countDistinctContentSha256As(String alias){ - super.countDistinctProperty(alias, OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctObjectKey(){ - return countDistinctObjectKeyAs("object_key_distinct_count"); - } - - public OrderAttachmentRequest countDistinctObjectKeyAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - public OrderAttachmentRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderAttachmentRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderAttachment.VERSION_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupById(){ - groupBy(OrderAttachment.ID_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByIdAs(String retName){ - groupBy(retName, OrderAttachment.ID_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.ID_PROPERTY, function); - return this; - } - public OrderAttachmentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderAttachment.CUSTOMER_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); - return this; - } - public OrderAttachmentRequest groupByCustomerOrder(){ - groupBy(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByCustomerOrderAs(String retName){ - groupBy(retName, OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.CUSTOMER_ORDER_PROPERTY, function); - return this; - } - - public OrderAttachmentRequest groupByFileName(){ - groupBy(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByFileNameAs(String retName){ - groupBy(retName, OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByFileNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.FILE_NAME_PROPERTY, function); - return this; - } - - public OrderAttachmentRequest groupByContentType(){ - groupBy(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByContentTypeAs(String retName){ - groupBy(retName, OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByContentTypeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.CONTENT_TYPE_PROPERTY, function); - return this; - } - - public OrderAttachmentRequest groupByContentLength(){ - groupBy(OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByContentLengthAs(String retName){ - groupBy(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByContentLengthWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.CONTENT_LENGTH_PROPERTY, function); - return this; - } - - public OrderAttachmentRequest groupByContentSha256(){ - groupBy(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByContentSha256As(String retName){ - groupBy(retName, OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByContentSha256WithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.CONTENT_SHA256_PROPERTY, function); - return this; - } - - public OrderAttachmentRequest groupByObjectKey(){ - groupBy(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByObjectKeyAs(String retName){ - groupBy(retName, OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByObjectKeyWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.OBJECT_KEY_PROPERTY, function); - return this; - } - - public OrderAttachmentRequest groupByVersion(){ - groupBy(OrderAttachment.VERSION_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByVersionAs(String retName){ - groupBy(retName, OrderAttachment.VERSION_PROPERTY); - return this; - } - - public OrderAttachmentRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderAttachment.VERSION_PROPERTY, function); - return this; - } - - - - public OrderAttachmentRequest orderByIdAscending(){ - addOrderByAscending(OrderAttachment.ID_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByIdDescending(){ - addOrderByDescending(OrderAttachment.ID_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByCustomerOrderAscending(){ - addOrderByAscending(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByCustomerOrderDescending(){ - addOrderByDescending(OrderAttachment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByFileNameAscending(){ - addOrderByAscending(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByFileNameDescending(){ - addOrderByDescending(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByFileNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByFileNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderAttachment.FILE_NAME_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByContentTypeAscending(){ - addOrderByAscending(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByContentTypeDescending(){ - addOrderByDescending(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByContentTypeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByContentTypeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderAttachment.CONTENT_TYPE_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByContentLengthAscending(){ - addOrderByAscending(OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByContentLengthDescending(){ - addOrderByDescending(OrderAttachment.CONTENT_LENGTH_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByContentSha256Ascending(){ - addOrderByAscending(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByContentSha256Descending(){ - addOrderByDescending(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByContentSha256AscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByContentSha256DescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderAttachment.CONTENT_SHA256_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByObjectKeyAscending(){ - addOrderByAscending(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByObjectKeyDescending(){ - addOrderByDescending(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByObjectKeyAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByObjectKeyDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderAttachment.OBJECT_KEY_PROPERTY); - return this; - } - public OrderAttachmentRequest orderByVersionAscending(){ - addOrderByAscending(OrderAttachment.VERSION_PROPERTY); - return this; - } - - public OrderAttachmentRequest orderByVersionDescending(){ - addOrderByDescending(OrderAttachment.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest rollUpToCustomerOrder(){ - CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.internalRollUpTo("customer_order", customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); - return customerOrder; - } - - - - - - - - - public OrderAttachmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ - return facetByCustomerOrderAs(facetName, customerOrder, true); - } - - public OrderAttachmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, OrderAttachment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderAttachment.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderAttachmentRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderAttachmentRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderAttachmentRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderAttachmentRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderAttachmentRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderAttachmentRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java b/examples/object-storage/java-app-console/lib/src/main/java/com/teaql/orderattachmentservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 09a7e0e70..000000000 --- a/examples/object-storage/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.orderattachmentservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/object-storage/showcase.json b/examples/object-storage/showcase.json index 57ad45751..8202584d5 100644 --- a/examples/object-storage/showcase.json +++ b/examples/object-storage/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "9b50d62f8a83f6cd23192b8ea0e03758ad109fb6a1692ef2ab090bc1ce278b9f", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/order-management/java-app-console/lib/pom.xml b/examples/order-management/java-app-console/lib/pom.xml deleted file mode 100644 index e02844cd5..000000000 --- a/examples/order-management/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - order-management-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java deleted file mode 100644 index 83c69ad5c..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Constants.java +++ /dev/null @@ -1,13 +0,0 @@ - -package com.teaql.ordermanagementservice; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; - -public interface Constants { - public static final long COMMERCE_PLATFORM_ID = 1l; - public static final CommercePlatform COMMERCE_PLATFORM = CommercePlatform.refer(COMMERCE_PLATFORM_ID); - public static final long ORDER_STATUS_PENDING_ID = 1001l ; - public static final OrderStatus ORDER_STATUS_PENDING = OrderStatus.refer(ORDER_STATUS_PENDING_ID);public static final long ORDER_STATUS_CONFIRMED_ID = 1002l ; - public static final OrderStatus ORDER_STATUS_CONFIRMED = OrderStatus.refer(ORDER_STATUS_CONFIRMED_ID); -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java deleted file mode 100644 index 8e27c74fc..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/E.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.teaql.ordermanagementservice; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerExpression; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderExpression; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineExpression; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetExpression; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusExpression; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static CommercePlatformExpression commercePlatform(CommercePlatform commercePlatform){ - return new CommercePlatformExpression(new ValueExpression(commercePlatform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.commercePlatform()")); - } - public static CustomerExpression customer(Customer customer){ - return new CustomerExpression(new ValueExpression(customer, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customer()")); - } - public static OrderStatusExpression orderStatus(OrderStatus orderStatus){ - return new OrderStatusExpression(new ValueExpression(orderStatus, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderStatus()")); - } - public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); - } - public static ProductExpression product(Product product){ - return new ProductExpression(new ValueExpression(product, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.product()")); - } - public static OrderLineExpression orderLine(OrderLine orderLine){ - return new OrderLineExpression(new ValueExpression(orderLine, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderLine()")); - } - public static OrderSearchPresetExpression orderSearchPreset(OrderSearchPreset orderSearchPreset){ - return new OrderSearchPresetExpression(new ValueExpression(orderSearchPreset, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderSearchPreset()")); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java deleted file mode 100644 index d855d7fe5..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/EntityMetaRegistry.java +++ /dev/null @@ -1,1741 +0,0 @@ - -package com.teaql.ordermanagementservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerCommercePlatform(); - registerCustomer(); - registerOrderStatus(); - registerCustomerOrder(); - registerProduct(); - registerOrderLine(); - registerOrderSearchPreset(); - } - private void registerCommercePlatform() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Northwind Demo") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("candidates", "createTime()") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("candidates", "updateTime()") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomer() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.customer.Customer.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.customer.Customer.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.customer.Customer.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.customer.Customer::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY, String.class) - ; - PropertyDescriptor email = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY, String.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customer.Customer.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CUSTOMER_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.EMAIL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customer.Customer.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderStatus() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.orderstatus.OrderStatus.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.orderstatus.OrderStatus.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.orderstatus.OrderStatus::new); - entityDescriptor.with("constant", "true") - - .with("identifier", "code") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY, String.class) - ; - PropertyDescriptor code = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY, String.class) - ; - PropertyDescriptor color = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COLOR_PROPERTY, String.class) - ; - PropertyDescriptor displayOrder = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ORDER_STATUS_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("candidates", "1001,1002") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Pending,Confirmed") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.CODE_PROPERTY).with("identifier", "true") - - .with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "PENDING,CONFIRMED") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("javaType", "java.lang.String") - - .with("candidates", "#F59E0B,#10B981") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("candidates", "1,2") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.COMMERCE_PLATFORM_PROPERTY).with("candidates", "1,1") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomerOrder() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.customerorder.CustomerOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.customerorder.CustomerOrder::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor orderDate = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY, LocalDate.class) - ; - PropertyDescriptor totalAmount = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor status = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customerorder.CustomerOrder.STATUS_PROPERTY, com.teaql.ordermanagementservice.orderstatus.OrderStatus.INTERNAL_TYPE, com.teaql.ordermanagementservice.orderstatus.OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.ordermanagementservice.orderstatus.OrderStatus.class) - ; - PropertyDescriptor customer = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY, com.teaql.ordermanagementservice.customer.Customer.INTERNAL_TYPE, com.teaql.ordermanagementservice.customer.Customer.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.ordermanagementservice.customer.Customer.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDate") - - .with("sqlType", "DATE") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "Date") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.STATUS_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerProduct() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.product.Product.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.product.Product.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.product.Product.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.product.Product::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY, String.class) - ; - PropertyDescriptor sku = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY, String.class) - ; - PropertyDescriptor imageUrl = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.IMAGE_URL_PROPERTY, String.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.product.Product.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.PRODUCT_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.SKU_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.IMAGE_URL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.product.Product.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderLine() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.orderline.OrderLine.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.orderline.OrderLine.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.orderline.OrderLine.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.orderline.OrderLine::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customerOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderline.OrderLine.CUSTOMER_ORDER_PROPERTY, com.teaql.ordermanagementservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.ordermanagementservice.customerorder.CustomerOrder.ORDER_LINE_LIST_PROPERTY, com.teaql.ordermanagementservice.customerorder.CustomerOrder.class) - ; - PropertyDescriptor product = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_PROPERTY, com.teaql.ordermanagementservice.product.Product.INTERNAL_TYPE, com.teaql.ordermanagementservice.product.Product.ORDER_LINE_LIST_PROPERTY, com.teaql.ordermanagementservice.product.Product.class) - ; - PropertyDescriptor productName = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY, String.class) - ; - PropertyDescriptor sku = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY, String.class) - ; - PropertyDescriptor quantity = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY, Integer.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.orderline.OrderLine.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ORDER_LINE_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CUSTOMER_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.PRODUCT_NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.SKU_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.QUANTITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.orderline.OrderLine.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderSearchPreset() { - FieldLayout.installGenerated(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class); - entityDescriptor.setEntitySupplier(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY, String.class) - ; - PropertyDescriptor filterJson = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY, String.class) - ; - PropertyDescriptor requestId = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY, String.class) - ; - PropertyDescriptor ownerUserId = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY, String.class) - ; - PropertyDescriptor commercePlatform = - entityDescriptor.addObjectProperty($factory, com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.INTERNAL_TYPE, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.FILTER_JSON_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.REQUEST_ID_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.OWNER_USER_ID_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java deleted file mode 100644 index 098165a55..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.teaql.ordermanagementservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker(), new com.teaql.ordermanagementservice.customer.CustomerChecker(), new com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker(), new com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker(), new com.teaql.ordermanagementservice.product.ProductChecker(), new com.teaql.ordermanagementservice.orderline.OrderLineChecker(), new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:feb0a6c97f37d35282317bf77fbd60ffde5a4dc18d6f6a371fd40d2c37d6c975\",\"entities\":{\"CommercePlatform\":{\"labels\":{\"en\":\"commerce platform\"},\"fields\":[{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_list\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"customer\"},\"aliases\":[\"CustomerList\",\"customerList\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"order_search_preset_list\",\"targetType\":\"OrderSearchPreset\",\"labels\":{\"en\":\"order search preset\"},\"aliases\":[\"OrderSearchPresetList\",\"orderSearchPresetList\"]},{\"name\":\"order_status_list\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"order status\"},\"aliases\":[\"OrderStatusList\",\"orderStatusList\"]},{\"name\":\"product_list\",\"targetType\":\"Product\",\"labels\":{\"en\":\"product\"},\"aliases\":[\"ProductList\",\"productList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Customer\":{\"labels\":{\"en\":\"customer\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"email\",\"labels\":{\"en\":\"email\"},\"aliases\":[\"Email\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"customer order\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"customer\"},\"aliases\":[\"Customer\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_date\",\"labels\":{\"en\":\"order date\"},\"aliases\":[\"OrderDate\",\"orderDate\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"status\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"status\"},\"aliases\":[\"Status\"]},{\"name\":\"total_amount\",\"labels\":{\"en\":\"total amount\"},\"aliases\":[\"TotalAmount\",\"totalAmount\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderLine\":{\"labels\":{\"en\":\"order line\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product\",\"targetType\":\"Product\",\"labels\":{\"en\":\"product\"},\"aliases\":[\"Product\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderSearchPreset\":{", "\"labels\":{\"en\":\"order search preset\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"filter_json\",\"labels\":{\"en\":\"filter json\"},\"aliases\":[\"FilterJson\",\"filterJson\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"owner_user_id\",\"labels\":{\"en\":\"owner user id\"},\"aliases\":[\"OwnerUserId\",\"ownerUserId\"]},{\"name\":\"request_id\",\"labels\":{\"en\":\"request id\"},\"aliases\":[\"RequestId\",\"requestId\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderStatus\":{\"labels\":{\"en\":\"order status\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"color\",\"labels\":{\"en\":\"color\"},\"aliases\":[\"Color\"]},{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"customer order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Product\":{\"labels\":{\"en\":\"product\"},\"fields\":[{\"name\":\"commerce_platform\",\"targetType\":\"CommercePlatform\",\"labels\":{\"en\":\"commerce platform\"},\"aliases\":[\"CommercePlatform\",\"commercePlatform\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"image_url\",\"labels\":{\"en\":\"image url\"},\"aliases\":[\"ImageUrl\",\"imageUrl\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_line_list\",\"targetType\":\"OrderLine\",\"labels\":{\"en\":\"order line\"},\"aliases\":[\"OrderLineList\",\"orderLineList\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("CommercePlatform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Customer", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("email", "email"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderStatus", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("color", "color"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("order_date", "orderDate"), java.util.Map.entry("total_amount", "totalAmount"), java.util.Map.entry("status", "status"), java.util.Map.entry("customer", "customer"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Product", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("image_url", "imageUrl"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderLine", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("product", "product"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderSearchPreset", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("filter_json", "filterJson"), java.util.Map.entry("request_id", "requestId"), java.util.Map.entry("owner_user_id", "ownerUserId"), java.util.Map.entry("commerce_platform", "commercePlatform"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.commercePlatforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.ordermanagementservice.commerceplatform.CommercePlatform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.ordermanagementservice.commerceplatform.CommercePlatform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Northwind Demo"); - domainRoot.auditAs("create generated Domain Root CommercePlatform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("CommercePlatform", domainRoot.getId())); - var constantOrderStatus1001Rows = Q.orderStatuses().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantOrderStatus1001Rows.isEmpty()) { - com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1001 = new com.teaql.ordermanagementservice.orderstatus.OrderStatus(); - constantOrderStatus1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1001, 1001L); - constantOrderStatus1001.updateName("Pending"); - constantOrderStatus1001.updateCode("PENDING"); - constantOrderStatus1001.updateColor("#F59E0B"); - constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); - constantOrderStatus1001.updateCommercePlatform(domainRoot); - constantOrderStatus1001.auditAs("create model constant OrderStatus(1001)").save(context); - } else { - com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1001 = constantOrderStatus1001Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantOrderStatus1001.getName(), "Pending"))) { constantOrderStatus1001.updateName("Pending"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1001.getCode(), "PENDING"))) { constantOrderStatus1001.updateCode("PENDING"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1001.getColor(), "#F59E0B"))) { constantOrderStatus1001.updateColor("#F59E0B"); changed = true; } - if (!((constantOrderStatus1001.getDisplayOrder() != null && constantOrderStatus1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1001.getCommercePlatform().getId(), domainRoot.getId()))) { constantOrderStatus1001.updateCommercePlatform(domainRoot); changed = true; } - if (changed) constantOrderStatus1001.auditAs("reconcile model constant OrderStatus(1001)").save(context); - } - var constantOrderStatus1002Rows = Q.orderStatuses().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantOrderStatus1002Rows.isEmpty()) { - com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1002 = new com.teaql.ordermanagementservice.orderstatus.OrderStatus(); - constantOrderStatus1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1002, 1002L); - constantOrderStatus1002.updateName("Confirmed"); - constantOrderStatus1002.updateCode("CONFIRMED"); - constantOrderStatus1002.updateColor("#10B981"); - constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); - constantOrderStatus1002.updateCommercePlatform(domainRoot); - constantOrderStatus1002.auditAs("create model constant OrderStatus(1002)").save(context); - } else { - com.teaql.ordermanagementservice.orderstatus.OrderStatus constantOrderStatus1002 = constantOrderStatus1002Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantOrderStatus1002.getName(), "Confirmed"))) { constantOrderStatus1002.updateName("Confirmed"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1002.getCode(), "CONFIRMED"))) { constantOrderStatus1002.updateCode("CONFIRMED"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1002.getColor(), "#10B981"))) { constantOrderStatus1002.updateColor("#10B981"); changed = true; } - if (!((constantOrderStatus1002.getDisplayOrder() != null && constantOrderStatus1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1002.getCommercePlatform().getId(), domainRoot.getId()))) { constantOrderStatus1002.updateCommercePlatform(domainRoot); changed = true; } - if (changed) constantOrderStatus1002.auditAs("reconcile model constant OrderStatus(1002)").save(context); - } - } -} diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java deleted file mode 100644 index ce5d39903..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/OrderManagementServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.ordermanagementservice; - -import io.teaql.core.UserContext; -public interface OrderManagementServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java deleted file mode 100644 index 0cdd1f62a..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Q.java +++ /dev/null @@ -1,70 +0,0 @@ - -package com.teaql.ordermanagementservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest commercePlatforms(){ - return new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest commercePlatformsWithMinimalFields(){ - return new com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest(com.teaql.ordermanagementservice.commerceplatform.CommercePlatform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordermanagementservice.customer.CustomerRequest customers(){ - return new com.teaql.ordermanagementservice.customer.CustomerRequest(com.teaql.ordermanagementservice.customer.Customer.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.customer.CustomerRequest customersWithMinimalFields(){ - return new com.teaql.ordermanagementservice.customer.CustomerRequest(com.teaql.ordermanagementservice.customer.Customer.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest orderStatuses(){ - return new com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest orderStatusesWithMinimalFields(){ - return new com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest(com.teaql.ordermanagementservice.orderstatus.OrderStatus.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest customerOrders(){ - return new com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ - return new com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest(com.teaql.ordermanagementservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordermanagementservice.product.ProductRequest products(){ - return new com.teaql.ordermanagementservice.product.ProductRequest(com.teaql.ordermanagementservice.product.Product.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.product.ProductRequest productsWithMinimalFields(){ - return new com.teaql.ordermanagementservice.product.ProductRequest(com.teaql.ordermanagementservice.product.Product.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordermanagementservice.orderline.OrderLineRequest orderLines(){ - return new com.teaql.ordermanagementservice.orderline.OrderLineRequest(com.teaql.ordermanagementservice.orderline.OrderLine.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.orderline.OrderLineRequest orderLinesWithMinimalFields(){ - return new com.teaql.ordermanagementservice.orderline.OrderLineRequest(com.teaql.ordermanagementservice.orderline.OrderLine.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest orderSearchPresets(){ - return new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest orderSearchPresetsWithMinimalFields(){ - return new com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest(com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java deleted file mode 100644 index ccc71faac..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatform.java +++ /dev/null @@ -1,281 +0,0 @@ - -package com.teaql.ordermanagementservice.commerceplatform; - -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.product.Product; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CommercePlatform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CommercePlatform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "67294964fa1d025f37e472895a7b4548e18b1d34e91dd854877dbc11d0367f28"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("create_time", 2), java.util.Map.entry("update_time", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_list", "order_status_list", "customer_order_list", "product_list", "order_line_list", "order_search_preset_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CommercePlatform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String CUSTOMER_LIST_PROPERTY = "customer_list"; - public static final String ORDER_STATUS_LIST_PROPERTY = "order_status_list"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - public static final String PRODUCT_LIST_PROPERTY = "product_list"; - public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; - public static final String ORDER_SEARCH_PRESET_LIST_PROPERTY = "order_search_preset_list"; - private String name; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList customerList; - private SmartList orderStatusList; - private SmartList customerOrderList; - private SmartList productList; - private SmartList orderLineList; - private SmartList orderSearchPresetList; - - public String getName(){ - return this.name; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getCustomerList(){ - return this.customerList == null ? SmartList.unloaded() : this.customerList; - } - public SmartList getOrderStatusList(){ - return this.orderStatusList == null ? SmartList.unloaded() : this.orderStatusList; - } - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public SmartList getProductList(){ - return this.productList == null ? SmartList.unloaded() : this.productList; - } - public SmartList getOrderLineList(){ - return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; - } - public SmartList getOrderSearchPresetList(){ - return this.orderSearchPresetList == null ? SmartList.unloaded() : this.orderSearchPresetList; - } - public CommercePlatform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public CommercePlatform updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public CommercePlatform updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public CommercePlatform addCustomer(Customer customer){ - if (customer == null){ - return this; - } - - if(null == this.customerList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerList = teaqlUnloadedItems.map(value -> value); - } - - this.customerList.add(customer); - customer.updateCommercePlatform(this); - return this; - } - public CommercePlatform addOrderStatus(OrderStatus orderStatus){ - if (orderStatus == null){ - return this; - } - - if(null == this.orderStatusList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderStatusList = teaqlUnloadedItems.map(value -> value); - } - - this.orderStatusList.add(orderStatus); - orderStatus.updateCommercePlatform(this); - return this; - } - public CommercePlatform addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateCommercePlatform(this); - return this; - } - public CommercePlatform addProduct(Product product){ - if (product == null){ - return this; - } - - if(null == this.productList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.productList = teaqlUnloadedItems.map(value -> value); - } - - this.productList.add(product); - product.updateCommercePlatform(this); - return this; - } - public CommercePlatform addOrderLine(OrderLine orderLine){ - if (orderLine == null){ - return this; - } - - if(null == this.orderLineList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderLineList = teaqlUnloadedItems.map(value -> value); - } - - this.orderLineList.add(orderLine); - orderLine.updateCommercePlatform(this); - return this; - } - public CommercePlatform addOrderSearchPreset(OrderSearchPreset orderSearchPreset){ - if (orderSearchPreset == null){ - return this; - } - - if(null == this.orderSearchPresetList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderSearchPresetList = teaqlUnloadedItems.map(value -> value); - } - - this.orderSearchPresetList.add(orderSearchPreset); - orderSearchPreset.updateCommercePlatform(this); - return this; - } - - public static CommercePlatform refer(Long id){ - CommercePlatform refer = new CommercePlatform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CommercePlatform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "customer_list": this.customerList = (SmartList) value; break; - case "order_status_list": this.orderStatusList = (SmartList) value; break; - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - case "product_list": this.productList = (SmartList) value; break; - case "order_line_list": this.orderLineList = (SmartList) value; break; - case "order_search_preset_list": this.orderSearchPresetList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "customer_list": return this.customerList; - case "order_status_list": return this.orderStatusList; - case "customer_order_list": return this.customerOrderList; - case "product_list": return this.productList; - case "order_line_list": return this.orderLineList; - case "order_search_preset_list": return this.orderSearchPresetList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java deleted file mode 100644 index 51cc24171..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformChecker.java +++ /dev/null @@ -1,126 +0,0 @@ - -package com.teaql.ordermanagementservice.commerceplatform; - -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerChecker; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineChecker; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetChecker; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class CommercePlatformChecker implements Checker{ - - public String type(){ - return CommercePlatform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - if(needCheck(_context, commercePlatform)){ - markAsChecked(_context, commercePlatform); - doCheck(_context, commercePlatform, _parentLocation); - } - } - - public void doCheck(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - if((commercePlatform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, commercePlatform); - if(commercePlatform.needPersist()){ - } - if(commercePlatform.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - commercePlatform.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - commercePlatform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(commercePlatform.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - commercePlatform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!commercePlatform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!commercePlatform.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!commercePlatform.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, commercePlatform.getProperty(CommercePlatform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCreateTime(_context, commercePlatform.getProperty(CommercePlatform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, commercePlatform.getProperty(CommercePlatform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; commercePlatform.getCustomerList() != null && i < commercePlatform.getCustomerList().size(); i++){ - Customer customer = commercePlatform.getCustomerList().get(i); - new CustomerChecker().checkAndFix(_context, customer, newLocation(_parentLocation, "customer_list", i)); - } - for(int i = 0; commercePlatform.getOrderStatusList() != null && i < commercePlatform.getOrderStatusList().size(); i++){ - OrderStatus orderStatus = commercePlatform.getOrderStatusList().get(i); - new OrderStatusChecker().checkAndFix(_context, orderStatus, newLocation(_parentLocation, "order_status_list", i)); - } - for(int i = 0; commercePlatform.getCustomerOrderList() != null && i < commercePlatform.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = commercePlatform.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - for(int i = 0; commercePlatform.getProductList() != null && i < commercePlatform.getProductList().size(); i++){ - Product product = commercePlatform.getProductList().get(i); - new ProductChecker().checkAndFix(_context, product, newLocation(_parentLocation, "product_list", i)); - } - for(int i = 0; commercePlatform.getOrderLineList() != null && i < commercePlatform.getOrderLineList().size(); i++){ - OrderLine orderLine = commercePlatform.getOrderLineList().get(i); - new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); - } - for(int i = 0; commercePlatform.getOrderSearchPresetList() != null && i < commercePlatform.getOrderSearchPresetList().size(); i++){ - OrderSearchPreset orderSearchPreset = commercePlatform.getOrderSearchPresetList().get(i); - new OrderSearchPresetChecker().checkAndFix(_context, orderSearchPreset, newLocation(_parentLocation, "order_search_preset_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java deleted file mode 100644 index 9bd17a4b3..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformExpression.java +++ /dev/null @@ -1,106 +0,0 @@ - -package com.teaql.ordermanagementservice.commerceplatform; - -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerListExpression; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderListExpression; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineListExpression; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetListExpression; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusListExpression; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class CommercePlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CommercePlatformExpression(Expression expression){ - super(expression); - } - - public CommercePlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public CommercePlatformExpression updateId(Long id){ - return new CommercePlatformExpression(this, $it -> {((CommercePlatform)$it).__internalSet("id", id); return this;}); - } - - public CommercePlatformExpression save(UserContext userContext){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CommercePlatformExpression save(String intent, UserContext userContext){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", CommercePlatform::getName); - } - public CommercePlatformExpression updateName(String name){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateName(name)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", CommercePlatform::getCreateTime); - } - public CommercePlatformExpression updateCreateTime(LocalDateTime createTime){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", CommercePlatform::getUpdateTime); - } - public CommercePlatformExpression updateUpdateTime(LocalDateTime updateTime){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).updateUpdateTime(updateTime)); - } - - public CustomerListExpression getCustomerList(){ - return new CustomerListExpression(loaded("customer_list", "getCustomerList", CommercePlatform::getCustomerList)); - } - public OrderStatusListExpression getOrderStatusList(){ - return new OrderStatusListExpression(loaded("order_status_list", "getOrderStatusList", CommercePlatform::getOrderStatusList)); - } - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CommercePlatform::getCustomerOrderList)); - } - public ProductListExpression getProductList(){ - return new ProductListExpression(loaded("product_list", "getProductList", CommercePlatform::getProductList)); - } - public OrderLineListExpression getOrderLineList(){ - return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", CommercePlatform::getOrderLineList)); - } - public OrderSearchPresetListExpression getOrderSearchPresetList(){ - return new OrderSearchPresetListExpression(loaded("order_search_preset_list", "getOrderSearchPresetList", CommercePlatform::getOrderSearchPresetList)); - } - public CommercePlatformExpression addCustomer(Customer customer){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomer(customer)); - } - public CommercePlatformExpression addOrderStatus(OrderStatus orderStatus){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addOrderStatus(orderStatus)); - } - public CommercePlatformExpression addCustomerOrder(CustomerOrder customerOrder){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addCustomerOrder(customerOrder)); - } - public CommercePlatformExpression addProduct(Product product){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addProduct(product)); - } - public CommercePlatformExpression addOrderLine(OrderLine orderLine){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addOrderLine(orderLine)); - } - public CommercePlatformExpression addOrderSearchPreset(OrderSearchPreset orderSearchPreset){ - return new CommercePlatformExpression(this, $it -> ((CommercePlatform)$it).addOrderSearchPreset(orderSearchPreset)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java deleted file mode 100644 index e3da0f48e..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.commerceplatform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CommercePlatformListExpression extends SmartListExpression { - public CommercePlatformListExpression(Expression> expression){ - super(expression); - } - - public CommercePlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CommercePlatformExpression first() { - return new CommercePlatformExpression(super.first()); - } - - public CommercePlatformExpression get(int index) { - return new CommercePlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java deleted file mode 100644 index 9d87e3de1..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/commerceplatform/CommercePlatformRequest.java +++ /dev/null @@ -1,1643 +0,0 @@ - -package com.teaql.ordermanagementservice.commerceplatform; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerRequest; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineRequest; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPreset; -import com.teaql.ordermanagementservice.ordersearchpreset.OrderSearchPresetRequest; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class CommercePlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CommercePlatformRequest(Class returnType){ - this(returnType, () -> (T) new CommercePlatform()); - } - - protected CommercePlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CommercePlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CommercePlatformRequest copy(){ - return (CommercePlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CommercePlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CommercePlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CommercePlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CommercePlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CommercePlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CommercePlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CommercePlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CommercePlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CommercePlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CommercePlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CommercePlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CommercePlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public CommercePlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CommercePlatformRequest matchingAnyOf(CommercePlatformRequest commercePlatform){ - super.internalMatchAny(commercePlatform); - return this; - } - - public CommercePlatformRequest matchingIdsOf(CommercePlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CommercePlatform.ID_PROPERTY, request, CommercePlatform.ID_PROPERTY)); - } - - public CommercePlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CommercePlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CommercePlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CommercePlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public CommercePlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public CommercePlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CommercePlatform.ID_PROPERTY); - selectProperty(CommercePlatform.NAME_PROPERTY); - selectProperty(CommercePlatform.CREATE_TIME_PROPERTY); - selectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); - selectProperty(CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public CommercePlatformRequest selectChildren(){ - super.selectAny(); - selectCustomerList().selectOrderStatusList().selectCustomerOrderList().selectProductList().selectOrderLineList().selectOrderSearchPresetList(); - return selectId().selectName().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public CommercePlatformRequest selectId(){ - selectProperty(CommercePlatform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectId(){ - unselectProperty(CommercePlatform.ID_PROPERTY); - return this; - } - public CommercePlatformRequest selectName(){ - selectProperty(CommercePlatform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectName(){ - unselectProperty(CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest selectCreateTime(){ - selectProperty(CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectCreateTime(){ - unselectProperty(CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - public CommercePlatformRequest selectUpdateTime(){ - selectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectUpdateTime(){ - unselectProperty(CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - public CommercePlatformRequest selectVersion(){ - selectProperty(CommercePlatform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CommercePlatformRequest unselectVersion(){ - unselectProperty(CommercePlatform.VERSION_PROPERTY); - return this; - } - public CommercePlatformRequest selectCustomerList(){ - return selectCustomerListWith(Q.customers().selectSelf()); - } - - public CommercePlatformRequest selectCustomerListWith(CustomerRequest customerList){ - enhanceRelation(CommercePlatform.CUSTOMER_LIST_PROPERTY, customerList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerListWith", null, CommercePlatform.CUSTOMER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest selectOrderStatusList(){ - return selectOrderStatusListWith(Q.orderStatuses().selectSelf()); - } - - public CommercePlatformRequest selectOrderStatusListWith(OrderStatusRequest orderStatusList){ - enhanceRelation(CommercePlatform.ORDER_STATUS_LIST_PROPERTY, orderStatusList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderStatusListWith", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public CommercePlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest selectProductList(){ - return selectProductListWith(Q.products().selectSelf()); - } - - public CommercePlatformRequest selectProductListWith(ProductRequest productList){ - enhanceRelation(CommercePlatform.PRODUCT_LIST_PROPERTY, productList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectProductListWith", null, CommercePlatform.PRODUCT_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest selectOrderLineList(){ - return selectOrderLineListWith(Q.orderLines().selectSelf()); - } - - public CommercePlatformRequest selectOrderLineListWith(OrderLineRequest orderLineList){ - enhanceRelation(CommercePlatform.ORDER_LINE_LIST_PROPERTY, orderLineList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest selectOrderSearchPresetList(){ - return selectOrderSearchPresetListWith(Q.orderSearchPresets().selectSelf()); - } - - public CommercePlatformRequest selectOrderSearchPresetListWith(OrderSearchPresetRequest orderSearchPresetList){ - enhanceRelation(CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, orderSearchPresetList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderSearchPresetListWith", null, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.ID_PROPERTY, operator, values); - } - - public CommercePlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CommercePlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CommercePlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CommercePlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CommercePlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public CommercePlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public CommercePlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public CommercePlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.NAME_PROPERTY, operator, values); - } - - public CommercePlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public CommercePlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public CommercePlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public CommercePlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public CommercePlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public CommercePlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public CommercePlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public CommercePlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public CommercePlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public CommercePlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public CommercePlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public CommercePlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public CommercePlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public CommercePlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public CommercePlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public CommercePlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public CommercePlatformRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public CommercePlatformRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public CommercePlatformRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public CommercePlatformRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.CREATE_TIME_PROPERTY, operator, values); - } - - public CommercePlatformRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public CommercePlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public CommercePlatformRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public CommercePlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public CommercePlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CommercePlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public CommercePlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CommercePlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public CommercePlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public CommercePlatformRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CommercePlatformRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CommercePlatformRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CommercePlatformRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CommercePlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public CommercePlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public CommercePlatformRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public CommercePlatformRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public CommercePlatformRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.UPDATE_TIME_PROPERTY, operator, values); - } - - public CommercePlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public CommercePlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public CommercePlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public CommercePlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public CommercePlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CommercePlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public CommercePlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CommercePlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public CommercePlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public CommercePlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CommercePlatformRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CommercePlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CommercePlatformRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CommercePlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public CommercePlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CommercePlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CommercePlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CommercePlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CommercePlatform.VERSION_PROPERTY, operator, values); - } - - public CommercePlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CommercePlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CommercePlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CommercePlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CommercePlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CommercePlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CommercePlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CommercePlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CommercePlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CommercePlatformRequest withCustomerListMatching(CustomerRequest customerRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerRequest, Customer.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutCustomerListMatching(CustomerRequest customerRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerRequest, Customer.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveCustomers(){ - return withCustomerListMatching(Q.customers().unlimited()); - } - - public CommercePlatformRequest haveNoCustomers(){ - return withoutCustomerListMatching(Q.customers().unlimited()); - } - public CommercePlatformRequest withOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderStatusRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderStatusRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveOrderStatuses(){ - return withOrderStatusListMatching(Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest haveNoOrderStatuses(){ - return withoutOrderStatusListMatching(Q.orderStatuses().unlimited()); - } - public CommercePlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, customerOrderRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - public CommercePlatformRequest withProductListMatching(ProductRequest productRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, productRequest, Product.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutProductListMatching(ProductRequest productRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, productRequest, Product.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveProducts(){ - return withProductListMatching(Q.products().unlimited()); - } - - public CommercePlatformRequest haveNoProducts(){ - return withoutProductListMatching(Q.products().unlimited()); - } - public CommercePlatformRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderLineRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutOrderLineListMatching(OrderLineRequest orderLineRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderLineRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveOrderLines(){ - return withOrderLineListMatching(Q.orderLines().unlimited()); - } - - public CommercePlatformRequest haveNoOrderLines(){ - return withoutOrderLineListMatching(Q.orderLines().unlimited()); - } - public CommercePlatformRequest withOrderSearchPresetListMatching(OrderSearchPresetRequest orderSearchPresetRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderSearchPresetRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); - } - - public CommercePlatformRequest withoutOrderSearchPresetListMatching(OrderSearchPresetRequest orderSearchPresetRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CommercePlatform.ID_PROPERTY, orderSearchPresetRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY))); - } - - public CommercePlatformRequest haveOrderSearchPresets(){ - return withOrderSearchPresetListMatching(Q.orderSearchPresets().unlimited()); - } - - public CommercePlatformRequest haveNoOrderSearchPresets(){ - return withoutOrderSearchPresetListMatching(Q.orderSearchPresets().unlimited()); - } - - public CommercePlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CommercePlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CommercePlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CommercePlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.ID_PROPERTY); - return this; - } - public CommercePlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public CommercePlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public CommercePlatformRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - public CommercePlatformRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public CommercePlatformRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - public CommercePlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CommercePlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CommercePlatform.VERSION_PROPERTY); - return this; - } - public CommercePlatformRequest groupByCustomersWithDetails(CustomerRequest subRequest){ - aggregate(CommercePlatform.CUSTOMER_LIST_PROPERTY, subRequest); - return this; - } - public CommercePlatformRequest groupByOrderStatusesWithDetails(OrderStatusRequest subRequest){ - aggregate(CommercePlatform.ORDER_STATUS_LIST_PROPERTY, subRequest); - return this; - } - public CommercePlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - public CommercePlatformRequest groupByProductsWithDetails(ProductRequest subRequest){ - aggregate(CommercePlatform.PRODUCT_LIST_PROPERTY, subRequest); - return this; - } - public CommercePlatformRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ - aggregate(CommercePlatform.ORDER_LINE_LIST_PROPERTY, subRequest); - return this; - } - public CommercePlatformRequest groupByOrderSearchPresetsWithDetails(OrderSearchPresetRequest subRequest){ - aggregate(CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY, subRequest); - return this; - } - - public CommercePlatformRequest groupById(){ - groupBy(CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByIdAs(String retName){ - groupBy(retName, CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.ID_PROPERTY, function); - return this; - } - - public CommercePlatformRequest groupByName(){ - groupBy(CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByNameAs(String retName){ - groupBy(retName, CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.NAME_PROPERTY, function); - return this; - } - - public CommercePlatformRequest groupByCreateTime(){ - groupBy(CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByCreateTimeAs(String retName){ - groupBy(retName, CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.CREATE_TIME_PROPERTY, function); - return this; - } - - public CommercePlatformRequest groupByUpdateTime(){ - groupBy(CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.UPDATE_TIME_PROPERTY, function); - return this; - } - - public CommercePlatformRequest groupByVersion(){ - groupBy(CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByVersionAs(String retName){ - groupBy(retName, CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CommercePlatform.VERSION_PROPERTY, function); - return this; - } - - - - public CommercePlatformRequest orderByIdAscending(){ - addOrderByAscending(CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByIdDescending(){ - addOrderByDescending(CommercePlatform.ID_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByNameAscending(){ - addOrderByAscending(CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByNameDescending(){ - addOrderByDescending(CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CommercePlatform.NAME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CommercePlatform.NAME_PROPERTY); - return this; - } - public CommercePlatformRequest orderByCreateTimeAscending(){ - addOrderByAscending(CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByCreateTimeDescending(){ - addOrderByDescending(CommercePlatform.CREATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByUpdateTimeAscending(){ - addOrderByAscending(CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByUpdateTimeDescending(){ - addOrderByDescending(CommercePlatform.UPDATE_TIME_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByVersionAscending(){ - addOrderByAscending(CommercePlatform.VERSION_PROPERTY); - return this; - } - - public CommercePlatformRequest orderByVersionDescending(){ - addOrderByDescending(CommercePlatform.VERSION_PROPERTY); - return this; - } - - - public CommercePlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest){ - return statsFromCustomersAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Customer.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomersAs", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromCustomers(CustomerRequest subRequest){ - return statsFromCustomersAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromOrderStatuses(OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest statsFromProductsAs(String name, ProductRequest subRequest){ - return statsFromProductsAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromProductsAs(String name, ProductRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Product.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromProductsAs", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromProducts(ProductRequest subRequest){ - return statsFromProductsAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromOrderLines(OrderLineRequest subRequest){ - return statsFromOrderLinesAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest statsFromOrderSearchPresetsAs(String name, OrderSearchPresetRequest subRequest){ - return statsFromOrderSearchPresetsAs(name, subRequest, false); - } - - public CommercePlatformRequest statsFromOrderSearchPresetsAs(String name, OrderSearchPresetRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderSearchPresetsAs", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest statsFromOrderSearchPresets(OrderSearchPresetRequest subRequest){ - return statsFromOrderSearchPresetsAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest countCustomers(){ - addRelationCount("Count", Q.customers().unlimited(), Customer.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomers", null, CommercePlatform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countCustomersAs(String name){ - addRelationCount(name, Q.customers().unlimited(), Customer.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersAs", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countCustomersWith(String name, CustomerRequest subRequest){ - addRelationCount(name, subRequest, Customer.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersWith", name, CommercePlatform.CUSTOMER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest countOrderStatuses(){ - addRelationCount("Count", Q.orderStatuses().unlimited(), OrderStatus.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countOrderStatusesAs(String name){ - addRelationCount(name, Q.orderStatuses().unlimited(), OrderStatus.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countOrderStatusesWith(String name, OrderStatusRequest subRequest){ - addRelationCount(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesWith", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest countProducts(){ - addRelationCount("Count", Q.products().unlimited(), Product.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProducts", null, CommercePlatform.PRODUCT_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countProductsAs(String name){ - addRelationCount(name, Q.products().unlimited(), Product.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProductsAs", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countProductsWith(String name, ProductRequest subRequest){ - addRelationCount(name, subRequest, Product.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countProductsWith", name, CommercePlatform.PRODUCT_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest countOrderLines(){ - addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countOrderLinesAs(String name){ - addRelationCount(name, Q.orderLines().unlimited(), OrderLine.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ - addRelationCount(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest countOrderSearchPresets(){ - addRelationCount("Count", Q.orderSearchPresets().unlimited(), OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresets", null, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countOrderSearchPresetsAs(String name){ - addRelationCount(name, Q.orderSearchPresets().unlimited(), OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresetsAs", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest countOrderSearchPresetsWith(String name, OrderSearchPresetRequest subRequest){ - addRelationCount(name, subRequest, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderSearchPresetsWith", name, CommercePlatform.ORDER_SEARCH_PRESET_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest minDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("minDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name){ - return minDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest minDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest maxDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("maxDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name){ - return maxDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest maxDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest sumDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("sumDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name){ - return sumDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest sumDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest avgDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("avgDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name){ - return avgDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest avgDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("stdDevDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name){ - return standardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("stdDevPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name){ - return squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("varSampDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name){ - return sampleVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("varPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.COMMERCE_PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatuses", null, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name){ - return samplePopulationVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public CommercePlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.COMMERCE_PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatusesAs", name, CommercePlatform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest minTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name){ - return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest maxTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name){ - return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest sumTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name){ - return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest avgTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name){ - return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ - return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.COMMERCE_PLATFORM_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CommercePlatformRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, CommercePlatform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest minQuantityOfOrderLines(){ - addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest minQuantityOfOrderLinesAs(String name){ - return minQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest maxQuantityOfOrderLines(){ - addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name){ - return maxQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest sumQuantityOfOrderLines(){ - addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name){ - return sumQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest avgQuantityOfOrderLines(){ - addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name){ - return avgQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest standardDeviationQuantityOfOrderLines(){ - addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String name){ - return standardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ - addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest sampleVarianceQuantityOfOrderLines(){ - addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String name){ - return sampleVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLines(){ - addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.COMMERCE_PLATFORM_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ - return samplePopulationVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CommercePlatformRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.COMMERCE_PLATFORM_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, CommercePlatform.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public CommercePlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CommercePlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CommercePlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CommercePlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CommercePlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CommercePlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java deleted file mode 100644 index eb9a12f4a..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/Customer.java +++ /dev/null @@ -1,213 +0,0 @@ - -package com.teaql.ordermanagementservice.customer; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Customer extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Customer"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "829c8ab79820e41e3f9a3fb0b12d364d33e0a9a3f50ea30186dd727937701a39"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("email", 2), java.util.Map.entry("commerce_platform", 3), java.util.Map.entry("create_time", 4), java.util.Map.entry("update_time", 5), java.util.Map.entry("version", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("email", java.util.List.of("email", "email")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Customer.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String EMAIL_PROPERTY = "email"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private String name; - - private String email; - - private CommercePlatform commercePlatform; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList customerOrderList; - - public String getName(){ - return this.name; - } - - public String getEmail(){ - return this.email; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public Customer updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Customer updateEmail(String email){ - email = (email == null ? null : email.trim()); - if(isPropertyLoaded(EMAIL_PROPERTY) && Objects.equals(this.email, email)){ - return this; - } - handleUpdate(EMAIL_PROPERTY, getEmail(), email); - this.email = email; - return this; - } - - public Customer updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public Customer updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public Customer updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public Customer addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateCustomer(this); - return this; - } - - public static Customer refer(Long id){ - Customer refer = new Customer(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Customer comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "email": this.email = (value == null ? null : ((String)value).trim()); break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "email": return this.email; - case "commerce_platform": return this.commercePlatform; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "email": return this.email; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java deleted file mode 100644 index 99635a77e..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerChecker.java +++ /dev/null @@ -1,121 +0,0 @@ - -package com.teaql.ordermanagementservice.customer; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class CustomerChecker implements Checker{ - - public String type(){ - return Customer.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Customer customer, ObjectLocation _parentLocation){ - if(needCheck(_context, customer)){ - markAsChecked(_context, customer); - doCheck(_context, customer, _parentLocation); - } - } - - public void doCheck(UserContext _context, Customer customer, ObjectLocation _parentLocation){ - if((customer == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customer); - if(customer.needPersist()){ - } - if(customer.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - customer.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - customer.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(customer.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - customer.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!customer.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!customer.isPropertyLoaded("email")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "email"), "Mutation requires a fully loaded entity"); - } - if(!customer.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - if(!customer.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!customer.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, customer.getProperty(Customer.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkEmail(_context, customer.getProperty(Customer.EMAIL_PROPERTY), newLocation(_parentLocation, "email")); - checkCommercePlatform(_context, customer.getProperty(Customer.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - checkCreateTime(_context, customer.getProperty(Customer.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, customer.getProperty(Customer.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; customer.getCustomerOrderList() != null && i < customer.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = customer.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkEmail(UserContext _context, String email, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, email); - if((email == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, email); - - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java deleted file mode 100644 index a2731bc84..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerExpression.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.teaql.ordermanagementservice.customer; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class CustomerExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerExpression(Expression expression){ - super(expression); - } - - public CustomerExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerExpression updateId(Long id){ - return new CustomerExpression(this, $it -> {((Customer)$it).__internalSet("id", id); return this;}); - } - - public CustomerExpression save(UserContext userContext){ - return new CustomerExpression(this, $it -> ((Customer)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerExpression save(String intent, UserContext userContext){ - return new CustomerExpression(this, $it -> ((Customer)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Customer::getName); - } - public CustomerExpression updateName(String name){ - return new CustomerExpression(this, $it -> ((Customer)$it).updateName(name)); - } - - public Expression getEmail(){ - return loaded("email", "getEmail", Customer::getEmail); - } - public CustomerExpression updateEmail(String email){ - return new CustomerExpression(this, $it -> ((Customer)$it).updateEmail(email)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", Customer::getCommercePlatform)); - } - - public CustomerExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new CustomerExpression(this, $it -> ((Customer)$it).updateCommercePlatform(commercePlatform)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", Customer::getCreateTime); - } - public CustomerExpression updateCreateTime(LocalDateTime createTime){ - return new CustomerExpression(this, $it -> ((Customer)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", Customer::getUpdateTime); - } - public CustomerExpression updateUpdateTime(LocalDateTime updateTime){ - return new CustomerExpression(this, $it -> ((Customer)$it).updateUpdateTime(updateTime)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Customer::getCustomerOrderList)); - } - public CustomerExpression addCustomerOrder(CustomerOrder customerOrder){ - return new CustomerExpression(this, $it -> ((Customer)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java deleted file mode 100644 index 8c21e9948..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.customer; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerListExpression extends SmartListExpression { - public CustomerListExpression(Expression> expression){ - super(expression); - } - - public CustomerListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerExpression first() { - return new CustomerExpression(super.first()); - } - - public CustomerExpression get(int index) { - return new CustomerExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java deleted file mode 100644 index 114b51337..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customer/CustomerRequest.java +++ /dev/null @@ -1,1313 +0,0 @@ - -package com.teaql.ordermanagementservice.customer; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class CustomerRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerRequest(Class returnType){ - this(returnType, () -> (T) new Customer()); - } - - protected CustomerRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerRequest copy(){ - return (CustomerRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerRequest matchingAnyOf(CustomerRequest customer){ - super.internalMatchAny(customer); - return this; - } - - public CustomerRequest matchingIdsOf(CustomerRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Customer.ID_PROPERTY, request, Customer.ID_PROPERTY)); - } - - public CustomerRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectEmail().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public CustomerRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Customer.ID_PROPERTY); - selectProperty(Customer.NAME_PROPERTY); - selectProperty(Customer.EMAIL_PROPERTY); - selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); - selectProperty(Customer.CREATE_TIME_PROPERTY); - selectProperty(Customer.UPDATE_TIME_PROPERTY); - selectProperty(Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectEmail().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public CustomerRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectId().selectName().selectEmail().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public CustomerRequest selectId(){ - selectProperty(Customer.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectId(){ - unselectProperty(Customer.ID_PROPERTY); - return this; - } - public CustomerRequest selectName(){ - selectProperty(Customer.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectName(){ - unselectProperty(Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest selectEmail(){ - selectProperty(Customer.EMAIL_PROPERTY); - return this; - } - - /** - * fill the email with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS email) to fetch email property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectEmail(){ - unselectProperty(Customer.EMAIL_PROPERTY); - return this; - } - public CustomerRequest selectCommercePlatformIdOnly(){ - selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public CustomerRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, Customer.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public CustomerRequest unselectCommercePlatform(){ - unselectProperty(Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public CustomerRequest selectCreateTime(){ - selectProperty(Customer.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectCreateTime(){ - unselectProperty(Customer.CREATE_TIME_PROPERTY); - return this; - } - public CustomerRequest selectUpdateTime(){ - selectProperty(Customer.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectUpdateTime(){ - unselectProperty(Customer.UPDATE_TIME_PROPERTY); - return this; - } - public CustomerRequest selectVersion(){ - selectProperty(Customer.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectVersion(){ - unselectProperty(Customer.VERSION_PROPERTY); - return this; - } - public CustomerRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public CustomerRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(Customer.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.ID_PROPERTY, operator, values); - } - - public CustomerRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public CustomerRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public CustomerRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public CustomerRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.NAME_PROPERTY, operator, values); - } - - public CustomerRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public CustomerRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public CustomerRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public CustomerRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public CustomerRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public CustomerRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public CustomerRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public CustomerRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public CustomerRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public CustomerRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public CustomerRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public CustomerRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public CustomerRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public CustomerRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public CustomerRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public CustomerRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public CustomerRequest filterByEmail(String... email){ - if (email == null || email.length == 0) { - throw new IllegalArgumentException("filterByEmail parameter email cannot be empty"); - } - return appendSearchCriteria(createEmailCriteria(Operator.EQUAL, (Object[])email)); - } - - public CustomerRequest withEmail(Operator operator, Object... values){ - return appendSearchCriteria(createEmailCriteria(operator, values)); - } - - public CustomerRequest withEmailIsUnknown(){ - return withEmail(Operator.IS_NULL); - } - - public CustomerRequest withEmailIsKnown(){ - return withEmail(Operator.IS_NOT_NULL); - } - - public SearchCriteria createEmailCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.EMAIL_PROPERTY, operator, values); - } - - public CustomerRequest withEmailIsNot(String email){ - return withEmail(Operator.NOT_EQUAL, email); - } - - public CustomerRequest withEmailIn(String... email){ - return withEmail(Operator.IN, (Object[])email); - } - - public CustomerRequest withEmailNotIn(String... email){ - return withEmail(Operator.NOT_IN, (Object[])email); - } - public CustomerRequest withEmailGreaterThan(String email){ - return withEmail(Operator.GREATER_THAN, email); - } - - public CustomerRequest withEmailGreaterThanOrEqualTo(String email){ - return withEmail(Operator.GREATER_THAN_OR_EQUAL, email); - } - - public CustomerRequest withEmailLessThan(String email){ - return withEmail(Operator.LESS_THAN, email); - } - - public CustomerRequest withEmailLessThanOrEqualTo(String email){ - return withEmail(Operator.LESS_THAN_OR_EQUAL, email); - } - - public CustomerRequest withEmailBetween(String startOfEmail, String endOfEmail){ - return withEmail(Operator.BETWEEN, startOfEmail, endOfEmail); - } - public CustomerRequest withEmailStartingWith(String email){ - return withEmail(Operator.BEGIN_WITH, email); - } - public CustomerRequest withEmailContaining(String email){ - return withEmail(Operator.CONTAIN, email); - } - - public CustomerRequest withEmailNotContaining(String email){ - return withEmail(Operator.NOT_CONTAIN, email); - } - - public CustomerRequest withEmailNotStartingWith(String email){ - return withEmail(Operator.NOT_BEGIN_WITH, email); - } - - public CustomerRequest withEmailEndingWith(String email){ - return withEmail(Operator.END_WITH, email); - } - - public CustomerRequest withEmailNotEndingWith(String email){ - return withEmail(Operator.NOT_END_WITH, email); - } - - public CustomerRequest withEmailIs(String email){ - return withEmail(Operator.EQUAL, email); - } - - public CustomerRequest withEmailSoundingLike(String email){ - return withEmail(Operator.SOUNDS_LIKE, email); - } - - - - public CustomerRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public CustomerRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public CustomerRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public CustomerRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public CustomerRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public CustomerRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public CustomerRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public CustomerRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public CustomerRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public CustomerRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public CustomerRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.CREATE_TIME_PROPERTY, operator, values); - } - - public CustomerRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public CustomerRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public CustomerRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public CustomerRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public CustomerRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CustomerRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public CustomerRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CustomerRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public CustomerRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public CustomerRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CustomerRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CustomerRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CustomerRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CustomerRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public CustomerRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public CustomerRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public CustomerRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public CustomerRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.UPDATE_TIME_PROPERTY, operator, values); - } - - public CustomerRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public CustomerRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public CustomerRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public CustomerRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public CustomerRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CustomerRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public CustomerRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CustomerRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public CustomerRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public CustomerRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CustomerRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CustomerRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CustomerRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CustomerRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public CustomerRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.VERSION_PROPERTY, operator, values); - } - - public CustomerRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY)); - } - - public CustomerRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY))); - } - - public CustomerRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CustomerRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CustomerRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public CustomerRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(Customer.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public CustomerRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Customer.ID_PROPERTY); - return this; - } - public CustomerRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public CustomerRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest countDistinctEmail(){ - return countDistinctEmailAs("email_distinct_count"); - } - - public CustomerRequest countDistinctEmailAs(String alias){ - super.countDistinctProperty(alias, Customer.EMAIL_PROPERTY); - return this; - } - public CustomerRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public CustomerRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public CustomerRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public CustomerRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, Customer.CREATE_TIME_PROPERTY); - return this; - } - public CustomerRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public CustomerRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, Customer.UPDATE_TIME_PROPERTY); - return this; - } - public CustomerRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Customer.VERSION_PROPERTY); - return this; - } - public CustomerRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(Customer.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerRequest groupById(){ - groupBy(Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest groupByIdAs(String retName){ - groupBy(retName, Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.ID_PROPERTY, function); - return this; - } - - public CustomerRequest groupByName(){ - groupBy(Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest groupByNameAs(String retName){ - groupBy(retName, Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.NAME_PROPERTY, function); - return this; - } - - public CustomerRequest groupByEmail(){ - groupBy(Customer.EMAIL_PROPERTY); - return this; - } - - public CustomerRequest groupByEmailAs(String retName){ - groupBy(retName, Customer.EMAIL_PROPERTY); - return this; - } - - public CustomerRequest groupByEmailWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.EMAIL_PROPERTY, function); - return this; - } - public CustomerRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(Customer.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public CustomerRequest groupByCommercePlatform(){ - groupBy(Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public CustomerRequest groupByCreateTime(){ - groupBy(Customer.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest groupByCreateTimeAs(String retName){ - groupBy(retName, Customer.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.CREATE_TIME_PROPERTY, function); - return this; - } - - public CustomerRequest groupByUpdateTime(){ - groupBy(Customer.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, Customer.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.UPDATE_TIME_PROPERTY, function); - return this; - } - - public CustomerRequest groupByVersion(){ - groupBy(Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest groupByVersionAs(String retName){ - groupBy(retName, Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.VERSION_PROPERTY, function); - return this; - } - - - - public CustomerRequest orderByIdAscending(){ - addOrderByAscending(Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest orderByIdDescending(){ - addOrderByDescending(Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest orderByNameAscending(){ - addOrderByAscending(Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest orderByNameDescending(){ - addOrderByDescending(Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest orderByEmailAscending(){ - addOrderByAscending(Customer.EMAIL_PROPERTY); - return this; - } - - public CustomerRequest orderByEmailDescending(){ - addOrderByDescending(Customer.EMAIL_PROPERTY); - return this; - } - public CustomerRequest orderByEmailAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Customer.EMAIL_PROPERTY); - return this; - } - - public CustomerRequest orderByEmailDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Customer.EMAIL_PROPERTY); - return this; - } - public CustomerRequest orderByCommercePlatformAscending(){ - addOrderByAscending(Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest orderByCommercePlatformDescending(){ - addOrderByDescending(Customer.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest orderByCreateTimeAscending(){ - addOrderByAscending(Customer.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest orderByCreateTimeDescending(){ - addOrderByDescending(Customer.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest orderByUpdateTimeAscending(){ - addOrderByAscending(Customer.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest orderByUpdateTimeDescending(){ - addOrderByDescending(Customer.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerRequest orderByVersionAscending(){ - addOrderByAscending(Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest orderByVersionDescending(){ - addOrderByDescending(Customer.VERSION_PROPERTY); - return this; - } - - - public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - - - public CustomerRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest minTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name){ - return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest maxTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name){ - return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest sumTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name){ - return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest avgTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name){ - return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest standardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest sampleVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ - return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public CustomerRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, Customer.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, Customer.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java deleted file mode 100644 index 7a35c0d41..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrder.java +++ /dev/null @@ -1,291 +0,0 @@ - -package com.teaql.ordermanagementservice.customerorder; - -import com.teaql.ordermanagementservice.Constants; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CustomerOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CustomerOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e844b19b098f340a5ae18e4091f4a6d55afb35cd5a53ec24155bd4de2601988d"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("order_number", 1), java.util.Map.entry("order_date", 2), java.util.Map.entry("total_amount", 3), java.util.Map.entry("status", 4), java.util.Map.entry("customer", 5), java.util.Map.entry("commerce_platform", 6), java.util.Map.entry("create_time", 7), java.util.Map.entry("update_time", 8), java.util.Map.entry("version", 9)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("order_date", java.util.List.of("orderDate", "order_date")), java.util.Map.entry("total_amount", java.util.List.of("totalAmount", "total_amount")), java.util.Map.entry("status", java.util.List.of("status", "status")), java.util.Map.entry("customer", java.util.List.of("customer", "customer")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_line_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - public static final String ORDER_DATE_PROPERTY = "order_date"; - public static final String TOTAL_AMOUNT_PROPERTY = "total_amount"; - public static final String STATUS_PROPERTY = "status"; - public static final String CUSTOMER_PROPERTY = "customer"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; - private String orderNumber; - - private LocalDate orderDate; - - private BigDecimal totalAmount; - - private OrderStatus status; - - private Customer customer; - - private CommercePlatform commercePlatform; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList orderLineList; - - public String getOrderNumber(){ - return this.orderNumber; - } - - public LocalDate getOrderDate(){ - return this.orderDate; - } - - public BigDecimal getTotalAmount(){ - return this.totalAmount; - } - - public OrderStatus getStatus(){ - return this.status; - } - - public Customer getCustomer(){ - return this.customer; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getOrderLineList(){ - return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; - } - public CustomerOrder updateOrderNumber(String orderNumber){ - orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); - this.orderNumber = orderNumber; - return this; - } - - public CustomerOrder updateOrderDate(LocalDate orderDate){ - if(isPropertyLoaded(ORDER_DATE_PROPERTY) && Objects.equals(this.orderDate, orderDate)){ - return this; - } - handleUpdate(ORDER_DATE_PROPERTY, getOrderDate(), orderDate); - this.orderDate = orderDate; - return this; - } - - public CustomerOrder updateTotalAmount(BigDecimal totalAmount){ - if(isPropertyLoaded(TOTAL_AMOUNT_PROPERTY) && Objects.equals(this.totalAmount, totalAmount)){ - return this; - } - handleUpdate(TOTAL_AMOUNT_PROPERTY, getTotalAmount(), totalAmount); - this.totalAmount = totalAmount; - return this; - } - - protected CustomerOrder updateStatus(OrderStatus status){ - if(isPropertyLoaded(STATUS_PROPERTY) && Objects.equals(this.status, status)){ - return this; - } - handleUpdate(STATUS_PROPERTY, getStatus(), status); - this.status = status; - return this; - } - - public CustomerOrder updateCustomer(Customer customer){ - if(isPropertyLoaded(CUSTOMER_PROPERTY) && Objects.equals(this.customer, customer)){ - return this; - } - handleUpdate(CUSTOMER_PROPERTY, getCustomer(), customer); - this.customer = customer; - return this; - } - - public CustomerOrder updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public CustomerOrder updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public CustomerOrder updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public CustomerOrder addOrderLine(OrderLine orderLine){ - if (orderLine == null){ - return this; - } - - if(null == this.orderLineList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderLineList = teaqlUnloadedItems.map(value -> value); - } - - this.orderLineList.add(orderLine); - orderLine.updateCustomerOrder(this); - return this; - } - public boolean isStatusPending(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_PENDING); - } - - public CustomerOrder updateStatusToPending(){ - return updateStatus(Constants.ORDER_STATUS_PENDING); - } - public boolean isStatusConfirmed(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_CONFIRMED); - } - - public CustomerOrder updateStatusToConfirmed(){ - return updateStatus(Constants.ORDER_STATUS_CONFIRMED); - } - - public static CustomerOrder refer(Long id){ - CustomerOrder refer = new CustomerOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CustomerOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - case "order_date": this.orderDate = (LocalDate) value; break; - - case "total_amount": this.totalAmount = (BigDecimal) value; break; - - case "status": this.status = (OrderStatus) value; break; - - case "customer": this.customer = (Customer) value; break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "order_line_list": this.orderLineList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "order_number": return this.orderNumber; - case "order_date": return this.orderDate; - case "total_amount": return this.totalAmount; - case "status": return this.status; - case "customer": return this.customer; - case "commerce_platform": return this.commercePlatform; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "order_line_list": return this.orderLineList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "orderNumber": return this.orderNumber; - case "orderDate": return this.orderDate; - case "totalAmount": return this.totalAmount; - case "status": return this.status; - case "customer": return this.customer; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java deleted file mode 100644 index 04b7ef192..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderChecker.java +++ /dev/null @@ -1,157 +0,0 @@ - -package com.teaql.ordermanagementservice.customerorder; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerChecker; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineChecker; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -public class CustomerOrderChecker implements Checker{ - - public String type(){ - return CustomerOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, customerOrder)){ - markAsChecked(_context, customerOrder); - doCheck(_context, customerOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if((customerOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customerOrder); - if(customerOrder.needPersist()){ - } - if(customerOrder.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - customerOrder.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - customerOrder.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(customerOrder.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - customerOrder.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!customerOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("order_date")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_date"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("total_amount")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "total_amount"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("status")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "status"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("customer")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); - checkOrderDate(_context, customerOrder.getProperty(CustomerOrder.ORDER_DATE_PROPERTY), newLocation(_parentLocation, "order_date")); - checkTotalAmount(_context, customerOrder.getProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY), newLocation(_parentLocation, "total_amount")); - checkStatus(_context, customerOrder.getProperty(CustomerOrder.STATUS_PROPERTY), newLocation(_parentLocation, "status")); - checkCustomer(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROPERTY), newLocation(_parentLocation, "customer")); - checkCommercePlatform(_context, customerOrder.getProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - checkCreateTime(_context, customerOrder.getProperty(CustomerOrder.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, customerOrder.getProperty(CustomerOrder.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; customerOrder.getOrderLineList() != null && i < customerOrder.getOrderLineList().size(); i++){ - OrderLine orderLine = customerOrder.getOrderLineList().get(i); - new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); - } - } - - public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, orderNumber); - - } - public void checkOrderDate(UserContext _context, LocalDate orderDate, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderDate); - if((orderDate == null)){ - return; - } - } - public void checkTotalAmount(UserContext _context, BigDecimal totalAmount, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, totalAmount); - if((totalAmount == null)){ - return; - } - } - public void checkStatus(UserContext _context, OrderStatus status, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, status); - if((status == null)){ - return; - } - new OrderStatusChecker().checkAndFix(_context, status, _parentLocation); - } - public void checkCustomer(UserContext _context, Customer customer, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customer); - if((customer == null)){ - return; - } - new CustomerChecker().checkAndFix(_context, customer, _parentLocation); - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java deleted file mode 100644 index 68f35772a..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderExpression.java +++ /dev/null @@ -1,115 +0,0 @@ - -package com.teaql.ordermanagementservice.customerorder; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerExpression; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineListExpression; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerOrderExpression(Expression expression){ - super(expression); - } - - public CustomerOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerOrderExpression updateId(Long id){ - return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); - } - - public CustomerOrderExpression save(UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerOrderExpression save(String intent, UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); - } - public CustomerOrderExpression updateOrderNumber(String orderNumber){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); - } - - public Expression getOrderDate(){ - return loaded("order_date", "getOrderDate", CustomerOrder::getOrderDate); - } - public CustomerOrderExpression updateOrderDate(LocalDate orderDate){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderDate(orderDate)); - } - - public Expression getTotalAmount(){ - return loaded("total_amount", "getTotalAmount", CustomerOrder::getTotalAmount); - } - public CustomerOrderExpression updateTotalAmount(BigDecimal totalAmount){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateTotalAmount(totalAmount)); - } - - public OrderStatusExpression getStatus(){ - return new OrderStatusExpression(loaded("status", "getStatus", CustomerOrder::getStatus)); - } - - public CustomerOrderExpression updateStatusToPending(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToPending()); - } - public CustomerOrderExpression updateStatusToConfirmed(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToConfirmed()); - } - - public CustomerExpression getCustomer(){ - return new CustomerExpression(loaded("customer", "getCustomer", CustomerOrder::getCustomer)); - } - - public CustomerOrderExpression updateCustomer(Customer customer){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomer(customer)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", CustomerOrder::getCommercePlatform)); - } - - public CustomerOrderExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCommercePlatform(commercePlatform)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", CustomerOrder::getCreateTime); - } - public CustomerOrderExpression updateCreateTime(LocalDateTime createTime){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", CustomerOrder::getUpdateTime); - } - public CustomerOrderExpression updateUpdateTime(LocalDateTime updateTime){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateUpdateTime(updateTime)); - } - - public OrderLineListExpression getOrderLineList(){ - return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", CustomerOrder::getOrderLineList)); - } - public CustomerOrderExpression addOrderLine(OrderLine orderLine){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderLine(orderLine)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java deleted file mode 100644 index 144428aa9..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.customerorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerOrderListExpression extends SmartListExpression { - public CustomerOrderListExpression(Expression> expression){ - super(expression); - } - - public CustomerOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerOrderExpression first() { - return new CustomerOrderExpression(super.first()); - } - - public CustomerOrderExpression get(int index) { - return new CustomerOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java deleted file mode 100644 index cad513172..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/customerorder/CustomerOrderRequest.java +++ /dev/null @@ -1,1742 +0,0 @@ - -package com.teaql.ordermanagementservice.customerorder; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; -import com.teaql.ordermanagementservice.customer.Customer; -import com.teaql.ordermanagementservice.customer.CustomerRequest; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineRequest; -import com.teaql.ordermanagementservice.orderstatus.OrderStatus; -import com.teaql.ordermanagementservice.orderstatus.OrderStatusRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class CustomerOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerOrderRequest(Class returnType){ - this(returnType, () -> (T) new CustomerOrder()); - } - - protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerOrderRequest copy(){ - return (CustomerOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ - super.internalMatchAny(customerOrder); - return this; - } - - public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); - } - - public CustomerOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatusIdOnly().selectCustomerIdOnly().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public CustomerOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CustomerOrder.ID_PROPERTY); - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); - selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - selectProperty(CustomerOrder.STATUS_PROPERTY); - selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - selectProperty(CustomerOrder.CREATE_TIME_PROPERTY); - selectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatus().selectCustomer().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public CustomerOrderRequest selectChildren(){ - super.selectAny(); - selectOrderLineList(); - return selectId().selectOrderNumber().selectOrderDate().selectTotalAmount().selectStatus().selectCustomer().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public CustomerOrderRequest selectId(){ - selectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectId(){ - unselectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderNumber(){ - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderNumber(){ - unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderDate(){ - selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - /** - * fill the orderDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderDate) to fetch orderDate property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderDate(){ - unselectProperty(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - public CustomerOrderRequest selectTotalAmount(){ - selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - /** - * fill the totalAmount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalAmount) to fetch totalAmount property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the totalAmount with customized aggrFunction, TEAQL uses ({aggrFunction}(totalAmount) AS totalAmount to fetch totalAmount property. - * @param aggrFunction aggrFunction - */ - public CustomerOrderRequest selectTotalAmount(AggrFunction aggrFunction){ - selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY, aggrFunction); - return this; - } - - - public CustomerOrderRequest unselectTotalAmount(){ - unselectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest selectStatusIdOnly(){ - selectProperty(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest selectStatus(){ - return selectStatusWith(Q.orderStatuses().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectStatusWith(OrderStatusRequest status){ - selectProperty(CustomerOrder.STATUS_PROPERTY); - enhanceRelation(CustomerOrder.STATUS_PROPERTY, status, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectStatusWith", null, CustomerOrder.STATUS_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectStatus(){ - unselectProperty(CustomerOrder.STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest selectCustomerIdOnly(){ - selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest selectCustomer(){ - return selectCustomerWith(Q.customers().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectCustomerWith(CustomerRequest customer){ - selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - enhanceRelation(CustomerOrder.CUSTOMER_PROPERTY, customer, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerWith", null, CustomerOrder.CUSTOMER_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectCustomer(){ - unselectProperty(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - public CustomerOrderRequest selectCommercePlatformIdOnly(){ - selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectCommercePlatform(){ - unselectProperty(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public CustomerOrderRequest selectCreateTime(){ - selectProperty(CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectCreateTime(){ - unselectProperty(CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - public CustomerOrderRequest selectUpdateTime(){ - selectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectUpdateTime(){ - unselectProperty(CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - public CustomerOrderRequest selectVersion(){ - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectVersion(){ - unselectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderLineList(){ - return selectOrderLineListWith(Q.orderLines().selectSelf()); - } - - public CustomerOrderRequest selectOrderLineListWith(OrderLineRequest orderLineList){ - enhanceRelation(CustomerOrder.ORDER_LINE_LIST_PROPERTY, orderLineList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); - } - - public CustomerOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ - if (orderNumber == null || orderNumber.length == 0) { - throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); - } - return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); - } - - public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ - return appendSearchCriteria(createOrderNumberCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderNumberIsUnknown(){ - return withOrderNumber(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderNumberIsKnown(){ - return withOrderNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ - return withOrderNumber(Operator.NOT_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ - return withOrderNumber(Operator.IN, (Object[])orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ - return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); - } - public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ - return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); - } - public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ - return withOrderNumber(Operator.BEGIN_WITH, orderNumber); - } - public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ - return withOrderNumber(Operator.CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ - return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ - return withOrderNumber(Operator.END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIs(String orderNumber){ - return withOrderNumber(Operator.EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ - return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); - } - - - - public CustomerOrderRequest filterByOrderDate(LocalDate... orderDate){ - if (orderDate == null || orderDate.length == 0) { - throw new IllegalArgumentException("filterByOrderDate parameter orderDate cannot be empty"); - } - return appendSearchCriteria(createOrderDateCriteria(Operator.EQUAL, (Object[])orderDate)); - } - - public CustomerOrderRequest withOrderDate(Operator operator, Object... values){ - return appendSearchCriteria(createOrderDateCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderDateIsUnknown(){ - return withOrderDate(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderDateIsKnown(){ - return withOrderDate(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderDateCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_DATE_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderDateIs(LocalDate orderDate){ - return withOrderDate(Operator.EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateIsNot(LocalDate orderDate){ - return withOrderDate(Operator.NOT_EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateIn(LocalDate... orderDate){ - return withOrderDate(Operator.IN, (Object[])orderDate); - } - - public CustomerOrderRequest withOrderDateNotIn(LocalDate... orderDate){ - return withOrderDate(Operator.NOT_IN, (Object[])orderDate); - } - public CustomerOrderRequest withOrderDateGreaterThan(LocalDate orderDate){ - return withOrderDate(Operator.GREATER_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateGreaterThanOrEqualTo(LocalDate orderDate){ - return withOrderDate(Operator.GREATER_THAN_OR_EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateLessThan(LocalDate orderDate){ - return withOrderDate(Operator.LESS_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateLessThanOrEqualTo(LocalDate orderDate){ - return withOrderDate(Operator.LESS_THAN_OR_EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateBetween(LocalDate startOfOrderDate, LocalDate endOfOrderDate){ - return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); - } - public CustomerOrderRequest withOrderDateBefore(LocalDate orderDate){ - return withOrderDate(Operator.LESS_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateBefore(Date orderDate){ - return withOrderDate(Operator.LESS_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateAfter(LocalDate orderDate){ - return withOrderDate(Operator.GREATER_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateAfter(Date orderDate){ - return withOrderDate(Operator.GREATER_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateBetween(Date startOfOrderDate, Date endOfOrderDate){ - return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); - } - - - - - public CustomerOrderRequest filterByTotalAmount(BigDecimal... totalAmount){ - if (totalAmount == null || totalAmount.length == 0) { - throw new IllegalArgumentException("filterByTotalAmount parameter totalAmount cannot be empty"); - } - return appendSearchCriteria(createTotalAmountCriteria(Operator.EQUAL, (Object[])totalAmount)); - } - - public CustomerOrderRequest withTotalAmount(Operator operator, Object... values){ - return appendSearchCriteria(createTotalAmountCriteria(operator, values)); - } - - public CustomerOrderRequest withTotalAmountIsUnknown(){ - return withTotalAmount(Operator.IS_NULL); - } - - public CustomerOrderRequest withTotalAmountIsKnown(){ - return withTotalAmount(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTotalAmountCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.TOTAL_AMOUNT_PROPERTY, operator, values); - } - - public CustomerOrderRequest withTotalAmountIs(BigDecimal totalAmount){ - return withTotalAmount(Operator.EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountIsNot(BigDecimal totalAmount){ - return withTotalAmount(Operator.NOT_EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountIn(BigDecimal... totalAmount){ - return withTotalAmount(Operator.IN, (Object[])totalAmount); - } - - public CustomerOrderRequest withTotalAmountNotIn(BigDecimal... totalAmount){ - return withTotalAmount(Operator.NOT_IN, (Object[])totalAmount); - } - public CustomerOrderRequest withTotalAmountGreaterThan(BigDecimal totalAmount){ - return withTotalAmount(Operator.GREATER_THAN, totalAmount); - } - - public CustomerOrderRequest withTotalAmountGreaterThanOrEqualTo(BigDecimal totalAmount){ - return withTotalAmount(Operator.GREATER_THAN_OR_EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountLessThan(BigDecimal totalAmount){ - return withTotalAmount(Operator.LESS_THAN, totalAmount); - } - - public CustomerOrderRequest withTotalAmountLessThanOrEqualTo(BigDecimal totalAmount){ - return withTotalAmount(Operator.LESS_THAN_OR_EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountBetween(BigDecimal startOfTotalAmount, BigDecimal endOfTotalAmount){ - return withTotalAmount(Operator.BETWEEN, startOfTotalAmount, endOfTotalAmount); - } - - - - public CustomerOrderRequest filterByStatus(OrderStatus... status){ - if (status == null || status.length == 0) { - throw new IllegalArgumentException("filterByStatus parameter status cannot be empty"); - } - return appendSearchCriteria(createStatusCriteria(Operator.EQUAL, (Object[])status)); - } - - public CustomerOrderRequest withStatus(Operator operator, Object... values){ - return appendSearchCriteria(createStatusCriteria(operator, values)); - } - - public CustomerOrderRequest withStatusIsUnknown(){ - return withStatus(Operator.IS_NULL); - } - - public CustomerOrderRequest withStatusIsKnown(){ - return withStatus(Operator.IS_NOT_NULL); - } - - public SearchCriteria createStatusCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.STATUS_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByStatus(Long status){ - if(status == null){ - return this; - } - return withStatus(Operator.EQUAL, status); - } - public CustomerOrderRequest withStatusMatching(OrderStatusRequest status){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutStatusMatching(OrderStatusRequest status){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByCustomer(Customer... customer){ - if (customer == null || customer.length == 0) { - throw new IllegalArgumentException("filterByCustomer parameter customer cannot be empty"); - } - return appendSearchCriteria(createCustomerCriteria(Operator.EQUAL, (Object[])customer)); - } - - public CustomerOrderRequest withCustomer(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerCriteria(operator, values)); - } - - public CustomerOrderRequest withCustomerIsUnknown(){ - return withCustomer(Operator.IS_NULL); - } - - public CustomerOrderRequest withCustomerIsKnown(){ - return withCustomer(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByCustomer(Long customer){ - if(customer == null){ - return this; - } - return withCustomer(Operator.EQUAL, customer); - } - public CustomerOrderRequest withCustomerMatching(CustomerRequest customer){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutCustomerMatching(CustomerRequest customer){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public CustomerOrderRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public CustomerOrderRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public CustomerOrderRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public CustomerOrderRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public CustomerOrderRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public CustomerOrderRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public CustomerOrderRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.CREATE_TIME_PROPERTY, operator, values); - } - - public CustomerOrderRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public CustomerOrderRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public CustomerOrderRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public CustomerOrderRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public CustomerOrderRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CustomerOrderRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public CustomerOrderRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CustomerOrderRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public CustomerOrderRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public CustomerOrderRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CustomerOrderRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public CustomerOrderRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CustomerOrderRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public CustomerOrderRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public CustomerOrderRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public CustomerOrderRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public CustomerOrderRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public CustomerOrderRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.UPDATE_TIME_PROPERTY, operator, values); - } - - public CustomerOrderRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public CustomerOrderRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public CustomerOrderRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public CustomerOrderRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public CustomerOrderRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CustomerOrderRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public CustomerOrderRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CustomerOrderRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public CustomerOrderRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public CustomerOrderRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CustomerOrderRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public CustomerOrderRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CustomerOrderRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public CustomerOrderRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public CustomerOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); - } - - public CustomerOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerOrderRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderLineRequest, OrderLine.CUSTOMER_ORDER_PROPERTY)); - } - - public CustomerOrderRequest withoutOrderLineListMatching(OrderLineRequest orderLineRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderLineRequest, OrderLine.CUSTOMER_ORDER_PROPERTY))); - } - - public CustomerOrderRequest haveOrderLines(){ - return withOrderLineListMatching(Q.orderLines().unlimited()); - } - - public CustomerOrderRequest haveNoOrderLines(){ - return withoutOrderLineListMatching(Q.orderLines().unlimited()); - } - - public CustomerOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerOrderRequest minTotalAmount(){ - return minTotalAmountAs(prefix("minOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest minTotalAmountAs(String retName){ - super.min(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest maxTotalAmount(){ - return maxTotalAmountAs(prefix("maxOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest maxTotalAmountAs(String retName){ - super.max(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest sumTotalAmount(){ - return sumTotalAmountAs(prefix("sumOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest sumTotalAmountAs(String retName){ - super.sum(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest avgTotalAmount(){ - return avgTotalAmountAs(prefix("avgOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest avgTotalAmountAs(String retName){ - super.avg(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest standardDeviationTotalAmount(){ - return standardDeviationTotalAmountAs(prefix("standardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest standardDeviationTotalAmountAs(String retName){ - super.standardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmount(){ - return squareRootOfPopulationStandardDeviationTotalAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmountAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest sampleVarianceTotalAmount(){ - return sampleVarianceTotalAmountAs(prefix("sampleVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest sampleVarianceTotalAmountAs(String retName){ - super.sampleVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest samplePopulationVarianceTotalAmount(){ - return samplePopulationVarianceTotalAmountAs(prefix("samplePopulationVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest samplePopulationVarianceTotalAmountAs(String retName){ - super.samplePopulationVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest groupByStatusWithDetails(){ - return groupByStatusWithDetails(Q.orderStatuses().unlimited()); - } - - public CustomerOrderRequest groupByStatusWithDetails(OrderStatusRequest subRequest){ - aggregate(CustomerOrder.STATUS_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupByCustomerWithDetails(){ - return groupByCustomerWithDetails(Q.customers().unlimited()); - } - - public CustomerOrderRequest groupByCustomerWithDetails(CustomerRequest subRequest){ - aggregate(CustomerOrder.CUSTOMER_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public CustomerOrderRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public CustomerOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderDate(){ - return countDistinctOrderDateAs("order_date_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderDateAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctTotalAmount(){ - return countDistinctTotalAmountAs("total_amount_distinct_count"); - } - - public CustomerOrderRequest countDistinctTotalAmountAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctStatus(){ - return countDistinctStatusAs("status_distinct_count"); - } - - public CustomerOrderRequest countDistinctStatusAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctCustomer(){ - return countDistinctCustomerAs("customer_distinct_count"); - } - - public CustomerOrderRequest countDistinctCustomerAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public CustomerOrderRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public CustomerOrderRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public CustomerOrderRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ - aggregate(CustomerOrder.ORDER_LINE_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupById(){ - groupBy(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdAs(String retName){ - groupBy(retName, CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ID_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderNumber(){ - groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderDate(){ - groupBy(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderDateAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderDateWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByTotalAmount(){ - groupBy(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByTotalAmountAs(String retName){ - groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByTotalAmountWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByStatusWith(OrderStatusRequest subRequest){ - groupBy(CustomerOrder.STATUS_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByStatusWith", null, "status")); - return this; - } - public CustomerOrderRequest groupByStatus(){ - groupBy(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByStatusAs(String retName){ - groupBy(retName, CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByStatusWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.STATUS_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByCustomerWith(CustomerRequest subRequest){ - groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerWith", null, "customer")); - return this; - } - public CustomerOrderRequest groupByCustomer(){ - groupBy(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCustomerAs(String retName){ - groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCustomerWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public CustomerOrderRequest groupByCommercePlatform(){ - groupBy(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByCreateTime(){ - groupBy(CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCreateTimeAs(String retName){ - groupBy(retName, CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.CREATE_TIME_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByUpdateTime(){ - groupBy(CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.UPDATE_TIME_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByVersion(){ - groupBy(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionAs(String retName){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); - return this; - } - - public CustomerOrderRequest withStatusIsPending(){ - filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_PENDING); - return this; - } - - - public CustomerOrderRequest withStatusIsConfirmed(){ - filterByStatus(com.teaql.ordermanagementservice.Constants.ORDER_STATUS_CONFIRMED); - return this; - } - - - - - public CustomerOrderRequest orderByIdAscending(){ - addOrderByAscending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByIdDescending(){ - addOrderByDescending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderDateAscending(){ - addOrderByAscending(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderDateDescending(){ - addOrderByDescending(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByTotalAmountAscending(){ - addOrderByAscending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByTotalAmountDescending(){ - addOrderByDescending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByStatusAscending(){ - addOrderByAscending(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByStatusDescending(){ - addOrderByDescending(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCustomerAscending(){ - addOrderByAscending(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCustomerDescending(){ - addOrderByDescending(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCommercePlatformAscending(){ - addOrderByAscending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCommercePlatformDescending(){ - addOrderByDescending(CustomerOrder.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCreateTimeAscending(){ - addOrderByAscending(CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCreateTimeDescending(){ - addOrderByDescending(CustomerOrder.CREATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByUpdateTimeAscending(){ - addOrderByAscending(CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByUpdateTimeDescending(){ - addOrderByDescending(CustomerOrder.UPDATE_TIME_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionAscending(){ - addOrderByAscending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionDescending(){ - addOrderByDescending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest, false); - } - - public CustomerOrderRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest statsFromOrderLines(OrderLineRequest subRequest){ - return statsFromOrderLinesAs(REFINEMENTS, subRequest); - } - public OrderStatusRequest rollUpToStatus(){ - OrderStatusRequest status = Q.orderStatuses().unlimited(); - this.internalRollUpTo("status", status, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToStatus", null, "status")); - return status; - } - - public CustomerRequest rollUpToCustomer(){ - CustomerRequest customer = Q.customers().unlimited(); - this.internalRollUpTo("customer", customer, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomer", null, "customer")); - return customer; - } - - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - - - public CustomerOrderRequest countOrderLines(){ - addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderLinesAs(String name){ - addRelationCount(name, Q.orderLines().unlimited(), OrderLine.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ - addRelationCount(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest minQuantityOfOrderLines(){ - addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest minQuantityOfOrderLinesAs(String name){ - return minQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest maxQuantityOfOrderLines(){ - addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name){ - return maxQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sumQuantityOfOrderLines(){ - addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name){ - return sumQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest avgQuantityOfOrderLines(){ - addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name){ - return avgQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest standardDeviationQuantityOfOrderLines(){ - addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String name){ - return standardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ - addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sampleVarianceQuantityOfOrderLines(){ - addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name){ - return sampleVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLines(){ - addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.CUSTOMER_ORDER_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ - return samplePopulationVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.CUSTOMER_ORDER_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, CustomerOrder.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status){ - return facetByStatusAs(facetName, status, true); - } - - public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.STATUS_PROPERTY, status, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByStatusAs", facetName, CustomerOrder.STATUS_PROPERTY)); - return this; - } - public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer){ - return facetByCustomerAs(facetName, customer, true); - } - - public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.CUSTOMER_PROPERTY, customer, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerAs", facetName, CustomerOrder.CUSTOMER_PROPERTY)); - return this; - } - public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public CustomerOrderRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, CustomerOrder.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java deleted file mode 100644 index 00d93ae47..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLine.java +++ /dev/null @@ -1,232 +0,0 @@ - -package com.teaql.ordermanagementservice.orderline; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.product.Product; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderLine extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderLine"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "561e1330c3f6785b4b09c99056d83367e88ffa0c3bc41bf7be5a42ba53982496"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("product", 2), java.util.Map.entry("product_name", 3), java.util.Map.entry("sku", 4), java.util.Map.entry("quantity", 5), java.util.Map.entry("commerce_platform", 6), java.util.Map.entry("create_time", 7), java.util.Map.entry("version", 8)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("product", java.util.List.of("product", "product")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderLine.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; - public static final String PRODUCT_PROPERTY = "product"; - public static final String PRODUCT_NAME_PROPERTY = "product_name"; - public static final String SKU_PROPERTY = "sku"; - public static final String QUANTITY_PROPERTY = "quantity"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - private CustomerOrder customerOrder; - - private Product product; - - private String productName; - - private String sku; - - private Integer quantity; - - private CommercePlatform commercePlatform; - - private LocalDateTime createTime; - - - public CustomerOrder getCustomerOrder(){ - return this.customerOrder; - } - - public Product getProduct(){ - return this.product; - } - - public String getProductName(){ - return this.productName; - } - - public String getSku(){ - return this.sku; - } - - public Integer getQuantity(){ - return this.quantity; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public OrderLine updateCustomerOrder(CustomerOrder customerOrder){ - if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ - return this; - } - handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); - this.customerOrder = customerOrder; - return this; - } - - public OrderLine updateProduct(Product product){ - if(isPropertyLoaded(PRODUCT_PROPERTY) && Objects.equals(this.product, product)){ - return this; - } - handleUpdate(PRODUCT_PROPERTY, getProduct(), product); - this.product = product; - return this; - } - - public OrderLine updateProductName(String productName){ - productName = (productName == null ? null : productName.trim()); - if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ - return this; - } - handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); - this.productName = productName; - return this; - } - - public OrderLine updateSku(String sku){ - sku = (sku == null ? null : sku.trim()); - if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ - return this; - } - handleUpdate(SKU_PROPERTY, getSku(), sku); - this.sku = sku; - return this; - } - - public OrderLine updateQuantity(Integer quantity){ - if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ - return this; - } - handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); - this.quantity = quantity; - return this; - } - - public OrderLine updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public OrderLine updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - - public static OrderLine refer(Long id){ - OrderLine refer = new OrderLine(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderLine comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer_order": this.customerOrder = (CustomerOrder) value; break; - - case "product": this.product = (Product) value; break; - - case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; - - case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; - - case "quantity": this.quantity = (Integer) value; break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer_order": return this.customerOrder; - case "product": return this.product; - case "product_name": return this.productName; - case "sku": return this.sku; - case "quantity": return this.quantity; - case "commerce_platform": return this.commercePlatform; - case "create_time": return this.createTime; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customerOrder": return this.customerOrder; - case "product": return this.product; - case "productName": return this.productName; - case "sku": return this.sku; - case "quantity": return this.quantity; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java deleted file mode 100644 index 299ce5191..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineChecker.java +++ /dev/null @@ -1,126 +0,0 @@ - -package com.teaql.ordermanagementservice.orderline; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class OrderLineChecker implements Checker{ - - public String type(){ - return OrderLine.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderLine orderLine, ObjectLocation _parentLocation){ - if(needCheck(_context, orderLine)){ - markAsChecked(_context, orderLine); - doCheck(_context, orderLine, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderLine orderLine, ObjectLocation _parentLocation){ - if((orderLine == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderLine); - if(orderLine.needPersist()){ - } - if(orderLine.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - orderLine.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(orderLine.updateItem()){ - if(!orderLine.isPropertyLoaded("customer_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); - } - if(!orderLine.isPropertyLoaded("product")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "product"), "Mutation requires a fully loaded entity"); - } - if(!orderLine.isPropertyLoaded("product_name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); - } - if(!orderLine.isPropertyLoaded("sku")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); - } - if(!orderLine.isPropertyLoaded("quantity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); - } - if(!orderLine.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - if(!orderLine.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomerOrder(_context, orderLine.getProperty(OrderLine.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); - checkProduct(_context, orderLine.getProperty(OrderLine.PRODUCT_PROPERTY), newLocation(_parentLocation, "product")); - checkProductName(_context, orderLine.getProperty(OrderLine.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); - checkSku(_context, orderLine.getProperty(OrderLine.SKU_PROPERTY), newLocation(_parentLocation, "sku")); - checkQuantity(_context, orderLine.getProperty(OrderLine.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); - checkCommercePlatform(_context, orderLine.getProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - checkCreateTime(_context, orderLine.getProperty(OrderLine.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - } - - public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerOrder); - if((customerOrder == null)){ - return; - } - new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); - } - public void checkProduct(UserContext _context, Product product, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, product); - if((product == null)){ - return; - } - new ProductChecker().checkAndFix(_context, product, _parentLocation); - } - public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, productName); - if((productName == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, productName); - - } - public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, sku); - if((sku == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, sku); - - } - public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, quantity); - if((quantity == null)){ - return; - } - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java deleted file mode 100644 index 4b0e96834..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineExpression.java +++ /dev/null @@ -1,95 +0,0 @@ - -package com.teaql.ordermanagementservice.orderline; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderExpression; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class OrderLineExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderLineExpression(Expression expression){ - super(expression); - } - - public OrderLineExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderLineExpression updateId(Long id){ - return new OrderLineExpression(this, $it -> {((OrderLine)$it).__internalSet("id", id); return this;}); - } - - public OrderLineExpression save(UserContext userContext){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderLineExpression save(String intent, UserContext userContext){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderLine::getCustomerOrder)); - } - - public OrderLineExpression updateCustomerOrder(CustomerOrder customerOrder){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCustomerOrder(customerOrder)); - } - - public ProductExpression getProduct(){ - return new ProductExpression(loaded("product", "getProduct", OrderLine::getProduct)); - } - - public OrderLineExpression updateProduct(Product product){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateProduct(product)); - } - - public Expression getProductName(){ - return loaded("product_name", "getProductName", OrderLine::getProductName); - } - public OrderLineExpression updateProductName(String productName){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateProductName(productName)); - } - - public Expression getSku(){ - return loaded("sku", "getSku", OrderLine::getSku); - } - public OrderLineExpression updateSku(String sku){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateSku(sku)); - } - - public Expression getQuantity(){ - return loaded("quantity", "getQuantity", OrderLine::getQuantity); - } - public OrderLineExpression updateQuantity(Integer quantity){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateQuantity(quantity)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderLine::getCommercePlatform)); - } - - public OrderLineExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCommercePlatform(commercePlatform)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", OrderLine::getCreateTime); - } - public OrderLineExpression updateCreateTime(LocalDateTime createTime){ - return new OrderLineExpression(this, $it -> ((OrderLine)$it).updateCreateTime(createTime)); - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java deleted file mode 100644 index b7e5eeb32..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.orderline; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderLineListExpression extends SmartListExpression { - public OrderLineListExpression(Expression> expression){ - super(expression); - } - - public OrderLineListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderLineExpression first() { - return new OrderLineExpression(super.first()); - } - - public OrderLineExpression get(int index) { - return new OrderLineExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java deleted file mode 100644 index 420e2e78d..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderline/OrderLineRequest.java +++ /dev/null @@ -1,1402 +0,0 @@ - -package com.teaql.ordermanagementservice.orderline; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; -import com.teaql.ordermanagementservice.product.Product; -import com.teaql.ordermanagementservice.product.ProductRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class OrderLineRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderLineRequest(Class returnType){ - this(returnType, () -> (T) new OrderLine()); - } - - protected OrderLineRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderLineRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderLineRequest copy(){ - return (OrderLineRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderLineRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderLineRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderLineRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderLineRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderLineRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderLineRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderLineRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderLineRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderLineRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderLineRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderLineRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderLineRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderLineRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderLineRequest matchingAnyOf(OrderLineRequest orderLine){ - super.internalMatchAny(orderLine); - return this; - } - - public OrderLineRequest matchingIdsOf(OrderLineRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderLine.ID_PROPERTY, request, OrderLine.ID_PROPERTY)); - } - - public OrderLineRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderLineRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderLineRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderLineRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerOrderIdOnly().selectProductIdOnly().selectProductName().selectSku().selectQuantity().selectCommercePlatformIdOnly().selectCreateTime().selectVersion(); - } - - public OrderLineRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderLineRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderLine.ID_PROPERTY); - selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); - selectProperty(OrderLine.PRODUCT_PROPERTY); - selectProperty(OrderLine.PRODUCT_NAME_PROPERTY); - selectProperty(OrderLine.SKU_PROPERTY); - selectProperty(OrderLine.QUANTITY_PROPERTY); - selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); - selectProperty(OrderLine.CREATE_TIME_PROPERTY); - selectProperty(OrderLine.VERSION_PROPERTY); - return this; - } - - public OrderLineRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomerOrder().selectProduct().selectProductName().selectSku().selectQuantity().selectCommercePlatform().selectCreateTime().selectVersion(); - } - - public OrderLineRequest selectChildren(){ - super.selectAny(); - return selectId().selectCustomerOrder().selectProduct().selectProductName().selectSku().selectQuantity().selectCommercePlatform().selectCreateTime().selectVersion(); - } - - - public OrderLineRequest selectId(){ - selectProperty(OrderLine.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderLineRequest unselectId(){ - unselectProperty(OrderLine.ID_PROPERTY); - return this; - } - public OrderLineRequest selectCustomerOrderIdOnly(){ - selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderLineRequest selectCustomerOrder(){ - return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); - } - - public OrderLineRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ - selectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderLine.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - public OrderLineRequest unselectCustomerOrder(){ - unselectProperty(OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderLineRequest selectProductIdOnly(){ - selectProperty(OrderLine.PRODUCT_PROPERTY); - return this; - } - - public OrderLineRequest selectProduct(){ - return selectProductWith(Q.products().unlimited().selectSelf()); - } - - public OrderLineRequest selectProductWith(ProductRequest product){ - selectProperty(OrderLine.PRODUCT_PROPERTY); - enhanceRelation(OrderLine.PRODUCT_PROPERTY, product, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectProductWith", null, OrderLine.PRODUCT_PROPERTY)); - return this; - } - - public OrderLineRequest unselectProduct(){ - unselectProperty(OrderLine.PRODUCT_PROPERTY); - return this; - } - public OrderLineRequest selectProductName(){ - selectProperty(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - - /** - * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderLineRequest unselectProductName(){ - unselectProperty(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderLineRequest selectSku(){ - selectProperty(OrderLine.SKU_PROPERTY); - return this; - } - - /** - * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderLineRequest unselectSku(){ - unselectProperty(OrderLine.SKU_PROPERTY); - return this; - } - public OrderLineRequest selectQuantity(){ - selectProperty(OrderLine.QUANTITY_PROPERTY); - return this; - } - - /** - * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. - * @param aggrFunction aggrFunction - */ - public OrderLineRequest selectQuantity(AggrFunction aggrFunction){ - selectProperty(OrderLine.QUANTITY_PROPERTY, aggrFunction); - return this; - } - - - public OrderLineRequest unselectQuantity(){ - unselectProperty(OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest selectCommercePlatformIdOnly(){ - selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderLineRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public OrderLineRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderLine.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public OrderLineRequest unselectCommercePlatform(){ - unselectProperty(OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public OrderLineRequest selectCreateTime(){ - selectProperty(OrderLine.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderLineRequest unselectCreateTime(){ - unselectProperty(OrderLine.CREATE_TIME_PROPERTY); - return this; - } - public OrderLineRequest selectVersion(){ - selectProperty(OrderLine.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderLineRequest unselectVersion(){ - unselectProperty(OrderLine.VERSION_PROPERTY); - return this; - } - - public OrderLineRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.ID_PROPERTY, operator, values); - } - - public OrderLineRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderLineRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderLineRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderLineRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderLineRequest filterByCustomerOrder(CustomerOrder... customerOrder){ - if (customerOrder == null || customerOrder.length == 0) { - throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); - } - return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); - } - - public OrderLineRequest withCustomerOrder(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); - } - - public OrderLineRequest withCustomerOrderIsUnknown(){ - return withCustomerOrder(Operator.IS_NULL); - } - - public OrderLineRequest withCustomerOrderIsKnown(){ - return withCustomerOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, operator, values); - } - - public OrderLineRequest filterByCustomerOrder(Long customerOrder){ - if(customerOrder == null){ - return this; - } - return withCustomerOrder(Operator.EQUAL, customerOrder); - } - public OrderLineRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); - } - - public OrderLineRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); - } - - public OrderLineRequest filterByProduct(Product... product){ - if (product == null || product.length == 0) { - throw new IllegalArgumentException("filterByProduct parameter product cannot be empty"); - } - return appendSearchCriteria(createProductCriteria(Operator.EQUAL, (Object[])product)); - } - - public OrderLineRequest withProduct(Operator operator, Object... values){ - return appendSearchCriteria(createProductCriteria(operator, values)); - } - - public OrderLineRequest withProductIsUnknown(){ - return withProduct(Operator.IS_NULL); - } - - public OrderLineRequest withProductIsKnown(){ - return withProduct(Operator.IS_NOT_NULL); - } - - public SearchCriteria createProductCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.PRODUCT_PROPERTY, operator, values); - } - - public OrderLineRequest filterByProduct(Long product){ - if(product == null){ - return this; - } - return withProduct(Operator.EQUAL, product); - } - public OrderLineRequest withProductMatching(ProductRequest product){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.PRODUCT_PROPERTY, product, Product.ID_PROPERTY)); - } - - public OrderLineRequest withoutProductMatching(ProductRequest product){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderLine.PRODUCT_PROPERTY, product, Product.ID_PROPERTY))); - } - - public OrderLineRequest filterByProductName(String... productName){ - if (productName == null || productName.length == 0) { - throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); - } - return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); - } - - public OrderLineRequest withProductName(Operator operator, Object... values){ - return appendSearchCriteria(createProductNameCriteria(operator, values)); - } - - public OrderLineRequest withProductNameIsUnknown(){ - return withProductName(Operator.IS_NULL); - } - - public OrderLineRequest withProductNameIsKnown(){ - return withProductName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.PRODUCT_NAME_PROPERTY, operator, values); - } - - public OrderLineRequest withProductNameIsNot(String productName){ - return withProductName(Operator.NOT_EQUAL, productName); - } - - public OrderLineRequest withProductNameIn(String... productName){ - return withProductName(Operator.IN, (Object[])productName); - } - - public OrderLineRequest withProductNameNotIn(String... productName){ - return withProductName(Operator.NOT_IN, (Object[])productName); - } - public OrderLineRequest withProductNameGreaterThan(String productName){ - return withProductName(Operator.GREATER_THAN, productName); - } - - public OrderLineRequest withProductNameGreaterThanOrEqualTo(String productName){ - return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); - } - - public OrderLineRequest withProductNameLessThan(String productName){ - return withProductName(Operator.LESS_THAN, productName); - } - - public OrderLineRequest withProductNameLessThanOrEqualTo(String productName){ - return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); - } - - public OrderLineRequest withProductNameBetween(String startOfProductName, String endOfProductName){ - return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); - } - public OrderLineRequest withProductNameStartingWith(String productName){ - return withProductName(Operator.BEGIN_WITH, productName); - } - public OrderLineRequest withProductNameContaining(String productName){ - return withProductName(Operator.CONTAIN, productName); - } - - public OrderLineRequest withProductNameNotContaining(String productName){ - return withProductName(Operator.NOT_CONTAIN, productName); - } - - public OrderLineRequest withProductNameNotStartingWith(String productName){ - return withProductName(Operator.NOT_BEGIN_WITH, productName); - } - - public OrderLineRequest withProductNameEndingWith(String productName){ - return withProductName(Operator.END_WITH, productName); - } - - public OrderLineRequest withProductNameNotEndingWith(String productName){ - return withProductName(Operator.NOT_END_WITH, productName); - } - - public OrderLineRequest withProductNameIs(String productName){ - return withProductName(Operator.EQUAL, productName); - } - - public OrderLineRequest withProductNameSoundingLike(String productName){ - return withProductName(Operator.SOUNDS_LIKE, productName); - } - - - - public OrderLineRequest filterBySku(String... sku){ - if (sku == null || sku.length == 0) { - throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); - } - return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); - } - - public OrderLineRequest withSku(Operator operator, Object... values){ - return appendSearchCriteria(createSkuCriteria(operator, values)); - } - - public OrderLineRequest withSkuIsUnknown(){ - return withSku(Operator.IS_NULL); - } - - public OrderLineRequest withSkuIsKnown(){ - return withSku(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSkuCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.SKU_PROPERTY, operator, values); - } - - public OrderLineRequest withSkuIsNot(String sku){ - return withSku(Operator.NOT_EQUAL, sku); - } - - public OrderLineRequest withSkuIn(String... sku){ - return withSku(Operator.IN, (Object[])sku); - } - - public OrderLineRequest withSkuNotIn(String... sku){ - return withSku(Operator.NOT_IN, (Object[])sku); - } - public OrderLineRequest withSkuGreaterThan(String sku){ - return withSku(Operator.GREATER_THAN, sku); - } - - public OrderLineRequest withSkuGreaterThanOrEqualTo(String sku){ - return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); - } - - public OrderLineRequest withSkuLessThan(String sku){ - return withSku(Operator.LESS_THAN, sku); - } - - public OrderLineRequest withSkuLessThanOrEqualTo(String sku){ - return withSku(Operator.LESS_THAN_OR_EQUAL, sku); - } - - public OrderLineRequest withSkuBetween(String startOfSku, String endOfSku){ - return withSku(Operator.BETWEEN, startOfSku, endOfSku); - } - public OrderLineRequest withSkuStartingWith(String sku){ - return withSku(Operator.BEGIN_WITH, sku); - } - public OrderLineRequest withSkuContaining(String sku){ - return withSku(Operator.CONTAIN, sku); - } - - public OrderLineRequest withSkuNotContaining(String sku){ - return withSku(Operator.NOT_CONTAIN, sku); - } - - public OrderLineRequest withSkuNotStartingWith(String sku){ - return withSku(Operator.NOT_BEGIN_WITH, sku); - } - - public OrderLineRequest withSkuEndingWith(String sku){ - return withSku(Operator.END_WITH, sku); - } - - public OrderLineRequest withSkuNotEndingWith(String sku){ - return withSku(Operator.NOT_END_WITH, sku); - } - - public OrderLineRequest withSkuIs(String sku){ - return withSku(Operator.EQUAL, sku); - } - - public OrderLineRequest withSkuSoundingLike(String sku){ - return withSku(Operator.SOUNDS_LIKE, sku); - } - - - - public OrderLineRequest filterByQuantity(Integer... quantity){ - if (quantity == null || quantity.length == 0) { - throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); - } - return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); - } - - public OrderLineRequest withQuantity(Operator operator, Object... values){ - return appendSearchCriteria(createQuantityCriteria(operator, values)); - } - - public OrderLineRequest withQuantityIsUnknown(){ - return withQuantity(Operator.IS_NULL); - } - - public OrderLineRequest withQuantityIsKnown(){ - return withQuantity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.QUANTITY_PROPERTY, operator, values); - } - - public OrderLineRequest withQuantityIs(Integer quantity){ - return withQuantity(Operator.EQUAL, quantity); - } - - public OrderLineRequest withQuantityIsNot(Integer quantity){ - return withQuantity(Operator.NOT_EQUAL, quantity); - } - - public OrderLineRequest withQuantityIn(Integer... quantity){ - return withQuantity(Operator.IN, (Object[])quantity); - } - - public OrderLineRequest withQuantityNotIn(Integer... quantity){ - return withQuantity(Operator.NOT_IN, (Object[])quantity); - } - public OrderLineRequest withQuantityGreaterThan(Integer quantity){ - return withQuantity(Operator.GREATER_THAN, quantity); - } - - public OrderLineRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ - return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); - } - - public OrderLineRequest withQuantityLessThan(Integer quantity){ - return withQuantity(Operator.LESS_THAN, quantity); - } - - public OrderLineRequest withQuantityLessThanOrEqualTo(Integer quantity){ - return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); - } - - public OrderLineRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ - return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); - } - - - - public OrderLineRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public OrderLineRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public OrderLineRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public OrderLineRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public OrderLineRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public OrderLineRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public OrderLineRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public OrderLineRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public OrderLineRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public OrderLineRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public OrderLineRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.CREATE_TIME_PROPERTY, operator, values); - } - - public OrderLineRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public OrderLineRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public OrderLineRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public OrderLineRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public OrderLineRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderLineRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public OrderLineRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderLineRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public OrderLineRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public OrderLineRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderLineRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderLineRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderLineRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderLineRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public OrderLineRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderLineRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderLineRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderLineRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderLine.VERSION_PROPERTY, operator, values); - } - - public OrderLineRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderLineRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderLineRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderLineRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderLineRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderLineRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderLineRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderLineRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderLineRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderLineRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderLineRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderLineRequest minQuantity(){ - return minQuantityAs(prefix("minOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest minQuantityAs(String retName){ - super.min(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest maxQuantity(){ - return maxQuantityAs(prefix("maxOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest maxQuantityAs(String retName){ - super.max(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest sumQuantity(){ - return sumQuantityAs(prefix("sumOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest sumQuantityAs(String retName){ - super.sum(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest avgQuantity(){ - return avgQuantityAs(prefix("avgOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest avgQuantityAs(String retName){ - super.avg(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest standardDeviationQuantity(){ - return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest standardDeviationQuantityAs(String retName){ - super.standardDeviation(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest squareRootOfPopulationStandardDeviationQuantity(){ - return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest sampleVarianceQuantity(){ - return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest sampleVarianceQuantityAs(String retName){ - super.sampleVariance(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest samplePopulationVarianceQuantity(){ - return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderLine.QUANTITY_PROPERTY)); - } - - public OrderLineRequest samplePopulationVarianceQuantityAs(String retName){ - super.samplePopulationVariance(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest groupByCustomerOrderWithDetails(){ - return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); - } - - public OrderLineRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ - aggregate(OrderLine.CUSTOMER_ORDER_PROPERTY, subRequest); - return this; - } - - public OrderLineRequest groupByProductWithDetails(){ - return groupByProductWithDetails(Q.products().unlimited()); - } - - public OrderLineRequest groupByProductWithDetails(ProductRequest subRequest){ - aggregate(OrderLine.PRODUCT_PROPERTY, subRequest); - return this; - } - - - - - public OrderLineRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public OrderLineRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(OrderLine.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - - public OrderLineRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderLineRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderLine.ID_PROPERTY); - return this; - } - public OrderLineRequest countDistinctCustomerOrder(){ - return countDistinctCustomerOrderAs("customer_order_distinct_count"); - } - - public OrderLineRequest countDistinctCustomerOrderAs(String alias){ - super.countDistinctProperty(alias, OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderLineRequest countDistinctProduct(){ - return countDistinctProductAs("product_distinct_count"); - } - - public OrderLineRequest countDistinctProductAs(String alias){ - super.countDistinctProperty(alias, OrderLine.PRODUCT_PROPERTY); - return this; - } - public OrderLineRequest countDistinctProductName(){ - return countDistinctProductNameAs("product_name_distinct_count"); - } - - public OrderLineRequest countDistinctProductNameAs(String alias){ - super.countDistinctProperty(alias, OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderLineRequest countDistinctSku(){ - return countDistinctSkuAs("sku_distinct_count"); - } - - public OrderLineRequest countDistinctSkuAs(String alias){ - super.countDistinctProperty(alias, OrderLine.SKU_PROPERTY); - return this; - } - public OrderLineRequest countDistinctQuantity(){ - return countDistinctQuantityAs("quantity_distinct_count"); - } - - public OrderLineRequest countDistinctQuantityAs(String alias){ - super.countDistinctProperty(alias, OrderLine.QUANTITY_PROPERTY); - return this; - } - public OrderLineRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public OrderLineRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public OrderLineRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public OrderLineRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, OrderLine.CREATE_TIME_PROPERTY); - return this; - } - public OrderLineRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderLineRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderLine.VERSION_PROPERTY); - return this; - } - - public OrderLineRequest groupById(){ - groupBy(OrderLine.ID_PROPERTY); - return this; - } - - public OrderLineRequest groupByIdAs(String retName){ - groupBy(retName, OrderLine.ID_PROPERTY); - return this; - } - - public OrderLineRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.ID_PROPERTY, function); - return this; - } - public OrderLineRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderLine.CUSTOMER_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); - return this; - } - public OrderLineRequest groupByCustomerOrder(){ - groupBy(OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderLineRequest groupByCustomerOrderAs(String retName){ - groupBy(retName, OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderLineRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.CUSTOMER_ORDER_PROPERTY, function); - return this; - } - public OrderLineRequest groupByProductWith(ProductRequest subRequest){ - groupBy(OrderLine.PRODUCT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByProductWith", null, "product")); - return this; - } - public OrderLineRequest groupByProduct(){ - groupBy(OrderLine.PRODUCT_PROPERTY); - return this; - } - - public OrderLineRequest groupByProductAs(String retName){ - groupBy(retName, OrderLine.PRODUCT_PROPERTY); - return this; - } - - public OrderLineRequest groupByProductWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.PRODUCT_PROPERTY, function); - return this; - } - - public OrderLineRequest groupByProductName(){ - groupBy(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderLineRequest groupByProductNameAs(String retName){ - groupBy(retName, OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderLineRequest groupByProductNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.PRODUCT_NAME_PROPERTY, function); - return this; - } - - public OrderLineRequest groupBySku(){ - groupBy(OrderLine.SKU_PROPERTY); - return this; - } - - public OrderLineRequest groupBySkuAs(String retName){ - groupBy(retName, OrderLine.SKU_PROPERTY); - return this; - } - - public OrderLineRequest groupBySkuWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.SKU_PROPERTY, function); - return this; - } - - public OrderLineRequest groupByQuantity(){ - groupBy(OrderLine.QUANTITY_PROPERTY); - return this; - } - - public OrderLineRequest groupByQuantityAs(String retName){ - groupBy(retName, OrderLine.QUANTITY_PROPERTY); - return this; - } - - public OrderLineRequest groupByQuantityWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.QUANTITY_PROPERTY, function); - return this; - } - public OrderLineRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(OrderLine.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public OrderLineRequest groupByCommercePlatform(){ - groupBy(OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderLineRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderLineRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public OrderLineRequest groupByCreateTime(){ - groupBy(OrderLine.CREATE_TIME_PROPERTY); - return this; - } - - public OrderLineRequest groupByCreateTimeAs(String retName){ - groupBy(retName, OrderLine.CREATE_TIME_PROPERTY); - return this; - } - - public OrderLineRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.CREATE_TIME_PROPERTY, function); - return this; - } - - public OrderLineRequest groupByVersion(){ - groupBy(OrderLine.VERSION_PROPERTY); - return this; - } - - public OrderLineRequest groupByVersionAs(String retName){ - groupBy(retName, OrderLine.VERSION_PROPERTY); - return this; - } - - public OrderLineRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderLine.VERSION_PROPERTY, function); - return this; - } - - - - public OrderLineRequest orderByIdAscending(){ - addOrderByAscending(OrderLine.ID_PROPERTY); - return this; - } - - public OrderLineRequest orderByIdDescending(){ - addOrderByDescending(OrderLine.ID_PROPERTY); - return this; - } - - public OrderLineRequest orderByCustomerOrderAscending(){ - addOrderByAscending(OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderLineRequest orderByCustomerOrderDescending(){ - addOrderByDescending(OrderLine.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderLineRequest orderByProductAscending(){ - addOrderByAscending(OrderLine.PRODUCT_PROPERTY); - return this; - } - - public OrderLineRequest orderByProductDescending(){ - addOrderByDescending(OrderLine.PRODUCT_PROPERTY); - return this; - } - - public OrderLineRequest orderByProductNameAscending(){ - addOrderByAscending(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderLineRequest orderByProductNameDescending(){ - addOrderByDescending(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderLineRequest orderByProductNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderLineRequest orderByProductNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderLine.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderLineRequest orderBySkuAscending(){ - addOrderByAscending(OrderLine.SKU_PROPERTY); - return this; - } - - public OrderLineRequest orderBySkuDescending(){ - addOrderByDescending(OrderLine.SKU_PROPERTY); - return this; - } - public OrderLineRequest orderBySkuAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderLine.SKU_PROPERTY); - return this; - } - - public OrderLineRequest orderBySkuDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderLine.SKU_PROPERTY); - return this; - } - public OrderLineRequest orderByQuantityAscending(){ - addOrderByAscending(OrderLine.QUANTITY_PROPERTY); - return this; - } - - public OrderLineRequest orderByQuantityDescending(){ - addOrderByDescending(OrderLine.QUANTITY_PROPERTY); - return this; - } - - public OrderLineRequest orderByCommercePlatformAscending(){ - addOrderByAscending(OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderLineRequest orderByCommercePlatformDescending(){ - addOrderByDescending(OrderLine.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderLineRequest orderByCreateTimeAscending(){ - addOrderByAscending(OrderLine.CREATE_TIME_PROPERTY); - return this; - } - - public OrderLineRequest orderByCreateTimeDescending(){ - addOrderByDescending(OrderLine.CREATE_TIME_PROPERTY); - return this; - } - - public OrderLineRequest orderByVersionAscending(){ - addOrderByAscending(OrderLine.VERSION_PROPERTY); - return this; - } - - public OrderLineRequest orderByVersionDescending(){ - addOrderByDescending(OrderLine.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest rollUpToCustomerOrder(){ - CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.internalRollUpTo("customer_order", customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); - return customerOrder; - } - - public ProductRequest rollUpToProduct(){ - ProductRequest product = Q.products().unlimited(); - this.internalRollUpTo("product", product, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToProduct", null, "product")); - return product; - } - - - - - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - - - public OrderLineRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ - return facetByCustomerOrderAs(facetName, customerOrder, true); - } - - public OrderLineRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, OrderLine.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderLine.CUSTOMER_ORDER_PROPERTY)); - return this; - } - public OrderLineRequest facetByProductAs(String facetName, ProductRequest product){ - return facetByProductAs(facetName, product, true); - } - - public OrderLineRequest facetByProductAs(String facetName, ProductRequest product, boolean includeAllFacets){ - addFacet(facetName, OrderLine.PRODUCT_PROPERTY, product, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByProductAs", facetName, OrderLine.PRODUCT_PROPERTY)); - return this; - } - public OrderLineRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public OrderLineRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderLine.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderLineRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderLineRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderLineRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderLineRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderLineRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderLineRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java deleted file mode 100644 index 69f4b3ab6..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPreset.java +++ /dev/null @@ -1,232 +0,0 @@ - -package com.teaql.ordermanagementservice.ordersearchpreset; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderSearchPreset extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderSearchPreset"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7370ba923091e78805facef9877cc6c566871604f4974bb9d2fb39be83dcdf83"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("filter_json", 2), java.util.Map.entry("request_id", 3), java.util.Map.entry("owner_user_id", 4), java.util.Map.entry("commerce_platform", 5), java.util.Map.entry("create_time", 6), java.util.Map.entry("update_time", 7), java.util.Map.entry("version", 8)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("filter_json", java.util.List.of("filterJson", "filter_json")), java.util.Map.entry("request_id", java.util.List.of("requestId", "request_id")), java.util.Map.entry("owner_user_id", java.util.List.of("ownerUserId", "owner_user_id")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderSearchPreset.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String FILTER_JSON_PROPERTY = "filter_json"; - public static final String REQUEST_ID_PROPERTY = "request_id"; - public static final String OWNER_USER_ID_PROPERTY = "owner_user_id"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - private String name; - - private String filterJson; - - private String requestId; - - private String ownerUserId; - - private CommercePlatform commercePlatform; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - - public String getName(){ - return this.name; - } - - public String getFilterJson(){ - return this.filterJson; - } - - public String getRequestId(){ - return this.requestId; - } - - public String getOwnerUserId(){ - return this.ownerUserId; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public OrderSearchPreset updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public OrderSearchPreset updateFilterJson(String filterJson){ - filterJson = (filterJson == null ? null : filterJson.trim()); - if(isPropertyLoaded(FILTER_JSON_PROPERTY) && Objects.equals(this.filterJson, filterJson)){ - return this; - } - handleUpdate(FILTER_JSON_PROPERTY, getFilterJson(), filterJson); - this.filterJson = filterJson; - return this; - } - - public OrderSearchPreset updateRequestId(String requestId){ - requestId = (requestId == null ? null : requestId.trim()); - if(isPropertyLoaded(REQUEST_ID_PROPERTY) && Objects.equals(this.requestId, requestId)){ - return this; - } - handleUpdate(REQUEST_ID_PROPERTY, getRequestId(), requestId); - this.requestId = requestId; - return this; - } - - public OrderSearchPreset updateOwnerUserId(String ownerUserId){ - ownerUserId = (ownerUserId == null ? null : ownerUserId.trim()); - if(isPropertyLoaded(OWNER_USER_ID_PROPERTY) && Objects.equals(this.ownerUserId, ownerUserId)){ - return this; - } - handleUpdate(OWNER_USER_ID_PROPERTY, getOwnerUserId(), ownerUserId); - this.ownerUserId = ownerUserId; - return this; - } - - public OrderSearchPreset updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public OrderSearchPreset updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public OrderSearchPreset updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - - public static OrderSearchPreset refer(Long id){ - OrderSearchPreset refer = new OrderSearchPreset(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderSearchPreset comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "filter_json": this.filterJson = (value == null ? null : ((String)value).trim()); break; - - case "request_id": this.requestId = (value == null ? null : ((String)value).trim()); break; - - case "owner_user_id": this.ownerUserId = (value == null ? null : ((String)value).trim()); break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "filter_json": return this.filterJson; - case "request_id": return this.requestId; - case "owner_user_id": return this.ownerUserId; - case "commerce_platform": return this.commercePlatform; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "filterJson": return this.filterJson; - case "requestId": return this.requestId; - case "ownerUserId": return this.ownerUserId; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java deleted file mode 100644 index 566a351c7..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetChecker.java +++ /dev/null @@ -1,139 +0,0 @@ - -package com.teaql.ordermanagementservice.ordersearchpreset; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class OrderSearchPresetChecker implements Checker{ - - public String type(){ - return OrderSearchPreset.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ - if(needCheck(_context, orderSearchPreset)){ - markAsChecked(_context, orderSearchPreset); - doCheck(_context, orderSearchPreset, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderSearchPreset orderSearchPreset, ObjectLocation _parentLocation){ - if((orderSearchPreset == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderSearchPreset); - if(orderSearchPreset.needPersist()){ - } - if(orderSearchPreset.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - orderSearchPreset.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - orderSearchPreset.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(orderSearchPreset.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - orderSearchPreset.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!orderSearchPreset.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!orderSearchPreset.isPropertyLoaded("filter_json")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "filter_json"), "Mutation requires a fully loaded entity"); - } - if(!orderSearchPreset.isPropertyLoaded("request_id")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "request_id"), "Mutation requires a fully loaded entity"); - } - if(!orderSearchPreset.isPropertyLoaded("owner_user_id")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "owner_user_id"), "Mutation requires a fully loaded entity"); - } - if(!orderSearchPreset.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - if(!orderSearchPreset.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!orderSearchPreset.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, orderSearchPreset.getProperty(OrderSearchPreset.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkFilterJson(_context, orderSearchPreset.getProperty(OrderSearchPreset.FILTER_JSON_PROPERTY), newLocation(_parentLocation, "filter_json")); - checkRequestId(_context, orderSearchPreset.getProperty(OrderSearchPreset.REQUEST_ID_PROPERTY), newLocation(_parentLocation, "request_id")); - checkOwnerUserId(_context, orderSearchPreset.getProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY), newLocation(_parentLocation, "owner_user_id")); - checkCommercePlatform(_context, orderSearchPreset.getProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - checkCreateTime(_context, orderSearchPreset.getProperty(OrderSearchPreset.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, orderSearchPreset.getProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkFilterJson(UserContext _context, String filterJson, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, filterJson); - if((filterJson == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, filterJson); - - } - public void checkRequestId(UserContext _context, String requestId, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, requestId); - if((requestId == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, requestId); - - } - public void checkOwnerUserId(UserContext _context, String ownerUserId, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, ownerUserId); - if((ownerUserId == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, ownerUserId); - - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java deleted file mode 100644 index 91c9653dc..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetExpression.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.teaql.ordermanagementservice.ordersearchpreset; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class OrderSearchPresetExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderSearchPresetExpression(Expression expression){ - super(expression); - } - - public OrderSearchPresetExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderSearchPresetExpression updateId(Long id){ - return new OrderSearchPresetExpression(this, $it -> {((OrderSearchPreset)$it).__internalSet("id", id); return this;}); - } - - public OrderSearchPresetExpression save(UserContext userContext){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderSearchPresetExpression save(String intent, UserContext userContext){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", OrderSearchPreset::getName); - } - public OrderSearchPresetExpression updateName(String name){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateName(name)); - } - - public Expression getFilterJson(){ - return loaded("filter_json", "getFilterJson", OrderSearchPreset::getFilterJson); - } - public OrderSearchPresetExpression updateFilterJson(String filterJson){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateFilterJson(filterJson)); - } - - public Expression getRequestId(){ - return loaded("request_id", "getRequestId", OrderSearchPreset::getRequestId); - } - public OrderSearchPresetExpression updateRequestId(String requestId){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateRequestId(requestId)); - } - - public Expression getOwnerUserId(){ - return loaded("owner_user_id", "getOwnerUserId", OrderSearchPreset::getOwnerUserId); - } - public OrderSearchPresetExpression updateOwnerUserId(String ownerUserId){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateOwnerUserId(ownerUserId)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderSearchPreset::getCommercePlatform)); - } - - public OrderSearchPresetExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateCommercePlatform(commercePlatform)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", OrderSearchPreset::getCreateTime); - } - public OrderSearchPresetExpression updateCreateTime(LocalDateTime createTime){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", OrderSearchPreset::getUpdateTime); - } - public OrderSearchPresetExpression updateUpdateTime(LocalDateTime updateTime){ - return new OrderSearchPresetExpression(this, $it -> ((OrderSearchPreset)$it).updateUpdateTime(updateTime)); - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java deleted file mode 100644 index a3cefd1e4..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.ordersearchpreset; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderSearchPresetListExpression extends SmartListExpression { - public OrderSearchPresetListExpression(Expression> expression){ - super(expression); - } - - public OrderSearchPresetListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderSearchPresetExpression first() { - return new OrderSearchPresetExpression(super.first()); - } - - public OrderSearchPresetExpression get(int index) { - return new OrderSearchPresetExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java deleted file mode 100644 index 8ca8b107f..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/ordersearchpreset/OrderSearchPresetRequest.java +++ /dev/null @@ -1,1390 +0,0 @@ - -package com.teaql.ordermanagementservice.ordersearchpreset; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class OrderSearchPresetRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderSearchPresetRequest(Class returnType){ - this(returnType, () -> (T) new OrderSearchPreset()); - } - - protected OrderSearchPresetRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderSearchPresetRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderSearchPresetRequest copy(){ - return (OrderSearchPresetRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderSearchPresetRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderSearchPresetRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderSearchPresetRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderSearchPresetRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderSearchPresetRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderSearchPresetRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderSearchPresetRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderSearchPresetRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderSearchPresetRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderSearchPresetRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderSearchPresetRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderSearchPresetRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderSearchPresetRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderSearchPresetRequest matchingAnyOf(OrderSearchPresetRequest orderSearchPreset){ - super.internalMatchAny(orderSearchPreset); - return this; - } - - public OrderSearchPresetRequest matchingIdsOf(OrderSearchPresetRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderSearchPreset.ID_PROPERTY, request, OrderSearchPreset.ID_PROPERTY)); - } - - public OrderSearchPresetRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderSearchPresetRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderSearchPresetRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderSearchPresetRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public OrderSearchPresetRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderSearchPresetRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderSearchPreset.ID_PROPERTY); - selectProperty(OrderSearchPreset.NAME_PROPERTY); - selectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); - selectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); - selectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - selectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); - selectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); - selectProperty(OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - public OrderSearchPresetRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public OrderSearchPresetRequest selectChildren(){ - super.selectAny(); - return selectId().selectName().selectFilterJson().selectRequestId().selectOwnerUserId().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public OrderSearchPresetRequest selectId(){ - selectProperty(OrderSearchPreset.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectId(){ - unselectProperty(OrderSearchPreset.ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectName(){ - selectProperty(OrderSearchPreset.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectName(){ - unselectProperty(OrderSearchPreset.NAME_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectFilterJson(){ - selectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - - /** - * fill the filterJson with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS filterJson) to fetch filterJson property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectFilterJson(){ - unselectProperty(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectRequestId(){ - selectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - - /** - * fill the requestId with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS requestId) to fetch requestId property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectRequestId(){ - unselectProperty(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectOwnerUserId(){ - selectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - - /** - * fill the ownerUserId with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS ownerUserId) to fetch ownerUserId property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectOwnerUserId(){ - unselectProperty(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectCommercePlatformIdOnly(){ - selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderSearchPresetRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public OrderSearchPresetRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public OrderSearchPresetRequest unselectCommercePlatform(){ - unselectProperty(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectCreateTime(){ - selectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectCreateTime(){ - unselectProperty(OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectUpdateTime(){ - selectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectUpdateTime(){ - unselectProperty(OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - public OrderSearchPresetRequest selectVersion(){ - selectProperty(OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderSearchPresetRequest unselectVersion(){ - unselectProperty(OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - public OrderSearchPresetRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.ID_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderSearchPresetRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderSearchPresetRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderSearchPresetRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderSearchPresetRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public OrderSearchPresetRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public OrderSearchPresetRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.NAME_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public OrderSearchPresetRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public OrderSearchPresetRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public OrderSearchPresetRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public OrderSearchPresetRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public OrderSearchPresetRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public OrderSearchPresetRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public OrderSearchPresetRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public OrderSearchPresetRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public OrderSearchPresetRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public OrderSearchPresetRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public OrderSearchPresetRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public OrderSearchPresetRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public OrderSearchPresetRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public OrderSearchPresetRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public OrderSearchPresetRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public OrderSearchPresetRequest filterByFilterJson(String... filterJson){ - if (filterJson == null || filterJson.length == 0) { - throw new IllegalArgumentException("filterByFilterJson parameter filterJson cannot be empty"); - } - return appendSearchCriteria(createFilterJsonCriteria(Operator.EQUAL, (Object[])filterJson)); - } - - public OrderSearchPresetRequest withFilterJson(Operator operator, Object... values){ - return appendSearchCriteria(createFilterJsonCriteria(operator, values)); - } - - public OrderSearchPresetRequest withFilterJsonIsUnknown(){ - return withFilterJson(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withFilterJsonIsKnown(){ - return withFilterJson(Operator.IS_NOT_NULL); - } - - public SearchCriteria createFilterJsonCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.FILTER_JSON_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withFilterJsonIsNot(String filterJson){ - return withFilterJson(Operator.NOT_EQUAL, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonIn(String... filterJson){ - return withFilterJson(Operator.IN, (Object[])filterJson); - } - - public OrderSearchPresetRequest withFilterJsonNotIn(String... filterJson){ - return withFilterJson(Operator.NOT_IN, (Object[])filterJson); - } - public OrderSearchPresetRequest withFilterJsonGreaterThan(String filterJson){ - return withFilterJson(Operator.GREATER_THAN, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonGreaterThanOrEqualTo(String filterJson){ - return withFilterJson(Operator.GREATER_THAN_OR_EQUAL, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonLessThan(String filterJson){ - return withFilterJson(Operator.LESS_THAN, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonLessThanOrEqualTo(String filterJson){ - return withFilterJson(Operator.LESS_THAN_OR_EQUAL, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonBetween(String startOfFilterJson, String endOfFilterJson){ - return withFilterJson(Operator.BETWEEN, startOfFilterJson, endOfFilterJson); - } - public OrderSearchPresetRequest withFilterJsonStartingWith(String filterJson){ - return withFilterJson(Operator.BEGIN_WITH, filterJson); - } - public OrderSearchPresetRequest withFilterJsonContaining(String filterJson){ - return withFilterJson(Operator.CONTAIN, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonNotContaining(String filterJson){ - return withFilterJson(Operator.NOT_CONTAIN, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonNotStartingWith(String filterJson){ - return withFilterJson(Operator.NOT_BEGIN_WITH, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonEndingWith(String filterJson){ - return withFilterJson(Operator.END_WITH, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonNotEndingWith(String filterJson){ - return withFilterJson(Operator.NOT_END_WITH, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonIs(String filterJson){ - return withFilterJson(Operator.EQUAL, filterJson); - } - - public OrderSearchPresetRequest withFilterJsonSoundingLike(String filterJson){ - return withFilterJson(Operator.SOUNDS_LIKE, filterJson); - } - - - - public OrderSearchPresetRequest filterByRequestId(String... requestId){ - if (requestId == null || requestId.length == 0) { - throw new IllegalArgumentException("filterByRequestId parameter requestId cannot be empty"); - } - return appendSearchCriteria(createRequestIdCriteria(Operator.EQUAL, (Object[])requestId)); - } - - public OrderSearchPresetRequest withRequestId(Operator operator, Object... values){ - return appendSearchCriteria(createRequestIdCriteria(operator, values)); - } - - public OrderSearchPresetRequest withRequestIdIsUnknown(){ - return withRequestId(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withRequestIdIsKnown(){ - return withRequestId(Operator.IS_NOT_NULL); - } - - public SearchCriteria createRequestIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.REQUEST_ID_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withRequestIdIsNot(String requestId){ - return withRequestId(Operator.NOT_EQUAL, requestId); - } - - public OrderSearchPresetRequest withRequestIdIn(String... requestId){ - return withRequestId(Operator.IN, (Object[])requestId); - } - - public OrderSearchPresetRequest withRequestIdNotIn(String... requestId){ - return withRequestId(Operator.NOT_IN, (Object[])requestId); - } - public OrderSearchPresetRequest withRequestIdGreaterThan(String requestId){ - return withRequestId(Operator.GREATER_THAN, requestId); - } - - public OrderSearchPresetRequest withRequestIdGreaterThanOrEqualTo(String requestId){ - return withRequestId(Operator.GREATER_THAN_OR_EQUAL, requestId); - } - - public OrderSearchPresetRequest withRequestIdLessThan(String requestId){ - return withRequestId(Operator.LESS_THAN, requestId); - } - - public OrderSearchPresetRequest withRequestIdLessThanOrEqualTo(String requestId){ - return withRequestId(Operator.LESS_THAN_OR_EQUAL, requestId); - } - - public OrderSearchPresetRequest withRequestIdBetween(String startOfRequestId, String endOfRequestId){ - return withRequestId(Operator.BETWEEN, startOfRequestId, endOfRequestId); - } - public OrderSearchPresetRequest withRequestIdStartingWith(String requestId){ - return withRequestId(Operator.BEGIN_WITH, requestId); - } - public OrderSearchPresetRequest withRequestIdContaining(String requestId){ - return withRequestId(Operator.CONTAIN, requestId); - } - - public OrderSearchPresetRequest withRequestIdNotContaining(String requestId){ - return withRequestId(Operator.NOT_CONTAIN, requestId); - } - - public OrderSearchPresetRequest withRequestIdNotStartingWith(String requestId){ - return withRequestId(Operator.NOT_BEGIN_WITH, requestId); - } - - public OrderSearchPresetRequest withRequestIdEndingWith(String requestId){ - return withRequestId(Operator.END_WITH, requestId); - } - - public OrderSearchPresetRequest withRequestIdNotEndingWith(String requestId){ - return withRequestId(Operator.NOT_END_WITH, requestId); - } - - public OrderSearchPresetRequest withRequestIdIs(String requestId){ - return withRequestId(Operator.EQUAL, requestId); - } - - public OrderSearchPresetRequest withRequestIdSoundingLike(String requestId){ - return withRequestId(Operator.SOUNDS_LIKE, requestId); - } - - - - public OrderSearchPresetRequest filterByOwnerUserId(String... ownerUserId){ - if (ownerUserId == null || ownerUserId.length == 0) { - throw new IllegalArgumentException("filterByOwnerUserId parameter ownerUserId cannot be empty"); - } - return appendSearchCriteria(createOwnerUserIdCriteria(Operator.EQUAL, (Object[])ownerUserId)); - } - - public OrderSearchPresetRequest withOwnerUserId(Operator operator, Object... values){ - return appendSearchCriteria(createOwnerUserIdCriteria(operator, values)); - } - - public OrderSearchPresetRequest withOwnerUserIdIsUnknown(){ - return withOwnerUserId(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withOwnerUserIdIsKnown(){ - return withOwnerUserId(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOwnerUserIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.OWNER_USER_ID_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withOwnerUserIdIsNot(String ownerUserId){ - return withOwnerUserId(Operator.NOT_EQUAL, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdIn(String... ownerUserId){ - return withOwnerUserId(Operator.IN, (Object[])ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdNotIn(String... ownerUserId){ - return withOwnerUserId(Operator.NOT_IN, (Object[])ownerUserId); - } - public OrderSearchPresetRequest withOwnerUserIdGreaterThan(String ownerUserId){ - return withOwnerUserId(Operator.GREATER_THAN, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdGreaterThanOrEqualTo(String ownerUserId){ - return withOwnerUserId(Operator.GREATER_THAN_OR_EQUAL, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdLessThan(String ownerUserId){ - return withOwnerUserId(Operator.LESS_THAN, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdLessThanOrEqualTo(String ownerUserId){ - return withOwnerUserId(Operator.LESS_THAN_OR_EQUAL, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdBetween(String startOfOwnerUserId, String endOfOwnerUserId){ - return withOwnerUserId(Operator.BETWEEN, startOfOwnerUserId, endOfOwnerUserId); - } - public OrderSearchPresetRequest withOwnerUserIdStartingWith(String ownerUserId){ - return withOwnerUserId(Operator.BEGIN_WITH, ownerUserId); - } - public OrderSearchPresetRequest withOwnerUserIdContaining(String ownerUserId){ - return withOwnerUserId(Operator.CONTAIN, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdNotContaining(String ownerUserId){ - return withOwnerUserId(Operator.NOT_CONTAIN, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdNotStartingWith(String ownerUserId){ - return withOwnerUserId(Operator.NOT_BEGIN_WITH, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdEndingWith(String ownerUserId){ - return withOwnerUserId(Operator.END_WITH, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdNotEndingWith(String ownerUserId){ - return withOwnerUserId(Operator.NOT_END_WITH, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdIs(String ownerUserId){ - return withOwnerUserId(Operator.EQUAL, ownerUserId); - } - - public OrderSearchPresetRequest withOwnerUserIdSoundingLike(String ownerUserId){ - return withOwnerUserId(Operator.SOUNDS_LIKE, ownerUserId); - } - - - - public OrderSearchPresetRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public OrderSearchPresetRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public OrderSearchPresetRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public OrderSearchPresetRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public OrderSearchPresetRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public OrderSearchPresetRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public OrderSearchPresetRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public OrderSearchPresetRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.CREATE_TIME_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public OrderSearchPresetRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public OrderSearchPresetRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public OrderSearchPresetRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public OrderSearchPresetRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderSearchPresetRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public OrderSearchPresetRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderSearchPresetRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public OrderSearchPresetRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public OrderSearchPresetRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderSearchPresetRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public OrderSearchPresetRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderSearchPresetRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public OrderSearchPresetRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public OrderSearchPresetRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public OrderSearchPresetRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public OrderSearchPresetRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.UPDATE_TIME_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public OrderSearchPresetRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public OrderSearchPresetRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public OrderSearchPresetRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public OrderSearchPresetRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderSearchPresetRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderSearchPresetRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderSearchPresetRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderSearchPreset.VERSION_PROPERTY, operator, values); - } - - public OrderSearchPresetRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderSearchPresetRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderSearchPresetRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderSearchPresetRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderSearchPresetRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderSearchPresetRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderSearchPresetRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderSearchPresetRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderSearchPresetRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderSearchPresetRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderSearchPresetRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderSearchPresetRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public OrderSearchPresetRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public OrderSearchPresetRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.NAME_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctFilterJson(){ - return countDistinctFilterJsonAs("filter_json_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctFilterJsonAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctRequestId(){ - return countDistinctRequestIdAs("request_id_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctRequestIdAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctOwnerUserId(){ - return countDistinctOwnerUserIdAs("owner_user_id_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctOwnerUserIdAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - public OrderSearchPresetRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderSearchPresetRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupById(){ - groupBy(OrderSearchPreset.ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByIdAs(String retName){ - groupBy(retName, OrderSearchPreset.ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.ID_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByName(){ - groupBy(OrderSearchPreset.NAME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByNameAs(String retName){ - groupBy(retName, OrderSearchPreset.NAME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.NAME_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByFilterJson(){ - groupBy(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByFilterJsonAs(String retName){ - groupBy(retName, OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByFilterJsonWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.FILTER_JSON_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByRequestId(){ - groupBy(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByRequestIdAs(String retName){ - groupBy(retName, OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByRequestIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.REQUEST_ID_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByOwnerUserId(){ - groupBy(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByOwnerUserIdAs(String retName){ - groupBy(retName, OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByOwnerUserIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.OWNER_USER_ID_PROPERTY, function); - return this; - } - public OrderSearchPresetRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public OrderSearchPresetRequest groupByCommercePlatform(){ - groupBy(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByCreateTime(){ - groupBy(OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByCreateTimeAs(String retName){ - groupBy(retName, OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.CREATE_TIME_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByUpdateTime(){ - groupBy(OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.UPDATE_TIME_PROPERTY, function); - return this; - } - - public OrderSearchPresetRequest groupByVersion(){ - groupBy(OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByVersionAs(String retName){ - groupBy(retName, OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - public OrderSearchPresetRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderSearchPreset.VERSION_PROPERTY, function); - return this; - } - - - - public OrderSearchPresetRequest orderByIdAscending(){ - addOrderByAscending(OrderSearchPreset.ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByIdDescending(){ - addOrderByDescending(OrderSearchPreset.ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByNameAscending(){ - addOrderByAscending(OrderSearchPreset.NAME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByNameDescending(){ - addOrderByDescending(OrderSearchPreset.NAME_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderSearchPreset.NAME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderSearchPreset.NAME_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByFilterJsonAscending(){ - addOrderByAscending(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByFilterJsonDescending(){ - addOrderByDescending(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByFilterJsonAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByFilterJsonDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderSearchPreset.FILTER_JSON_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByRequestIdAscending(){ - addOrderByAscending(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByRequestIdDescending(){ - addOrderByDescending(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByRequestIdAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByRequestIdDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderSearchPreset.REQUEST_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByOwnerUserIdAscending(){ - addOrderByAscending(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByOwnerUserIdDescending(){ - addOrderByDescending(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByOwnerUserIdAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByOwnerUserIdDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderSearchPreset.OWNER_USER_ID_PROPERTY); - return this; - } - public OrderSearchPresetRequest orderByCommercePlatformAscending(){ - addOrderByAscending(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByCommercePlatformDescending(){ - addOrderByDescending(OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByCreateTimeAscending(){ - addOrderByAscending(OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByCreateTimeDescending(){ - addOrderByDescending(OrderSearchPreset.CREATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByUpdateTimeAscending(){ - addOrderByAscending(OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByUpdateTimeDescending(){ - addOrderByDescending(OrderSearchPreset.UPDATE_TIME_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByVersionAscending(){ - addOrderByAscending(OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - public OrderSearchPresetRequest orderByVersionDescending(){ - addOrderByDescending(OrderSearchPreset.VERSION_PROPERTY); - return this; - } - - - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - - - - public OrderSearchPresetRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public OrderSearchPresetRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderSearchPreset.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderSearchPresetRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderSearchPresetRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderSearchPresetRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderSearchPresetRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderSearchPresetRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderSearchPresetRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java deleted file mode 100644 index e44b5a8a9..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatus.java +++ /dev/null @@ -1,214 +0,0 @@ - -package com.teaql.ordermanagementservice.orderstatus; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderStatus extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderStatus"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f26f586dd82cdacffeee3bb7fe1ac1ef7385535d6ef257cd764ee435607e21c9"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("code", 2), java.util.Map.entry("color", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("commerce_platform", 5), java.util.Map.entry("version", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("color", java.util.List.of("color", "color")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderStatus.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String CODE_PROPERTY = "code"; - public static final String COLOR_PROPERTY = "color"; - public static final String DISPLAY_ORDER_PROPERTY = "display_order"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private String name; - - private String code; - - private String color; - - private BigDecimal displayOrder; - - private CommercePlatform commercePlatform; - - private SmartList customerOrderList; - - public String getName(){ - return this.name; - } - - public String getCode(){ - return this.code; - } - - public String getColor(){ - return this.color; - } - - public BigDecimal getDisplayOrder(){ - return this.displayOrder; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public OrderStatus updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public OrderStatus updateCode(String code){ - code = (code == null ? null : code.trim()); - if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ - return this; - } - handleUpdate(CODE_PROPERTY, getCode(), code); - this.code = code; - return this; - } - - public OrderStatus updateColor(String color){ - color = (color == null ? null : color.trim()); - if(isPropertyLoaded(COLOR_PROPERTY) && Objects.equals(this.color, color)){ - return this; - } - handleUpdate(COLOR_PROPERTY, getColor(), color); - this.color = color; - return this; - } - - public OrderStatus updateDisplayOrder(BigDecimal displayOrder){ - if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ - return this; - } - handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); - this.displayOrder = displayOrder; - return this; - } - - public OrderStatus updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public OrderStatus addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateProperty(CustomerOrder.STATUS_PROPERTY, this); - return this; - } - - public static OrderStatus refer(Long id){ - OrderStatus refer = new OrderStatus(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderStatus comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "code": this.code = (value == null ? null : ((String)value).trim()); break; - - case "color": this.color = (value == null ? null : ((String)value).trim()); break; - - case "display_order": this.displayOrder = (BigDecimal) value; break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "code": return this.code; - case "color": return this.color; - case "display_order": return this.displayOrder; - case "commerce_platform": return this.commercePlatform; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "code": return this.code; - case "color": return this.color; - case "displayOrder": return this.displayOrder; - case "commercePlatform": return this.commercePlatform; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java deleted file mode 100644 index 8ef805422..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusChecker.java +++ /dev/null @@ -1,98 +0,0 @@ - -package com.teaql.ordermanagementservice.orderstatus; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; - -public class OrderStatusChecker implements Checker{ - - public String type(){ - return OrderStatus.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ - if(needCheck(_context, orderStatus)){ - markAsChecked(_context, orderStatus); - doCheck(_context, orderStatus, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ - if((orderStatus == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderStatus); - if(orderStatus.needPersist()){ - } - if(orderStatus.newItem()){ - }else if(orderStatus.updateItem()){ - if(!orderStatus.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("color")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "color"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("display_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, orderStatus.getProperty(OrderStatus.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCode(_context, orderStatus.getProperty(OrderStatus.CODE_PROPERTY), newLocation(_parentLocation, "code")); - checkColor(_context, orderStatus.getProperty(OrderStatus.COLOR_PROPERTY), newLocation(_parentLocation, "color")); - checkDisplayOrder(_context, orderStatus.getProperty(OrderStatus.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); - checkCommercePlatform(_context, orderStatus.getProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - for(int i = 0; orderStatus.getCustomerOrderList() != null && i < orderStatus.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = orderStatus.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, code); - if((code == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, code); - - } - public void checkColor(UserContext _context, String color, ObjectLocation _parentLocation){ - if((color == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, color); - - } - public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ - if((displayOrder == null)){ - return; - } - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java deleted file mode 100644 index 0b3343d3a..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusExpression.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.teaql.ordermanagementservice.orderstatus; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.util.function.Function; - -public class OrderStatusExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderStatusExpression(Expression expression){ - super(expression); - } - - public OrderStatusExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderStatusExpression updateId(Long id){ - return new OrderStatusExpression(this, $it -> {((OrderStatus)$it).__internalSet("id", id); return this;}); - } - - public OrderStatusExpression save(UserContext userContext){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderStatusExpression save(String intent, UserContext userContext){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", OrderStatus::getName); - } - public OrderStatusExpression updateName(String name){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateName(name)); - } - - public Expression getCode(){ - return loaded("code", "getCode", OrderStatus::getCode); - } - public OrderStatusExpression updateCode(String code){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCode(code)); - } - - public Expression getColor(){ - return loaded("color", "getColor", OrderStatus::getColor); - } - public OrderStatusExpression updateColor(String color){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateColor(color)); - } - - public Expression getDisplayOrder(){ - return loaded("display_order", "getDisplayOrder", OrderStatus::getDisplayOrder); - } - public OrderStatusExpression updateDisplayOrder(BigDecimal displayOrder){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateDisplayOrder(displayOrder)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", OrderStatus::getCommercePlatform)); - } - - public OrderStatusExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCommercePlatform(commercePlatform)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", OrderStatus::getCustomerOrderList)); - } - public OrderStatusExpression addCustomerOrder(CustomerOrder customerOrder){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java deleted file mode 100644 index 5e1f5e979..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.orderstatus; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderStatusListExpression extends SmartListExpression { - public OrderStatusListExpression(Expression> expression){ - super(expression); - } - - public OrderStatusListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderStatusExpression first() { - return new OrderStatusExpression(super.first()); - } - - public OrderStatusExpression get(int index) { - return new OrderStatusExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java deleted file mode 100644 index 7196f1575..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/orderstatus/OrderStatusRequest.java +++ /dev/null @@ -1,1374 +0,0 @@ - -package com.teaql.ordermanagementservice.orderstatus; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; -import com.teaql.ordermanagementservice.customerorder.CustomerOrder; -import com.teaql.ordermanagementservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.util.Objects; - -public class OrderStatusRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderStatusRequest(Class returnType){ - this(returnType, () -> (T) new OrderStatus()); - } - - protected OrderStatusRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderStatusRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderStatusRequest copy(){ - return (OrderStatusRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderStatusRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderStatusRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderStatusRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderStatusRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderStatusRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderStatusRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderStatusRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderStatusRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderStatusRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderStatusRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderStatusRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderStatusRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderStatusRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderStatusRequest matchingAnyOf(OrderStatusRequest orderStatus){ - super.internalMatchAny(orderStatus); - return this; - } - - public OrderStatusRequest matchingIdsOf(OrderStatusRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderStatus.ID_PROPERTY, request, OrderStatus.ID_PROPERTY)); - } - - public OrderStatusRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderStatusRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderStatusRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderStatusRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatformIdOnly().selectVersion(); - } - - public OrderStatusRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderStatusRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderStatus.ID_PROPERTY); - selectProperty(OrderStatus.NAME_PROPERTY); - selectProperty(OrderStatus.CODE_PROPERTY); - selectProperty(OrderStatus.COLOR_PROPERTY); - selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); - selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - selectProperty(OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatform().selectVersion(); - } - - public OrderStatusRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectCommercePlatform().selectVersion(); - } - - - public OrderStatusRequest selectId(){ - selectProperty(OrderStatus.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectId(){ - unselectProperty(OrderStatus.ID_PROPERTY); - return this; - } - public OrderStatusRequest selectName(){ - selectProperty(OrderStatus.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectName(){ - unselectProperty(OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest selectCode(){ - selectProperty(OrderStatus.CODE_PROPERTY); - return this; - } - - /** - * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectCode(){ - unselectProperty(OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest selectColor(){ - selectProperty(OrderStatus.COLOR_PROPERTY); - return this; - } - - /** - * fill the color with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS color) to fetch color property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectColor(){ - unselectProperty(OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest selectDisplayOrder(){ - selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - /** - * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. - * @param aggrFunction aggrFunction - */ - public OrderStatusRequest selectDisplayOrder(AggrFunction aggrFunction){ - selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY, aggrFunction); - return this; - } - - - public OrderStatusRequest unselectDisplayOrder(){ - unselectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest selectCommercePlatformIdOnly(){ - selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public OrderStatusRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public OrderStatusRequest unselectCommercePlatform(){ - unselectProperty(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public OrderStatusRequest selectVersion(){ - selectProperty(OrderStatus.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectVersion(){ - unselectProperty(OrderStatus.VERSION_PROPERTY); - return this; - } - public OrderStatusRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public OrderStatusRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.ID_PROPERTY, operator, values); - } - - public OrderStatusRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderStatusRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderStatusRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderStatusRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderStatusRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public OrderStatusRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public OrderStatusRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public OrderStatusRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.NAME_PROPERTY, operator, values); - } - - public OrderStatusRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public OrderStatusRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public OrderStatusRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public OrderStatusRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public OrderStatusRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public OrderStatusRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public OrderStatusRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public OrderStatusRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public OrderStatusRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public OrderStatusRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public OrderStatusRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public OrderStatusRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public OrderStatusRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public OrderStatusRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public OrderStatusRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public OrderStatusRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public OrderStatusRequest filterByCode(String... code){ - if (code == null || code.length == 0) { - throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); - } - return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); - } - - public OrderStatusRequest withCode(Operator operator, Object... values){ - return appendSearchCriteria(createCodeCriteria(operator, values)); - } - - public OrderStatusRequest withCodeIsUnknown(){ - return withCode(Operator.IS_NULL); - } - - public OrderStatusRequest withCodeIsKnown(){ - return withCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.CODE_PROPERTY, operator, values); - } - - public OrderStatusRequest withCodeIsNot(String code){ - return withCode(Operator.NOT_EQUAL, code); - } - - public OrderStatusRequest withCodeIn(String... code){ - return withCode(Operator.IN, (Object[])code); - } - - public OrderStatusRequest withCodeNotIn(String... code){ - return withCode(Operator.NOT_IN, (Object[])code); - } - public OrderStatusRequest withCodeGreaterThan(String code){ - return withCode(Operator.GREATER_THAN, code); - } - - public OrderStatusRequest withCodeGreaterThanOrEqualTo(String code){ - return withCode(Operator.GREATER_THAN_OR_EQUAL, code); - } - - public OrderStatusRequest withCodeLessThan(String code){ - return withCode(Operator.LESS_THAN, code); - } - - public OrderStatusRequest withCodeLessThanOrEqualTo(String code){ - return withCode(Operator.LESS_THAN_OR_EQUAL, code); - } - - public OrderStatusRequest withCodeBetween(String startOfCode, String endOfCode){ - return withCode(Operator.BETWEEN, startOfCode, endOfCode); - } - public OrderStatusRequest withCodeStartingWith(String code){ - return withCode(Operator.BEGIN_WITH, code); - } - public OrderStatusRequest withCodeContaining(String code){ - return withCode(Operator.CONTAIN, code); - } - - public OrderStatusRequest withCodeNotContaining(String code){ - return withCode(Operator.NOT_CONTAIN, code); - } - - public OrderStatusRequest withCodeNotStartingWith(String code){ - return withCode(Operator.NOT_BEGIN_WITH, code); - } - - public OrderStatusRequest withCodeEndingWith(String code){ - return withCode(Operator.END_WITH, code); - } - - public OrderStatusRequest withCodeNotEndingWith(String code){ - return withCode(Operator.NOT_END_WITH, code); - } - - public OrderStatusRequest withCodeIs(String code){ - return withCode(Operator.EQUAL, code); - } - - public OrderStatusRequest withCodeSoundingLike(String code){ - return withCode(Operator.SOUNDS_LIKE, code); - } - - - - public OrderStatusRequest filterByColor(String... color){ - if (color == null || color.length == 0) { - throw new IllegalArgumentException("filterByColor parameter color cannot be empty"); - } - return appendSearchCriteria(createColorCriteria(Operator.EQUAL, (Object[])color)); - } - - public OrderStatusRequest withColor(Operator operator, Object... values){ - return appendSearchCriteria(createColorCriteria(operator, values)); - } - - public OrderStatusRequest withColorIsUnknown(){ - return withColor(Operator.IS_NULL); - } - - public OrderStatusRequest withColorIsKnown(){ - return withColor(Operator.IS_NOT_NULL); - } - - public SearchCriteria createColorCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.COLOR_PROPERTY, operator, values); - } - - public OrderStatusRequest withColorIsNot(String color){ - return withColor(Operator.NOT_EQUAL, color); - } - - public OrderStatusRequest withColorIn(String... color){ - return withColor(Operator.IN, (Object[])color); - } - - public OrderStatusRequest withColorNotIn(String... color){ - return withColor(Operator.NOT_IN, (Object[])color); - } - public OrderStatusRequest withColorGreaterThan(String color){ - return withColor(Operator.GREATER_THAN, color); - } - - public OrderStatusRequest withColorGreaterThanOrEqualTo(String color){ - return withColor(Operator.GREATER_THAN_OR_EQUAL, color); - } - - public OrderStatusRequest withColorLessThan(String color){ - return withColor(Operator.LESS_THAN, color); - } - - public OrderStatusRequest withColorLessThanOrEqualTo(String color){ - return withColor(Operator.LESS_THAN_OR_EQUAL, color); - } - - public OrderStatusRequest withColorBetween(String startOfColor, String endOfColor){ - return withColor(Operator.BETWEEN, startOfColor, endOfColor); - } - public OrderStatusRequest withColorStartingWith(String color){ - return withColor(Operator.BEGIN_WITH, color); - } - public OrderStatusRequest withColorContaining(String color){ - return withColor(Operator.CONTAIN, color); - } - - public OrderStatusRequest withColorNotContaining(String color){ - return withColor(Operator.NOT_CONTAIN, color); - } - - public OrderStatusRequest withColorNotStartingWith(String color){ - return withColor(Operator.NOT_BEGIN_WITH, color); - } - - public OrderStatusRequest withColorEndingWith(String color){ - return withColor(Operator.END_WITH, color); - } - - public OrderStatusRequest withColorNotEndingWith(String color){ - return withColor(Operator.NOT_END_WITH, color); - } - - public OrderStatusRequest withColorIs(String color){ - return withColor(Operator.EQUAL, color); - } - - public OrderStatusRequest withColorSoundingLike(String color){ - return withColor(Operator.SOUNDS_LIKE, color); - } - - - - public OrderStatusRequest filterByDisplayOrder(BigDecimal... displayOrder){ - if (displayOrder == null || displayOrder.length == 0) { - throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); - } - return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); - } - - public OrderStatusRequest withDisplayOrder(Operator operator, Object... values){ - return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); - } - - public OrderStatusRequest withDisplayOrderIsUnknown(){ - return withDisplayOrder(Operator.IS_NULL); - } - - public OrderStatusRequest withDisplayOrderIsKnown(){ - return withDisplayOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.DISPLAY_ORDER_PROPERTY, operator, values); - } - - public OrderStatusRequest withDisplayOrderIs(BigDecimal displayOrder){ - return withDisplayOrder(Operator.EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderIsNot(BigDecimal displayOrder){ - return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.IN, (Object[])displayOrder); - } - - public OrderStatusRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); - } - public OrderStatusRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN, displayOrder); - } - - public OrderStatusRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderLessThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN, displayOrder); - } - - public OrderStatusRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ - return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); - } - - - - public OrderStatusRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public OrderStatusRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public OrderStatusRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public OrderStatusRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public OrderStatusRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public OrderStatusRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public OrderStatusRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public OrderStatusRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderStatusRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderStatusRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderStatusRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.VERSION_PROPERTY, operator, values); - } - - public OrderStatusRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderStatusRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderStatusRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderStatusRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderStatusRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderStatusRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderStatusRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderStatusRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderStatusRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public OrderStatusRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY)); - } - - public OrderStatusRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY))); - } - - public OrderStatusRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public OrderStatusRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public OrderStatusRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderStatusRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderStatusRequest minDisplayOrder(){ - return minDisplayOrderAs(prefix("minOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest minDisplayOrderAs(String retName){ - super.min(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest maxDisplayOrder(){ - return maxDisplayOrderAs(prefix("maxOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest maxDisplayOrderAs(String retName){ - super.max(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest sumDisplayOrder(){ - return sumDisplayOrderAs(prefix("sumOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest sumDisplayOrderAs(String retName){ - super.sum(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest avgDisplayOrder(){ - return avgDisplayOrderAs(prefix("avgOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest avgDisplayOrderAs(String retName){ - super.avg(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest standardDeviationDisplayOrder(){ - return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest standardDeviationDisplayOrderAs(String retName){ - super.standardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ - return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest sampleVarianceDisplayOrder(){ - return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest sampleVarianceDisplayOrderAs(String retName){ - super.sampleVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest samplePopulationVarianceDisplayOrder(){ - return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest samplePopulationVarianceDisplayOrderAs(String retName){ - super.samplePopulationVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public OrderStatusRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(OrderStatus.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - public OrderStatusRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderStatusRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.ID_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public OrderStatusRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctCode(){ - return countDistinctCodeAs("code_distinct_count"); - } - - public OrderStatusRequest countDistinctCodeAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctColor(){ - return countDistinctColorAs("color_distinct_count"); - } - - public OrderStatusRequest countDistinctColorAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctDisplayOrder(){ - return countDistinctDisplayOrderAs("display_order_distinct_count"); - } - - public OrderStatusRequest countDistinctDisplayOrderAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public OrderStatusRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderStatusRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.VERSION_PROPERTY); - return this; - } - public OrderStatusRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public OrderStatusRequest groupById(){ - groupBy(OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest groupByIdAs(String retName){ - groupBy(retName, OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.ID_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByName(){ - groupBy(OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest groupByNameAs(String retName){ - groupBy(retName, OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.NAME_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByCode(){ - groupBy(OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest groupByCodeAs(String retName){ - groupBy(retName, OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest groupByCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.CODE_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByColor(){ - groupBy(OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest groupByColorAs(String retName){ - groupBy(retName, OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest groupByColorWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.COLOR_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByDisplayOrder(){ - groupBy(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest groupByDisplayOrderAs(String retName){ - groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY, function); - return this; - } - public OrderStatusRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(OrderStatus.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public OrderStatusRequest groupByCommercePlatform(){ - groupBy(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByVersion(){ - groupBy(OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest groupByVersionAs(String retName){ - groupBy(retName, OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.VERSION_PROPERTY, function); - return this; - } - - - - public OrderStatusRequest orderByIdAscending(){ - addOrderByAscending(OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest orderByIdDescending(){ - addOrderByDescending(OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest orderByNameAscending(){ - addOrderByAscending(OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest orderByNameDescending(){ - addOrderByDescending(OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest orderByCodeAscending(){ - addOrderByAscending(OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest orderByCodeDescending(){ - addOrderByDescending(OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest orderByCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest orderByCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest orderByColorAscending(){ - addOrderByAscending(OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest orderByColorDescending(){ - addOrderByDescending(OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest orderByColorAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest orderByColorDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest orderByDisplayOrderAscending(){ - addOrderByAscending(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest orderByDisplayOrderDescending(){ - addOrderByDescending(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest orderByCommercePlatformAscending(){ - addOrderByAscending(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest orderByCommercePlatformDescending(){ - addOrderByDescending(OrderStatus.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest orderByVersionAscending(){ - addOrderByAscending(OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest orderByVersionDescending(){ - addOrderByDescending(OrderStatus.VERSION_PROPERTY); - return this; - } - - - public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - public OrderStatusRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.STATUS_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest minTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name){ - return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest maxTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name){ - return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest sumTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name){ - return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest avgTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name){ - return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ - return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public OrderStatusRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, OrderStatus.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderStatusRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderStatusRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderStatusRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderStatusRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderStatusRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderStatusRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java deleted file mode 100644 index f7dddf0e5..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/Product.java +++ /dev/null @@ -1,234 +0,0 @@ - -package com.teaql.ordermanagementservice.product; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Product extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Product"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "53d713469d480508489d19bea0bdb683bf3d6b9b5c37b81ba4c247b0200f2d0d"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("sku", 2), java.util.Map.entry("image_url", 3), java.util.Map.entry("commerce_platform", 4), java.util.Map.entry("create_time", 5), java.util.Map.entry("update_time", 6), java.util.Map.entry("version", 7)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("image_url", java.util.List.of("imageUrl", "image_url")), java.util.Map.entry("commerce_platform", java.util.List.of("commercePlatform", "commerce_platform")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_line_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Product.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String SKU_PROPERTY = "sku"; - public static final String IMAGE_URL_PROPERTY = "image_url"; - public static final String COMMERCE_PLATFORM_PROPERTY = "commerce_platform"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String ORDER_LINE_LIST_PROPERTY = "order_line_list"; - private String name; - - private String sku; - - private String imageUrl; - - private CommercePlatform commercePlatform; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList orderLineList; - - public String getName(){ - return this.name; - } - - public String getSku(){ - return this.sku; - } - - public String getImageUrl(){ - return this.imageUrl; - } - - public CommercePlatform getCommercePlatform(){ - return this.commercePlatform; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getOrderLineList(){ - return this.orderLineList == null ? SmartList.unloaded() : this.orderLineList; - } - public Product updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Product updateSku(String sku){ - sku = (sku == null ? null : sku.trim()); - if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ - return this; - } - handleUpdate(SKU_PROPERTY, getSku(), sku); - this.sku = sku; - return this; - } - - public Product updateImageUrl(String imageUrl){ - imageUrl = (imageUrl == null ? null : imageUrl.trim()); - if(isPropertyLoaded(IMAGE_URL_PROPERTY) && Objects.equals(this.imageUrl, imageUrl)){ - return this; - } - handleUpdate(IMAGE_URL_PROPERTY, getImageUrl(), imageUrl); - this.imageUrl = imageUrl; - return this; - } - - public Product updateCommercePlatform(CommercePlatform commercePlatform){ - if(isPropertyLoaded(COMMERCE_PLATFORM_PROPERTY) && Objects.equals(this.commercePlatform, commercePlatform)){ - return this; - } - handleUpdate(COMMERCE_PLATFORM_PROPERTY, getCommercePlatform(), commercePlatform); - this.commercePlatform = commercePlatform; - return this; - } - - public Product updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public Product updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public Product addOrderLine(OrderLine orderLine){ - if (orderLine == null){ - return this; - } - - if(null == this.orderLineList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderLineList = teaqlUnloadedItems.map(value -> value); - } - - this.orderLineList.add(orderLine); - orderLine.updateProduct(this); - return this; - } - - public static Product refer(Long id){ - Product refer = new Product(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Product comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; - - case "image_url": this.imageUrl = (value == null ? null : ((String)value).trim()); break; - - case "commerce_platform": this.commercePlatform = (CommercePlatform) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "order_line_list": this.orderLineList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "sku": return this.sku; - case "image_url": return this.imageUrl; - case "commerce_platform": return this.commercePlatform; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "order_line_list": return this.orderLineList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "sku": return this.sku; - case "imageUrl": return this.imageUrl; - case "commercePlatform": return this.commercePlatform; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java deleted file mode 100644 index 2bbb9c1c5..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductChecker.java +++ /dev/null @@ -1,132 +0,0 @@ - -package com.teaql.ordermanagementservice.product; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformChecker; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class ProductChecker implements Checker{ - - public String type(){ - return Product.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Product product, ObjectLocation _parentLocation){ - if(needCheck(_context, product)){ - markAsChecked(_context, product); - doCheck(_context, product, _parentLocation); - } - } - - public void doCheck(UserContext _context, Product product, ObjectLocation _parentLocation){ - if((product == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, product); - if(product.needPersist()){ - } - if(product.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - product.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - product.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(product.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - product.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!product.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!product.isPropertyLoaded("sku")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); - } - if(!product.isPropertyLoaded("image_url")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "image_url"), "Mutation requires a fully loaded entity"); - } - if(!product.isPropertyLoaded("commerce_platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "commerce_platform"), "Mutation requires a fully loaded entity"); - } - if(!product.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!product.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, product.getProperty(Product.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkSku(_context, product.getProperty(Product.SKU_PROPERTY), newLocation(_parentLocation, "sku")); - checkImageUrl(_context, product.getProperty(Product.IMAGE_URL_PROPERTY), newLocation(_parentLocation, "image_url")); - checkCommercePlatform(_context, product.getProperty(Product.COMMERCE_PLATFORM_PROPERTY), newLocation(_parentLocation, "commerce_platform")); - checkCreateTime(_context, product.getProperty(Product.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, product.getProperty(Product.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; product.getOrderLineList() != null && i < product.getOrderLineList().size(); i++){ - OrderLine orderLine = product.getOrderLineList().get(i); - new OrderLineChecker().checkAndFix(_context, orderLine, newLocation(_parentLocation, "order_line_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, sku); - if((sku == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, sku); - - } - public void checkImageUrl(UserContext _context, String imageUrl, ObjectLocation _parentLocation){ - if((imageUrl == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, imageUrl); - - } - public void checkCommercePlatform(UserContext _context, CommercePlatform commercePlatform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, commercePlatform); - if((commercePlatform == null)){ - return; - } - new CommercePlatformChecker().checkAndFix(_context, commercePlatform, _parentLocation); - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java deleted file mode 100644 index f548bbf54..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductExpression.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.teaql.ordermanagementservice.product; - -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformExpression; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class ProductExpression extends ExpressionAdaptor implements BaseEntityExpression { - public ProductExpression(Expression expression){ - super(expression); - } - - public ProductExpression(Expression expression, Function function){ - super(expression, function); - } - - public ProductExpression updateId(Long id){ - return new ProductExpression(this, $it -> {((Product)$it).__internalSet("id", id); return this;}); - } - - public ProductExpression save(UserContext userContext){ - return new ProductExpression(this, $it -> ((Product)$it).auditAs("Saved by Expression").save(userContext)); - } - - public ProductExpression save(String intent, UserContext userContext){ - return new ProductExpression(this, $it -> ((Product)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Product::getName); - } - public ProductExpression updateName(String name){ - return new ProductExpression(this, $it -> ((Product)$it).updateName(name)); - } - - public Expression getSku(){ - return loaded("sku", "getSku", Product::getSku); - } - public ProductExpression updateSku(String sku){ - return new ProductExpression(this, $it -> ((Product)$it).updateSku(sku)); - } - - public Expression getImageUrl(){ - return loaded("image_url", "getImageUrl", Product::getImageUrl); - } - public ProductExpression updateImageUrl(String imageUrl){ - return new ProductExpression(this, $it -> ((Product)$it).updateImageUrl(imageUrl)); - } - - public CommercePlatformExpression getCommercePlatform(){ - return new CommercePlatformExpression(loaded("commerce_platform", "getCommercePlatform", Product::getCommercePlatform)); - } - - public ProductExpression updateCommercePlatform(CommercePlatform commercePlatform){ - return new ProductExpression(this, $it -> ((Product)$it).updateCommercePlatform(commercePlatform)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", Product::getCreateTime); - } - public ProductExpression updateCreateTime(LocalDateTime createTime){ - return new ProductExpression(this, $it -> ((Product)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", Product::getUpdateTime); - } - public ProductExpression updateUpdateTime(LocalDateTime updateTime){ - return new ProductExpression(this, $it -> ((Product)$it).updateUpdateTime(updateTime)); - } - - public OrderLineListExpression getOrderLineList(){ - return new OrderLineListExpression(loaded("order_line_list", "getOrderLineList", Product::getOrderLineList)); - } - public ProductExpression addOrderLine(OrderLine orderLine){ - return new ProductExpression(this, $it -> ((Product)$it).addOrderLine(orderLine)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java deleted file mode 100644 index badb04618..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordermanagementservice.product; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class ProductListExpression extends SmartListExpression { - public ProductListExpression(Expression> expression){ - super(expression); - } - - public ProductListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public ProductExpression first() { - return new ProductExpression(super.first()); - } - - public ProductExpression get(int index) { - return new ProductExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java deleted file mode 100644 index 87244ae9c..000000000 --- a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/product/ProductRequest.java +++ /dev/null @@ -1,1458 +0,0 @@ - -package com.teaql.ordermanagementservice.product; - -import com.teaql.ordermanagementservice.Q; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatform; -import com.teaql.ordermanagementservice.commerceplatform.CommercePlatformRequest; -import com.teaql.ordermanagementservice.orderline.OrderLine; -import com.teaql.ordermanagementservice.orderline.OrderLineRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class ProductRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public ProductRequest(Class returnType){ - this(returnType, () -> (T) new Product()); - } - - protected ProductRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public ProductRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public ProductRequest copy(){ - return (ProductRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new ProductRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public ProductRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public ProductRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public ProductRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public ProductRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public ProductRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public ProductRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public ProductRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public ProductRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public ProductRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public ProductRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (ProductRequest)super.appendSearchCriteria(searchCriteria); - } - - public ProductRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public ProductRequest matchingAnyOf(ProductRequest product){ - super.internalMatchAny(product); - return this; - } - - public ProductRequest matchingIdsOf(ProductRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Product.ID_PROPERTY, request, Product.ID_PROPERTY)); - } - - public ProductRequest enhanceChildrenIfNeeded(){ - return this; - } - - public ProductRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public ProductRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public ProductRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatformIdOnly().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public ProductRequest selectSelfFields(){ - return selectSelf(); - } - - public ProductRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Product.ID_PROPERTY); - selectProperty(Product.NAME_PROPERTY); - selectProperty(Product.SKU_PROPERTY); - selectProperty(Product.IMAGE_URL_PROPERTY); - selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); - selectProperty(Product.CREATE_TIME_PROPERTY); - selectProperty(Product.UPDATE_TIME_PROPERTY); - selectProperty(Product.VERSION_PROPERTY); - return this; - } - - public ProductRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public ProductRequest selectChildren(){ - super.selectAny(); - selectOrderLineList(); - return selectId().selectName().selectSku().selectImageUrl().selectCommercePlatform().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public ProductRequest selectId(){ - selectProperty(Product.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectId(){ - unselectProperty(Product.ID_PROPERTY); - return this; - } - public ProductRequest selectName(){ - selectProperty(Product.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectName(){ - unselectProperty(Product.NAME_PROPERTY); - return this; - } - public ProductRequest selectSku(){ - selectProperty(Product.SKU_PROPERTY); - return this; - } - - /** - * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectSku(){ - unselectProperty(Product.SKU_PROPERTY); - return this; - } - public ProductRequest selectImageUrl(){ - selectProperty(Product.IMAGE_URL_PROPERTY); - return this; - } - - /** - * fill the imageUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS imageUrl) to fetch imageUrl property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectImageUrl(){ - unselectProperty(Product.IMAGE_URL_PROPERTY); - return this; - } - public ProductRequest selectCommercePlatformIdOnly(){ - selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public ProductRequest selectCommercePlatform(){ - return selectCommercePlatformWith(Q.commercePlatforms().unlimited().selectSelf()); - } - - public ProductRequest selectCommercePlatformWith(CommercePlatformRequest commercePlatform){ - selectProperty(Product.COMMERCE_PLATFORM_PROPERTY); - enhanceRelation(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCommercePlatformWith", null, Product.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - public ProductRequest unselectCommercePlatform(){ - unselectProperty(Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public ProductRequest selectCreateTime(){ - selectProperty(Product.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectCreateTime(){ - unselectProperty(Product.CREATE_TIME_PROPERTY); - return this; - } - public ProductRequest selectUpdateTime(){ - selectProperty(Product.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectUpdateTime(){ - unselectProperty(Product.UPDATE_TIME_PROPERTY); - return this; - } - public ProductRequest selectVersion(){ - selectProperty(Product.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ProductRequest unselectVersion(){ - unselectProperty(Product.VERSION_PROPERTY); - return this; - } - public ProductRequest selectOrderLineList(){ - return selectOrderLineListWith(Q.orderLines().selectSelf()); - } - - public ProductRequest selectOrderLineListWith(OrderLineRequest orderLineList){ - enhanceRelation(Product.ORDER_LINE_LIST_PROPERTY, orderLineList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderLineListWith", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.ID_PROPERTY, operator, values); - } - - public ProductRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public ProductRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public ProductRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public ProductRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public ProductRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public ProductRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public ProductRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public ProductRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.NAME_PROPERTY, operator, values); - } - - public ProductRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public ProductRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public ProductRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public ProductRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public ProductRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public ProductRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public ProductRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public ProductRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public ProductRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public ProductRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public ProductRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public ProductRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public ProductRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public ProductRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public ProductRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public ProductRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public ProductRequest filterBySku(String... sku){ - if (sku == null || sku.length == 0) { - throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); - } - return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); - } - - public ProductRequest withSku(Operator operator, Object... values){ - return appendSearchCriteria(createSkuCriteria(operator, values)); - } - - public ProductRequest withSkuIsUnknown(){ - return withSku(Operator.IS_NULL); - } - - public ProductRequest withSkuIsKnown(){ - return withSku(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSkuCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.SKU_PROPERTY, operator, values); - } - - public ProductRequest withSkuIsNot(String sku){ - return withSku(Operator.NOT_EQUAL, sku); - } - - public ProductRequest withSkuIn(String... sku){ - return withSku(Operator.IN, (Object[])sku); - } - - public ProductRequest withSkuNotIn(String... sku){ - return withSku(Operator.NOT_IN, (Object[])sku); - } - public ProductRequest withSkuGreaterThan(String sku){ - return withSku(Operator.GREATER_THAN, sku); - } - - public ProductRequest withSkuGreaterThanOrEqualTo(String sku){ - return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); - } - - public ProductRequest withSkuLessThan(String sku){ - return withSku(Operator.LESS_THAN, sku); - } - - public ProductRequest withSkuLessThanOrEqualTo(String sku){ - return withSku(Operator.LESS_THAN_OR_EQUAL, sku); - } - - public ProductRequest withSkuBetween(String startOfSku, String endOfSku){ - return withSku(Operator.BETWEEN, startOfSku, endOfSku); - } - public ProductRequest withSkuStartingWith(String sku){ - return withSku(Operator.BEGIN_WITH, sku); - } - public ProductRequest withSkuContaining(String sku){ - return withSku(Operator.CONTAIN, sku); - } - - public ProductRequest withSkuNotContaining(String sku){ - return withSku(Operator.NOT_CONTAIN, sku); - } - - public ProductRequest withSkuNotStartingWith(String sku){ - return withSku(Operator.NOT_BEGIN_WITH, sku); - } - - public ProductRequest withSkuEndingWith(String sku){ - return withSku(Operator.END_WITH, sku); - } - - public ProductRequest withSkuNotEndingWith(String sku){ - return withSku(Operator.NOT_END_WITH, sku); - } - - public ProductRequest withSkuIs(String sku){ - return withSku(Operator.EQUAL, sku); - } - - public ProductRequest withSkuSoundingLike(String sku){ - return withSku(Operator.SOUNDS_LIKE, sku); - } - - - - public ProductRequest filterByImageUrl(String... imageUrl){ - if (imageUrl == null || imageUrl.length == 0) { - throw new IllegalArgumentException("filterByImageUrl parameter imageUrl cannot be empty"); - } - return appendSearchCriteria(createImageUrlCriteria(Operator.EQUAL, (Object[])imageUrl)); - } - - public ProductRequest withImageUrl(Operator operator, Object... values){ - return appendSearchCriteria(createImageUrlCriteria(operator, values)); - } - - public ProductRequest withImageUrlIsUnknown(){ - return withImageUrl(Operator.IS_NULL); - } - - public ProductRequest withImageUrlIsKnown(){ - return withImageUrl(Operator.IS_NOT_NULL); - } - - public SearchCriteria createImageUrlCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.IMAGE_URL_PROPERTY, operator, values); - } - - public ProductRequest withImageUrlIsNot(String imageUrl){ - return withImageUrl(Operator.NOT_EQUAL, imageUrl); - } - - public ProductRequest withImageUrlIn(String... imageUrl){ - return withImageUrl(Operator.IN, (Object[])imageUrl); - } - - public ProductRequest withImageUrlNotIn(String... imageUrl){ - return withImageUrl(Operator.NOT_IN, (Object[])imageUrl); - } - public ProductRequest withImageUrlGreaterThan(String imageUrl){ - return withImageUrl(Operator.GREATER_THAN, imageUrl); - } - - public ProductRequest withImageUrlGreaterThanOrEqualTo(String imageUrl){ - return withImageUrl(Operator.GREATER_THAN_OR_EQUAL, imageUrl); - } - - public ProductRequest withImageUrlLessThan(String imageUrl){ - return withImageUrl(Operator.LESS_THAN, imageUrl); - } - - public ProductRequest withImageUrlLessThanOrEqualTo(String imageUrl){ - return withImageUrl(Operator.LESS_THAN_OR_EQUAL, imageUrl); - } - - public ProductRequest withImageUrlBetween(String startOfImageUrl, String endOfImageUrl){ - return withImageUrl(Operator.BETWEEN, startOfImageUrl, endOfImageUrl); - } - public ProductRequest withImageUrlStartingWith(String imageUrl){ - return withImageUrl(Operator.BEGIN_WITH, imageUrl); - } - public ProductRequest withImageUrlContaining(String imageUrl){ - return withImageUrl(Operator.CONTAIN, imageUrl); - } - - public ProductRequest withImageUrlNotContaining(String imageUrl){ - return withImageUrl(Operator.NOT_CONTAIN, imageUrl); - } - - public ProductRequest withImageUrlNotStartingWith(String imageUrl){ - return withImageUrl(Operator.NOT_BEGIN_WITH, imageUrl); - } - - public ProductRequest withImageUrlEndingWith(String imageUrl){ - return withImageUrl(Operator.END_WITH, imageUrl); - } - - public ProductRequest withImageUrlNotEndingWith(String imageUrl){ - return withImageUrl(Operator.NOT_END_WITH, imageUrl); - } - - public ProductRequest withImageUrlIs(String imageUrl){ - return withImageUrl(Operator.EQUAL, imageUrl); - } - - public ProductRequest withImageUrlSoundingLike(String imageUrl){ - return withImageUrl(Operator.SOUNDS_LIKE, imageUrl); - } - - - - public ProductRequest filterByCommercePlatform(CommercePlatform... commercePlatform){ - if (commercePlatform == null || commercePlatform.length == 0) { - throw new IllegalArgumentException("filterByCommercePlatform parameter commercePlatform cannot be empty"); - } - return appendSearchCriteria(createCommercePlatformCriteria(Operator.EQUAL, (Object[])commercePlatform)); - } - - public ProductRequest withCommercePlatform(Operator operator, Object... values){ - return appendSearchCriteria(createCommercePlatformCriteria(operator, values)); - } - - public ProductRequest withCommercePlatformIsUnknown(){ - return withCommercePlatform(Operator.IS_NULL); - } - - public ProductRequest withCommercePlatformIsKnown(){ - return withCommercePlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCommercePlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, operator, values); - } - - public ProductRequest filterByCommercePlatform(Long commercePlatform){ - if(commercePlatform == null){ - return this; - } - return withCommercePlatform(Operator.EQUAL, commercePlatform); - } - public ProductRequest withCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(new SubQuerySearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY)); - } - - public ProductRequest withoutCommercePlatformMatching(CommercePlatformRequest commercePlatform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, CommercePlatform.ID_PROPERTY))); - } - - public ProductRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public ProductRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public ProductRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public ProductRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.CREATE_TIME_PROPERTY, operator, values); - } - - public ProductRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public ProductRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public ProductRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public ProductRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public ProductRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public ProductRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public ProductRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public ProductRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public ProductRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public ProductRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public ProductRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public ProductRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public ProductRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public ProductRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public ProductRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public ProductRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public ProductRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public ProductRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.UPDATE_TIME_PROPERTY, operator, values); - } - - public ProductRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public ProductRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public ProductRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public ProductRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public ProductRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public ProductRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public ProductRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public ProductRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public ProductRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public ProductRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public ProductRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public ProductRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public ProductRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public ProductRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public ProductRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public ProductRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public ProductRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public ProductRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Product.VERSION_PROPERTY, operator, values); - } - - public ProductRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public ProductRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public ProductRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public ProductRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public ProductRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public ProductRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public ProductRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public ProductRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public ProductRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public ProductRequest withOrderLineListMatching(OrderLineRequest orderLineRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Product.ID_PROPERTY, orderLineRequest, OrderLine.PRODUCT_PROPERTY)); - } - - public ProductRequest withoutOrderLineListMatching(OrderLineRequest orderLineRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Product.ID_PROPERTY, orderLineRequest, OrderLine.PRODUCT_PROPERTY))); - } - - public ProductRequest haveOrderLines(){ - return withOrderLineListMatching(Q.orderLines().unlimited()); - } - - public ProductRequest haveNoOrderLines(){ - return withoutOrderLineListMatching(Q.orderLines().unlimited()); - } - - public ProductRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public ProductRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public ProductRequest groupByCommercePlatformWithDetails(){ - return groupByCommercePlatformWithDetails(Q.commercePlatforms().unlimited()); - } - - public ProductRequest groupByCommercePlatformWithDetails(CommercePlatformRequest subRequest){ - aggregate(Product.COMMERCE_PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public ProductRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public ProductRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Product.ID_PROPERTY); - return this; - } - public ProductRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public ProductRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Product.NAME_PROPERTY); - return this; - } - public ProductRequest countDistinctSku(){ - return countDistinctSkuAs("sku_distinct_count"); - } - - public ProductRequest countDistinctSkuAs(String alias){ - super.countDistinctProperty(alias, Product.SKU_PROPERTY); - return this; - } - public ProductRequest countDistinctImageUrl(){ - return countDistinctImageUrlAs("image_url_distinct_count"); - } - - public ProductRequest countDistinctImageUrlAs(String alias){ - super.countDistinctProperty(alias, Product.IMAGE_URL_PROPERTY); - return this; - } - public ProductRequest countDistinctCommercePlatform(){ - return countDistinctCommercePlatformAs("commerce_platform_distinct_count"); - } - - public ProductRequest countDistinctCommercePlatformAs(String alias){ - super.countDistinctProperty(alias, Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - public ProductRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public ProductRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, Product.CREATE_TIME_PROPERTY); - return this; - } - public ProductRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public ProductRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, Product.UPDATE_TIME_PROPERTY); - return this; - } - public ProductRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public ProductRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Product.VERSION_PROPERTY); - return this; - } - public ProductRequest groupByOrderLinesWithDetails(OrderLineRequest subRequest){ - aggregate(Product.ORDER_LINE_LIST_PROPERTY, subRequest); - return this; - } - - public ProductRequest groupById(){ - groupBy(Product.ID_PROPERTY); - return this; - } - - public ProductRequest groupByIdAs(String retName){ - groupBy(retName, Product.ID_PROPERTY); - return this; - } - - public ProductRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.ID_PROPERTY, function); - return this; - } - - public ProductRequest groupByName(){ - groupBy(Product.NAME_PROPERTY); - return this; - } - - public ProductRequest groupByNameAs(String retName){ - groupBy(retName, Product.NAME_PROPERTY); - return this; - } - - public ProductRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.NAME_PROPERTY, function); - return this; - } - - public ProductRequest groupBySku(){ - groupBy(Product.SKU_PROPERTY); - return this; - } - - public ProductRequest groupBySkuAs(String retName){ - groupBy(retName, Product.SKU_PROPERTY); - return this; - } - - public ProductRequest groupBySkuWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.SKU_PROPERTY, function); - return this; - } - - public ProductRequest groupByImageUrl(){ - groupBy(Product.IMAGE_URL_PROPERTY); - return this; - } - - public ProductRequest groupByImageUrlAs(String retName){ - groupBy(retName, Product.IMAGE_URL_PROPERTY); - return this; - } - - public ProductRequest groupByImageUrlWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.IMAGE_URL_PROPERTY, function); - return this; - } - public ProductRequest groupByCommercePlatformWith(CommercePlatformRequest subRequest){ - groupBy(Product.COMMERCE_PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCommercePlatformWith", null, "commerce_platform")); - return this; - } - public ProductRequest groupByCommercePlatform(){ - groupBy(Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public ProductRequest groupByCommercePlatformAs(String retName){ - groupBy(retName, Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public ProductRequest groupByCommercePlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.COMMERCE_PLATFORM_PROPERTY, function); - return this; - } - - public ProductRequest groupByCreateTime(){ - groupBy(Product.CREATE_TIME_PROPERTY); - return this; - } - - public ProductRequest groupByCreateTimeAs(String retName){ - groupBy(retName, Product.CREATE_TIME_PROPERTY); - return this; - } - - public ProductRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.CREATE_TIME_PROPERTY, function); - return this; - } - - public ProductRequest groupByUpdateTime(){ - groupBy(Product.UPDATE_TIME_PROPERTY); - return this; - } - - public ProductRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, Product.UPDATE_TIME_PROPERTY); - return this; - } - - public ProductRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.UPDATE_TIME_PROPERTY, function); - return this; - } - - public ProductRequest groupByVersion(){ - groupBy(Product.VERSION_PROPERTY); - return this; - } - - public ProductRequest groupByVersionAs(String retName){ - groupBy(retName, Product.VERSION_PROPERTY); - return this; - } - - public ProductRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Product.VERSION_PROPERTY, function); - return this; - } - - - - public ProductRequest orderByIdAscending(){ - addOrderByAscending(Product.ID_PROPERTY); - return this; - } - - public ProductRequest orderByIdDescending(){ - addOrderByDescending(Product.ID_PROPERTY); - return this; - } - - public ProductRequest orderByNameAscending(){ - addOrderByAscending(Product.NAME_PROPERTY); - return this; - } - - public ProductRequest orderByNameDescending(){ - addOrderByDescending(Product.NAME_PROPERTY); - return this; - } - public ProductRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Product.NAME_PROPERTY); - return this; - } - - public ProductRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Product.NAME_PROPERTY); - return this; - } - public ProductRequest orderBySkuAscending(){ - addOrderByAscending(Product.SKU_PROPERTY); - return this; - } - - public ProductRequest orderBySkuDescending(){ - addOrderByDescending(Product.SKU_PROPERTY); - return this; - } - public ProductRequest orderBySkuAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Product.SKU_PROPERTY); - return this; - } - - public ProductRequest orderBySkuDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Product.SKU_PROPERTY); - return this; - } - public ProductRequest orderByImageUrlAscending(){ - addOrderByAscending(Product.IMAGE_URL_PROPERTY); - return this; - } - - public ProductRequest orderByImageUrlDescending(){ - addOrderByDescending(Product.IMAGE_URL_PROPERTY); - return this; - } - public ProductRequest orderByImageUrlAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Product.IMAGE_URL_PROPERTY); - return this; - } - - public ProductRequest orderByImageUrlDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Product.IMAGE_URL_PROPERTY); - return this; - } - public ProductRequest orderByCommercePlatformAscending(){ - addOrderByAscending(Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public ProductRequest orderByCommercePlatformDescending(){ - addOrderByDescending(Product.COMMERCE_PLATFORM_PROPERTY); - return this; - } - - public ProductRequest orderByCreateTimeAscending(){ - addOrderByAscending(Product.CREATE_TIME_PROPERTY); - return this; - } - - public ProductRequest orderByCreateTimeDescending(){ - addOrderByDescending(Product.CREATE_TIME_PROPERTY); - return this; - } - - public ProductRequest orderByUpdateTimeAscending(){ - addOrderByAscending(Product.UPDATE_TIME_PROPERTY); - return this; - } - - public ProductRequest orderByUpdateTimeDescending(){ - addOrderByDescending(Product.UPDATE_TIME_PROPERTY); - return this; - } - - public ProductRequest orderByVersionAscending(){ - addOrderByAscending(Product.VERSION_PROPERTY); - return this; - } - - public ProductRequest orderByVersionDescending(){ - addOrderByDescending(Product.VERSION_PROPERTY); - return this; - } - - - public ProductRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest){ - return statsFromOrderLinesAs(name, subRequest, false); - } - - public ProductRequest statsFromOrderLinesAs(String name, OrderLineRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest statsFromOrderLines(OrderLineRequest subRequest){ - return statsFromOrderLinesAs(REFINEMENTS, subRequest); - } - public CommercePlatformRequest rollUpToCommercePlatform(){ - CommercePlatformRequest commercePlatform = Q.commercePlatforms().unlimited(); - this.internalRollUpTo("commerce_platform", commercePlatform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCommercePlatform", null, "commerce_platform")); - return commercePlatform; - } - - - - - public ProductRequest countOrderLines(){ - addRelationCount("Count", Q.orderLines().unlimited(), OrderLine.PRODUCT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest countOrderLinesAs(String name){ - addRelationCount(name, Q.orderLines().unlimited(), OrderLine.PRODUCT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest countOrderLinesWith(String name, OrderLineRequest subRequest){ - addRelationCount(name, subRequest, OrderLine.PRODUCT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderLinesWith", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest minQuantityOfOrderLines(){ - addRelationScalarAggregate("minQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest minQuantityOfOrderLinesAs(String name){ - return minQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest minQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest maxQuantityOfOrderLines(){ - addRelationScalarAggregate("maxQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest maxQuantityOfOrderLinesAs(String name){ - return maxQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest maxQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest sumQuantityOfOrderLines(){ - addRelationScalarAggregate("sumQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest sumQuantityOfOrderLinesAs(String name){ - return sumQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest sumQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest avgQuantityOfOrderLines(){ - addRelationScalarAggregate("avgQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest avgQuantityOfOrderLinesAs(String name){ - return avgQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest avgQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest standardDeviationQuantityOfOrderLines(){ - addRelationScalarAggregate("stdDevQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name){ - return standardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest standardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLines(){ - addRelationScalarAggregate("stdDevPopQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest sampleVarianceQuantityOfOrderLines(){ - addRelationScalarAggregate("varSampQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name){ - return sampleVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest sampleVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - public ProductRequest samplePopulationVarianceQuantityOfOrderLines(){ - addRelationScalarAggregate("varPopQuantityOfOrderLines", Q.orderLines().unlimited(), - OrderLine.PRODUCT_PROPERTY, OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLines", null, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name){ - return samplePopulationVarianceQuantityOfOrderLinesAs(name, Q.orderLines().unlimited()); - } - - public ProductRequest samplePopulationVarianceQuantityOfOrderLinesAs(String name, OrderLineRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderLine.PRODUCT_PROPERTY, - OrderLine.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderLinesAs", name, Product.ORDER_LINE_LIST_PROPERTY)); - return this; - } - - public ProductRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform){ - return facetByCommercePlatformAs(facetName, commercePlatform, true); - } - - public ProductRequest facetByCommercePlatformAs(String facetName, CommercePlatformRequest commercePlatform, boolean includeAllFacets){ - addFacet(facetName, Product.COMMERCE_PLATFORM_PROPERTY, commercePlatform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCommercePlatformAs", facetName, Product.COMMERCE_PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public ProductRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public ProductRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public ProductRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public ProductRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public ProductRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public ProductRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java b/examples/order-management/java-app-console/lib/src/main/java/com/teaql/ordermanagementservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index a17a410ee..000000000 --- a/examples/order-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.ordermanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/order-management/showcase.json b/examples/order-management/showcase.json index b1af2fa1d..67bb68bbd 100644 --- a/examples/order-management/showcase.json +++ b/examples/order-management/showcase.json @@ -56,6 +56,7 @@ ], "generatedFilesManifestSHA256": "af0df75974d561910dc1ff9119e04668b5529fbfd425a1226e39560797360985", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/pom.xml b/examples/round-trip-reference-runtime/java-app-console/lib/pom.xml deleted file mode 100644 index f574b27bd..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - order-edit-reference-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Checkers.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java deleted file mode 100644 index 68ecabba0..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.ordereditreference; - -import com.teaql.ordereditreference.merchant.Merchant; - -public interface Constants { - public static final long MERCHANT_ID = 1l; - public static final Merchant MERCHANT = Merchant.refer(MERCHANT_ID); -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java deleted file mode 100644 index 42215a2bf..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/E.java +++ /dev/null @@ -1,23 +0,0 @@ - -package com.teaql.ordereditreference; - -import com.teaql.ordereditreference.merchant.Merchant; -import com.teaql.ordereditreference.merchant.MerchantExpression; -import com.teaql.ordereditreference.orderitem.OrderItem; -import com.teaql.ordereditreference.orderitem.OrderItemExpression; -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static MerchantExpression merchant(Merchant merchant){ - return new MerchantExpression(new ValueExpression(merchant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.merchant()")); - } - public static SalesOrderExpression salesOrder(SalesOrder salesOrder){ - return new SalesOrderExpression(new ValueExpression(salesOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.salesOrder()")); - } - public static OrderItemExpression orderItem(OrderItem orderItem){ - return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java deleted file mode 100644 index 0bbe6ea3e..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/EntityMetaRegistry.java +++ /dev/null @@ -1,405 +0,0 @@ - -package com.teaql.ordereditreference; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerMerchant(); - registerSalesOrder(); - registerOrderItem(); - } - private void registerMerchant() { - FieldLayout.installGenerated(com.teaql.ordereditreference.merchant.Merchant.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordereditreference.merchant.Merchant.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordereditreference.merchant.Merchant.class); - entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.merchant.Merchant::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Northwind Retail") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.merchant.Merchant.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSalesOrder() { - FieldLayout.installGenerated(com.teaql.ordereditreference.salesorder.SalesOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordereditreference.salesorder.SalesOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordereditreference.salesorder.SalesOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.salesorder.SalesOrder::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor merchant = - entityDescriptor.addObjectProperty($factory, com.teaql.ordereditreference.salesorder.SalesOrder.MERCHANT_PROPERTY, com.teaql.ordereditreference.merchant.Merchant.INTERNAL_TYPE, com.teaql.ordereditreference.merchant.Merchant.SALES_ORDER_LIST_PROPERTY, com.teaql.ordereditreference.merchant.Merchant.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.MERCHANT_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.salesorder.SalesOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderItem() { - FieldLayout.installGenerated(com.teaql.ordereditreference.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.ordereditreference.orderitem.OrderItem.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.ordereditreference.orderitem.OrderItem.class); - entityDescriptor.setEntitySupplier(com.teaql.ordereditreference.orderitem.OrderItem::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY, Long.class) - ; - PropertyDescriptor salesOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.ordereditreference.orderitem.OrderItem.SALES_ORDER_PROPERTY, com.teaql.ordereditreference.salesorder.SalesOrder.INTERNAL_TYPE, com.teaql.ordereditreference.salesorder.SalesOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.ordereditreference.salesorder.SalesOrder.class) - ; - PropertyDescriptor sku = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY, String.class) - ; - PropertyDescriptor quantity = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY, Integer.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SALES_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.SKU_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.QUANTITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.ordereditreference.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java deleted file mode 100644 index 663fa2609..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/GeneratedRuntimeModule.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.teaql.ordereditreference; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.ordereditreference.merchant.MerchantChecker(), new com.teaql.ordereditreference.salesorder.SalesOrderChecker(), new com.teaql.ordereditreference.orderitem.OrderItemChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:c2dacaf8377a726fc38a9cf13920679bb314d4127c7cc9c550dc98d516508240\",\"entities\":{\"Merchant\":{\"labels\":{\"en\":\"merchant\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"sales_order_list\",\"targetType\":\"SalesOrder\",\"labels\":{\"en\":\"sales order\"},\"aliases\":[\"SalesOrderList\",\"salesOrderList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"order item\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"sales_order\",\"targetType\":\"SalesOrder\",\"labels\":{\"en\":\"sales order\"},\"aliases\":[\"SalesOrder\",\"salesOrder\"]},{\"name\":\"sku\",\"labels\":{\"en\":\"sku\"},\"aliases\":[\"Sku\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SalesOrder\":{\"labels\":{\"en\":\"sales order\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"order item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Merchant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("SalesOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("sales_order", "salesOrder"), java.util.Map.entry("sku", "sku"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.merchants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.ordereditreference.merchant.Merchant domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.ordereditreference.merchant.Merchant(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Northwind Retail"); - domainRoot.auditAs("create generated Domain Root Merchant").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Merchant", domainRoot.getId())); - } -} diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java deleted file mode 100644 index 38a8d79c3..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/OrderEditReferenceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.ordereditreference; - -import io.teaql.core.UserContext; -public interface OrderEditReferenceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java deleted file mode 100644 index 49d46f241..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Q.java +++ /dev/null @@ -1,34 +0,0 @@ - -package com.teaql.ordereditreference; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.ordereditreference.merchant.MerchantRequest merchants(){ - return new com.teaql.ordereditreference.merchant.MerchantRequest(com.teaql.ordereditreference.merchant.Merchant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordereditreference.merchant.MerchantRequest merchantsWithMinimalFields(){ - return new com.teaql.ordereditreference.merchant.MerchantRequest(com.teaql.ordereditreference.merchant.Merchant.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordereditreference.salesorder.SalesOrderRequest salesOrders(){ - return new com.teaql.ordereditreference.salesorder.SalesOrderRequest(com.teaql.ordereditreference.salesorder.SalesOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordereditreference.salesorder.SalesOrderRequest salesOrdersWithMinimalFields(){ - return new com.teaql.ordereditreference.salesorder.SalesOrderRequest(com.teaql.ordereditreference.salesorder.SalesOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.ordereditreference.orderitem.OrderItemRequest orderItems(){ - return new com.teaql.ordereditreference.orderitem.OrderItemRequest(com.teaql.ordereditreference.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.ordereditreference.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ - return new com.teaql.ordereditreference.orderitem.OrderItemRequest(com.teaql.ordereditreference.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Repositories.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java deleted file mode 100644 index ed385f8aa..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/Merchant.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.teaql.ordereditreference.merchant; - -import com.teaql.ordereditreference.salesorder.SalesOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Merchant extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Merchant"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5f39ea5c4412183f01dd053549e36ebdc775b789c2346cb2b800a9f80d8cdb5a"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "sales_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Merchant.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String SALES_ORDER_LIST_PROPERTY = "sales_order_list"; - private String name; - - private SmartList salesOrderList; - - public String getName(){ - return this.name; - } - - public SmartList getSalesOrderList(){ - return this.salesOrderList == null ? SmartList.unloaded() : this.salesOrderList; - } - public Merchant updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Merchant addSalesOrder(SalesOrder salesOrder){ - if (salesOrder == null){ - return this; - } - - if(null == this.salesOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.salesOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.salesOrderList.add(salesOrder); - salesOrder.updateMerchant(this); - return this; - } - - public static Merchant refer(Long id){ - Merchant refer = new Merchant(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Merchant comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "sales_order_list": this.salesOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "sales_order_list": return this.salesOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java deleted file mode 100644 index 4594a518b..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.teaql.ordereditreference.merchant; - -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class MerchantChecker implements Checker{ - - public String type(){ - return Merchant.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - if(needCheck(_context, merchant)){ - markAsChecked(_context, merchant); - doCheck(_context, merchant, _parentLocation); - } - } - - public void doCheck(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - if((merchant == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, merchant); - if(merchant.needPersist()){ - } - if(merchant.newItem()){ - }else if(merchant.updateItem()){ - if(!merchant.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, merchant.getProperty(Merchant.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; merchant.getSalesOrderList() != null && i < merchant.getSalesOrderList().size(); i++){ - SalesOrder salesOrder = merchant.getSalesOrderList().get(i); - new SalesOrderChecker().checkAndFix(_context, salesOrder, newLocation(_parentLocation, "sales_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java deleted file mode 100644 index adc417be6..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.teaql.ordereditreference.merchant; - -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class MerchantExpression extends ExpressionAdaptor implements BaseEntityExpression { - public MerchantExpression(Expression expression){ - super(expression); - } - - public MerchantExpression(Expression expression, Function function){ - super(expression, function); - } - - public MerchantExpression updateId(Long id){ - return new MerchantExpression(this, $it -> {((Merchant)$it).__internalSet("id", id); return this;}); - } - - public MerchantExpression save(UserContext userContext){ - return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs("Saved by Expression").save(userContext)); - } - - public MerchantExpression save(String intent, UserContext userContext){ - return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Merchant::getName); - } - public MerchantExpression updateName(String name){ - return new MerchantExpression(this, $it -> ((Merchant)$it).updateName(name)); - } - - public SalesOrderListExpression getSalesOrderList(){ - return new SalesOrderListExpression(loaded("sales_order_list", "getSalesOrderList", Merchant::getSalesOrderList)); - } - public MerchantExpression addSalesOrder(SalesOrder salesOrder){ - return new MerchantExpression(this, $it -> ((Merchant)$it).addSalesOrder(salesOrder)); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java deleted file mode 100644 index 256390530..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordereditreference.merchant; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class MerchantListExpression extends SmartListExpression { - public MerchantListExpression(Expression> expression){ - super(expression); - } - - public MerchantListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public MerchantExpression first() { - return new MerchantExpression(super.first()); - } - - public MerchantExpression get(int index) { - return new MerchantExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java deleted file mode 100644 index 96d82292c..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/merchant/MerchantRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.teaql.ordereditreference.merchant; - -import com.teaql.ordereditreference.Q; -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class MerchantRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public MerchantRequest(Class returnType){ - this(returnType, () -> (T) new Merchant()); - } - - protected MerchantRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public MerchantRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public MerchantRequest copy(){ - return (MerchantRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new MerchantRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public MerchantRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public MerchantRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public MerchantRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public MerchantRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public MerchantRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public MerchantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public MerchantRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public MerchantRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public MerchantRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public MerchantRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (MerchantRequest)super.appendSearchCriteria(searchCriteria); - } - - public MerchantRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public MerchantRequest matchingAnyOf(MerchantRequest merchant){ - super.internalMatchAny(merchant); - return this; - } - - public MerchantRequest matchingIdsOf(MerchantRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Merchant.ID_PROPERTY, request, Merchant.ID_PROPERTY)); - } - - public MerchantRequest enhanceChildrenIfNeeded(){ - return this; - } - - public MerchantRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public MerchantRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public MerchantRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public MerchantRequest selectSelfFields(){ - return selectSelf(); - } - - public MerchantRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Merchant.ID_PROPERTY); - selectProperty(Merchant.NAME_PROPERTY); - selectProperty(Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public MerchantRequest selectChildren(){ - super.selectAny(); - selectSalesOrderList(); - return selectId().selectName().selectVersion(); - } - - - public MerchantRequest selectId(){ - selectProperty(Merchant.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public MerchantRequest unselectId(){ - unselectProperty(Merchant.ID_PROPERTY); - return this; - } - public MerchantRequest selectName(){ - selectProperty(Merchant.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public MerchantRequest unselectName(){ - unselectProperty(Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest selectVersion(){ - selectProperty(Merchant.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public MerchantRequest unselectVersion(){ - unselectProperty(Merchant.VERSION_PROPERTY); - return this; - } - public MerchantRequest selectSalesOrderList(){ - return selectSalesOrderListWith(Q.salesOrders().selectSelf()); - } - - public MerchantRequest selectSalesOrderListWith(SalesOrderRequest salesOrderList){ - enhanceRelation(Merchant.SALES_ORDER_LIST_PROPERTY, salesOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSalesOrderListWith", null, Merchant.SALES_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Merchant.ID_PROPERTY, operator, values); - } - - public MerchantRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public MerchantRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public MerchantRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public MerchantRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public MerchantRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public MerchantRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public MerchantRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public MerchantRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Merchant.NAME_PROPERTY, operator, values); - } - - public MerchantRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public MerchantRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public MerchantRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public MerchantRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public MerchantRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public MerchantRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public MerchantRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public MerchantRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public MerchantRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public MerchantRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public MerchantRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public MerchantRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public MerchantRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public MerchantRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public MerchantRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public MerchantRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public MerchantRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public MerchantRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public MerchantRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public MerchantRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Merchant.VERSION_PROPERTY, operator, values); - } - - public MerchantRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public MerchantRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public MerchantRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public MerchantRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public MerchantRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public MerchantRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public MerchantRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public MerchantRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public MerchantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public MerchantRequest withSalesOrderListMatching(SalesOrderRequest salesOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, salesOrderRequest, SalesOrder.MERCHANT_PROPERTY)); - } - - public MerchantRequest withoutSalesOrderListMatching(SalesOrderRequest salesOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, salesOrderRequest, SalesOrder.MERCHANT_PROPERTY))); - } - - public MerchantRequest haveSalesOrders(){ - return withSalesOrderListMatching(Q.salesOrders().unlimited()); - } - - public MerchantRequest haveNoSalesOrders(){ - return withoutSalesOrderListMatching(Q.salesOrders().unlimited()); - } - - public MerchantRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public MerchantRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public MerchantRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public MerchantRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Merchant.ID_PROPERTY); - return this; - } - public MerchantRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public MerchantRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public MerchantRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Merchant.VERSION_PROPERTY); - return this; - } - public MerchantRequest groupBySalesOrdersWithDetails(SalesOrderRequest subRequest){ - aggregate(Merchant.SALES_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public MerchantRequest groupById(){ - groupBy(Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest groupByIdAs(String retName){ - groupBy(retName, Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Merchant.ID_PROPERTY, function); - return this; - } - - public MerchantRequest groupByName(){ - groupBy(Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest groupByNameAs(String retName){ - groupBy(retName, Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Merchant.NAME_PROPERTY, function); - return this; - } - - public MerchantRequest groupByVersion(){ - groupBy(Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest groupByVersionAs(String retName){ - groupBy(retName, Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Merchant.VERSION_PROPERTY, function); - return this; - } - - - - public MerchantRequest orderByIdAscending(){ - addOrderByAscending(Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest orderByIdDescending(){ - addOrderByDescending(Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest orderByNameAscending(){ - addOrderByAscending(Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest orderByNameDescending(){ - addOrderByDescending(Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest orderByVersionAscending(){ - addOrderByAscending(Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest orderByVersionDescending(){ - addOrderByDescending(Merchant.VERSION_PROPERTY); - return this; - } - - - public MerchantRequest statsFromSalesOrdersAs(String name, SalesOrderRequest subRequest){ - return statsFromSalesOrdersAs(name, subRequest, false); - } - - public MerchantRequest statsFromSalesOrdersAs(String name, SalesOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, SalesOrder.MERCHANT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSalesOrdersAs", name, Merchant.SALES_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest statsFromSalesOrders(SalesOrderRequest subRequest){ - return statsFromSalesOrdersAs(REFINEMENTS, subRequest); - } - public MerchantRequest countSalesOrders(){ - addRelationCount("Count", Q.salesOrders().unlimited(), SalesOrder.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrders", null, Merchant.SALES_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest countSalesOrdersAs(String name){ - addRelationCount(name, Q.salesOrders().unlimited(), SalesOrder.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrdersAs", name, Merchant.SALES_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest countSalesOrdersWith(String name, SalesOrderRequest subRequest){ - addRelationCount(name, subRequest, SalesOrder.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSalesOrdersWith", name, Merchant.SALES_ORDER_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public MerchantRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public MerchantRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public MerchantRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public MerchantRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public MerchantRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public MerchantRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java deleted file mode 100644 index 25e0728e2..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItem.java +++ /dev/null @@ -1,148 +0,0 @@ - -package com.teaql.ordereditreference.orderitem; - -import com.teaql.ordereditreference.salesorder.SalesOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderItem extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderItem"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "8d70859137f59ca1b9c6e9daa84dde3e7300bdbbb95ca56c147662302a8a6aba"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("sales_order", 1), java.util.Map.entry("sku", 2), java.util.Map.entry("quantity", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("sales_order", java.util.List.of("salesOrder", "sales_order")), java.util.Map.entry("sku", java.util.List.of("sku", "sku")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String SALES_ORDER_PROPERTY = "sales_order"; - public static final String SKU_PROPERTY = "sku"; - public static final String QUANTITY_PROPERTY = "quantity"; - private SalesOrder salesOrder; - - private String sku; - - private Integer quantity; - - - public SalesOrder getSalesOrder(){ - return this.salesOrder; - } - - public String getSku(){ - return this.sku; - } - - public Integer getQuantity(){ - return this.quantity; - } - - public OrderItem updateSalesOrder(SalesOrder salesOrder){ - if(isPropertyLoaded(SALES_ORDER_PROPERTY) && Objects.equals(this.salesOrder, salesOrder)){ - return this; - } - handleUpdate(SALES_ORDER_PROPERTY, getSalesOrder(), salesOrder); - this.salesOrder = salesOrder; - return this; - } - - public OrderItem updateSku(String sku){ - sku = (sku == null ? null : sku.trim()); - if(isPropertyLoaded(SKU_PROPERTY) && Objects.equals(this.sku, sku)){ - return this; - } - handleUpdate(SKU_PROPERTY, getSku(), sku); - this.sku = sku; - return this; - } - - public OrderItem updateQuantity(Integer quantity){ - if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ - return this; - } - handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); - this.quantity = quantity; - return this; - } - - - public static OrderItem refer(Long id){ - OrderItem refer = new OrderItem(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderItem comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "sales_order": this.salesOrder = (SalesOrder) value; break; - - case "sku": this.sku = (value == null ? null : ((String)value).trim()); break; - - case "quantity": this.quantity = (Integer) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "sales_order": return this.salesOrder; - case "sku": return this.sku; - case "quantity": return this.quantity; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "salesOrder": return this.salesOrder; - case "sku": return this.sku; - case "quantity": return this.quantity; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java deleted file mode 100644 index a13d78b0a..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemChecker.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.teaql.ordereditreference.orderitem; - -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class OrderItemChecker implements Checker{ - - public String type(){ - return OrderItem.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if(needCheck(_context, orderItem)){ - markAsChecked(_context, orderItem); - doCheck(_context, orderItem, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if((orderItem == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderItem); - if(orderItem.needPersist()){ - } - if(orderItem.newItem()){ - }else if(orderItem.updateItem()){ - if(!orderItem.isPropertyLoaded("sales_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "sales_order"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("sku")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "sku"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("quantity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); - } - - } - checkSalesOrder(_context, orderItem.getProperty(OrderItem.SALES_ORDER_PROPERTY), newLocation(_parentLocation, "sales_order")); - checkSku(_context, orderItem.getProperty(OrderItem.SKU_PROPERTY), newLocation(_parentLocation, "sku")); - checkQuantity(_context, orderItem.getProperty(OrderItem.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); - } - - public void checkSalesOrder(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, salesOrder); - if((salesOrder == null)){ - return; - } - new SalesOrderChecker().checkAndFix(_context, salesOrder, _parentLocation); - } - public void checkSku(UserContext _context, String sku, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, sku); - if((sku == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, sku); - - } - public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, quantity); - if((quantity == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java deleted file mode 100644 index d7a5a442e..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemExpression.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.teaql.ordereditreference.orderitem; - -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderItemExpression(Expression expression){ - super(expression); - } - - public OrderItemExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderItemExpression updateId(Long id){ - return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); - } - - public OrderItemExpression save(UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderItemExpression save(String intent, UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public SalesOrderExpression getSalesOrder(){ - return new SalesOrderExpression(loaded("sales_order", "getSalesOrder", OrderItem::getSalesOrder)); - } - - public OrderItemExpression updateSalesOrder(SalesOrder salesOrder){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateSalesOrder(salesOrder)); - } - - public Expression getSku(){ - return loaded("sku", "getSku", OrderItem::getSku); - } - public OrderItemExpression updateSku(String sku){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateSku(sku)); - } - - public Expression getQuantity(){ - return loaded("quantity", "getQuantity", OrderItem::getQuantity); - } - public OrderItemExpression updateQuantity(Integer quantity){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateQuantity(quantity)); - } - -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java deleted file mode 100644 index db1c0ce5c..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordereditreference.orderitem; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderItemListExpression extends SmartListExpression { - public OrderItemListExpression(Expression> expression){ - super(expression); - } - - public OrderItemListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderItemExpression first() { - return new OrderItemExpression(super.first()); - } - - public OrderItemExpression get(int index) { - return new OrderItemExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java deleted file mode 100644 index 3e6e862be..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/orderitem/OrderItemRequest.java +++ /dev/null @@ -1,874 +0,0 @@ - -package com.teaql.ordereditreference.orderitem; - -import com.teaql.ordereditreference.Q; -import com.teaql.ordereditreference.salesorder.SalesOrder; -import com.teaql.ordereditreference.salesorder.SalesOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class OrderItemRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderItemRequest(Class returnType){ - this(returnType, () -> (T) new OrderItem()); - } - - protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderItemRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderItemRequest copy(){ - return (OrderItemRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderItemRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderItemRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderItemRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderItemRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderItemRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ - super.internalMatchAny(orderItem); - return this; - } - - public OrderItemRequest matchingIdsOf(OrderItemRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); - } - - public OrderItemRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderItemRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderItemRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderItemRequest selectSelf(){ - super.selectSelf(); - return selectId().selectSalesOrderIdOnly().selectSku().selectQuantity().selectVersion(); - } - - public OrderItemRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderItemRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderItem.ID_PROPERTY); - selectProperty(OrderItem.SALES_ORDER_PROPERTY); - selectProperty(OrderItem.SKU_PROPERTY); - selectProperty(OrderItem.QUANTITY_PROPERTY); - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest selectAll(){ - super.selectAll(); - return selectId().selectSalesOrder().selectSku().selectQuantity().selectVersion(); - } - - public OrderItemRequest selectChildren(){ - super.selectAny(); - return selectId().selectSalesOrder().selectSku().selectQuantity().selectVersion(); - } - - - public OrderItemRequest selectId(){ - selectProperty(OrderItem.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectId(){ - unselectProperty(OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest selectSalesOrderIdOnly(){ - selectProperty(OrderItem.SALES_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest selectSalesOrder(){ - return selectSalesOrderWith(Q.salesOrders().unlimited().selectSelf()); - } - - public OrderItemRequest selectSalesOrderWith(SalesOrderRequest salesOrder){ - selectProperty(OrderItem.SALES_ORDER_PROPERTY); - enhanceRelation(OrderItem.SALES_ORDER_PROPERTY, salesOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSalesOrderWith", null, OrderItem.SALES_ORDER_PROPERTY)); - return this; - } - - public OrderItemRequest unselectSalesOrder(){ - unselectProperty(OrderItem.SALES_ORDER_PROPERTY); - return this; - } - public OrderItemRequest selectSku(){ - selectProperty(OrderItem.SKU_PROPERTY); - return this; - } - - /** - * fill the sku with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS sku) to fetch sku property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectSku(){ - unselectProperty(OrderItem.SKU_PROPERTY); - return this; - } - public OrderItemRequest selectQuantity(){ - selectProperty(OrderItem.QUANTITY_PROPERTY); - return this; - } - - /** - * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. - * @param aggrFunction aggrFunction - */ - public OrderItemRequest selectQuantity(AggrFunction aggrFunction){ - selectProperty(OrderItem.QUANTITY_PROPERTY, aggrFunction); - return this; - } - - - public OrderItemRequest unselectQuantity(){ - unselectProperty(OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest selectVersion(){ - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectVersion(){ - unselectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); - } - - public OrderItemRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderItemRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderItemRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderItemRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderItemRequest filterBySalesOrder(SalesOrder... salesOrder){ - if (salesOrder == null || salesOrder.length == 0) { - throw new IllegalArgumentException("filterBySalesOrder parameter salesOrder cannot be empty"); - } - return appendSearchCriteria(createSalesOrderCriteria(Operator.EQUAL, (Object[])salesOrder)); - } - - public OrderItemRequest withSalesOrder(Operator operator, Object... values){ - return appendSearchCriteria(createSalesOrderCriteria(operator, values)); - } - - public OrderItemRequest withSalesOrderIsUnknown(){ - return withSalesOrder(Operator.IS_NULL); - } - - public OrderItemRequest withSalesOrderIsKnown(){ - return withSalesOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSalesOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.SALES_ORDER_PROPERTY, operator, values); - } - - public OrderItemRequest filterBySalesOrder(Long salesOrder){ - if(salesOrder == null){ - return this; - } - return withSalesOrder(Operator.EQUAL, salesOrder); - } - public OrderItemRequest withSalesOrderMatching(SalesOrderRequest salesOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.SALES_ORDER_PROPERTY, salesOrder, SalesOrder.ID_PROPERTY)); - } - - public OrderItemRequest withoutSalesOrderMatching(SalesOrderRequest salesOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderItem.SALES_ORDER_PROPERTY, salesOrder, SalesOrder.ID_PROPERTY))); - } - - public OrderItemRequest filterBySku(String... sku){ - if (sku == null || sku.length == 0) { - throw new IllegalArgumentException("filterBySku parameter sku cannot be empty"); - } - return appendSearchCriteria(createSkuCriteria(Operator.EQUAL, (Object[])sku)); - } - - public OrderItemRequest withSku(Operator operator, Object... values){ - return appendSearchCriteria(createSkuCriteria(operator, values)); - } - - public OrderItemRequest withSkuIsUnknown(){ - return withSku(Operator.IS_NULL); - } - - public OrderItemRequest withSkuIsKnown(){ - return withSku(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSkuCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.SKU_PROPERTY, operator, values); - } - - public OrderItemRequest withSkuIsNot(String sku){ - return withSku(Operator.NOT_EQUAL, sku); - } - - public OrderItemRequest withSkuIn(String... sku){ - return withSku(Operator.IN, (Object[])sku); - } - - public OrderItemRequest withSkuNotIn(String... sku){ - return withSku(Operator.NOT_IN, (Object[])sku); - } - public OrderItemRequest withSkuGreaterThan(String sku){ - return withSku(Operator.GREATER_THAN, sku); - } - - public OrderItemRequest withSkuGreaterThanOrEqualTo(String sku){ - return withSku(Operator.GREATER_THAN_OR_EQUAL, sku); - } - - public OrderItemRequest withSkuLessThan(String sku){ - return withSku(Operator.LESS_THAN, sku); - } - - public OrderItemRequest withSkuLessThanOrEqualTo(String sku){ - return withSku(Operator.LESS_THAN_OR_EQUAL, sku); - } - - public OrderItemRequest withSkuBetween(String startOfSku, String endOfSku){ - return withSku(Operator.BETWEEN, startOfSku, endOfSku); - } - public OrderItemRequest withSkuStartingWith(String sku){ - return withSku(Operator.BEGIN_WITH, sku); - } - public OrderItemRequest withSkuContaining(String sku){ - return withSku(Operator.CONTAIN, sku); - } - - public OrderItemRequest withSkuNotContaining(String sku){ - return withSku(Operator.NOT_CONTAIN, sku); - } - - public OrderItemRequest withSkuNotStartingWith(String sku){ - return withSku(Operator.NOT_BEGIN_WITH, sku); - } - - public OrderItemRequest withSkuEndingWith(String sku){ - return withSku(Operator.END_WITH, sku); - } - - public OrderItemRequest withSkuNotEndingWith(String sku){ - return withSku(Operator.NOT_END_WITH, sku); - } - - public OrderItemRequest withSkuIs(String sku){ - return withSku(Operator.EQUAL, sku); - } - - public OrderItemRequest withSkuSoundingLike(String sku){ - return withSku(Operator.SOUNDS_LIKE, sku); - } - - - - public OrderItemRequest filterByQuantity(Integer... quantity){ - if (quantity == null || quantity.length == 0) { - throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); - } - return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); - } - - public OrderItemRequest withQuantity(Operator operator, Object... values){ - return appendSearchCriteria(createQuantityCriteria(operator, values)); - } - - public OrderItemRequest withQuantityIsUnknown(){ - return withQuantity(Operator.IS_NULL); - } - - public OrderItemRequest withQuantityIsKnown(){ - return withQuantity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.QUANTITY_PROPERTY, operator, values); - } - - public OrderItemRequest withQuantityIs(Integer quantity){ - return withQuantity(Operator.EQUAL, quantity); - } - - public OrderItemRequest withQuantityIsNot(Integer quantity){ - return withQuantity(Operator.NOT_EQUAL, quantity); - } - - public OrderItemRequest withQuantityIn(Integer... quantity){ - return withQuantity(Operator.IN, (Object[])quantity); - } - - public OrderItemRequest withQuantityNotIn(Integer... quantity){ - return withQuantity(Operator.NOT_IN, (Object[])quantity); - } - public OrderItemRequest withQuantityGreaterThan(Integer quantity){ - return withQuantity(Operator.GREATER_THAN, quantity); - } - - public OrderItemRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ - return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); - } - - public OrderItemRequest withQuantityLessThan(Integer quantity){ - return withQuantity(Operator.LESS_THAN, quantity); - } - - public OrderItemRequest withQuantityLessThanOrEqualTo(Integer quantity){ - return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); - } - - public OrderItemRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ - return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); - } - - - - public OrderItemRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderItemRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderItemRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderItemRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); - } - - public OrderItemRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderItemRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderItemRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderItemRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderItemRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderItemRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderItemRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderItemRequest minQuantity(){ - return minQuantityAs(prefix("minOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest minQuantityAs(String retName){ - super.min(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest maxQuantity(){ - return maxQuantityAs(prefix("maxOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest maxQuantityAs(String retName){ - super.max(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest sumQuantity(){ - return sumQuantityAs(prefix("sumOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest sumQuantityAs(String retName){ - super.sum(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest avgQuantity(){ - return avgQuantityAs(prefix("avgOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest avgQuantityAs(String retName){ - super.avg(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest standardDeviationQuantity(){ - return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest standardDeviationQuantityAs(String retName){ - super.standardDeviation(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest squareRootOfPopulationStandardDeviationQuantity(){ - return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest sampleVarianceQuantity(){ - return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest sampleVarianceQuantityAs(String retName){ - super.sampleVariance(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest samplePopulationVarianceQuantity(){ - return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest samplePopulationVarianceQuantityAs(String retName){ - super.samplePopulationVariance(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest groupBySalesOrderWithDetails(){ - return groupBySalesOrderWithDetails(Q.salesOrders().unlimited()); - } - - public OrderItemRequest groupBySalesOrderWithDetails(SalesOrderRequest subRequest){ - aggregate(OrderItem.SALES_ORDER_PROPERTY, subRequest); - return this; - } - - - - - public OrderItemRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderItemRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest countDistinctSalesOrder(){ - return countDistinctSalesOrderAs("sales_order_distinct_count"); - } - - public OrderItemRequest countDistinctSalesOrderAs(String alias){ - super.countDistinctProperty(alias, OrderItem.SALES_ORDER_PROPERTY); - return this; - } - public OrderItemRequest countDistinctSku(){ - return countDistinctSkuAs("sku_distinct_count"); - } - - public OrderItemRequest countDistinctSkuAs(String alias){ - super.countDistinctProperty(alias, OrderItem.SKU_PROPERTY); - return this; - } - public OrderItemRequest countDistinctQuantity(){ - return countDistinctQuantityAs("quantity_distinct_count"); - } - - public OrderItemRequest countDistinctQuantityAs(String alias){ - super.countDistinctProperty(alias, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderItemRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupById(){ - groupBy(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdAs(String retName){ - groupBy(retName, OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.ID_PROPERTY, function); - return this; - } - public OrderItemRequest groupBySalesOrderWith(SalesOrderRequest subRequest){ - groupBy(OrderItem.SALES_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySalesOrderWith", null, "sales_order")); - return this; - } - public OrderItemRequest groupBySalesOrder(){ - groupBy(OrderItem.SALES_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupBySalesOrderAs(String retName){ - groupBy(retName, OrderItem.SALES_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupBySalesOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.SALES_ORDER_PROPERTY, function); - return this; - } - - public OrderItemRequest groupBySku(){ - groupBy(OrderItem.SKU_PROPERTY); - return this; - } - - public OrderItemRequest groupBySkuAs(String retName){ - groupBy(retName, OrderItem.SKU_PROPERTY); - return this; - } - - public OrderItemRequest groupBySkuWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.SKU_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByQuantity(){ - groupBy(OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest groupByQuantityAs(String retName){ - groupBy(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest groupByQuantityWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.QUANTITY_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByVersion(){ - groupBy(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionAs(String retName){ - groupBy(retName, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.VERSION_PROPERTY, function); - return this; - } - - - - public OrderItemRequest orderByIdAscending(){ - addOrderByAscending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByIdDescending(){ - addOrderByDescending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderBySalesOrderAscending(){ - addOrderByAscending(OrderItem.SALES_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderBySalesOrderDescending(){ - addOrderByDescending(OrderItem.SALES_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderBySkuAscending(){ - addOrderByAscending(OrderItem.SKU_PROPERTY); - return this; - } - - public OrderItemRequest orderBySkuDescending(){ - addOrderByDescending(OrderItem.SKU_PROPERTY); - return this; - } - public OrderItemRequest orderBySkuAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderItem.SKU_PROPERTY); - return this; - } - - public OrderItemRequest orderBySkuDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderItem.SKU_PROPERTY); - return this; - } - public OrderItemRequest orderByQuantityAscending(){ - addOrderByAscending(OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest orderByQuantityDescending(){ - addOrderByDescending(OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionAscending(){ - addOrderByAscending(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionDescending(){ - addOrderByDescending(OrderItem.VERSION_PROPERTY); - return this; - } - - - public SalesOrderRequest rollUpToSalesOrder(){ - SalesOrderRequest salesOrder = Q.salesOrders().unlimited(); - this.internalRollUpTo("sales_order", salesOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSalesOrder", null, "sales_order")); - return salesOrder; - } - - - - - - public OrderItemRequest facetBySalesOrderAs(String facetName, SalesOrderRequest salesOrder){ - return facetBySalesOrderAs(facetName, salesOrder, true); - } - - public OrderItemRequest facetBySalesOrderAs(String facetName, SalesOrderRequest salesOrder, boolean includeAllFacets){ - addFacet(facetName, OrderItem.SALES_ORDER_PROPERTY, salesOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySalesOrderAs", facetName, OrderItem.SALES_ORDER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderItemRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderItemRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderItemRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderItemRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderItemRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderItemRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java deleted file mode 100644 index 919b8f4c7..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrder.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.teaql.ordereditreference.salesorder; - -import com.teaql.ordereditreference.merchant.Merchant; -import com.teaql.ordereditreference.orderitem.OrderItem; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class SalesOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "SalesOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c887e95abcd3078f0518b67a359e764511c1e109c190cfab61732bd002847815"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("order_number", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_item_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - SalesOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String MERCHANT_PROPERTY = "merchant"; - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; - private Merchant merchant; - - private String orderNumber; - - private SmartList orderItemList; - - public Merchant getMerchant(){ - return this.merchant; - } - - public String getOrderNumber(){ - return this.orderNumber; - } - - public SmartList getOrderItemList(){ - return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; - } - public SalesOrder updateMerchant(Merchant merchant){ - if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ - return this; - } - handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); - this.merchant = merchant; - return this; - } - - public SalesOrder updateOrderNumber(String orderNumber){ - orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); - this.orderNumber = orderNumber; - return this; - } - - public SalesOrder addOrderItem(OrderItem orderItem){ - if (orderItem == null){ - return this; - } - - if(null == this.orderItemList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderItemList = teaqlUnloadedItems.map(value -> value); - } - - this.orderItemList.add(orderItem); - orderItem.updateSalesOrder(this); - return this; - } - - public static SalesOrder refer(Long id){ - SalesOrder refer = new SalesOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public SalesOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "merchant": this.merchant = (Merchant) value; break; - - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - case "order_item_list": this.orderItemList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "merchant": return this.merchant; - case "order_number": return this.orderNumber; - case "order_item_list": return this.orderItemList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "merchant": return this.merchant; - case "orderNumber": return this.orderNumber; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java deleted file mode 100644 index 07cedc666..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderChecker.java +++ /dev/null @@ -1,65 +0,0 @@ - -package com.teaql.ordereditreference.salesorder; - -import com.teaql.ordereditreference.merchant.Merchant; -import com.teaql.ordereditreference.merchant.MerchantChecker; -import com.teaql.ordereditreference.orderitem.OrderItem; -import com.teaql.ordereditreference.orderitem.OrderItemChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class SalesOrderChecker implements Checker{ - - public String type(){ - return SalesOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, salesOrder)){ - markAsChecked(_context, salesOrder); - doCheck(_context, salesOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, SalesOrder salesOrder, ObjectLocation _parentLocation){ - if((salesOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, salesOrder); - if(salesOrder.needPersist()){ - } - if(salesOrder.newItem()){ - }else if(salesOrder.updateItem()){ - if(!salesOrder.isPropertyLoaded("merchant")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); - } - if(!salesOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - - } - checkMerchant(_context, salesOrder.getProperty(SalesOrder.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); - checkOrderNumber(_context, salesOrder.getProperty(SalesOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); - for(int i = 0; salesOrder.getOrderItemList() != null && i < salesOrder.getOrderItemList().size(); i++){ - OrderItem orderItem = salesOrder.getOrderItemList().get(i); - new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); - } - } - - public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, merchant); - if((merchant == null)){ - return; - } - new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); - } - public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, orderNumber); - - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java deleted file mode 100644 index a034c8604..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.teaql.ordereditreference.salesorder; - -import com.teaql.ordereditreference.merchant.Merchant; -import com.teaql.ordereditreference.merchant.MerchantExpression; -import com.teaql.ordereditreference.orderitem.OrderItem; -import com.teaql.ordereditreference.orderitem.OrderItemListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class SalesOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SalesOrderExpression(Expression expression){ - super(expression); - } - - public SalesOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public SalesOrderExpression updateId(Long id){ - return new SalesOrderExpression(this, $it -> {((SalesOrder)$it).__internalSet("id", id); return this;}); - } - - public SalesOrderExpression save(UserContext userContext){ - return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SalesOrderExpression save(String intent, UserContext userContext){ - return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public MerchantExpression getMerchant(){ - return new MerchantExpression(loaded("merchant", "getMerchant", SalesOrder::getMerchant)); - } - - public SalesOrderExpression updateMerchant(Merchant merchant){ - return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).updateMerchant(merchant)); - } - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", SalesOrder::getOrderNumber); - } - public SalesOrderExpression updateOrderNumber(String orderNumber){ - return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).updateOrderNumber(orderNumber)); - } - - public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", SalesOrder::getOrderItemList)); - } - public SalesOrderExpression addOrderItem(OrderItem orderItem){ - return new SalesOrderExpression(this, $it -> ((SalesOrder)$it).addOrderItem(orderItem)); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java deleted file mode 100644 index 8e041cce7..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.ordereditreference.salesorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SalesOrderListExpression extends SmartListExpression { - public SalesOrderListExpression(Expression> expression){ - super(expression); - } - - public SalesOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SalesOrderExpression first() { - return new SalesOrderExpression(super.first()); - } - - public SalesOrderExpression get(int index) { - return new SalesOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java deleted file mode 100644 index fd2ff1dde..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/salesorder/SalesOrderRequest.java +++ /dev/null @@ -1,902 +0,0 @@ - -package com.teaql.ordereditreference.salesorder; - -import com.teaql.ordereditreference.Q; -import com.teaql.ordereditreference.merchant.Merchant; -import com.teaql.ordereditreference.merchant.MerchantRequest; -import com.teaql.ordereditreference.orderitem.OrderItem; -import com.teaql.ordereditreference.orderitem.OrderItemRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class SalesOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SalesOrderRequest(Class returnType){ - this(returnType, () -> (T) new SalesOrder()); - } - - protected SalesOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SalesOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SalesOrderRequest copy(){ - return (SalesOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SalesOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SalesOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SalesOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SalesOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SalesOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SalesOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SalesOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SalesOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SalesOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SalesOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SalesOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SalesOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public SalesOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SalesOrderRequest matchingAnyOf(SalesOrderRequest salesOrder){ - super.internalMatchAny(salesOrder); - return this; - } - - public SalesOrderRequest matchingIdsOf(SalesOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - SalesOrder.ID_PROPERTY, request, SalesOrder.ID_PROPERTY)); - } - - public SalesOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SalesOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SalesOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SalesOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectMerchantIdOnly().selectOrderNumber().selectVersion(); - } - - public SalesOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public SalesOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(SalesOrder.ID_PROPERTY); - selectProperty(SalesOrder.MERCHANT_PROPERTY); - selectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); - selectProperty(SalesOrder.VERSION_PROPERTY); - return this; - } - - public SalesOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectMerchant().selectOrderNumber().selectVersion(); - } - - public SalesOrderRequest selectChildren(){ - super.selectAny(); - selectOrderItemList(); - return selectId().selectMerchant().selectOrderNumber().selectVersion(); - } - - - public SalesOrderRequest selectId(){ - selectProperty(SalesOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SalesOrderRequest unselectId(){ - unselectProperty(SalesOrder.ID_PROPERTY); - return this; - } - public SalesOrderRequest selectMerchantIdOnly(){ - selectProperty(SalesOrder.MERCHANT_PROPERTY); - return this; - } - - public SalesOrderRequest selectMerchant(){ - return selectMerchantWith(Q.merchants().unlimited().selectSelf()); - } - - public SalesOrderRequest selectMerchantWith(MerchantRequest merchant){ - selectProperty(SalesOrder.MERCHANT_PROPERTY); - enhanceRelation(SalesOrder.MERCHANT_PROPERTY, merchant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, SalesOrder.MERCHANT_PROPERTY)); - return this; - } - - public SalesOrderRequest unselectMerchant(){ - unselectProperty(SalesOrder.MERCHANT_PROPERTY); - return this; - } - public SalesOrderRequest selectOrderNumber(){ - selectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SalesOrderRequest unselectOrderNumber(){ - unselectProperty(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public SalesOrderRequest selectVersion(){ - selectProperty(SalesOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SalesOrderRequest unselectVersion(){ - unselectProperty(SalesOrder.VERSION_PROPERTY); - return this; - } - public SalesOrderRequest selectOrderItemList(){ - return selectOrderItemListWith(Q.orderItems().selectSelf()); - } - - public SalesOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ - enhanceRelation(SalesOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SalesOrder.ID_PROPERTY, operator, values); - } - - public SalesOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SalesOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SalesOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SalesOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SalesOrderRequest filterByMerchant(Merchant... merchant){ - if (merchant == null || merchant.length == 0) { - throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); - } - return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); - } - - public SalesOrderRequest withMerchant(Operator operator, Object... values){ - return appendSearchCriteria(createMerchantCriteria(operator, values)); - } - - public SalesOrderRequest withMerchantIsUnknown(){ - return withMerchant(Operator.IS_NULL); - } - - public SalesOrderRequest withMerchantIsKnown(){ - return withMerchant(Operator.IS_NOT_NULL); - } - - public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SalesOrder.MERCHANT_PROPERTY, operator, values); - } - - public SalesOrderRequest filterByMerchant(Long merchant){ - if(merchant == null){ - return this; - } - return withMerchant(Operator.EQUAL, merchant); - } - public SalesOrderRequest withMerchantMatching(MerchantRequest merchant){ - return appendSearchCriteria(new SubQuerySearchCriteria(SalesOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); - } - - public SalesOrderRequest withoutMerchantMatching(MerchantRequest merchant){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(SalesOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); - } - - public SalesOrderRequest filterByOrderNumber(String... orderNumber){ - if (orderNumber == null || orderNumber.length == 0) { - throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); - } - return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); - } - - public SalesOrderRequest withOrderNumber(Operator operator, Object... values){ - return appendSearchCriteria(createOrderNumberCriteria(operator, values)); - } - - public SalesOrderRequest withOrderNumberIsUnknown(){ - return withOrderNumber(Operator.IS_NULL); - } - - public SalesOrderRequest withOrderNumberIsKnown(){ - return withOrderNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SalesOrder.ORDER_NUMBER_PROPERTY, operator, values); - } - - public SalesOrderRequest withOrderNumberIsNot(String orderNumber){ - return withOrderNumber(Operator.NOT_EQUAL, orderNumber); - } - - public SalesOrderRequest withOrderNumberIn(String... orderNumber){ - return withOrderNumber(Operator.IN, (Object[])orderNumber); - } - - public SalesOrderRequest withOrderNumberNotIn(String... orderNumber){ - return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); - } - public SalesOrderRequest withOrderNumberGreaterThan(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN, orderNumber); - } - - public SalesOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); - } - - public SalesOrderRequest withOrderNumberLessThan(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN, orderNumber); - } - - public SalesOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); - } - - public SalesOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ - return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); - } - public SalesOrderRequest withOrderNumberStartingWith(String orderNumber){ - return withOrderNumber(Operator.BEGIN_WITH, orderNumber); - } - public SalesOrderRequest withOrderNumberContaining(String orderNumber){ - return withOrderNumber(Operator.CONTAIN, orderNumber); - } - - public SalesOrderRequest withOrderNumberNotContaining(String orderNumber){ - return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); - } - - public SalesOrderRequest withOrderNumberNotStartingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); - } - - public SalesOrderRequest withOrderNumberEndingWith(String orderNumber){ - return withOrderNumber(Operator.END_WITH, orderNumber); - } - - public SalesOrderRequest withOrderNumberNotEndingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_END_WITH, orderNumber); - } - - public SalesOrderRequest withOrderNumberIs(String orderNumber){ - return withOrderNumber(Operator.EQUAL, orderNumber); - } - - public SalesOrderRequest withOrderNumberSoundingLike(String orderNumber){ - return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); - } - - - - public SalesOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SalesOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SalesOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SalesOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SalesOrder.VERSION_PROPERTY, operator, values); - } - - public SalesOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SalesOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SalesOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SalesOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SalesOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SalesOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SalesOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SalesOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SalesOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public SalesOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(SalesOrder.ID_PROPERTY, orderItemRequest, OrderItem.SALES_ORDER_PROPERTY)); - } - - public SalesOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SalesOrder.ID_PROPERTY, orderItemRequest, OrderItem.SALES_ORDER_PROPERTY))); - } - - public SalesOrderRequest haveOrderItems(){ - return withOrderItemListMatching(Q.orderItems().unlimited()); - } - - public SalesOrderRequest haveNoOrderItems(){ - return withoutOrderItemListMatching(Q.orderItems().unlimited()); - } - - public SalesOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SalesOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SalesOrderRequest groupByMerchantWithDetails(){ - return groupByMerchantWithDetails(Q.merchants().unlimited()); - } - - public SalesOrderRequest groupByMerchantWithDetails(MerchantRequest subRequest){ - aggregate(SalesOrder.MERCHANT_PROPERTY, subRequest); - return this; - } - - - - public SalesOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SalesOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, SalesOrder.ID_PROPERTY); - return this; - } - public SalesOrderRequest countDistinctMerchant(){ - return countDistinctMerchantAs("merchant_distinct_count"); - } - - public SalesOrderRequest countDistinctMerchantAs(String alias){ - super.countDistinctProperty(alias, SalesOrder.MERCHANT_PROPERTY); - return this; - } - public SalesOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public SalesOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public SalesOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SalesOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, SalesOrder.VERSION_PROPERTY); - return this; - } - public SalesOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ - aggregate(SalesOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); - return this; - } - - public SalesOrderRequest groupById(){ - groupBy(SalesOrder.ID_PROPERTY); - return this; - } - - public SalesOrderRequest groupByIdAs(String retName){ - groupBy(retName, SalesOrder.ID_PROPERTY); - return this; - } - - public SalesOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, SalesOrder.ID_PROPERTY, function); - return this; - } - public SalesOrderRequest groupByMerchantWith(MerchantRequest subRequest){ - groupBy(SalesOrder.MERCHANT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); - return this; - } - public SalesOrderRequest groupByMerchant(){ - groupBy(SalesOrder.MERCHANT_PROPERTY); - return this; - } - - public SalesOrderRequest groupByMerchantAs(String retName){ - groupBy(retName, SalesOrder.MERCHANT_PROPERTY); - return this; - } - - public SalesOrderRequest groupByMerchantWithFunction(String retName, AggrFunction function){ - groupBy(retName, SalesOrder.MERCHANT_PROPERTY, function); - return this; - } - - public SalesOrderRequest groupByOrderNumber(){ - groupBy(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public SalesOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public SalesOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, SalesOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - - public SalesOrderRequest groupByVersion(){ - groupBy(SalesOrder.VERSION_PROPERTY); - return this; - } - - public SalesOrderRequest groupByVersionAs(String retName){ - groupBy(retName, SalesOrder.VERSION_PROPERTY); - return this; - } - - public SalesOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, SalesOrder.VERSION_PROPERTY, function); - return this; - } - - - - public SalesOrderRequest orderByIdAscending(){ - addOrderByAscending(SalesOrder.ID_PROPERTY); - return this; - } - - public SalesOrderRequest orderByIdDescending(){ - addOrderByDescending(SalesOrder.ID_PROPERTY); - return this; - } - - public SalesOrderRequest orderByMerchantAscending(){ - addOrderByAscending(SalesOrder.MERCHANT_PROPERTY); - return this; - } - - public SalesOrderRequest orderByMerchantDescending(){ - addOrderByDescending(SalesOrder.MERCHANT_PROPERTY); - return this; - } - - public SalesOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public SalesOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public SalesOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public SalesOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SalesOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public SalesOrderRequest orderByVersionAscending(){ - addOrderByAscending(SalesOrder.VERSION_PROPERTY); - return this; - } - - public SalesOrderRequest orderByVersionDescending(){ - addOrderByDescending(SalesOrder.VERSION_PROPERTY); - return this; - } - - - public SalesOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ - return statsFromOrderItemsAs(name, subRequest, false); - } - - public SalesOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ - return statsFromOrderItemsAs(REFINEMENTS, subRequest); - } - public MerchantRequest rollUpToMerchant(){ - MerchantRequest merchant = Q.merchants().unlimited(); - this.internalRollUpTo("merchant", merchant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); - return merchant; - } - - - - public SalesOrderRequest countOrderItems(){ - addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.SALES_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest countOrderItemsAs(String name){ - addRelationCount(name, Q.orderItems().unlimited(), OrderItem.SALES_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ - addRelationCount(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest minQuantityOfOrderItems(){ - addRelationScalarAggregate("minQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest minQuantityOfOrderItemsAs(String name){ - return minQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest minQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest maxQuantityOfOrderItems(){ - addRelationScalarAggregate("maxQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest maxQuantityOfOrderItemsAs(String name){ - return maxQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest maxQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest sumQuantityOfOrderItems(){ - addRelationScalarAggregate("sumQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest sumQuantityOfOrderItemsAs(String name){ - return sumQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest sumQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest avgQuantityOfOrderItems(){ - addRelationScalarAggregate("avgQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest avgQuantityOfOrderItemsAs(String name){ - return avgQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest avgQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest standardDeviationQuantityOfOrderItems(){ - addRelationScalarAggregate("stdDevQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest standardDeviationQuantityOfOrderItemsAs(String name){ - return standardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest standardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItems(){ - addRelationScalarAggregate("stdDevPopQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest sampleVarianceQuantityOfOrderItems(){ - addRelationScalarAggregate("varSampQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name){ - return sampleVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItems(){ - addRelationScalarAggregate("varPopQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.SALES_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItems", null, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name){ - return samplePopulationVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public SalesOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.SALES_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItemsAs", name, SalesOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public SalesOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ - return facetByMerchantAs(facetName, merchant, true); - } - - public SalesOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ - addFacet(facetName, SalesOrder.MERCHANT_PROPERTY, merchant, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, SalesOrder.MERCHANT_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SalesOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SalesOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SalesOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SalesOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SalesOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SalesOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/java/com/teaql/ordereditreference/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 86905e0e5..000000000 --- a/examples/round-trip-reference-runtime/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.ordereditreference.EntityMetaRegistry \ No newline at end of file diff --git a/examples/round-trip-reference-runtime/showcase.json b/examples/round-trip-reference-runtime/showcase.json index e9df030d4..5790b5643 100644 --- a/examples/round-trip-reference-runtime/showcase.json +++ b/examples/round-trip-reference-runtime/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "1a34d54140420df516ae53cca73e99dd5107187dddef4679221b36aabc883f73", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/scalar-type-probe/java-app-console/lib/pom.xml b/examples/scalar-type-probe/java-app-console/lib/pom.xml deleted file mode 100644 index 94e09187f..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - freight-quote-settlement-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Checkers.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java deleted file mode 100644 index c5f05d388..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.example.freightquotesettlement; - -import com.example.freightquotesettlement.platform.Platform; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java deleted file mode 100644 index 16334b78c..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/E.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.example.freightquotesettlement; - -import com.example.freightquotesettlement.freightquote.FreightQuote; -import com.example.freightquotesettlement.freightquote.FreightQuoteExpression; -import com.example.freightquotesettlement.platform.Platform; -import com.example.freightquotesettlement.platform.PlatformExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static FreightQuoteExpression freightQuote(FreightQuote freightQuote){ - return new FreightQuoteExpression(new ValueExpression(freightQuote, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.freightQuote()")); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java deleted file mode 100644 index e928f2055..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/EntityMetaRegistry.java +++ /dev/null @@ -1,508 +0,0 @@ - -package com.example.freightquotesettlement; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerFreightQuote(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.example.freightquotesettlement.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.freightquotesettlement.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.freightquotesettlement.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.example.freightquotesettlement.platform.Platform::new); - entityDescriptor.with("name", "Dispatch Platform") - - .with("module", "Freight") - - .with("module_key", "freight") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Harbor Freight Desk") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerFreightQuote() { - FieldLayout.installGenerated(com.example.freightquotesettlement.freightquote.FreightQuote.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.freightquotesettlement.freightquote.FreightQuote.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.freightquotesettlement.freightquote.FreightQuote.class); - entityDescriptor.setEntitySupplier(com.example.freightquotesettlement.freightquote.FreightQuote::new); - entityDescriptor.with("name", "Freight Quote") - - .with("module", "Freight") - - .with("module_key", "freight") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.freightquotesettlement.freightquote.FreightQuote.PLATFORM_PROPERTY, com.example.freightquotesettlement.platform.Platform.INTERNAL_TYPE, com.example.freightquotesettlement.platform.Platform.FREIGHT_QUOTE_LIST_PROPERTY, com.example.freightquotesettlement.platform.Platform.class) - ; - PropertyDescriptor reference = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY, String.class) - ; - PropertyDescriptor amount = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor shipmentNumber = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY, Long.class) - ; - PropertyDescriptor packageCount = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY, Integer.class) - ; - PropertyDescriptor deliveryDate = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY, LocalDate.class) - ; - PropertyDescriptor pickupTime = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY, LocalTime.class) - ; - PropertyDescriptor quotedAt = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor instructions = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.INSTRUCTIONS_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.REFERENCE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.AMOUNT_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.SHIPMENT_NUMBER_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PACKAGE_COUNT_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.DELIVERY_DATE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDate") - - .with("sqlType", "DATE") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "Date") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.PICKUP_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalTime") - - .with("sqlType", "TIME") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Time") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.QUOTED_AT_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.INSTRUCTIONS_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.freightquotesettlement.freightquote.FreightQuote.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java deleted file mode 100644 index 2dfb38496..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/FreightQuoteSettlementUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.freightquotesettlement; - -import io.teaql.core.UserContext; -public interface FreightQuoteSettlementUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java deleted file mode 100644 index c90b62ca2..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/GeneratedRuntimeModule.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.freightquotesettlement; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.freightquotesettlement.platform.PlatformChecker(), new com.example.freightquotesettlement.freightquote.FreightQuoteChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:3b8da34e762562f0877bfd04865e33c225b4d854c8a5914ea30b4a922d3df3b7\",\"entities\":{\"FreightQuote\":{\"labels\":{\"en\":\"Freight Quote\"},\"fields\":[{\"name\":\"amount\",\"labels\":{\"en\":\"amount\"},\"aliases\":[\"Amount\"]},{\"name\":\"delivery_date\",\"labels\":{\"en\":\"delivery date\"},\"aliases\":[\"DeliveryDate\",\"deliveryDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"instructions\",\"labels\":{\"en\":\"instructions\"},\"aliases\":[\"Instructions\"]},{\"name\":\"package_count\",\"labels\":{\"en\":\"package count\"},\"aliases\":[\"PackageCount\",\"packageCount\"]},{\"name\":\"pickup_time\",\"labels\":{\"en\":\"pickup time\"},\"aliases\":[\"PickupTime\",\"pickupTime\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Dispatch Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"quoted_at\",\"labels\":{\"en\":\"quoted at\"},\"aliases\":[\"QuotedAt\",\"quotedAt\"]},{\"name\":\"reference\",\"labels\":{\"en\":\"reference\"},\"aliases\":[\"Reference\"]},{\"name\":\"shipment_number\",\"labels\":{\"en\":\"shipment number\"},\"aliases\":[\"ShipmentNumber\",\"shipmentNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Dispatch Platform\"},\"fields\":[{\"name\":\"freight_quote_list\",\"targetType\":\"FreightQuote\",\"labels\":{\"en\":\"Freight Quote\"},\"aliases\":[\"FreightQuoteList\",\"freightQuoteList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("FreightQuote", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("reference", "reference"), java.util.Map.entry("amount", "amount"), java.util.Map.entry("shipment_number", "shipmentNumber"), java.util.Map.entry("package_count", "packageCount"), java.util.Map.entry("delivery_date", "deliveryDate"), java.util.Map.entry("pickup_time", "pickupTime"), java.util.Map.entry("quoted_at", "quotedAt"), java.util.Map.entry("instructions", "instructions"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.freightquotesettlement.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.freightquotesettlement.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Harbor Freight Desk"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - } -} diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java deleted file mode 100644 index 7e977454e..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Q.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.freightquotesettlement; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.freightquotesettlement.platform.PlatformRequest platforms(){ - return new com.example.freightquotesettlement.platform.PlatformRequest(com.example.freightquotesettlement.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.freightquotesettlement.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.example.freightquotesettlement.platform.PlatformRequest(com.example.freightquotesettlement.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.freightquotesettlement.freightquote.FreightQuoteRequest freightQuotes(){ - return new com.example.freightquotesettlement.freightquote.FreightQuoteRequest(com.example.freightquotesettlement.freightquote.FreightQuote.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.freightquotesettlement.freightquote.FreightQuoteRequest freightQuotesWithMinimalFields(){ - return new com.example.freightquotesettlement.freightquote.FreightQuoteRequest(com.example.freightquotesettlement.freightquote.FreightQuote.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Repositories.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java deleted file mode 100644 index 4f6fcf146..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuote.java +++ /dev/null @@ -1,273 +0,0 @@ - -package com.example.freightquotesettlement.freightquote; - -import com.example.freightquotesettlement.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class FreightQuote extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "FreightQuote"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "661de8675c51355614d50183496c991171adfdb1f52cc15029141a8114080a1e"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("reference", 2), java.util.Map.entry("amount", 3), java.util.Map.entry("shipment_number", 4), java.util.Map.entry("package_count", 5), java.util.Map.entry("delivery_date", 6), java.util.Map.entry("pickup_time", 7), java.util.Map.entry("quoted_at", 8), java.util.Map.entry("instructions", 9), java.util.Map.entry("version", 10)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("reference", java.util.List.of("reference", "reference")), java.util.Map.entry("amount", java.util.List.of("amount", "amount")), java.util.Map.entry("shipment_number", java.util.List.of("shipmentNumber", "shipment_number")), java.util.Map.entry("package_count", java.util.List.of("packageCount", "package_count")), java.util.Map.entry("delivery_date", java.util.List.of("deliveryDate", "delivery_date")), java.util.Map.entry("pickup_time", java.util.List.of("pickupTime", "pickup_time")), java.util.Map.entry("quoted_at", java.util.List.of("quotedAt", "quoted_at")), java.util.Map.entry("instructions", java.util.List.of("instructions", "instructions")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - FreightQuote.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String REFERENCE_PROPERTY = "reference"; - public static final String AMOUNT_PROPERTY = "amount"; - public static final String SHIPMENT_NUMBER_PROPERTY = "shipment_number"; - public static final String PACKAGE_COUNT_PROPERTY = "package_count"; - public static final String DELIVERY_DATE_PROPERTY = "delivery_date"; - public static final String PICKUP_TIME_PROPERTY = "pickup_time"; - public static final String QUOTED_AT_PROPERTY = "quoted_at"; - public static final String INSTRUCTIONS_PROPERTY = "instructions"; - private Platform platform; - - private String reference; - - private BigDecimal amount; - - private Long shipmentNumber; - - private Integer packageCount; - - private LocalDate deliveryDate; - - private LocalTime pickupTime; - - private LocalDateTime quotedAt; - - private String instructions; - - - public Platform getPlatform(){ - return this.platform; - } - - public String getReference(){ - return this.reference; - } - - public BigDecimal getAmount(){ - return this.amount; - } - - public Long getShipmentNumber(){ - return this.shipmentNumber; - } - - public Integer getPackageCount(){ - return this.packageCount; - } - - public LocalDate getDeliveryDate(){ - return this.deliveryDate; - } - - public LocalTime getPickupTime(){ - return this.pickupTime; - } - - public LocalDateTime getQuotedAt(){ - return this.quotedAt; - } - - public String getInstructions(){ - return this.instructions; - } - - public FreightQuote updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public FreightQuote updateReference(String reference){ - reference = (reference == null ? null : reference.trim()); - if(isPropertyLoaded(REFERENCE_PROPERTY) && Objects.equals(this.reference, reference)){ - return this; - } - handleUpdate(REFERENCE_PROPERTY, getReference(), reference); - this.reference = reference; - return this; - } - - public FreightQuote updateAmount(BigDecimal amount){ - if(isPropertyLoaded(AMOUNT_PROPERTY) && Objects.equals(this.amount, amount)){ - return this; - } - handleUpdate(AMOUNT_PROPERTY, getAmount(), amount); - this.amount = amount; - return this; - } - - public FreightQuote updateShipmentNumber(Long shipmentNumber){ - if(isPropertyLoaded(SHIPMENT_NUMBER_PROPERTY) && Objects.equals(this.shipmentNumber, shipmentNumber)){ - return this; - } - handleUpdate(SHIPMENT_NUMBER_PROPERTY, getShipmentNumber(), shipmentNumber); - this.shipmentNumber = shipmentNumber; - return this; - } - - public FreightQuote updatePackageCount(Integer packageCount){ - if(isPropertyLoaded(PACKAGE_COUNT_PROPERTY) && Objects.equals(this.packageCount, packageCount)){ - return this; - } - handleUpdate(PACKAGE_COUNT_PROPERTY, getPackageCount(), packageCount); - this.packageCount = packageCount; - return this; - } - - public FreightQuote updateDeliveryDate(LocalDate deliveryDate){ - if(isPropertyLoaded(DELIVERY_DATE_PROPERTY) && Objects.equals(this.deliveryDate, deliveryDate)){ - return this; - } - handleUpdate(DELIVERY_DATE_PROPERTY, getDeliveryDate(), deliveryDate); - this.deliveryDate = deliveryDate; - return this; - } - - public FreightQuote updatePickupTime(LocalTime pickupTime){ - if(isPropertyLoaded(PICKUP_TIME_PROPERTY) && Objects.equals(this.pickupTime, pickupTime)){ - return this; - } - handleUpdate(PICKUP_TIME_PROPERTY, getPickupTime(), pickupTime); - this.pickupTime = pickupTime; - return this; - } - - public FreightQuote updateQuotedAt(LocalDateTime quotedAt){ - if(isPropertyLoaded(QUOTED_AT_PROPERTY) && Objects.equals(this.quotedAt, quotedAt)){ - return this; - } - handleUpdate(QUOTED_AT_PROPERTY, getQuotedAt(), quotedAt); - this.quotedAt = quotedAt; - return this; - } - - public FreightQuote updateInstructions(String instructions){ - instructions = (instructions == null ? null : instructions.trim()); - if(isPropertyLoaded(INSTRUCTIONS_PROPERTY) && Objects.equals(this.instructions, instructions)){ - return this; - } - handleUpdate(INSTRUCTIONS_PROPERTY, getInstructions(), instructions); - this.instructions = instructions; - return this; - } - - - public static FreightQuote refer(Long id){ - FreightQuote refer = new FreightQuote(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public FreightQuote comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "reference": this.reference = (value == null ? null : ((String)value).trim()); break; - - case "amount": this.amount = (BigDecimal) value; break; - - case "shipment_number": this.shipmentNumber = (Long) value; break; - - case "package_count": this.packageCount = (Integer) value; break; - - case "delivery_date": this.deliveryDate = (LocalDate) value; break; - - case "pickup_time": this.pickupTime = (LocalTime) value; break; - - case "quoted_at": this.quotedAt = (LocalDateTime) value; break; - - case "instructions": this.instructions = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "reference": return this.reference; - case "amount": return this.amount; - case "shipment_number": return this.shipmentNumber; - case "package_count": return this.packageCount; - case "delivery_date": return this.deliveryDate; - case "pickup_time": return this.pickupTime; - case "quoted_at": return this.quotedAt; - case "instructions": return this.instructions; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "reference": return this.reference; - case "amount": return this.amount; - case "shipmentNumber": return this.shipmentNumber; - case "packageCount": return this.packageCount; - case "deliveryDate": return this.deliveryDate; - case "pickupTime": return this.pickupTime; - case "quotedAt": return this.quotedAt; - case "instructions": return this.instructions; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java deleted file mode 100644 index c716fce7d..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteChecker.java +++ /dev/null @@ -1,134 +0,0 @@ - -package com.example.freightquotesettlement.freightquote; - -import com.example.freightquotesettlement.platform.Platform; -import com.example.freightquotesettlement.platform.PlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; - -public class FreightQuoteChecker implements Checker{ - - public String type(){ - return FreightQuote.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, FreightQuote freightQuote, ObjectLocation _parentLocation){ - if(needCheck(_context, freightQuote)){ - markAsChecked(_context, freightQuote); - doCheck(_context, freightQuote, _parentLocation); - } - } - - public void doCheck(UserContext _context, FreightQuote freightQuote, ObjectLocation _parentLocation){ - if((freightQuote == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, freightQuote); - if(freightQuote.needPersist()){ - } - if(freightQuote.newItem()){ - }else if(freightQuote.updateItem()){ - if(!freightQuote.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("reference")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "reference"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("amount")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "amount"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("shipment_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "shipment_number"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("package_count")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "package_count"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("delivery_date")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "delivery_date"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("pickup_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "pickup_time"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("quoted_at")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "quoted_at"), "Mutation requires a fully loaded entity"); - } - if(!freightQuote.isPropertyLoaded("instructions")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "instructions"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, freightQuote.getProperty(FreightQuote.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkReference(_context, freightQuote.getProperty(FreightQuote.REFERENCE_PROPERTY), newLocation(_parentLocation, "reference")); - checkAmount(_context, freightQuote.getProperty(FreightQuote.AMOUNT_PROPERTY), newLocation(_parentLocation, "amount")); - checkShipmentNumber(_context, freightQuote.getProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY), newLocation(_parentLocation, "shipment_number")); - checkPackageCount(_context, freightQuote.getProperty(FreightQuote.PACKAGE_COUNT_PROPERTY), newLocation(_parentLocation, "package_count")); - checkDeliveryDate(_context, freightQuote.getProperty(FreightQuote.DELIVERY_DATE_PROPERTY), newLocation(_parentLocation, "delivery_date")); - checkPickupTime(_context, freightQuote.getProperty(FreightQuote.PICKUP_TIME_PROPERTY), newLocation(_parentLocation, "pickup_time")); - checkQuotedAt(_context, freightQuote.getProperty(FreightQuote.QUOTED_AT_PROPERTY), newLocation(_parentLocation, "quoted_at")); - checkInstructions(_context, freightQuote.getProperty(FreightQuote.INSTRUCTIONS_PROPERTY), newLocation(_parentLocation, "instructions")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkReference(UserContext _context, String reference, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, reference); - if((reference == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, reference); - - } - public void checkAmount(UserContext _context, BigDecimal amount, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, amount); - if((amount == null)){ - return; - } - } - public void checkShipmentNumber(UserContext _context, Long shipmentNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, shipmentNumber); - if((shipmentNumber == null)){ - return; - } - } - public void checkPackageCount(UserContext _context, Integer packageCount, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, packageCount); - if((packageCount == null)){ - return; - } - } - public void checkDeliveryDate(UserContext _context, LocalDate deliveryDate, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, deliveryDate); - if((deliveryDate == null)){ - return; - } - } - public void checkPickupTime(UserContext _context, LocalTime pickupTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, pickupTime); - if((pickupTime == null)){ - return; - } - } - public void checkQuotedAt(UserContext _context, LocalDateTime quotedAt, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, quotedAt); - if((quotedAt == null)){ - return; - } - } - public void checkInstructions(UserContext _context, String instructions, ObjectLocation _parentLocation){ - if((instructions == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, instructions); - - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java deleted file mode 100644 index 04f2c5ee5..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteExpression.java +++ /dev/null @@ -1,106 +0,0 @@ - -package com.example.freightquotesettlement.freightquote; - -import com.example.freightquotesettlement.platform.Platform; -import com.example.freightquotesettlement.platform.PlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.function.Function; - -public class FreightQuoteExpression extends ExpressionAdaptor implements BaseEntityExpression { - public FreightQuoteExpression(Expression expression){ - super(expression); - } - - public FreightQuoteExpression(Expression expression, Function function){ - super(expression, function); - } - - public FreightQuoteExpression updateId(Long id){ - return new FreightQuoteExpression(this, $it -> {((FreightQuote)$it).__internalSet("id", id); return this;}); - } - - public FreightQuoteExpression save(UserContext userContext){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).auditAs("Saved by Expression").save(userContext)); - } - - public FreightQuoteExpression save(String intent, UserContext userContext){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", FreightQuote::getPlatform)); - } - - public FreightQuoteExpression updatePlatform(Platform platform){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePlatform(platform)); - } - - public Expression getReference(){ - return loaded("reference", "getReference", FreightQuote::getReference); - } - public FreightQuoteExpression updateReference(String reference){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateReference(reference)); - } - - public Expression getAmount(){ - return loaded("amount", "getAmount", FreightQuote::getAmount); - } - public FreightQuoteExpression updateAmount(BigDecimal amount){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateAmount(amount)); - } - - public Expression getShipmentNumber(){ - return loaded("shipment_number", "getShipmentNumber", FreightQuote::getShipmentNumber); - } - public FreightQuoteExpression updateShipmentNumber(Long shipmentNumber){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateShipmentNumber(shipmentNumber)); - } - - public Expression getPackageCount(){ - return loaded("package_count", "getPackageCount", FreightQuote::getPackageCount); - } - public FreightQuoteExpression updatePackageCount(Integer packageCount){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePackageCount(packageCount)); - } - - public Expression getDeliveryDate(){ - return loaded("delivery_date", "getDeliveryDate", FreightQuote::getDeliveryDate); - } - public FreightQuoteExpression updateDeliveryDate(LocalDate deliveryDate){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateDeliveryDate(deliveryDate)); - } - - public Expression getPickupTime(){ - return loaded("pickup_time", "getPickupTime", FreightQuote::getPickupTime); - } - public FreightQuoteExpression updatePickupTime(LocalTime pickupTime){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updatePickupTime(pickupTime)); - } - - public Expression getQuotedAt(){ - return loaded("quoted_at", "getQuotedAt", FreightQuote::getQuotedAt); - } - public FreightQuoteExpression updateQuotedAt(LocalDateTime quotedAt){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateQuotedAt(quotedAt)); - } - - public Expression getInstructions(){ - return loaded("instructions", "getInstructions", FreightQuote::getInstructions); - } - public FreightQuoteExpression updateInstructions(String instructions){ - return new FreightQuoteExpression(this, $it -> ((FreightQuote)$it).updateInstructions(instructions)); - } - -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java deleted file mode 100644 index 0f5131b45..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.freightquotesettlement.freightquote; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class FreightQuoteListExpression extends SmartListExpression { - public FreightQuoteListExpression(Expression> expression){ - super(expression); - } - - public FreightQuoteListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public FreightQuoteExpression first() { - return new FreightQuoteExpression(super.first()); - } - - public FreightQuoteExpression get(int index) { - return new FreightQuoteExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java deleted file mode 100644 index e19feac84..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/freightquote/FreightQuoteRequest.java +++ /dev/null @@ -1,1774 +0,0 @@ - -package com.example.freightquotesettlement.freightquote; - -import com.example.freightquotesettlement.Q; -import com.example.freightquotesettlement.platform.Platform; -import com.example.freightquotesettlement.platform.PlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.util.Date; -import java.util.Objects; - -public class FreightQuoteRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public FreightQuoteRequest(Class returnType){ - this(returnType, () -> (T) new FreightQuote()); - } - - protected FreightQuoteRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public FreightQuoteRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public FreightQuoteRequest copy(){ - return (FreightQuoteRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new FreightQuoteRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public FreightQuoteRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public FreightQuoteRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public FreightQuoteRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public FreightQuoteRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public FreightQuoteRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public FreightQuoteRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public FreightQuoteRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public FreightQuoteRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public FreightQuoteRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public FreightQuoteRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (FreightQuoteRequest)super.appendSearchCriteria(searchCriteria); - } - - public FreightQuoteRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public FreightQuoteRequest matchingAnyOf(FreightQuoteRequest freightQuote){ - super.internalMatchAny(freightQuote); - return this; - } - - public FreightQuoteRequest matchingIdsOf(FreightQuoteRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - FreightQuote.ID_PROPERTY, request, FreightQuote.ID_PROPERTY)); - } - - public FreightQuoteRequest enhanceChildrenIfNeeded(){ - return this; - } - - public FreightQuoteRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public FreightQuoteRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public FreightQuoteRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); - } - - public FreightQuoteRequest selectSelfFields(){ - return selectSelf(); - } - - public FreightQuoteRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(FreightQuote.ID_PROPERTY); - selectProperty(FreightQuote.PLATFORM_PROPERTY); - selectProperty(FreightQuote.REFERENCE_PROPERTY); - selectProperty(FreightQuote.AMOUNT_PROPERTY); - selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); - selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); - selectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); - selectProperty(FreightQuote.PICKUP_TIME_PROPERTY); - selectProperty(FreightQuote.QUOTED_AT_PROPERTY); - selectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); - selectProperty(FreightQuote.VERSION_PROPERTY); - return this; - } - - public FreightQuoteRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); - } - - public FreightQuoteRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectReference().selectAmount().selectShipmentNumber().selectPackageCount().selectDeliveryDate().selectPickupTime().selectQuotedAt().selectInstructions().selectVersion(); - } - - - public FreightQuoteRequest selectId(){ - selectProperty(FreightQuote.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectId(){ - unselectProperty(FreightQuote.ID_PROPERTY); - return this; - } - public FreightQuoteRequest selectPlatformIdOnly(){ - selectProperty(FreightQuote.PLATFORM_PROPERTY); - return this; - } - - public FreightQuoteRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public FreightQuoteRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(FreightQuote.PLATFORM_PROPERTY); - enhanceRelation(FreightQuote.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, FreightQuote.PLATFORM_PROPERTY)); - return this; - } - - public FreightQuoteRequest unselectPlatform(){ - unselectProperty(FreightQuote.PLATFORM_PROPERTY); - return this; - } - public FreightQuoteRequest selectReference(){ - selectProperty(FreightQuote.REFERENCE_PROPERTY); - return this; - } - - /** - * fill the reference with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS reference) to fetch reference property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectReference(){ - unselectProperty(FreightQuote.REFERENCE_PROPERTY); - return this; - } - public FreightQuoteRequest selectAmount(){ - selectProperty(FreightQuote.AMOUNT_PROPERTY); - return this; - } - - /** - * fill the amount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS amount) to fetch amount property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the amount with customized aggrFunction, TEAQL uses ({aggrFunction}(amount) AS amount to fetch amount property. - * @param aggrFunction aggrFunction - */ - public FreightQuoteRequest selectAmount(AggrFunction aggrFunction){ - selectProperty(FreightQuote.AMOUNT_PROPERTY, aggrFunction); - return this; - } - - - public FreightQuoteRequest unselectAmount(){ - unselectProperty(FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest selectShipmentNumber(){ - selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - - /** - * fill the shipmentNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS shipmentNumber) to fetch shipmentNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the shipmentNumber with customized aggrFunction, TEAQL uses ({aggrFunction}(shipmentNumber) AS shipmentNumber to fetch shipmentNumber property. - * @param aggrFunction aggrFunction - */ - public FreightQuoteRequest selectShipmentNumber(AggrFunction aggrFunction){ - selectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY, aggrFunction); - return this; - } - - - public FreightQuoteRequest unselectShipmentNumber(){ - unselectProperty(FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest selectPackageCount(){ - selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - - /** - * fill the packageCount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS packageCount) to fetch packageCount property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the packageCount with customized aggrFunction, TEAQL uses ({aggrFunction}(packageCount) AS packageCount to fetch packageCount property. - * @param aggrFunction aggrFunction - */ - public FreightQuoteRequest selectPackageCount(AggrFunction aggrFunction){ - selectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY, aggrFunction); - return this; - } - - - public FreightQuoteRequest unselectPackageCount(){ - unselectProperty(FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest selectDeliveryDate(){ - selectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - - /** - * fill the deliveryDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS deliveryDate) to fetch deliveryDate property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectDeliveryDate(){ - unselectProperty(FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - public FreightQuoteRequest selectPickupTime(){ - selectProperty(FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - - /** - * fill the pickupTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS pickupTime) to fetch pickupTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectPickupTime(){ - unselectProperty(FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - public FreightQuoteRequest selectQuotedAt(){ - selectProperty(FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - - /** - * fill the quotedAt with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quotedAt) to fetch quotedAt property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectQuotedAt(){ - unselectProperty(FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - public FreightQuoteRequest selectInstructions(){ - selectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - - /** - * fill the instructions with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS instructions) to fetch instructions property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectInstructions(){ - unselectProperty(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - public FreightQuoteRequest selectVersion(){ - selectProperty(FreightQuote.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public FreightQuoteRequest unselectVersion(){ - unselectProperty(FreightQuote.VERSION_PROPERTY); - return this; - } - - public FreightQuoteRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.ID_PROPERTY, operator, values); - } - - public FreightQuoteRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public FreightQuoteRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public FreightQuoteRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public FreightQuoteRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public FreightQuoteRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public FreightQuoteRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public FreightQuoteRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public FreightQuoteRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.PLATFORM_PROPERTY, operator, values); - } - - public FreightQuoteRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public FreightQuoteRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(FreightQuote.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public FreightQuoteRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(FreightQuote.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public FreightQuoteRequest filterByReference(String... reference){ - if (reference == null || reference.length == 0) { - throw new IllegalArgumentException("filterByReference parameter reference cannot be empty"); - } - return appendSearchCriteria(createReferenceCriteria(Operator.EQUAL, (Object[])reference)); - } - - public FreightQuoteRequest withReference(Operator operator, Object... values){ - return appendSearchCriteria(createReferenceCriteria(operator, values)); - } - - public FreightQuoteRequest withReferenceIsUnknown(){ - return withReference(Operator.IS_NULL); - } - - public FreightQuoteRequest withReferenceIsKnown(){ - return withReference(Operator.IS_NOT_NULL); - } - - public SearchCriteria createReferenceCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.REFERENCE_PROPERTY, operator, values); - } - - public FreightQuoteRequest withReferenceIsNot(String reference){ - return withReference(Operator.NOT_EQUAL, reference); - } - - public FreightQuoteRequest withReferenceIn(String... reference){ - return withReference(Operator.IN, (Object[])reference); - } - - public FreightQuoteRequest withReferenceNotIn(String... reference){ - return withReference(Operator.NOT_IN, (Object[])reference); - } - public FreightQuoteRequest withReferenceGreaterThan(String reference){ - return withReference(Operator.GREATER_THAN, reference); - } - - public FreightQuoteRequest withReferenceGreaterThanOrEqualTo(String reference){ - return withReference(Operator.GREATER_THAN_OR_EQUAL, reference); - } - - public FreightQuoteRequest withReferenceLessThan(String reference){ - return withReference(Operator.LESS_THAN, reference); - } - - public FreightQuoteRequest withReferenceLessThanOrEqualTo(String reference){ - return withReference(Operator.LESS_THAN_OR_EQUAL, reference); - } - - public FreightQuoteRequest withReferenceBetween(String startOfReference, String endOfReference){ - return withReference(Operator.BETWEEN, startOfReference, endOfReference); - } - public FreightQuoteRequest withReferenceStartingWith(String reference){ - return withReference(Operator.BEGIN_WITH, reference); - } - public FreightQuoteRequest withReferenceContaining(String reference){ - return withReference(Operator.CONTAIN, reference); - } - - public FreightQuoteRequest withReferenceNotContaining(String reference){ - return withReference(Operator.NOT_CONTAIN, reference); - } - - public FreightQuoteRequest withReferenceNotStartingWith(String reference){ - return withReference(Operator.NOT_BEGIN_WITH, reference); - } - - public FreightQuoteRequest withReferenceEndingWith(String reference){ - return withReference(Operator.END_WITH, reference); - } - - public FreightQuoteRequest withReferenceNotEndingWith(String reference){ - return withReference(Operator.NOT_END_WITH, reference); - } - - public FreightQuoteRequest withReferenceIs(String reference){ - return withReference(Operator.EQUAL, reference); - } - - public FreightQuoteRequest withReferenceSoundingLike(String reference){ - return withReference(Operator.SOUNDS_LIKE, reference); - } - - - - public FreightQuoteRequest filterByAmount(BigDecimal... amount){ - if (amount == null || amount.length == 0) { - throw new IllegalArgumentException("filterByAmount parameter amount cannot be empty"); - } - return appendSearchCriteria(createAmountCriteria(Operator.EQUAL, (Object[])amount)); - } - - public FreightQuoteRequest withAmount(Operator operator, Object... values){ - return appendSearchCriteria(createAmountCriteria(operator, values)); - } - - public FreightQuoteRequest withAmountIsUnknown(){ - return withAmount(Operator.IS_NULL); - } - - public FreightQuoteRequest withAmountIsKnown(){ - return withAmount(Operator.IS_NOT_NULL); - } - - public SearchCriteria createAmountCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.AMOUNT_PROPERTY, operator, values); - } - - public FreightQuoteRequest withAmountIs(BigDecimal amount){ - return withAmount(Operator.EQUAL, amount); - } - - public FreightQuoteRequest withAmountIsNot(BigDecimal amount){ - return withAmount(Operator.NOT_EQUAL, amount); - } - - public FreightQuoteRequest withAmountIn(BigDecimal... amount){ - return withAmount(Operator.IN, (Object[])amount); - } - - public FreightQuoteRequest withAmountNotIn(BigDecimal... amount){ - return withAmount(Operator.NOT_IN, (Object[])amount); - } - public FreightQuoteRequest withAmountGreaterThan(BigDecimal amount){ - return withAmount(Operator.GREATER_THAN, amount); - } - - public FreightQuoteRequest withAmountGreaterThanOrEqualTo(BigDecimal amount){ - return withAmount(Operator.GREATER_THAN_OR_EQUAL, amount); - } - - public FreightQuoteRequest withAmountLessThan(BigDecimal amount){ - return withAmount(Operator.LESS_THAN, amount); - } - - public FreightQuoteRequest withAmountLessThanOrEqualTo(BigDecimal amount){ - return withAmount(Operator.LESS_THAN_OR_EQUAL, amount); - } - - public FreightQuoteRequest withAmountBetween(BigDecimal startOfAmount, BigDecimal endOfAmount){ - return withAmount(Operator.BETWEEN, startOfAmount, endOfAmount); - } - - - - public FreightQuoteRequest filterByShipmentNumber(Long... shipmentNumber){ - if (shipmentNumber == null || shipmentNumber.length == 0) { - throw new IllegalArgumentException("filterByShipmentNumber parameter shipmentNumber cannot be empty"); - } - return appendSearchCriteria(createShipmentNumberCriteria(Operator.EQUAL, (Object[])shipmentNumber)); - } - - public FreightQuoteRequest withShipmentNumber(Operator operator, Object... values){ - return appendSearchCriteria(createShipmentNumberCriteria(operator, values)); - } - - public FreightQuoteRequest withShipmentNumberIsUnknown(){ - return withShipmentNumber(Operator.IS_NULL); - } - - public FreightQuoteRequest withShipmentNumberIsKnown(){ - return withShipmentNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createShipmentNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.SHIPMENT_NUMBER_PROPERTY, operator, values); - } - - public FreightQuoteRequest withShipmentNumberIs(Long shipmentNumber){ - return withShipmentNumber(Operator.EQUAL, shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberIsNot(Long shipmentNumber){ - return withShipmentNumber(Operator.NOT_EQUAL, shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberIn(Long... shipmentNumber){ - return withShipmentNumber(Operator.IN, (Object[])shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberNotIn(Long... shipmentNumber){ - return withShipmentNumber(Operator.NOT_IN, (Object[])shipmentNumber); - } - public FreightQuoteRequest withShipmentNumberGreaterThan(Long shipmentNumber){ - return withShipmentNumber(Operator.GREATER_THAN, shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberGreaterThanOrEqualTo(Long shipmentNumber){ - return withShipmentNumber(Operator.GREATER_THAN_OR_EQUAL, shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberLessThan(Long shipmentNumber){ - return withShipmentNumber(Operator.LESS_THAN, shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberLessThanOrEqualTo(Long shipmentNumber){ - return withShipmentNumber(Operator.LESS_THAN_OR_EQUAL, shipmentNumber); - } - - public FreightQuoteRequest withShipmentNumberBetween(Long startOfShipmentNumber, Long endOfShipmentNumber){ - return withShipmentNumber(Operator.BETWEEN, startOfShipmentNumber, endOfShipmentNumber); - } - - - - public FreightQuoteRequest filterByPackageCount(Integer... packageCount){ - if (packageCount == null || packageCount.length == 0) { - throw new IllegalArgumentException("filterByPackageCount parameter packageCount cannot be empty"); - } - return appendSearchCriteria(createPackageCountCriteria(Operator.EQUAL, (Object[])packageCount)); - } - - public FreightQuoteRequest withPackageCount(Operator operator, Object... values){ - return appendSearchCriteria(createPackageCountCriteria(operator, values)); - } - - public FreightQuoteRequest withPackageCountIsUnknown(){ - return withPackageCount(Operator.IS_NULL); - } - - public FreightQuoteRequest withPackageCountIsKnown(){ - return withPackageCount(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPackageCountCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.PACKAGE_COUNT_PROPERTY, operator, values); - } - - public FreightQuoteRequest withPackageCountIs(Integer packageCount){ - return withPackageCount(Operator.EQUAL, packageCount); - } - - public FreightQuoteRequest withPackageCountIsNot(Integer packageCount){ - return withPackageCount(Operator.NOT_EQUAL, packageCount); - } - - public FreightQuoteRequest withPackageCountIn(Integer... packageCount){ - return withPackageCount(Operator.IN, (Object[])packageCount); - } - - public FreightQuoteRequest withPackageCountNotIn(Integer... packageCount){ - return withPackageCount(Operator.NOT_IN, (Object[])packageCount); - } - public FreightQuoteRequest withPackageCountGreaterThan(Integer packageCount){ - return withPackageCount(Operator.GREATER_THAN, packageCount); - } - - public FreightQuoteRequest withPackageCountGreaterThanOrEqualTo(Integer packageCount){ - return withPackageCount(Operator.GREATER_THAN_OR_EQUAL, packageCount); - } - - public FreightQuoteRequest withPackageCountLessThan(Integer packageCount){ - return withPackageCount(Operator.LESS_THAN, packageCount); - } - - public FreightQuoteRequest withPackageCountLessThanOrEqualTo(Integer packageCount){ - return withPackageCount(Operator.LESS_THAN_OR_EQUAL, packageCount); - } - - public FreightQuoteRequest withPackageCountBetween(Integer startOfPackageCount, Integer endOfPackageCount){ - return withPackageCount(Operator.BETWEEN, startOfPackageCount, endOfPackageCount); - } - - - - public FreightQuoteRequest filterByDeliveryDate(LocalDate... deliveryDate){ - if (deliveryDate == null || deliveryDate.length == 0) { - throw new IllegalArgumentException("filterByDeliveryDate parameter deliveryDate cannot be empty"); - } - return appendSearchCriteria(createDeliveryDateCriteria(Operator.EQUAL, (Object[])deliveryDate)); - } - - public FreightQuoteRequest withDeliveryDate(Operator operator, Object... values){ - return appendSearchCriteria(createDeliveryDateCriteria(operator, values)); - } - - public FreightQuoteRequest withDeliveryDateIsUnknown(){ - return withDeliveryDate(Operator.IS_NULL); - } - - public FreightQuoteRequest withDeliveryDateIsKnown(){ - return withDeliveryDate(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDeliveryDateCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.DELIVERY_DATE_PROPERTY, operator, values); - } - - public FreightQuoteRequest withDeliveryDateIs(LocalDate deliveryDate){ - return withDeliveryDate(Operator.EQUAL, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateIsNot(LocalDate deliveryDate){ - return withDeliveryDate(Operator.NOT_EQUAL, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateIn(LocalDate... deliveryDate){ - return withDeliveryDate(Operator.IN, (Object[])deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateNotIn(LocalDate... deliveryDate){ - return withDeliveryDate(Operator.NOT_IN, (Object[])deliveryDate); - } - public FreightQuoteRequest withDeliveryDateGreaterThan(LocalDate deliveryDate){ - return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateGreaterThanOrEqualTo(LocalDate deliveryDate){ - return withDeliveryDate(Operator.GREATER_THAN_OR_EQUAL, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateLessThan(LocalDate deliveryDate){ - return withDeliveryDate(Operator.LESS_THAN, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateLessThanOrEqualTo(LocalDate deliveryDate){ - return withDeliveryDate(Operator.LESS_THAN_OR_EQUAL, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateBetween(LocalDate startOfDeliveryDate, LocalDate endOfDeliveryDate){ - return withDeliveryDate(Operator.BETWEEN, startOfDeliveryDate, endOfDeliveryDate); - } - public FreightQuoteRequest withDeliveryDateBefore(LocalDate deliveryDate){ - return withDeliveryDate(Operator.LESS_THAN, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateBefore(Date deliveryDate){ - return withDeliveryDate(Operator.LESS_THAN, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateAfter(LocalDate deliveryDate){ - return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateAfter(Date deliveryDate){ - return withDeliveryDate(Operator.GREATER_THAN, deliveryDate); - } - - public FreightQuoteRequest withDeliveryDateBetween(Date startOfDeliveryDate, Date endOfDeliveryDate){ - return withDeliveryDate(Operator.BETWEEN, startOfDeliveryDate, endOfDeliveryDate); - } - - - - - public FreightQuoteRequest filterByPickupTime(LocalTime... pickupTime){ - if (pickupTime == null || pickupTime.length == 0) { - throw new IllegalArgumentException("filterByPickupTime parameter pickupTime cannot be empty"); - } - return appendSearchCriteria(createPickupTimeCriteria(Operator.EQUAL, (Object[])pickupTime)); - } - - public FreightQuoteRequest withPickupTime(Operator operator, Object... values){ - return appendSearchCriteria(createPickupTimeCriteria(operator, values)); - } - - public FreightQuoteRequest withPickupTimeIsUnknown(){ - return withPickupTime(Operator.IS_NULL); - } - - public FreightQuoteRequest withPickupTimeIsKnown(){ - return withPickupTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPickupTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.PICKUP_TIME_PROPERTY, operator, values); - } - - public FreightQuoteRequest withPickupTimeIs(LocalTime pickupTime){ - return withPickupTime(Operator.EQUAL, pickupTime); - } - - public FreightQuoteRequest withPickupTimeIsNot(LocalTime pickupTime){ - return withPickupTime(Operator.NOT_EQUAL, pickupTime); - } - - public FreightQuoteRequest withPickupTimeIn(LocalTime... pickupTime){ - return withPickupTime(Operator.IN, (Object[])pickupTime); - } - - public FreightQuoteRequest withPickupTimeNotIn(LocalTime... pickupTime){ - return withPickupTime(Operator.NOT_IN, (Object[])pickupTime); - } - public FreightQuoteRequest withPickupTimeGreaterThan(LocalTime pickupTime){ - return withPickupTime(Operator.GREATER_THAN, pickupTime); - } - - public FreightQuoteRequest withPickupTimeGreaterThanOrEqualTo(LocalTime pickupTime){ - return withPickupTime(Operator.GREATER_THAN_OR_EQUAL, pickupTime); - } - - public FreightQuoteRequest withPickupTimeLessThan(LocalTime pickupTime){ - return withPickupTime(Operator.LESS_THAN, pickupTime); - } - - public FreightQuoteRequest withPickupTimeLessThanOrEqualTo(LocalTime pickupTime){ - return withPickupTime(Operator.LESS_THAN_OR_EQUAL, pickupTime); - } - - public FreightQuoteRequest withPickupTimeBetween(LocalTime startOfPickupTime, LocalTime endOfPickupTime){ - return withPickupTime(Operator.BETWEEN, startOfPickupTime, endOfPickupTime); - } - - - public FreightQuoteRequest filterByQuotedAt(LocalDateTime... quotedAt){ - if (quotedAt == null || quotedAt.length == 0) { - throw new IllegalArgumentException("filterByQuotedAt parameter quotedAt cannot be empty"); - } - return appendSearchCriteria(createQuotedAtCriteria(Operator.EQUAL, (Object[])quotedAt)); - } - - public FreightQuoteRequest withQuotedAt(Operator operator, Object... values){ - return appendSearchCriteria(createQuotedAtCriteria(operator, values)); - } - - public FreightQuoteRequest withQuotedAtIsUnknown(){ - return withQuotedAt(Operator.IS_NULL); - } - - public FreightQuoteRequest withQuotedAtIsKnown(){ - return withQuotedAt(Operator.IS_NOT_NULL); - } - - public SearchCriteria createQuotedAtCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.QUOTED_AT_PROPERTY, operator, values); - } - - public FreightQuoteRequest withQuotedAtIs(LocalDateTime quotedAt){ - return withQuotedAt(Operator.EQUAL, quotedAt); - } - - public FreightQuoteRequest withQuotedAtIsNot(LocalDateTime quotedAt){ - return withQuotedAt(Operator.NOT_EQUAL, quotedAt); - } - - public FreightQuoteRequest withQuotedAtIn(LocalDateTime... quotedAt){ - return withQuotedAt(Operator.IN, (Object[])quotedAt); - } - - public FreightQuoteRequest withQuotedAtNotIn(LocalDateTime... quotedAt){ - return withQuotedAt(Operator.NOT_IN, (Object[])quotedAt); - } - public FreightQuoteRequest withQuotedAtGreaterThan(LocalDateTime quotedAt){ - return withQuotedAt(Operator.GREATER_THAN, quotedAt); - } - - public FreightQuoteRequest withQuotedAtGreaterThanOrEqualTo(LocalDateTime quotedAt){ - return withQuotedAt(Operator.GREATER_THAN_OR_EQUAL, quotedAt); - } - - public FreightQuoteRequest withQuotedAtLessThan(LocalDateTime quotedAt){ - return withQuotedAt(Operator.LESS_THAN, quotedAt); - } - - public FreightQuoteRequest withQuotedAtLessThanOrEqualTo(LocalDateTime quotedAt){ - return withQuotedAt(Operator.LESS_THAN_OR_EQUAL, quotedAt); - } - - public FreightQuoteRequest withQuotedAtBetween(LocalDateTime startOfQuotedAt, LocalDateTime endOfQuotedAt){ - return withQuotedAt(Operator.BETWEEN, startOfQuotedAt, endOfQuotedAt); - } - public FreightQuoteRequest withQuotedAtBefore(LocalDateTime quotedAt){ - return withQuotedAt(Operator.LESS_THAN, quotedAt); - } - - public FreightQuoteRequest withQuotedAtBefore(Date quotedAt){ - return withQuotedAt(Operator.LESS_THAN, quotedAt); - } - - public FreightQuoteRequest withQuotedAtAfter(LocalDateTime quotedAt){ - return withQuotedAt(Operator.GREATER_THAN, quotedAt); - } - - public FreightQuoteRequest withQuotedAtAfter(Date quotedAt){ - return withQuotedAt(Operator.GREATER_THAN, quotedAt); - } - - public FreightQuoteRequest withQuotedAtBetween(Date startOfQuotedAt, Date endOfQuotedAt){ - return withQuotedAt(Operator.BETWEEN, startOfQuotedAt, endOfQuotedAt); - } - - - - - public FreightQuoteRequest filterByInstructions(String... instructions){ - if (instructions == null || instructions.length == 0) { - throw new IllegalArgumentException("filterByInstructions parameter instructions cannot be empty"); - } - return appendSearchCriteria(createInstructionsCriteria(Operator.EQUAL, (Object[])instructions)); - } - - public FreightQuoteRequest withInstructions(Operator operator, Object... values){ - return appendSearchCriteria(createInstructionsCriteria(operator, values)); - } - - public FreightQuoteRequest withInstructionsIsUnknown(){ - return withInstructions(Operator.IS_NULL); - } - - public FreightQuoteRequest withInstructionsIsKnown(){ - return withInstructions(Operator.IS_NOT_NULL); - } - - public SearchCriteria createInstructionsCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.INSTRUCTIONS_PROPERTY, operator, values); - } - - public FreightQuoteRequest withInstructionsIsNot(String instructions){ - return withInstructions(Operator.NOT_EQUAL, instructions); - } - - public FreightQuoteRequest withInstructionsIn(String... instructions){ - return withInstructions(Operator.IN, (Object[])instructions); - } - - public FreightQuoteRequest withInstructionsNotIn(String... instructions){ - return withInstructions(Operator.NOT_IN, (Object[])instructions); - } - public FreightQuoteRequest withInstructionsGreaterThan(String instructions){ - return withInstructions(Operator.GREATER_THAN, instructions); - } - - public FreightQuoteRequest withInstructionsGreaterThanOrEqualTo(String instructions){ - return withInstructions(Operator.GREATER_THAN_OR_EQUAL, instructions); - } - - public FreightQuoteRequest withInstructionsLessThan(String instructions){ - return withInstructions(Operator.LESS_THAN, instructions); - } - - public FreightQuoteRequest withInstructionsLessThanOrEqualTo(String instructions){ - return withInstructions(Operator.LESS_THAN_OR_EQUAL, instructions); - } - - public FreightQuoteRequest withInstructionsBetween(String startOfInstructions, String endOfInstructions){ - return withInstructions(Operator.BETWEEN, startOfInstructions, endOfInstructions); - } - public FreightQuoteRequest withInstructionsStartingWith(String instructions){ - return withInstructions(Operator.BEGIN_WITH, instructions); - } - public FreightQuoteRequest withInstructionsContaining(String instructions){ - return withInstructions(Operator.CONTAIN, instructions); - } - - public FreightQuoteRequest withInstructionsNotContaining(String instructions){ - return withInstructions(Operator.NOT_CONTAIN, instructions); - } - - public FreightQuoteRequest withInstructionsNotStartingWith(String instructions){ - return withInstructions(Operator.NOT_BEGIN_WITH, instructions); - } - - public FreightQuoteRequest withInstructionsEndingWith(String instructions){ - return withInstructions(Operator.END_WITH, instructions); - } - - public FreightQuoteRequest withInstructionsNotEndingWith(String instructions){ - return withInstructions(Operator.NOT_END_WITH, instructions); - } - - public FreightQuoteRequest withInstructionsIs(String instructions){ - return withInstructions(Operator.EQUAL, instructions); - } - - public FreightQuoteRequest withInstructionsSoundingLike(String instructions){ - return withInstructions(Operator.SOUNDS_LIKE, instructions); - } - - - - public FreightQuoteRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public FreightQuoteRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public FreightQuoteRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public FreightQuoteRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(FreightQuote.VERSION_PROPERTY, operator, values); - } - - public FreightQuoteRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public FreightQuoteRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public FreightQuoteRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public FreightQuoteRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public FreightQuoteRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public FreightQuoteRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public FreightQuoteRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public FreightQuoteRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public FreightQuoteRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public FreightQuoteRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public FreightQuoteRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public FreightQuoteRequest minAmount(){ - return minAmountAs(prefix("minOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest minAmountAs(String retName){ - super.min(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest maxAmount(){ - return maxAmountAs(prefix("maxOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest maxAmountAs(String retName){ - super.max(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest sumAmount(){ - return sumAmountAs(prefix("sumOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest sumAmountAs(String retName){ - super.sum(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest avgAmount(){ - return avgAmountAs(prefix("avgOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest avgAmountAs(String retName){ - super.avg(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest standardDeviationAmount(){ - return standardDeviationAmountAs(prefix("standardDeviationOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest standardDeviationAmountAs(String retName){ - super.standardDeviation(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest squareRootOfPopulationStandardDeviationAmount(){ - return squareRootOfPopulationStandardDeviationAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest squareRootOfPopulationStandardDeviationAmountAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest sampleVarianceAmount(){ - return sampleVarianceAmountAs(prefix("sampleVarianceOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest sampleVarianceAmountAs(String retName){ - super.sampleVariance(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest samplePopulationVarianceAmount(){ - return samplePopulationVarianceAmountAs(prefix("samplePopulationVarianceOf",FreightQuote.AMOUNT_PROPERTY)); - } - - public FreightQuoteRequest samplePopulationVarianceAmountAs(String retName){ - super.samplePopulationVariance(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest minShipmentNumber(){ - return minShipmentNumberAs(prefix("minOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest minShipmentNumberAs(String retName){ - super.min(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest maxShipmentNumber(){ - return maxShipmentNumberAs(prefix("maxOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest maxShipmentNumberAs(String retName){ - super.max(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest sumShipmentNumber(){ - return sumShipmentNumberAs(prefix("sumOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest sumShipmentNumberAs(String retName){ - super.sum(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest avgShipmentNumber(){ - return avgShipmentNumberAs(prefix("avgOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest avgShipmentNumberAs(String retName){ - super.avg(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest standardDeviationShipmentNumber(){ - return standardDeviationShipmentNumberAs(prefix("standardDeviationOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest standardDeviationShipmentNumberAs(String retName){ - super.standardDeviation(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest squareRootOfPopulationStandardDeviationShipmentNumber(){ - return squareRootOfPopulationStandardDeviationShipmentNumberAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest squareRootOfPopulationStandardDeviationShipmentNumberAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest sampleVarianceShipmentNumber(){ - return sampleVarianceShipmentNumberAs(prefix("sampleVarianceOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest sampleVarianceShipmentNumberAs(String retName){ - super.sampleVariance(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest samplePopulationVarianceShipmentNumber(){ - return samplePopulationVarianceShipmentNumberAs(prefix("samplePopulationVarianceOf",FreightQuote.SHIPMENT_NUMBER_PROPERTY)); - } - - public FreightQuoteRequest samplePopulationVarianceShipmentNumberAs(String retName){ - super.samplePopulationVariance(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest minPackageCount(){ - return minPackageCountAs(prefix("minOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest minPackageCountAs(String retName){ - super.min(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest maxPackageCount(){ - return maxPackageCountAs(prefix("maxOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest maxPackageCountAs(String retName){ - super.max(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest sumPackageCount(){ - return sumPackageCountAs(prefix("sumOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest sumPackageCountAs(String retName){ - super.sum(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest avgPackageCount(){ - return avgPackageCountAs(prefix("avgOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest avgPackageCountAs(String retName){ - super.avg(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest standardDeviationPackageCount(){ - return standardDeviationPackageCountAs(prefix("standardDeviationOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest standardDeviationPackageCountAs(String retName){ - super.standardDeviation(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest squareRootOfPopulationStandardDeviationPackageCount(){ - return squareRootOfPopulationStandardDeviationPackageCountAs(prefix("squareRootOfPopulationStandardDeviationOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest squareRootOfPopulationStandardDeviationPackageCountAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest sampleVariancePackageCount(){ - return sampleVariancePackageCountAs(prefix("sampleVarianceOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest sampleVariancePackageCountAs(String retName){ - super.sampleVariance(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest samplePopulationVariancePackageCount(){ - return samplePopulationVariancePackageCountAs(prefix("samplePopulationVarianceOf",FreightQuote.PACKAGE_COUNT_PROPERTY)); - } - - public FreightQuoteRequest samplePopulationVariancePackageCountAs(String retName){ - super.samplePopulationVariance(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public FreightQuoteRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(FreightQuote.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - - - - - - - public FreightQuoteRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public FreightQuoteRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.ID_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public FreightQuoteRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.PLATFORM_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctReference(){ - return countDistinctReferenceAs("reference_distinct_count"); - } - - public FreightQuoteRequest countDistinctReferenceAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.REFERENCE_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctAmount(){ - return countDistinctAmountAs("amount_distinct_count"); - } - - public FreightQuoteRequest countDistinctAmountAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.AMOUNT_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctShipmentNumber(){ - return countDistinctShipmentNumberAs("shipment_number_distinct_count"); - } - - public FreightQuoteRequest countDistinctShipmentNumberAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctPackageCount(){ - return countDistinctPackageCountAs("package_count_distinct_count"); - } - - public FreightQuoteRequest countDistinctPackageCountAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctDeliveryDate(){ - return countDistinctDeliveryDateAs("delivery_date_distinct_count"); - } - - public FreightQuoteRequest countDistinctDeliveryDateAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctPickupTime(){ - return countDistinctPickupTimeAs("pickup_time_distinct_count"); - } - - public FreightQuoteRequest countDistinctPickupTimeAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctQuotedAt(){ - return countDistinctQuotedAtAs("quoted_at_distinct_count"); - } - - public FreightQuoteRequest countDistinctQuotedAtAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctInstructions(){ - return countDistinctInstructionsAs("instructions_distinct_count"); - } - - public FreightQuoteRequest countDistinctInstructionsAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - public FreightQuoteRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public FreightQuoteRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, FreightQuote.VERSION_PROPERTY); - return this; - } - - public FreightQuoteRequest groupById(){ - groupBy(FreightQuote.ID_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByIdAs(String retName){ - groupBy(retName, FreightQuote.ID_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.ID_PROPERTY, function); - return this; - } - public FreightQuoteRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(FreightQuote.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public FreightQuoteRequest groupByPlatform(){ - groupBy(FreightQuote.PLATFORM_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByPlatformAs(String retName){ - groupBy(retName, FreightQuote.PLATFORM_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.PLATFORM_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByReference(){ - groupBy(FreightQuote.REFERENCE_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByReferenceAs(String retName){ - groupBy(retName, FreightQuote.REFERENCE_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByReferenceWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.REFERENCE_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByAmount(){ - groupBy(FreightQuote.AMOUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByAmountAs(String retName){ - groupBy(retName, FreightQuote.AMOUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByAmountWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.AMOUNT_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByShipmentNumber(){ - groupBy(FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByShipmentNumberAs(String retName){ - groupBy(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByShipmentNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.SHIPMENT_NUMBER_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByPackageCount(){ - groupBy(FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByPackageCountAs(String retName){ - groupBy(retName, FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByPackageCountWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.PACKAGE_COUNT_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByDeliveryDate(){ - groupBy(FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByDeliveryDateAs(String retName){ - groupBy(retName, FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByDeliveryDateWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.DELIVERY_DATE_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByPickupTime(){ - groupBy(FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByPickupTimeAs(String retName){ - groupBy(retName, FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByPickupTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.PICKUP_TIME_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByQuotedAt(){ - groupBy(FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByQuotedAtAs(String retName){ - groupBy(retName, FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByQuotedAtWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.QUOTED_AT_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByInstructions(){ - groupBy(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByInstructionsAs(String retName){ - groupBy(retName, FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByInstructionsWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.INSTRUCTIONS_PROPERTY, function); - return this; - } - - public FreightQuoteRequest groupByVersion(){ - groupBy(FreightQuote.VERSION_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByVersionAs(String retName){ - groupBy(retName, FreightQuote.VERSION_PROPERTY); - return this; - } - - public FreightQuoteRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, FreightQuote.VERSION_PROPERTY, function); - return this; - } - - - - public FreightQuoteRequest orderByIdAscending(){ - addOrderByAscending(FreightQuote.ID_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByIdDescending(){ - addOrderByDescending(FreightQuote.ID_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByPlatformAscending(){ - addOrderByAscending(FreightQuote.PLATFORM_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByPlatformDescending(){ - addOrderByDescending(FreightQuote.PLATFORM_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByReferenceAscending(){ - addOrderByAscending(FreightQuote.REFERENCE_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByReferenceDescending(){ - addOrderByDescending(FreightQuote.REFERENCE_PROPERTY); - return this; - } - public FreightQuoteRequest orderByReferenceAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(FreightQuote.REFERENCE_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByReferenceDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(FreightQuote.REFERENCE_PROPERTY); - return this; - } - public FreightQuoteRequest orderByAmountAscending(){ - addOrderByAscending(FreightQuote.AMOUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByAmountDescending(){ - addOrderByDescending(FreightQuote.AMOUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByShipmentNumberAscending(){ - addOrderByAscending(FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByShipmentNumberDescending(){ - addOrderByDescending(FreightQuote.SHIPMENT_NUMBER_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByPackageCountAscending(){ - addOrderByAscending(FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByPackageCountDescending(){ - addOrderByDescending(FreightQuote.PACKAGE_COUNT_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByDeliveryDateAscending(){ - addOrderByAscending(FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByDeliveryDateDescending(){ - addOrderByDescending(FreightQuote.DELIVERY_DATE_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByPickupTimeAscending(){ - addOrderByAscending(FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByPickupTimeDescending(){ - addOrderByDescending(FreightQuote.PICKUP_TIME_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByQuotedAtAscending(){ - addOrderByAscending(FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByQuotedAtDescending(){ - addOrderByDescending(FreightQuote.QUOTED_AT_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByInstructionsAscending(){ - addOrderByAscending(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByInstructionsDescending(){ - addOrderByDescending(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - public FreightQuoteRequest orderByInstructionsAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByInstructionsDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(FreightQuote.INSTRUCTIONS_PROPERTY); - return this; - } - public FreightQuoteRequest orderByVersionAscending(){ - addOrderByAscending(FreightQuote.VERSION_PROPERTY); - return this; - } - - public FreightQuoteRequest orderByVersionDescending(){ - addOrderByDescending(FreightQuote.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - - - - - - - public FreightQuoteRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public FreightQuoteRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, FreightQuote.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, FreightQuote.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public FreightQuoteRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public FreightQuoteRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public FreightQuoteRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public FreightQuoteRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public FreightQuoteRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public FreightQuoteRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java deleted file mode 100644 index d3f9a3cf4..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/Platform.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.example.freightquotesettlement.platform; - -import com.example.freightquotesettlement.freightquote.FreightQuote; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e43c5eed054b71b94131c0d8733d90a89b34235c2ba8726ec08f9f3687a87edf"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "freight_quote_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String FREIGHT_QUOTE_LIST_PROPERTY = "freight_quote_list"; - private String name; - - private SmartList freightQuoteList; - - public String getName(){ - return this.name; - } - - public SmartList getFreightQuoteList(){ - return this.freightQuoteList == null ? SmartList.unloaded() : this.freightQuoteList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform addFreightQuote(FreightQuote freightQuote){ - if (freightQuote == null){ - return this; - } - - if(null == this.freightQuoteList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.freightQuoteList = teaqlUnloadedItems.map(value -> value); - } - - this.freightQuoteList.add(freightQuote); - freightQuote.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "freight_quote_list": this.freightQuoteList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "freight_quote_list": return this.freightQuoteList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java deleted file mode 100644 index 649f1cf3f..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.example.freightquotesettlement.platform; - -import com.example.freightquotesettlement.freightquote.FreightQuote; -import com.example.freightquotesettlement.freightquote.FreightQuoteChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; platform.getFreightQuoteList() != null && i < platform.getFreightQuoteList().size(); i++){ - FreightQuote freightQuote = platform.getFreightQuoteList().get(i); - new FreightQuoteChecker().checkAndFix(_context, freightQuote, newLocation(_parentLocation, "freight_quote_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java deleted file mode 100644 index 1cbee6f9a..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.example.freightquotesettlement.platform; - -import com.example.freightquotesettlement.freightquote.FreightQuote; -import com.example.freightquotesettlement.freightquote.FreightQuoteListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public FreightQuoteListExpression getFreightQuoteList(){ - return new FreightQuoteListExpression(loaded("freight_quote_list", "getFreightQuoteList", Platform::getFreightQuoteList)); - } - public PlatformExpression addFreightQuote(FreightQuote freightQuote){ - return new PlatformExpression(this, $it -> ((Platform)$it).addFreightQuote(freightQuote)); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java deleted file mode 100644 index bee3a3854..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.freightquotesettlement.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java deleted file mode 100644 index 28e42e082..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/platform/PlatformRequest.java +++ /dev/null @@ -1,1079 +0,0 @@ - -package com.example.freightquotesettlement.platform; - -import com.example.freightquotesettlement.Q; -import com.example.freightquotesettlement.freightquote.FreightQuote; -import com.example.freightquotesettlement.freightquote.FreightQuoteRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectFreightQuoteList(); - return selectId().selectName().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectFreightQuoteList(){ - return selectFreightQuoteListWith(Q.freightQuotes().selectSelf()); - } - - public PlatformRequest selectFreightQuoteListWith(FreightQuoteRequest freightQuoteList){ - enhanceRelation(Platform.FREIGHT_QUOTE_LIST_PROPERTY, freightQuoteList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectFreightQuoteListWith", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withFreightQuoteListMatching(FreightQuoteRequest freightQuoteRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, freightQuoteRequest, FreightQuote.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutFreightQuoteListMatching(FreightQuoteRequest freightQuoteRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, freightQuoteRequest, FreightQuote.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveFreightQuotes(){ - return withFreightQuoteListMatching(Q.freightQuotes().unlimited()); - } - - public PlatformRequest haveNoFreightQuotes(){ - return withoutFreightQuoteListMatching(Q.freightQuotes().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupByFreightQuotesWithDetails(FreightQuoteRequest subRequest){ - aggregate(Platform.FREIGHT_QUOTE_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - return statsFromFreightQuotesAs(name, subRequest, false); - } - - public PlatformRequest statsFromFreightQuotesAs(String name, FreightQuoteRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromFreightQuotes(FreightQuoteRequest subRequest){ - return statsFromFreightQuotesAs(REFINEMENTS, subRequest); - } - public PlatformRequest countFreightQuotes(){ - addRelationCount("Count", Q.freightQuotes().unlimited(), FreightQuote.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countFreightQuotesAs(String name){ - addRelationCount(name, Q.freightQuotes().unlimited(), FreightQuote.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countFreightQuotesWith(String name, FreightQuoteRequest subRequest){ - addRelationCount(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countFreightQuotesWith", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest minAmountOfFreightQuotes(){ - addRelationScalarAggregate("minAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minAmountOfFreightQuotesAs(String name){ - return minAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest minAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxAmountOfFreightQuotes(){ - addRelationScalarAggregate("maxAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxAmountOfFreightQuotesAs(String name){ - return maxAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest maxAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumAmountOfFreightQuotes(){ - addRelationScalarAggregate("sumAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumAmountOfFreightQuotesAs(String name){ - return sumAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest sumAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgAmountOfFreightQuotes(){ - addRelationScalarAggregate("avgAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgAmountOfFreightQuotesAs(String name){ - return avgAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest avgAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationAmountOfFreightQuotes(){ - addRelationScalarAggregate("stdDevAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationAmountOfFreightQuotesAs(String name){ - return standardDeviationAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest standardDeviationAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotes(){ - addRelationScalarAggregate("stdDevPopAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(String name){ - return squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceAmountOfFreightQuotes(){ - addRelationScalarAggregate("varSampAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceAmountOfFreightQuotesAs(String name){ - return sampleVarianceAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest sampleVarianceAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceAmountOfFreightQuotes(){ - addRelationScalarAggregate("varPopAmountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceAmountOfFreightQuotesAs(String name){ - return samplePopulationVarianceAmountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest samplePopulationVarianceAmountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceAmountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest minShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("minShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minShipmentNumberOfFreightQuotesAs(String name){ - return minShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest minShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("maxShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxShipmentNumberOfFreightQuotesAs(String name){ - return maxShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest maxShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("sumShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumShipmentNumberOfFreightQuotesAs(String name){ - return sumShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest sumShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("avgShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgShipmentNumberOfFreightQuotesAs(String name){ - return avgShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest avgShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("stdDevShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationShipmentNumberOfFreightQuotesAs(String name){ - return standardDeviationShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest standardDeviationShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("stdDevPopShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(String name){ - return squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("varSampShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotesAs(String name){ - return sampleVarianceShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest sampleVarianceShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotes(){ - addRelationScalarAggregate("varPopShipmentNumberOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceShipmentNumberOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotesAs(String name){ - return samplePopulationVarianceShipmentNumberOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest samplePopulationVarianceShipmentNumberOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.SHIPMENT_NUMBER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceShipmentNumberOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest minPackageCountOfFreightQuotes(){ - addRelationScalarAggregate("minPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minPackageCountOfFreightQuotesAs(String name){ - return minPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest minPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxPackageCountOfFreightQuotes(){ - addRelationScalarAggregate("maxPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxPackageCountOfFreightQuotesAs(String name){ - return maxPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest maxPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumPackageCountOfFreightQuotes(){ - addRelationScalarAggregate("sumPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumPackageCountOfFreightQuotesAs(String name){ - return sumPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest sumPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgPackageCountOfFreightQuotes(){ - addRelationScalarAggregate("avgPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgPackageCountOfFreightQuotesAs(String name){ - return avgPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest avgPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationPackageCountOfFreightQuotes(){ - addRelationScalarAggregate("stdDevPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationPackageCountOfFreightQuotesAs(String name){ - return standardDeviationPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest standardDeviationPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotes(){ - addRelationScalarAggregate("stdDevPopPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(String name){ - return squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationPackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVariancePackageCountOfFreightQuotes(){ - addRelationScalarAggregate("varSampPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVariancePackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVariancePackageCountOfFreightQuotesAs(String name){ - return sampleVariancePackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest sampleVariancePackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVariancePackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotes(){ - addRelationScalarAggregate("varPopPackageCountOfFreightQuotes", Q.freightQuotes().unlimited(), - FreightQuote.PLATFORM_PROPERTY, FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVariancePackageCountOfFreightQuotes", null, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotesAs(String name){ - return samplePopulationVariancePackageCountOfFreightQuotesAs(name, Q.freightQuotes().unlimited()); - } - - public PlatformRequest samplePopulationVariancePackageCountOfFreightQuotesAs(String name, FreightQuoteRequest subRequest){ - addRelationScalarAggregate(name, subRequest, FreightQuote.PLATFORM_PROPERTY, - FreightQuote.PACKAGE_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVariancePackageCountOfFreightQuotesAs", name, Platform.FREIGHT_QUOTE_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java b/examples/scalar-type-probe/java-app-console/lib/src/main/java/com/example/freightquotesettlement/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 3159e1a6b..000000000 --- a/examples/scalar-type-probe/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.freightquotesettlement.EntityMetaRegistry \ No newline at end of file diff --git a/examples/scalar-type-probe/showcase.json b/examples/scalar-type-probe/showcase.json index 9599588d7..426b89e7d 100644 --- a/examples/scalar-type-probe/showcase.json +++ b/examples/scalar-type-probe/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "1157a515e32373a53a8284422c878f0e433e9d4870e4ca779ca7e88ba36384fa", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/scalar-type-probe/verify-freight-quotes.sh b/examples/scalar-type-probe/verify-freight-quotes.sh index 3498a5d64..158045dfd 100644 --- a/examples/scalar-type-probe/verify-freight-quotes.sh +++ b/examples/scalar-type-probe/verify-freight-quotes.sh @@ -26,7 +26,7 @@ git -C "$repo" archive HEAD | tar -xf - -C "$source" app="$source/examples/scalar-type-probe/java-app-console" library="$source/examples/scalar-type-probe/java-lib-core/lib" cp "$app/pom.xml" "$evidence/workspace-pom.xml" -diff -qr "$app/lib/src" "$library/src" +[[ ! -e "$app/lib" ]] cat > "$scratch/pom.xml" <<'XML' 4.0.0 diff --git a/examples/school-management/java-app-console/lib/pom.xml b/examples/school-management/java-app-console/lib/pom.xml deleted file mode 100644 index 2031c7204..000000000 --- a/examples/school-management/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - school-management-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java deleted file mode 100644 index bdacf16bf..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java +++ /dev/null @@ -1,13 +0,0 @@ - -package com.example.schoolmanagementservice; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.schooltype.SchoolType; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); - public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; - public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; - public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java deleted file mode 100644 index 0629960ea..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java +++ /dev/null @@ -1,23 +0,0 @@ - -package com.example.schoolmanagementservice; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolExpression; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static SchoolTypeExpression schoolType(SchoolType schoolType){ - return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); - } - public static SchoolExpression school(School school){ - return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java deleted file mode 100644 index 257189a02..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java +++ /dev/null @@ -1,808 +0,0 @@ - -package com.example.schoolmanagementservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerSchoolType(); - registerSchool(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.platform.Platform::new); - entityDescriptor.with("name", "Platform") - - .with("module", "Organization") - - .with("module_key", "organization") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor baseUrl = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY, String.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Campus Learning Platform") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "https://campus.example.com") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("candidates", "createTime()") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("candidates", "updateTime()") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchoolType() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.schooltype.SchoolType.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schooltype.SchoolType::new); - entityDescriptor.with("name", "School Type") - - .with("module", "Academics") - - .with("module_key", "academics") - - .with("constant", "true") - - .with("identifier", "code") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) - ; - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY, String.class) - ; - PropertyDescriptor code = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY, String.class) - ; - PropertyDescriptor displayOrder = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("candidates", "1001,1002") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Primary,Secondary") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") - - .with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "PRIMARY,SECONDARY") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("candidates", "1,2") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchool() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.school.School.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.school.School.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.school.School.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.school.School::new); - entityDescriptor.with("name", "School") - - .with("module", "Academics") - - .with("module_key", "academics") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) - ; - PropertyDescriptor schoolType = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.schoolmanagementservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY, String.class) - ; - PropertyDescriptor address = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY, String.class) - ; - PropertyDescriptor establishedDate = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY, LocalDate.class) - ; - PropertyDescriptor studentCapacity = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) - ; - PropertyDescriptor active = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY, Boolean.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDate") - - .with("sqlType", "DATE") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "Date") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(1)") - - .with("javaType", "java.lang.Boolean") - - .with("sqlType", "BOOLEAN") - - .with("isId", "false") - - .with("isBool", "true") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "bit") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Boolean") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java deleted file mode 100644 index 9f8f340c9..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.example.schoolmanagementservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.schoolmanagementservice.platform.PlatformChecker(), new com.example.schoolmanagementservice.schooltype.SchoolTypeChecker(), new com.example.schoolmanagementservice.school.SchoolChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:71ba9da7267282a87034f786438f6f60442609b86ca42c3ef288e51c43107ce1\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"School\"},\"fields\":[{\"name\":\"active\",\"labels\":{\"en\":\"active\"},\"aliases\":[\"Active\"]},{\"name\":\"address\",\"labels\":{\"en\":\"address\"},\"aliases\":[\"Address\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"established_date\",\"labels\":{\"en\":\"established date\"},\"aliases\":[\"EstablishedDate\",\"establishedDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"School Type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"School Type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"School\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("address", "address"), java.util.Map.entry("established_date", "establishedDate"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("active", "active"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.schoolmanagementservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.schoolmanagementservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Campus Learning Platform"); - domainRoot.updateBaseUrl("https://campus.example.com"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantSchoolType1001Rows.isEmpty()) { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = new com.example.schoolmanagementservice.schooltype.SchoolType(); - constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); - constantSchoolType1001.updatePlatform(domainRoot); - constantSchoolType1001.updateName("Primary"); - constantSchoolType1001.updateCode("PRIMARY"); - constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); - constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); - } else { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } - if (!((constantSchoolType1001.getDisplayOrder() != null && constantSchoolType1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } - if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); - } - var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantSchoolType1002Rows.isEmpty()) { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = new com.example.schoolmanagementservice.schooltype.SchoolType(); - constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); - constantSchoolType1002.updatePlatform(domainRoot); - constantSchoolType1002.updateName("Secondary"); - constantSchoolType1002.updateCode("SECONDARY"); - constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); - constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); - } else { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } - if (!((constantSchoolType1002.getDisplayOrder() != null && constantSchoolType1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } - if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); - } - } -} diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java deleted file mode 100644 index c8368197d..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java +++ /dev/null @@ -1,34 +0,0 @@ - -package com.example.schoolmanagementservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.schoolmanagementservice.platform.PlatformRequest platforms(){ - return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypes(){ - return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ - return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.schoolmanagementservice.school.SchoolRequest schools(){ - return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.school.SchoolRequest schoolsWithMinimalFields(){ - return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java deleted file mode 100644 index e53bf00a7..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.schoolmanagementservice; - -import io.teaql.core.UserContext; -public interface SchoolManagementServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java deleted file mode 100644 index 97fe06180..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java +++ /dev/null @@ -1,214 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e1da6639feab09f3d1ed370802410798c759f6bf13f85e0a93374c42d1646603"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "school_type_list", "school_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String BASE_URL_PROPERTY = "base_url"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; - public static final String SCHOOL_LIST_PROPERTY = "school_list"; - private String name; - - private String baseUrl; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList schoolTypeList; - private SmartList schoolList; - - public String getName(){ - return this.name; - } - - public String getBaseUrl(){ - return this.baseUrl; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getSchoolTypeList(){ - return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; - } - public SmartList getSchoolList(){ - return this.schoolList == null ? SmartList.unloaded() : this.schoolList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform updateBaseUrl(String baseUrl){ - baseUrl = (baseUrl == null ? null : baseUrl.trim()); - if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ - return this; - } - handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); - this.baseUrl = baseUrl; - return this; - } - - public Platform updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public Platform updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public Platform addSchoolType(SchoolType schoolType){ - if (schoolType == null){ - return this; - } - - if(null == this.schoolTypeList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolTypeList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolTypeList.add(schoolType); - schoolType.updatePlatform(this); - return this; - } - public Platform addSchool(School school){ - if (school == null){ - return this; - } - - if(null == this.schoolList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolList.add(school); - school.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "school_type_list": this.schoolTypeList = (SmartList) value; break; - case "school_list": this.schoolList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "base_url": return this.baseUrl; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "school_type_list": return this.schoolTypeList; - case "school_list": return this.schoolList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "baseUrl": return this.baseUrl; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java deleted file mode 100644 index d20345fd5..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java +++ /dev/null @@ -1,114 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolChecker; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - platform.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - platform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(platform.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - platform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("base_url")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); - checkCreateTime(_context, platform.getProperty(Platform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, platform.getProperty(Platform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ - SchoolType schoolType = platform.getSchoolTypeList().get(i); - new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); - } - for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ - School school = platform.getSchoolList().get(i); - new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, baseUrl); - if((baseUrl == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, baseUrl); - - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java deleted file mode 100644 index 0547820e6..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java +++ /dev/null @@ -1,81 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolListExpression; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public Expression getBaseUrl(){ - return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); - } - public PlatformExpression updateBaseUrl(String baseUrl){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", Platform::getCreateTime); - } - public PlatformExpression updateCreateTime(LocalDateTime createTime){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", Platform::getUpdateTime); - } - public PlatformExpression updateUpdateTime(LocalDateTime updateTime){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateUpdateTime(updateTime)); - } - - public SchoolTypeListExpression getSchoolTypeList(){ - return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); - } - public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); - } - public PlatformExpression addSchoolType(SchoolType schoolType){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); - } - public PlatformExpression addSchool(School school){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java deleted file mode 100644 index 14e4a4c13..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java deleted file mode 100644 index c0abb6538..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java +++ /dev/null @@ -1,1396 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolRequest; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.BASE_URL_PROPERTY); - selectProperty(Platform.CREATE_TIME_PROPERTY); - selectProperty(Platform.UPDATE_TIME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectSchoolTypeList().selectSchoolList(); - return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectBaseUrl(){ - selectProperty(Platform.BASE_URL_PROPERTY); - return this; - } - - /** - * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectBaseUrl(){ - unselectProperty(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest selectCreateTime(){ - selectProperty(Platform.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectCreateTime(){ - unselectProperty(Platform.CREATE_TIME_PROPERTY); - return this; - } - public PlatformRequest selectUpdateTime(){ - selectProperty(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectUpdateTime(){ - unselectProperty(Platform.UPDATE_TIME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectSchoolTypeList(){ - return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); - } - - public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ - enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest selectSchoolList(){ - return selectSchoolListWith(Q.schools().selectSelf()); - } - - public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByBaseUrl(String... baseUrl){ - if (baseUrl == null || baseUrl.length == 0) { - throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); - } - return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); - } - - public PlatformRequest withBaseUrl(Operator operator, Object... values){ - return appendSearchCriteria(createBaseUrlCriteria(operator, values)); - } - - public PlatformRequest withBaseUrlIsUnknown(){ - return withBaseUrl(Operator.IS_NULL); - } - - public PlatformRequest withBaseUrlIsKnown(){ - return withBaseUrl(Operator.IS_NOT_NULL); - } - - public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); - } - - public PlatformRequest withBaseUrlIsNot(String baseUrl){ - return withBaseUrl(Operator.NOT_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlIn(String... baseUrl){ - return withBaseUrl(Operator.IN, (Object[])baseUrl); - } - - public PlatformRequest withBaseUrlNotIn(String... baseUrl){ - return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); - } - public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ - return withBaseUrl(Operator.GREATER_THAN, baseUrl); - } - - public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ - return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlLessThan(String baseUrl){ - return withBaseUrl(Operator.LESS_THAN, baseUrl); - } - - public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ - return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ - return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); - } - public PlatformRequest withBaseUrlStartingWith(String baseUrl){ - return withBaseUrl(Operator.BEGIN_WITH, baseUrl); - } - public PlatformRequest withBaseUrlContaining(String baseUrl){ - return withBaseUrl(Operator.CONTAIN, baseUrl); - } - - public PlatformRequest withBaseUrlNotContaining(String baseUrl){ - return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); - } - - public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ - return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlEndingWith(String baseUrl){ - return withBaseUrl(Operator.END_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ - return withBaseUrl(Operator.NOT_END_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlIs(String baseUrl){ - return withBaseUrl(Operator.EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ - return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); - } - - - - public PlatformRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public PlatformRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public PlatformRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public PlatformRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.CREATE_TIME_PROPERTY, operator, values); - } - - public PlatformRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public PlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public PlatformRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public PlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public PlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public PlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public PlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public PlatformRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PlatformRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PlatformRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PlatformRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public PlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public PlatformRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public PlatformRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public PlatformRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.UPDATE_TIME_PROPERTY, operator, values); - } - - public PlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public PlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public PlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public PlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchoolTypes(){ - return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); - } - - public PlatformRequest haveNoSchoolTypes(){ - return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); - } - public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchools(){ - return withSchoolListMatching(Q.schools().unlimited()); - } - - public PlatformRequest haveNoSchools(){ - return withoutSchoolListMatching(Q.schools().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctBaseUrl(){ - return countDistinctBaseUrlAs("base_url_distinct_count"); - } - - public PlatformRequest countDistinctBaseUrlAs(String alias){ - super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public PlatformRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, Platform.CREATE_TIME_PROPERTY); - return this; - } - public PlatformRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public PlatformRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, Platform.UPDATE_TIME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ - aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); - return this; - } - public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ - aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByBaseUrl(){ - groupBy(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest groupByBaseUrlAs(String retName){ - groupBy(retName, Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.BASE_URL_PROPERTY, function); - return this; - } - - public PlatformRequest groupByCreateTime(){ - groupBy(Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByCreateTimeAs(String retName){ - groupBy(retName, Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.CREATE_TIME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByUpdateTime(){ - groupBy(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.UPDATE_TIME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByBaseUrlAscending(){ - addOrderByAscending(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest orderByBaseUrlDescending(){ - addOrderByDescending(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest orderByCreateTimeAscending(){ - addOrderByAscending(Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByCreateTimeDescending(){ - addOrderByDescending(Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByUpdateTimeAscending(){ - addOrderByAscending(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByUpdateTimeDescending(){ - addOrderByDescending(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(REFINEMENTS, subRequest); - } - public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchools(SchoolRequest subRequest){ - return statsFromSchoolsAs(REFINEMENTS, subRequest); - } - public PlatformRequest countSchoolTypes(){ - addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolTypesAs(String name){ - addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ - addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest countSchools(){ - addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolsAs(String name){ - addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ - addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest minDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("minDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ - return minDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("maxDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ - return maxDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("sumDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ - return sumDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("avgDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ - return avgDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("stdDevDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name){ - return standardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("stdDevPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name){ - return squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("varSampDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name){ - return sampleVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("varPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name){ - return samplePopulationVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest minStudentCapacityOfSchools(){ - addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ - return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxStudentCapacityOfSchools(){ - addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ - return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumStudentCapacityOfSchools(){ - addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ - return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgStudentCapacityOfSchools(){ - addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ - return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ - return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ - return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java deleted file mode 100644 index 3923b042c..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java +++ /dev/null @@ -1,287 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.Constants; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class School extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "School"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "14b4bfbb4cda258779665e3bc38ab991040fe75793a416d29eddd06f8fa8f586"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("address", 4), java.util.Map.entry("established_date", 5), java.util.Map.entry("student_capacity", 6), java.util.Map.entry("active", 7), java.util.Map.entry("create_time", 8), java.util.Map.entry("update_time", 9), java.util.Map.entry("version", 10)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("address", java.util.List.of("address", "address")), java.util.Map.entry("established_date", java.util.List.of("establishedDate", "established_date")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("active", java.util.List.of("active", "active")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - School.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String SCHOOL_TYPE_PROPERTY = "school_type"; - public static final String NAME_PROPERTY = "name"; - public static final String ADDRESS_PROPERTY = "address"; - public static final String ESTABLISHED_DATE_PROPERTY = "established_date"; - public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; - public static final String ACTIVE_PROPERTY = "active"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - private Platform platform; - - private SchoolType schoolType; - - private String name; - - private String address; - - private LocalDate establishedDate; - - private Integer studentCapacity; - - private Boolean active; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - - public Platform getPlatform(){ - return this.platform; - } - - public SchoolType getSchoolType(){ - return this.schoolType; - } - - public String getName(){ - return this.name; - } - - public String getAddress(){ - return this.address; - } - - public LocalDate getEstablishedDate(){ - return this.establishedDate; - } - - public Integer getStudentCapacity(){ - return this.studentCapacity; - } - - public Boolean isActive(){ - return this.active; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public School updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - protected School updateSchoolType(SchoolType schoolType){ - if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ - return this; - } - handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); - this.schoolType = schoolType; - return this; - } - - public School updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public School updateAddress(String address){ - address = (address == null ? null : address.trim()); - if(isPropertyLoaded(ADDRESS_PROPERTY) && Objects.equals(this.address, address)){ - return this; - } - handleUpdate(ADDRESS_PROPERTY, getAddress(), address); - this.address = address; - return this; - } - - public School updateEstablishedDate(LocalDate establishedDate){ - if(isPropertyLoaded(ESTABLISHED_DATE_PROPERTY) && Objects.equals(this.establishedDate, establishedDate)){ - return this; - } - handleUpdate(ESTABLISHED_DATE_PROPERTY, getEstablishedDate(), establishedDate); - this.establishedDate = establishedDate; - return this; - } - - public School updateStudentCapacity(Integer studentCapacity){ - if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ - return this; - } - handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); - this.studentCapacity = studentCapacity; - return this; - } - - public School updateActive(Boolean active){ - if(isPropertyLoaded(ACTIVE_PROPERTY) && Objects.equals(this.active, active)){ - return this; - } - handleUpdate(ACTIVE_PROPERTY, isActive(), active); - this.active = active; - return this; - } - - public School updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public School updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public boolean isSchoolTypePrimary(){ - return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); - } - - public School updateSchoolTypeToPrimary(){ - return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); - } - public boolean isSchoolTypeSecondary(){ - return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); - } - - public School updateSchoolTypeToSecondary(){ - return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); - } - - public static School refer(Long id){ - School refer = new School(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public School comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "school_type": this.schoolType = (SchoolType) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "address": this.address = (value == null ? null : ((String)value).trim()); break; - - case "established_date": this.establishedDate = (LocalDate) value; break; - - case "student_capacity": this.studentCapacity = (Integer) value; break; - - case "active": this.active = (Boolean) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "school_type": return this.schoolType; - case "name": return this.name; - case "address": return this.address; - case "established_date": return this.establishedDate; - case "student_capacity": return this.studentCapacity; - case "active": return this.active; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "schoolType": return this.schoolType; - case "name": return this.name; - case "address": return this.address; - case "establishedDate": return this.establishedDate; - case "studentCapacity": return this.studentCapacity; - case "active": return this.active; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java deleted file mode 100644 index df8d0faa3..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java +++ /dev/null @@ -1,159 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformChecker; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDate; -import java.time.LocalDateTime; - -public class SchoolChecker implements Checker{ - - public String type(){ - return School.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ - if(needCheck(_context, school)){ - markAsChecked(_context, school); - doCheck(_context, school, _parentLocation); - } - } - - public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ - if((school == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, school); - if(school.needPersist()){ - } - if(school.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - school.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - school.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(school.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - school.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!school.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("school_type")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("address")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "address"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("established_date")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "established_date"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("student_capacity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("active")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "active"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); - checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkAddress(_context, school.getProperty(School.ADDRESS_PROPERTY), newLocation(_parentLocation, "address")); - checkEstablishedDate(_context, school.getProperty(School.ESTABLISHED_DATE_PROPERTY), newLocation(_parentLocation, "established_date")); - checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); - checkActive(_context, school.getProperty(School.ACTIVE_PROPERTY), newLocation(_parentLocation, "active")); - checkCreateTime(_context, school.getProperty(School.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, school.getProperty(School.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, schoolType); - if((schoolType == null)){ - return; - } - new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkAddress(UserContext _context, String address, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, address); - if((address == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, address); - - } - public void checkEstablishedDate(UserContext _context, LocalDate establishedDate, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, establishedDate); - if((establishedDate == null)){ - return; - } - } - public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, studentCapacity); - if((studentCapacity == null)){ - return; - } - } - public void checkActive(UserContext _context, Boolean active, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, active); - if((active == null)){ - return; - } - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java deleted file mode 100644 index 381a4e119..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java +++ /dev/null @@ -1,110 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolExpression(Expression expression){ - super(expression); - } - - public SchoolExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolExpression updateId(Long id){ - return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); - } - - public SchoolExpression save(UserContext userContext){ - return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolExpression save(String intent, UserContext userContext){ - return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); - } - - public SchoolExpression updatePlatform(Platform platform){ - return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); - } - - public SchoolTypeExpression getSchoolType(){ - return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); - } - - public SchoolExpression updateSchoolTypeToPrimary(){ - return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); - } - public SchoolExpression updateSchoolTypeToSecondary(){ - return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); - } - - public Expression getName(){ - return loaded("name", "getName", School::getName); - } - public SchoolExpression updateName(String name){ - return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); - } - - public Expression getAddress(){ - return loaded("address", "getAddress", School::getAddress); - } - public SchoolExpression updateAddress(String address){ - return new SchoolExpression(this, $it -> ((School)$it).updateAddress(address)); - } - - public Expression getEstablishedDate(){ - return loaded("established_date", "getEstablishedDate", School::getEstablishedDate); - } - public SchoolExpression updateEstablishedDate(LocalDate establishedDate){ - return new SchoolExpression(this, $it -> ((School)$it).updateEstablishedDate(establishedDate)); - } - - public Expression getStudentCapacity(){ - return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); - } - public SchoolExpression updateStudentCapacity(Integer studentCapacity){ - return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); - } - - public Expression isActive(){ - return loaded("active", "isActive", School::isActive); - } - public SchoolExpression updateActive(Boolean active){ - return new SchoolExpression(this, $it -> ((School)$it).updateActive(active)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", School::getCreateTime); - } - public SchoolExpression updateCreateTime(LocalDateTime createTime){ - return new SchoolExpression(this, $it -> ((School)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", School::getUpdateTime); - } - public SchoolExpression updateUpdateTime(LocalDateTime updateTime){ - return new SchoolExpression(this, $it -> ((School)$it).updateUpdateTime(updateTime)); - } - -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java deleted file mode 100644 index c41793f7b..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolListExpression extends SmartListExpression { - public SchoolListExpression(Expression> expression){ - super(expression); - } - - public SchoolListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolExpression first() { - return new SchoolExpression(super.first()); - } - - public SchoolExpression get(int index) { - return new SchoolExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java deleted file mode 100644 index c5ad3c9c4..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java +++ /dev/null @@ -1,1643 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformRequest; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class SchoolRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolRequest(Class returnType){ - this(returnType, () -> (T) new School()); - } - - protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolRequest copy(){ - return (SchoolRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolRequest matchingAnyOf(SchoolRequest school){ - super.internalMatchAny(school); - return this; - } - - public SchoolRequest matchingIdsOf(SchoolRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - School.ID_PROPERTY, request, School.ID_PROPERTY)); - } - - public SchoolRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SchoolRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public SchoolRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(School.ID_PROPERTY); - selectProperty(School.PLATFORM_PROPERTY); - selectProperty(School.SCHOOL_TYPE_PROPERTY); - selectProperty(School.NAME_PROPERTY); - selectProperty(School.ADDRESS_PROPERTY); - selectProperty(School.ESTABLISHED_DATE_PROPERTY); - selectProperty(School.STUDENT_CAPACITY_PROPERTY); - selectProperty(School.ACTIVE_PROPERTY); - selectProperty(School.CREATE_TIME_PROPERTY); - selectProperty(School.UPDATE_TIME_PROPERTY); - selectProperty(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public SchoolRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public SchoolRequest selectId(){ - selectProperty(School.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectId(){ - unselectProperty(School.ID_PROPERTY); - return this; - } - public SchoolRequest selectPlatformIdOnly(){ - selectProperty(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(School.PLATFORM_PROPERTY); - enhanceRelation(School.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); - return this; - } - - public SchoolRequest unselectPlatform(){ - unselectProperty(School.PLATFORM_PROPERTY); - return this; - } - public SchoolRequest selectSchoolTypeIdOnly(){ - selectProperty(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest selectSchoolType(){ - return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); - } - - public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ - selectProperty(School.SCHOOL_TYPE_PROPERTY); - enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); - return this; - } - - public SchoolRequest unselectSchoolType(){ - unselectProperty(School.SCHOOL_TYPE_PROPERTY); - return this; - } - public SchoolRequest selectName(){ - selectProperty(School.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectName(){ - unselectProperty(School.NAME_PROPERTY); - return this; - } - public SchoolRequest selectAddress(){ - selectProperty(School.ADDRESS_PROPERTY); - return this; - } - - /** - * fill the address with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS address) to fetch address property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectAddress(){ - unselectProperty(School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest selectEstablishedDate(){ - selectProperty(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - /** - * fill the establishedDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS establishedDate) to fetch establishedDate property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectEstablishedDate(){ - unselectProperty(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - public SchoolRequest selectStudentCapacity(){ - selectProperty(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - /** - * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. - * @param aggrFunction aggrFunction - */ - public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ - selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); - return this; - } - - - public SchoolRequest unselectStudentCapacity(){ - unselectProperty(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest selectActive(){ - selectProperty(School.ACTIVE_PROPERTY); - return this; - } - - /** - * fill the active with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS active) to fetch active property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectActive(){ - unselectProperty(School.ACTIVE_PROPERTY); - return this; - } - public SchoolRequest selectCreateTime(){ - selectProperty(School.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectCreateTime(){ - unselectProperty(School.CREATE_TIME_PROPERTY); - return this; - } - public SchoolRequest selectUpdateTime(){ - selectProperty(School.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectUpdateTime(){ - unselectProperty(School.UPDATE_TIME_PROPERTY); - return this; - } - public SchoolRequest selectVersion(){ - selectProperty(School.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectVersion(){ - unselectProperty(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); - } - - public SchoolRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); - } - - public SchoolRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolRequest filterBySchoolType(SchoolType... schoolType){ - if (schoolType == null || schoolType.length == 0) { - throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); - } - return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); - } - - public SchoolRequest withSchoolType(Operator operator, Object... values){ - return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); - } - - public SchoolRequest withSchoolTypeIsUnknown(){ - return withSchoolType(Operator.IS_NULL); - } - - public SchoolRequest withSchoolTypeIsKnown(){ - return withSchoolType(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); - } - - public SchoolRequest filterBySchoolType(Long schoolType){ - if(schoolType == null){ - return this; - } - return withSchoolType(Operator.EQUAL, schoolType); - } - public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ - return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); - } - - public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); - } - - public SchoolRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); - } - - public SchoolRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolRequest filterByAddress(String... address){ - if (address == null || address.length == 0) { - throw new IllegalArgumentException("filterByAddress parameter address cannot be empty"); - } - return appendSearchCriteria(createAddressCriteria(Operator.EQUAL, (Object[])address)); - } - - public SchoolRequest withAddress(Operator operator, Object... values){ - return appendSearchCriteria(createAddressCriteria(operator, values)); - } - - public SchoolRequest withAddressIsUnknown(){ - return withAddress(Operator.IS_NULL); - } - - public SchoolRequest withAddressIsKnown(){ - return withAddress(Operator.IS_NOT_NULL); - } - - public SearchCriteria createAddressCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ADDRESS_PROPERTY, operator, values); - } - - public SchoolRequest withAddressIsNot(String address){ - return withAddress(Operator.NOT_EQUAL, address); - } - - public SchoolRequest withAddressIn(String... address){ - return withAddress(Operator.IN, (Object[])address); - } - - public SchoolRequest withAddressNotIn(String... address){ - return withAddress(Operator.NOT_IN, (Object[])address); - } - public SchoolRequest withAddressGreaterThan(String address){ - return withAddress(Operator.GREATER_THAN, address); - } - - public SchoolRequest withAddressGreaterThanOrEqualTo(String address){ - return withAddress(Operator.GREATER_THAN_OR_EQUAL, address); - } - - public SchoolRequest withAddressLessThan(String address){ - return withAddress(Operator.LESS_THAN, address); - } - - public SchoolRequest withAddressLessThanOrEqualTo(String address){ - return withAddress(Operator.LESS_THAN_OR_EQUAL, address); - } - - public SchoolRequest withAddressBetween(String startOfAddress, String endOfAddress){ - return withAddress(Operator.BETWEEN, startOfAddress, endOfAddress); - } - public SchoolRequest withAddressStartingWith(String address){ - return withAddress(Operator.BEGIN_WITH, address); - } - public SchoolRequest withAddressContaining(String address){ - return withAddress(Operator.CONTAIN, address); - } - - public SchoolRequest withAddressNotContaining(String address){ - return withAddress(Operator.NOT_CONTAIN, address); - } - - public SchoolRequest withAddressNotStartingWith(String address){ - return withAddress(Operator.NOT_BEGIN_WITH, address); - } - - public SchoolRequest withAddressEndingWith(String address){ - return withAddress(Operator.END_WITH, address); - } - - public SchoolRequest withAddressNotEndingWith(String address){ - return withAddress(Operator.NOT_END_WITH, address); - } - - public SchoolRequest withAddressIs(String address){ - return withAddress(Operator.EQUAL, address); - } - - public SchoolRequest withAddressSoundingLike(String address){ - return withAddress(Operator.SOUNDS_LIKE, address); - } - - - - public SchoolRequest filterByEstablishedDate(LocalDate... establishedDate){ - if (establishedDate == null || establishedDate.length == 0) { - throw new IllegalArgumentException("filterByEstablishedDate parameter establishedDate cannot be empty"); - } - return appendSearchCriteria(createEstablishedDateCriteria(Operator.EQUAL, (Object[])establishedDate)); - } - - public SchoolRequest withEstablishedDate(Operator operator, Object... values){ - return appendSearchCriteria(createEstablishedDateCriteria(operator, values)); - } - - public SchoolRequest withEstablishedDateIsUnknown(){ - return withEstablishedDate(Operator.IS_NULL); - } - - public SchoolRequest withEstablishedDateIsKnown(){ - return withEstablishedDate(Operator.IS_NOT_NULL); - } - - public SearchCriteria createEstablishedDateCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ESTABLISHED_DATE_PROPERTY, operator, values); - } - - public SchoolRequest withEstablishedDateIs(LocalDate establishedDate){ - return withEstablishedDate(Operator.EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateIsNot(LocalDate establishedDate){ - return withEstablishedDate(Operator.NOT_EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateIn(LocalDate... establishedDate){ - return withEstablishedDate(Operator.IN, (Object[])establishedDate); - } - - public SchoolRequest withEstablishedDateNotIn(LocalDate... establishedDate){ - return withEstablishedDate(Operator.NOT_IN, (Object[])establishedDate); - } - public SchoolRequest withEstablishedDateGreaterThan(LocalDate establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateGreaterThanOrEqualTo(LocalDate establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN_OR_EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateLessThan(LocalDate establishedDate){ - return withEstablishedDate(Operator.LESS_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateLessThanOrEqualTo(LocalDate establishedDate){ - return withEstablishedDate(Operator.LESS_THAN_OR_EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateBetween(LocalDate startOfEstablishedDate, LocalDate endOfEstablishedDate){ - return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); - } - public SchoolRequest withEstablishedDateBefore(LocalDate establishedDate){ - return withEstablishedDate(Operator.LESS_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateBefore(Date establishedDate){ - return withEstablishedDate(Operator.LESS_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateAfter(LocalDate establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateAfter(Date establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateBetween(Date startOfEstablishedDate, Date endOfEstablishedDate){ - return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); - } - - - - - public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ - if (studentCapacity == null || studentCapacity.length == 0) { - throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); - } - return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); - } - - public SchoolRequest withStudentCapacity(Operator operator, Object... values){ - return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); - } - - public SchoolRequest withStudentCapacityIsUnknown(){ - return withStudentCapacity(Operator.IS_NULL); - } - - public SchoolRequest withStudentCapacityIsKnown(){ - return withStudentCapacity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); - } - - public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ - return withStudentCapacity(Operator.EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ - return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ - return withStudentCapacity(Operator.IN, (Object[])studentCapacity); - } - - public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ - return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); - } - public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ - return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); - } - - public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ - return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ - return withStudentCapacity(Operator.LESS_THAN, studentCapacity); - } - - public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ - return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ - return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); - } - - - - public SchoolRequest filterByActive(Boolean... active){ - if (active == null || active.length == 0) { - throw new IllegalArgumentException("filterByActive parameter active cannot be empty"); - } - return appendSearchCriteria(createActiveCriteria(Operator.EQUAL, (Object[])active)); - } - - public SchoolRequest withActive(Operator operator, Object... values){ - return appendSearchCriteria(createActiveCriteria(operator, values)); - } - - public SchoolRequest withActiveIsUnknown(){ - return withActive(Operator.IS_NULL); - } - - public SchoolRequest withActiveIsKnown(){ - return withActive(Operator.IS_NOT_NULL); - } - - public SearchCriteria createActiveCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ACTIVE_PROPERTY, operator, values); - } - - public SchoolRequest whichAreActive(){ - return withActive(Operator.EQUAL, true); - } - - public SchoolRequest whichAreNotActive(){ - return withActive(Operator.EQUAL, false); - } - - - public SchoolRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public SchoolRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public SchoolRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public SchoolRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.CREATE_TIME_PROPERTY, operator, values); - } - - public SchoolRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public SchoolRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public SchoolRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public SchoolRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public SchoolRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public SchoolRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public SchoolRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public SchoolRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public SchoolRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public SchoolRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public SchoolRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public SchoolRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public SchoolRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public SchoolRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public SchoolRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public SchoolRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public SchoolRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public SchoolRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.UPDATE_TIME_PROPERTY, operator, values); - } - - public SchoolRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public SchoolRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public SchoolRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public SchoolRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public SchoolRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); - } - - public SchoolRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public SchoolRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolRequest minStudentCapacity(){ - return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest minStudentCapacityAs(String retName){ - super.min(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest maxStudentCapacity(){ - return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest maxStudentCapacityAs(String retName){ - super.max(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest sumStudentCapacity(){ - return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest sumStudentCapacityAs(String retName){ - super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest avgStudentCapacity(){ - return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest avgStudentCapacityAs(String retName){ - super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest standardDeviationStudentCapacity(){ - return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest standardDeviationStudentCapacityAs(String retName){ - super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ - return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest sampleVarianceStudentCapacity(){ - return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ - super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest samplePopulationVarianceStudentCapacity(){ - return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ - super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(School.PLATFORM_PROPERTY, subRequest); - return this; - } - - public SchoolRequest groupBySchoolTypeWithDetails(){ - return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); - } - - public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ - aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); - return this; - } - - - - - - - - - - public SchoolRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, School.ID_PROPERTY); - return this; - } - public SchoolRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); - return this; - } - public SchoolRequest countDistinctSchoolType(){ - return countDistinctSchoolTypeAs("school_type_distinct_count"); - } - - public SchoolRequest countDistinctSchoolTypeAs(String alias){ - super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); - return this; - } - public SchoolRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, School.NAME_PROPERTY); - return this; - } - public SchoolRequest countDistinctAddress(){ - return countDistinctAddressAs("address_distinct_count"); - } - - public SchoolRequest countDistinctAddressAs(String alias){ - super.countDistinctProperty(alias, School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest countDistinctEstablishedDate(){ - return countDistinctEstablishedDateAs("established_date_distinct_count"); - } - - public SchoolRequest countDistinctEstablishedDateAs(String alias){ - super.countDistinctProperty(alias, School.ESTABLISHED_DATE_PROPERTY); - return this; - } - public SchoolRequest countDistinctStudentCapacity(){ - return countDistinctStudentCapacityAs("student_capacity_distinct_count"); - } - - public SchoolRequest countDistinctStudentCapacityAs(String alias){ - super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest countDistinctActive(){ - return countDistinctActiveAs("active_distinct_count"); - } - - public SchoolRequest countDistinctActiveAs(String alias){ - super.countDistinctProperty(alias, School.ACTIVE_PROPERTY); - return this; - } - public SchoolRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public SchoolRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, School.CREATE_TIME_PROPERTY); - return this; - } - public SchoolRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public SchoolRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, School.UPDATE_TIME_PROPERTY); - return this; - } - public SchoolRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupById(){ - groupBy(School.ID_PROPERTY); - return this; - } - - public SchoolRequest groupByIdAs(String retName){ - groupBy(retName, School.ID_PROPERTY); - return this; - } - - public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ID_PROPERTY, function); - return this; - } - public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(School.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolRequest groupByPlatform(){ - groupBy(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest groupByPlatformAs(String retName){ - groupBy(retName, School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.PLATFORM_PROPERTY, function); - return this; - } - public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); - return this; - } - public SchoolRequest groupBySchoolType(){ - groupBy(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest groupBySchoolTypeAs(String retName){ - groupBy(retName, School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByName(){ - groupBy(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest groupByNameAs(String retName){ - groupBy(retName, School.NAME_PROPERTY); - return this; - } - - public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.NAME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByAddress(){ - groupBy(School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest groupByAddressAs(String retName){ - groupBy(retName, School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest groupByAddressWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ADDRESS_PROPERTY, function); - return this; - } - - public SchoolRequest groupByEstablishedDate(){ - groupBy(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest groupByEstablishedDateAs(String retName){ - groupBy(retName, School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest groupByEstablishedDateWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ESTABLISHED_DATE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByStudentCapacity(){ - groupBy(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest groupByStudentCapacityAs(String retName){ - groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); - return this; - } - - public SchoolRequest groupByActive(){ - groupBy(School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest groupByActiveAs(String retName){ - groupBy(retName, School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest groupByActiveWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ACTIVE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByCreateTime(){ - groupBy(School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByCreateTimeAs(String retName){ - groupBy(retName, School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.CREATE_TIME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByUpdateTime(){ - groupBy(School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.UPDATE_TIME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByVersion(){ - groupBy(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupByVersionAs(String retName){ - groupBy(retName, School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.VERSION_PROPERTY, function); - return this; - } - - public SchoolRequest withSchoolTypeIsPrimary(){ - filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_PRIMARY); - return this; - } - - - public SchoolRequest withSchoolTypeIsSecondary(){ - filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_SECONDARY); - return this; - } - - - - - public SchoolRequest orderByIdAscending(){ - addOrderByAscending(School.ID_PROPERTY); - return this; - } - - public SchoolRequest orderByIdDescending(){ - addOrderByDescending(School.ID_PROPERTY); - return this; - } - - public SchoolRequest orderByPlatformAscending(){ - addOrderByAscending(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest orderByPlatformDescending(){ - addOrderByDescending(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest orderBySchoolTypeAscending(){ - addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest orderBySchoolTypeDescending(){ - addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest orderByNameAscending(){ - addOrderByAscending(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest orderByNameDescending(){ - addOrderByDescending(School.NAME_PROPERTY); - return this; - } - public SchoolRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(School.NAME_PROPERTY); - return this; - } - public SchoolRequest orderByAddressAscending(){ - addOrderByAscending(School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest orderByAddressDescending(){ - addOrderByDescending(School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest orderByAddressAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest orderByAddressDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest orderByEstablishedDateAscending(){ - addOrderByAscending(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest orderByEstablishedDateDescending(){ - addOrderByDescending(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest orderByStudentCapacityAscending(){ - addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest orderByStudentCapacityDescending(){ - addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest orderByActiveAscending(){ - addOrderByAscending(School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest orderByActiveDescending(){ - addOrderByDescending(School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest orderByCreateTimeAscending(){ - addOrderByAscending(School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByCreateTimeDescending(){ - addOrderByDescending(School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByUpdateTimeAscending(){ - addOrderByAscending(School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByUpdateTimeDescending(){ - addOrderByDescending(School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByVersionAscending(){ - addOrderByAscending(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest orderByVersionDescending(){ - addOrderByDescending(School.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - public SchoolTypeRequest rollUpToSchoolType(){ - SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); - this.internalRollUpTo("school_type", schoolType, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); - return schoolType; - } - - - - - - - - - - - public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); - return this; - } - public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ - return facetBySchoolTypeAs(facetName, schoolType, true); - } - - public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ - addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java deleted file mode 100644 index 082e03793..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java +++ /dev/null @@ -1,193 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.school.School; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class SchoolType extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "SchoolType"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "36f5b35e840d2f9ef89c6ee13c7d936fa10abc12a139d7f0373f9acabc9eac12"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "school_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String NAME_PROPERTY = "name"; - public static final String CODE_PROPERTY = "code"; - public static final String DISPLAY_ORDER_PROPERTY = "display_order"; - public static final String SCHOOL_LIST_PROPERTY = "school_list"; - private Platform platform; - - private String name; - - private String code; - - private BigDecimal displayOrder; - - private SmartList schoolList; - - public Platform getPlatform(){ - return this.platform; - } - - public String getName(){ - return this.name; - } - - public String getCode(){ - return this.code; - } - - public BigDecimal getDisplayOrder(){ - return this.displayOrder; - } - - public SmartList getSchoolList(){ - return this.schoolList == null ? SmartList.unloaded() : this.schoolList; - } - public SchoolType updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public SchoolType updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public SchoolType updateCode(String code){ - code = (code == null ? null : code.trim()); - if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ - return this; - } - handleUpdate(CODE_PROPERTY, getCode(), code); - this.code = code; - return this; - } - - public SchoolType updateDisplayOrder(BigDecimal displayOrder){ - if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ - return this; - } - handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); - this.displayOrder = displayOrder; - return this; - } - - public SchoolType addSchool(School school){ - if (school == null){ - return this; - } - - if(null == this.schoolList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolList.add(school); - school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); - return this; - } - - public static SchoolType refer(Long id){ - SchoolType refer = new SchoolType(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public SchoolType comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "code": this.code = (value == null ? null : ((String)value).trim()); break; - - case "display_order": this.displayOrder = (BigDecimal) value; break; - - case "school_list": this.schoolList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "display_order": return this.displayOrder; - case "school_list": return this.schoolList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "displayOrder": return this.displayOrder; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java deleted file mode 100644 index 6e59fad6a..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java +++ /dev/null @@ -1,88 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformChecker; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; - -public class SchoolTypeChecker implements Checker{ - - public String type(){ - return SchoolType.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - if(needCheck(_context, schoolType)){ - markAsChecked(_context, schoolType); - doCheck(_context, schoolType, _parentLocation); - } - } - - public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - if((schoolType == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, schoolType); - if(schoolType.needPersist()){ - } - if(schoolType.newItem()){ - }else if(schoolType.updateItem()){ - if(!schoolType.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("display_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); - checkDisplayOrder(_context, schoolType.getProperty(SchoolType.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); - for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ - School school = schoolType.getSchoolList().get(i); - new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); - } - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, code); - if((code == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, code); - - } - public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, displayOrder); - if((displayOrder == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java deleted file mode 100644 index f77c8c705..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java +++ /dev/null @@ -1,76 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.util.function.Function; - -public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolTypeExpression(Expression expression){ - super(expression); - } - - public SchoolTypeExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolTypeExpression updateId(Long id){ - return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); - } - - public SchoolTypeExpression save(UserContext userContext){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolTypeExpression save(String intent, UserContext userContext){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); - } - - public SchoolTypeExpression updatePlatform(Platform platform){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); - } - - public Expression getName(){ - return loaded("name", "getName", SchoolType::getName); - } - public SchoolTypeExpression updateName(String name){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); - } - - public Expression getCode(){ - return loaded("code", "getCode", SchoolType::getCode); - } - public SchoolTypeExpression updateCode(String code){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); - } - - public Expression getDisplayOrder(){ - return loaded("display_order", "getDisplayOrder", SchoolType::getDisplayOrder); - } - public SchoolTypeExpression updateDisplayOrder(BigDecimal displayOrder){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateDisplayOrder(displayOrder)); - } - - public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); - } - public SchoolTypeExpression addSchool(School school){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java deleted file mode 100644 index 55fdae628..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolTypeListExpression extends SmartListExpression { - public SchoolTypeListExpression(Expression> expression){ - super(expression); - } - - public SchoolTypeListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolTypeExpression first() { - return new SchoolTypeExpression(super.first()); - } - - public SchoolTypeExpression get(int index) { - return new SchoolTypeExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java deleted file mode 100644 index 1b91f030f..000000000 --- a/examples/school-management/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java +++ /dev/null @@ -1,1238 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformRequest; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.util.Objects; - -public class SchoolTypeRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolTypeRequest(Class returnType){ - this(returnType, () -> (T) new SchoolType()); - } - - protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolTypeRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolTypeRequest copy(){ - return (SchoolTypeRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolTypeRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolTypeRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolTypeRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolTypeRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolTypeRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolTypeRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolTypeRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ - super.internalMatchAny(schoolType); - return this; - } - - public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); - } - - public SchoolTypeRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SchoolTypeRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolTypeRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolTypeRequest selectSelf(){ - super.selectSelf(); - return selectPlatformIdOnly().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); - } - - public SchoolTypeRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolTypeRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(SchoolType.PLATFORM_PROPERTY); - selectProperty(SchoolType.ID_PROPERTY); - selectProperty(SchoolType.NAME_PROPERTY); - selectProperty(SchoolType.CODE_PROPERTY); - selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); - selectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest selectAll(){ - super.selectAll(); - return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); - } - - public SchoolTypeRequest selectChildren(){ - super.selectAny(); - selectSchoolList(); - return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); - } - - - public SchoolTypeRequest selectPlatformIdOnly(){ - selectProperty(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(SchoolType.PLATFORM_PROPERTY); - enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); - return this; - } - - public SchoolTypeRequest unselectPlatform(){ - unselectProperty(SchoolType.PLATFORM_PROPERTY); - return this; - } - public SchoolTypeRequest selectId(){ - selectProperty(SchoolType.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectId(){ - unselectProperty(SchoolType.ID_PROPERTY); - return this; - } - public SchoolTypeRequest selectName(){ - selectProperty(SchoolType.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectName(){ - unselectProperty(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest selectCode(){ - selectProperty(SchoolType.CODE_PROPERTY); - return this; - } - - /** - * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectCode(){ - unselectProperty(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest selectDisplayOrder(){ - selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - /** - * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. - * @param aggrFunction aggrFunction - */ - public SchoolTypeRequest selectDisplayOrder(AggrFunction aggrFunction){ - selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY, aggrFunction); - return this; - } - - - public SchoolTypeRequest unselectDisplayOrder(){ - unselectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest selectVersion(){ - selectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectVersion(){ - unselectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - public SchoolTypeRequest selectSchoolList(){ - return selectSchoolListWith(Q.schools().selectSelf()); - } - - public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolTypeRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolTypeRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolTypeRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); - } - - public SchoolTypeRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolTypeRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); - } - - public SchoolTypeRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolTypeRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolTypeRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolTypeRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolTypeRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolTypeRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolTypeRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolTypeRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); - } - - public SchoolTypeRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolTypeRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolTypeRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolTypeRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolTypeRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolTypeRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolTypeRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolTypeRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolTypeRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolTypeRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolTypeRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolTypeRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolTypeRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolTypeRequest filterByCode(String... code){ - if (code == null || code.length == 0) { - throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); - } - return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); - } - - public SchoolTypeRequest withCode(Operator operator, Object... values){ - return appendSearchCriteria(createCodeCriteria(operator, values)); - } - - public SchoolTypeRequest withCodeIsUnknown(){ - return withCode(Operator.IS_NULL); - } - - public SchoolTypeRequest withCodeIsKnown(){ - return withCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); - } - - public SchoolTypeRequest withCodeIsNot(String code){ - return withCode(Operator.NOT_EQUAL, code); - } - - public SchoolTypeRequest withCodeIn(String... code){ - return withCode(Operator.IN, (Object[])code); - } - - public SchoolTypeRequest withCodeNotIn(String... code){ - return withCode(Operator.NOT_IN, (Object[])code); - } - public SchoolTypeRequest withCodeGreaterThan(String code){ - return withCode(Operator.GREATER_THAN, code); - } - - public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ - return withCode(Operator.GREATER_THAN_OR_EQUAL, code); - } - - public SchoolTypeRequest withCodeLessThan(String code){ - return withCode(Operator.LESS_THAN, code); - } - - public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ - return withCode(Operator.LESS_THAN_OR_EQUAL, code); - } - - public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ - return withCode(Operator.BETWEEN, startOfCode, endOfCode); - } - public SchoolTypeRequest withCodeStartingWith(String code){ - return withCode(Operator.BEGIN_WITH, code); - } - public SchoolTypeRequest withCodeContaining(String code){ - return withCode(Operator.CONTAIN, code); - } - - public SchoolTypeRequest withCodeNotContaining(String code){ - return withCode(Operator.NOT_CONTAIN, code); - } - - public SchoolTypeRequest withCodeNotStartingWith(String code){ - return withCode(Operator.NOT_BEGIN_WITH, code); - } - - public SchoolTypeRequest withCodeEndingWith(String code){ - return withCode(Operator.END_WITH, code); - } - - public SchoolTypeRequest withCodeNotEndingWith(String code){ - return withCode(Operator.NOT_END_WITH, code); - } - - public SchoolTypeRequest withCodeIs(String code){ - return withCode(Operator.EQUAL, code); - } - - public SchoolTypeRequest withCodeSoundingLike(String code){ - return withCode(Operator.SOUNDS_LIKE, code); - } - - - - public SchoolTypeRequest filterByDisplayOrder(BigDecimal... displayOrder){ - if (displayOrder == null || displayOrder.length == 0) { - throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); - } - return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); - } - - public SchoolTypeRequest withDisplayOrder(Operator operator, Object... values){ - return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); - } - - public SchoolTypeRequest withDisplayOrderIsUnknown(){ - return withDisplayOrder(Operator.IS_NULL); - } - - public SchoolTypeRequest withDisplayOrderIsKnown(){ - return withDisplayOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.DISPLAY_ORDER_PROPERTY, operator, values); - } - - public SchoolTypeRequest withDisplayOrderIs(BigDecimal displayOrder){ - return withDisplayOrder(Operator.EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderIsNot(BigDecimal displayOrder){ - return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.IN, (Object[])displayOrder); - } - - public SchoolTypeRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); - } - public SchoolTypeRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderLessThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ - return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); - } - - - - public SchoolTypeRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolTypeRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolTypeRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolTypeRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); - } - - public SchoolTypeRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolTypeRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolTypeRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolTypeRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolTypeRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolTypeRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); - } - - public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); - } - - public SchoolTypeRequest haveSchools(){ - return withSchoolListMatching(Q.schools().unlimited()); - } - - public SchoolTypeRequest haveNoSchools(){ - return withoutSchoolListMatching(Q.schools().unlimited()); - } - - public SchoolTypeRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolTypeRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolTypeRequest minDisplayOrder(){ - return minDisplayOrderAs(prefix("minOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest minDisplayOrderAs(String retName){ - super.min(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest maxDisplayOrder(){ - return maxDisplayOrderAs(prefix("maxOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest maxDisplayOrderAs(String retName){ - super.max(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest sumDisplayOrder(){ - return sumDisplayOrderAs(prefix("sumOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest sumDisplayOrderAs(String retName){ - super.sum(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest avgDisplayOrder(){ - return avgDisplayOrderAs(prefix("avgOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest avgDisplayOrderAs(String retName){ - super.avg(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest standardDeviationDisplayOrder(){ - return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest standardDeviationDisplayOrderAs(String retName){ - super.standardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ - return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest sampleVarianceDisplayOrder(){ - return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest sampleVarianceDisplayOrderAs(String retName){ - super.sampleVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest samplePopulationVarianceDisplayOrder(){ - return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest samplePopulationVarianceDisplayOrderAs(String retName){ - super.samplePopulationVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - - - public SchoolTypeRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolTypeRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolTypeRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolTypeRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctCode(){ - return countDistinctCodeAs("code_distinct_count"); - } - - public SchoolTypeRequest countDistinctCodeAs(String alias){ - super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctDisplayOrder(){ - return countDistinctDisplayOrderAs("display_order_distinct_count"); - } - - public SchoolTypeRequest countDistinctDisplayOrderAs(String alias){ - super.countDistinctProperty(alias, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolTypeRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); - return this; - } - public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ - aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); - return this; - } - - public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolTypeRequest groupByPlatform(){ - groupBy(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByPlatformAs(String retName){ - groupBy(retName, SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupById(){ - groupBy(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByIdAs(String retName){ - groupBy(retName, SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.ID_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByName(){ - groupBy(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByNameAs(String retName){ - groupBy(retName, SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.NAME_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByCode(){ - groupBy(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByCodeAs(String retName){ - groupBy(retName, SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.CODE_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByDisplayOrder(){ - groupBy(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByDisplayOrderAs(String retName){ - groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByVersion(){ - groupBy(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByVersionAs(String retName){ - groupBy(retName, SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.VERSION_PROPERTY, function); - return this; - } - - - - public SchoolTypeRequest orderByPlatformAscending(){ - addOrderByAscending(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByPlatformDescending(){ - addOrderByDescending(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByIdAscending(){ - addOrderByAscending(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByIdDescending(){ - addOrderByDescending(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameAscending(){ - addOrderByAscending(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameDescending(){ - addOrderByDescending(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest orderByCodeAscending(){ - addOrderByAscending(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByCodeDescending(){ - addOrderByDescending(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest orderByDisplayOrderAscending(){ - addOrderByAscending(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByDisplayOrderDescending(){ - addOrderByDescending(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByVersionAscending(){ - addOrderByAscending(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByVersionDescending(){ - addOrderByDescending(SchoolType.VERSION_PROPERTY); - return this; - } - - - public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest, false); - } - - public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ - return statsFromSchoolsAs(REFINEMENTS, subRequest); - } - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - - public SchoolTypeRequest countSchools(){ - addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest countSchoolsAs(String name){ - addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ - addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest minStudentCapacityOfSchools(){ - addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ - return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest maxStudentCapacityOfSchools(){ - addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ - return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest sumStudentCapacityOfSchools(){ - addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ - return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest avgStudentCapacityOfSchools(){ - addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ - return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ - return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ - return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolTypeRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolTypeRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolTypeRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolTypeRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolTypeRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolTypeRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/school-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/school-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 29fd0dd7c..000000000 --- a/examples/school-management/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.schoolmanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/school-management/showcase.json b/examples/school-management/showcase.json index 70434687b..daf220d90 100644 --- a/examples/school-management/showcase.json +++ b/examples/school-management/showcase.json @@ -60,6 +60,7 @@ ], "generatedFilesManifestSHA256": "820c6d2a699fd8ce6686d6f6398357195211c062f2fd95ff87a2dde57aff4765", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/security-foundations/java-app-console/lib/pom.xml b/examples/security-foundations/java-app-console/lib/pom.xml deleted file mode 100644 index bf1225a19..000000000 --- a/examples/security-foundations/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - merchant-order-privacy-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java deleted file mode 100644 index bc79fc767..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.merchantorderprivacyservice; - -import com.teaql.merchantorderprivacyservice.merchant.Merchant; - -public interface Constants { - public static final long MERCHANT_ID = 1l; - public static final Merchant MERCHANT = Merchant.refer(MERCHANT_ID); -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java deleted file mode 100644 index e791a61e2..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/E.java +++ /dev/null @@ -1,23 +0,0 @@ - -package com.teaql.merchantorderprivacyservice; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderExpression; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileExpression; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static MerchantExpression merchant(Merchant merchant){ - return new MerchantExpression(new ValueExpression(merchant, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.merchant()")); - } - public static CustomerProfileExpression customerProfile(CustomerProfile customerProfile){ - return new CustomerProfileExpression(new ValueExpression(customerProfile, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerProfile()")); - } - public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java deleted file mode 100644 index a573c8fcc..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/EntityMetaRegistry.java +++ /dev/null @@ -1,429 +0,0 @@ - -package com.teaql.merchantorderprivacyservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerMerchant(); - registerCustomerProfile(); - registerCustomerOrder(); - } - private void registerMerchant() { - FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.merchant.Merchant.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.merchant.Merchant.class); - entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.merchant.Merchant::new); - entityDescriptor.with("name", "Merchant") - - .with("module", "Sales") - - .with("module_key", "sales") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Harbour Retail") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.merchant.Merchant.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomerProfile() { - FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class); - entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile::new); - entityDescriptor.with("name", "Customer Profile") - - .with("module", "Sales") - - .with("module_key", "sales") - - .with("audit_mask_fields", "email") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY, Long.class) - ; - PropertyDescriptor merchant = - entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.MERCHANT_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.merchant.Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.class) - ; - PropertyDescriptor email = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.MERCHANT_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.EMAIL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomerOrder() { - FieldLayout.installGenerated(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder::new); - entityDescriptor.with("name", "Customer Order") - - .with("module", "Sales") - - .with("module_key", "sales") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor merchant = - entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.MERCHANT_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.merchant.Merchant.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.merchant.Merchant.class) - ; - PropertyDescriptor customerProfile = - entityDescriptor.addObjectProperty($factory, com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.CUSTOMER_PROFILE_PROPERTY, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.INTERNAL_TYPE, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor fulfillmentStatus = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.MERCHANT_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.CUSTOMER_PROFILE_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.FULFILLMENT_STATUS_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java deleted file mode 100644 index 591b7e603..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.teaql.merchantorderprivacyservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.merchantorderprivacyservice.merchant.MerchantChecker(), new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker(), new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:9136e660d5a681229d56c6670cb24a5831b04ca1677b181ea98574f12221c515\",\"entities\":{\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"customer_profile\",\"targetType\":\"CustomerProfile\",\"labels\":{\"en\":\"Customer Profile\"},\"aliases\":[\"CustomerProfile\",\"customerProfile\"]},{\"name\":\"fulfillment_status\",\"labels\":{\"en\":\"fulfillment status\"},\"aliases\":[\"FulfillmentStatus\",\"fulfillmentStatus\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"Merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerProfile\":{\"labels\":{\"en\":\"Customer Profile\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"email\",\"labels\":{\"en\":\"email\"},\"aliases\":[\"Email\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"merchant\",\"targetType\":\"Merchant\",\"labels\":{\"en\":\"Merchant\"},\"aliases\":[\"Merchant\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Merchant\":{\"labels\":{\"en\":\"Merchant\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"customer_profile_list\",\"targetType\":\"CustomerProfile\",\"labels\":{\"en\":\"Customer Profile\"},\"aliases\":[\"CustomerProfileList\",\"customerProfileList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Merchant", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("CustomerProfile", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("email", "email"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("merchant", "merchant"), java.util.Map.entry("customer_profile", "customerProfile"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("fulfillment_status", "fulfillmentStatus"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.merchants().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.merchantorderprivacyservice.merchant.Merchant domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.merchantorderprivacyservice.merchant.Merchant(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Harbour Retail"); - domainRoot.auditAs("create generated Domain Root Merchant").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Merchant", domainRoot.getId())); - } -} diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java deleted file mode 100644 index 8b8afaf68..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.merchantorderprivacyservice; - -import io.teaql.core.UserContext; -public interface MerchantOrderPrivacyServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java deleted file mode 100644 index 8feed11c0..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Q.java +++ /dev/null @@ -1,34 +0,0 @@ - -package com.teaql.merchantorderprivacyservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.merchantorderprivacyservice.merchant.MerchantRequest merchants(){ - return new com.teaql.merchantorderprivacyservice.merchant.MerchantRequest(com.teaql.merchantorderprivacyservice.merchant.Merchant.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.merchantorderprivacyservice.merchant.MerchantRequest merchantsWithMinimalFields(){ - return new com.teaql.merchantorderprivacyservice.merchant.MerchantRequest(com.teaql.merchantorderprivacyservice.merchant.Merchant.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest customerProfiles(){ - return new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest customerProfilesWithMinimalFields(){ - return new com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest(com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest customerOrders(){ - return new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ - return new com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest(com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java deleted file mode 100644 index 2a3c3f2cf..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrder.java +++ /dev/null @@ -1,170 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerorder; - -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CustomerOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CustomerOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "1e5c269646b9d3a77d2b8da3dfb1cf2899c91e276510b91bba15700d02c0d1a3"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("customer_profile", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("fulfillment_status", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("customer_profile", java.util.List.of("customerProfile", "customer_profile")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("fulfillment_status", java.util.List.of("fulfillmentStatus", "fulfillment_status")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String MERCHANT_PROPERTY = "merchant"; - public static final String CUSTOMER_PROFILE_PROPERTY = "customer_profile"; - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - public static final String FULFILLMENT_STATUS_PROPERTY = "fulfillment_status"; - private Merchant merchant; - - private CustomerProfile customerProfile; - - private String orderNumber; - - private String fulfillmentStatus; - - - public Merchant getMerchant(){ - return this.merchant; - } - - public CustomerProfile getCustomerProfile(){ - return this.customerProfile; - } - - public String getOrderNumber(){ - return this.orderNumber; - } - - public String getFulfillmentStatus(){ - return this.fulfillmentStatus; - } - - public CustomerOrder updateMerchant(Merchant merchant){ - if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ - return this; - } - handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); - this.merchant = merchant; - return this; - } - - public CustomerOrder updateCustomerProfile(CustomerProfile customerProfile){ - if(isPropertyLoaded(CUSTOMER_PROFILE_PROPERTY) && Objects.equals(this.customerProfile, customerProfile)){ - return this; - } - handleUpdate(CUSTOMER_PROFILE_PROPERTY, getCustomerProfile(), customerProfile); - this.customerProfile = customerProfile; - return this; - } - - public CustomerOrder updateOrderNumber(String orderNumber){ - orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); - this.orderNumber = orderNumber; - return this; - } - - public CustomerOrder updateFulfillmentStatus(String fulfillmentStatus){ - fulfillmentStatus = (fulfillmentStatus == null ? null : fulfillmentStatus.trim()); - if(isPropertyLoaded(FULFILLMENT_STATUS_PROPERTY) && Objects.equals(this.fulfillmentStatus, fulfillmentStatus)){ - return this; - } - handleUpdate(FULFILLMENT_STATUS_PROPERTY, getFulfillmentStatus(), fulfillmentStatus); - this.fulfillmentStatus = fulfillmentStatus; - return this; - } - - - public static CustomerOrder refer(Long id){ - CustomerOrder refer = new CustomerOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CustomerOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "merchant": this.merchant = (Merchant) value; break; - - case "customer_profile": this.customerProfile = (CustomerProfile) value; break; - - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - case "fulfillment_status": this.fulfillmentStatus = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "merchant": return this.merchant; - case "customer_profile": return this.customerProfile; - case "order_number": return this.orderNumber; - case "fulfillment_status": return this.fulfillmentStatus; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "merchant": return this.merchant; - case "customerProfile": return this.customerProfile; - case "orderNumber": return this.orderNumber; - case "fulfillmentStatus": return this.fulfillmentStatus; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java deleted file mode 100644 index dc1f2d837..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderChecker.java +++ /dev/null @@ -1,84 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerorder; - -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CustomerOrderChecker implements Checker{ - - public String type(){ - return CustomerOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, customerOrder)){ - markAsChecked(_context, customerOrder); - doCheck(_context, customerOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if((customerOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customerOrder); - if(customerOrder.needPersist()){ - } - if(customerOrder.newItem()){ - }else if(customerOrder.updateItem()){ - if(!customerOrder.isPropertyLoaded("merchant")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("customer_profile")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_profile"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("fulfillment_status")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "fulfillment_status"), "Mutation requires a fully loaded entity"); - } - - } - checkMerchant(_context, customerOrder.getProperty(CustomerOrder.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); - checkCustomerProfile(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY), newLocation(_parentLocation, "customer_profile")); - checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); - checkFulfillmentStatus(_context, customerOrder.getProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY), newLocation(_parentLocation, "fulfillment_status")); - } - - public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, merchant); - if((merchant == null)){ - return; - } - new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); - } - public void checkCustomerProfile(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerProfile); - if((customerProfile == null)){ - return; - } - new CustomerProfileChecker().checkAndFix(_context, customerProfile, _parentLocation); - } - public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, orderNumber); - - } - public void checkFulfillmentStatus(UserContext _context, String fulfillmentStatus, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, fulfillmentStatus); - if((fulfillmentStatus == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, fulfillmentStatus); - - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java deleted file mode 100644 index 326968aa8..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderExpression.java +++ /dev/null @@ -1,70 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerorder; - -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileExpression; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerOrderExpression(Expression expression){ - super(expression); - } - - public CustomerOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerOrderExpression updateId(Long id){ - return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); - } - - public CustomerOrderExpression save(UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerOrderExpression save(String intent, UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public MerchantExpression getMerchant(){ - return new MerchantExpression(loaded("merchant", "getMerchant", CustomerOrder::getMerchant)); - } - - public CustomerOrderExpression updateMerchant(Merchant merchant){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateMerchant(merchant)); - } - - public CustomerProfileExpression getCustomerProfile(){ - return new CustomerProfileExpression(loaded("customer_profile", "getCustomerProfile", CustomerOrder::getCustomerProfile)); - } - - public CustomerOrderExpression updateCustomerProfile(CustomerProfile customerProfile){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomerProfile(customerProfile)); - } - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); - } - public CustomerOrderExpression updateOrderNumber(String orderNumber){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); - } - - public Expression getFulfillmentStatus(){ - return loaded("fulfillment_status", "getFulfillmentStatus", CustomerOrder::getFulfillmentStatus); - } - public CustomerOrderExpression updateFulfillmentStatus(String fulfillmentStatus){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateFulfillmentStatus(fulfillmentStatus)); - } - -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java deleted file mode 100644 index bb3804728..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerOrderListExpression extends SmartListExpression { - public CustomerOrderListExpression(Expression> expression){ - super(expression); - } - - public CustomerOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerOrderExpression first() { - return new CustomerOrderExpression(super.first()); - } - - public CustomerOrderExpression get(int index) { - return new CustomerOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java deleted file mode 100644 index b2495f5f8..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerorder/CustomerOrderRequest.java +++ /dev/null @@ -1,959 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerorder; - -import com.teaql.merchantorderprivacyservice.Q; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CustomerOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerOrderRequest(Class returnType){ - this(returnType, () -> (T) new CustomerOrder()); - } - - protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerOrderRequest copy(){ - return (CustomerOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ - super.internalMatchAny(customerOrder); - return this; - } - - public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); - } - - public CustomerOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectMerchantIdOnly().selectCustomerProfileIdOnly().selectOrderNumber().selectFulfillmentStatus().selectVersion(); - } - - public CustomerOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CustomerOrder.ID_PROPERTY); - selectProperty(CustomerOrder.MERCHANT_PROPERTY); - selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - selectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectMerchant().selectCustomerProfile().selectOrderNumber().selectFulfillmentStatus().selectVersion(); - } - - public CustomerOrderRequest selectChildren(){ - super.selectAny(); - return selectId().selectMerchant().selectCustomerProfile().selectOrderNumber().selectFulfillmentStatus().selectVersion(); - } - - - public CustomerOrderRequest selectId(){ - selectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectId(){ - unselectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest selectMerchantIdOnly(){ - selectProperty(CustomerOrder.MERCHANT_PROPERTY); - return this; - } - - public CustomerOrderRequest selectMerchant(){ - return selectMerchantWith(Q.merchants().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectMerchantWith(MerchantRequest merchant){ - selectProperty(CustomerOrder.MERCHANT_PROPERTY); - enhanceRelation(CustomerOrder.MERCHANT_PROPERTY, merchant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, CustomerOrder.MERCHANT_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectMerchant(){ - unselectProperty(CustomerOrder.MERCHANT_PROPERTY); - return this; - } - public CustomerOrderRequest selectCustomerProfileIdOnly(){ - selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - - public CustomerOrderRequest selectCustomerProfile(){ - return selectCustomerProfileWith(Q.customerProfiles().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectCustomerProfileWith(CustomerProfileRequest customerProfile){ - selectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - enhanceRelation(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerProfileWith", null, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectCustomerProfile(){ - unselectProperty(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderNumber(){ - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderNumber(){ - unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest selectFulfillmentStatus(){ - selectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - - /** - * fill the fulfillmentStatus with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS fulfillmentStatus) to fetch fulfillmentStatus property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectFulfillmentStatus(){ - unselectProperty(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest selectVersion(){ - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectVersion(){ - unselectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); - } - - public CustomerOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerOrderRequest filterByMerchant(Merchant... merchant){ - if (merchant == null || merchant.length == 0) { - throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); - } - return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); - } - - public CustomerOrderRequest withMerchant(Operator operator, Object... values){ - return appendSearchCriteria(createMerchantCriteria(operator, values)); - } - - public CustomerOrderRequest withMerchantIsUnknown(){ - return withMerchant(Operator.IS_NULL); - } - - public CustomerOrderRequest withMerchantIsKnown(){ - return withMerchant(Operator.IS_NOT_NULL); - } - - public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.MERCHANT_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByMerchant(Long merchant){ - if(merchant == null){ - return this; - } - return withMerchant(Operator.EQUAL, merchant); - } - public CustomerOrderRequest withMerchantMatching(MerchantRequest merchant){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutMerchantMatching(MerchantRequest merchant){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByCustomerProfile(CustomerProfile... customerProfile){ - if (customerProfile == null || customerProfile.length == 0) { - throw new IllegalArgumentException("filterByCustomerProfile parameter customerProfile cannot be empty"); - } - return appendSearchCriteria(createCustomerProfileCriteria(Operator.EQUAL, (Object[])customerProfile)); - } - - public CustomerOrderRequest withCustomerProfile(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerProfileCriteria(operator, values)); - } - - public CustomerOrderRequest withCustomerProfileIsUnknown(){ - return withCustomerProfile(Operator.IS_NULL); - } - - public CustomerOrderRequest withCustomerProfileIsKnown(){ - return withCustomerProfile(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerProfileCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByCustomerProfile(Long customerProfile){ - if(customerProfile == null){ - return this; - } - return withCustomerProfile(Operator.EQUAL, customerProfile); - } - public CustomerOrderRequest withCustomerProfileMatching(CustomerProfileRequest customerProfile){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, CustomerProfile.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutCustomerProfileMatching(CustomerProfileRequest customerProfile){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, CustomerProfile.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ - if (orderNumber == null || orderNumber.length == 0) { - throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); - } - return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); - } - - public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ - return appendSearchCriteria(createOrderNumberCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderNumberIsUnknown(){ - return withOrderNumber(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderNumberIsKnown(){ - return withOrderNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ - return withOrderNumber(Operator.NOT_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ - return withOrderNumber(Operator.IN, (Object[])orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ - return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); - } - public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ - return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); - } - public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ - return withOrderNumber(Operator.BEGIN_WITH, orderNumber); - } - public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ - return withOrderNumber(Operator.CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ - return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ - return withOrderNumber(Operator.END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIs(String orderNumber){ - return withOrderNumber(Operator.EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ - return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); - } - - - - public CustomerOrderRequest filterByFulfillmentStatus(String... fulfillmentStatus){ - if (fulfillmentStatus == null || fulfillmentStatus.length == 0) { - throw new IllegalArgumentException("filterByFulfillmentStatus parameter fulfillmentStatus cannot be empty"); - } - return appendSearchCriteria(createFulfillmentStatusCriteria(Operator.EQUAL, (Object[])fulfillmentStatus)); - } - - public CustomerOrderRequest withFulfillmentStatus(Operator operator, Object... values){ - return appendSearchCriteria(createFulfillmentStatusCriteria(operator, values)); - } - - public CustomerOrderRequest withFulfillmentStatusIsUnknown(){ - return withFulfillmentStatus(Operator.IS_NULL); - } - - public CustomerOrderRequest withFulfillmentStatusIsKnown(){ - return withFulfillmentStatus(Operator.IS_NOT_NULL); - } - - public SearchCriteria createFulfillmentStatusCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.FULFILLMENT_STATUS_PROPERTY, operator, values); - } - - public CustomerOrderRequest withFulfillmentStatusIsNot(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.NOT_EQUAL, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusIn(String... fulfillmentStatus){ - return withFulfillmentStatus(Operator.IN, (Object[])fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusNotIn(String... fulfillmentStatus){ - return withFulfillmentStatus(Operator.NOT_IN, (Object[])fulfillmentStatus); - } - public CustomerOrderRequest withFulfillmentStatusGreaterThan(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.GREATER_THAN, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusGreaterThanOrEqualTo(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.GREATER_THAN_OR_EQUAL, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusLessThan(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.LESS_THAN, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusLessThanOrEqualTo(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.LESS_THAN_OR_EQUAL, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusBetween(String startOfFulfillmentStatus, String endOfFulfillmentStatus){ - return withFulfillmentStatus(Operator.BETWEEN, startOfFulfillmentStatus, endOfFulfillmentStatus); - } - public CustomerOrderRequest withFulfillmentStatusStartingWith(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.BEGIN_WITH, fulfillmentStatus); - } - public CustomerOrderRequest withFulfillmentStatusContaining(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.CONTAIN, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusNotContaining(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.NOT_CONTAIN, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusNotStartingWith(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.NOT_BEGIN_WITH, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusEndingWith(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.END_WITH, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusNotEndingWith(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.NOT_END_WITH, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusIs(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.EQUAL, fulfillmentStatus); - } - - public CustomerOrderRequest withFulfillmentStatusSoundingLike(String fulfillmentStatus){ - return withFulfillmentStatus(Operator.SOUNDS_LIKE, fulfillmentStatus); - } - - - - public CustomerOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); - } - - public CustomerOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public CustomerOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerOrderRequest groupByMerchantWithDetails(){ - return groupByMerchantWithDetails(Q.merchants().unlimited()); - } - - public CustomerOrderRequest groupByMerchantWithDetails(MerchantRequest subRequest){ - aggregate(CustomerOrder.MERCHANT_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupByCustomerProfileWithDetails(){ - return groupByCustomerProfileWithDetails(Q.customerProfiles().unlimited()); - } - - public CustomerOrderRequest groupByCustomerProfileWithDetails(CustomerProfileRequest subRequest){ - aggregate(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, subRequest); - return this; - } - - - - - public CustomerOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctMerchant(){ - return countDistinctMerchantAs("merchant_distinct_count"); - } - - public CustomerOrderRequest countDistinctMerchantAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.MERCHANT_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctCustomerProfile(){ - return countDistinctCustomerProfileAs("customer_profile_distinct_count"); - } - - public CustomerOrderRequest countDistinctCustomerProfileAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctFulfillmentStatus(){ - return countDistinctFulfillmentStatusAs("fulfillment_status_distinct_count"); - } - - public CustomerOrderRequest countDistinctFulfillmentStatusAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupById(){ - groupBy(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdAs(String retName){ - groupBy(retName, CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ID_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByMerchantWith(MerchantRequest subRequest){ - groupBy(CustomerOrder.MERCHANT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); - return this; - } - public CustomerOrderRequest groupByMerchant(){ - groupBy(CustomerOrder.MERCHANT_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByMerchantAs(String retName){ - groupBy(retName, CustomerOrder.MERCHANT_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByMerchantWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.MERCHANT_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByCustomerProfileWith(CustomerProfileRequest subRequest){ - groupBy(CustomerOrder.CUSTOMER_PROFILE_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerProfileWith", null, "customer_profile")); - return this; - } - public CustomerOrderRequest groupByCustomerProfile(){ - groupBy(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCustomerProfileAs(String retName){ - groupBy(retName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCustomerProfileWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderNumber(){ - groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByFulfillmentStatus(){ - groupBy(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByFulfillmentStatusAs(String retName){ - groupBy(retName, CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByFulfillmentStatusWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.FULFILLMENT_STATUS_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByVersion(){ - groupBy(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionAs(String retName){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); - return this; - } - - - - public CustomerOrderRequest orderByIdAscending(){ - addOrderByAscending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByIdDescending(){ - addOrderByDescending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByMerchantAscending(){ - addOrderByAscending(CustomerOrder.MERCHANT_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByMerchantDescending(){ - addOrderByDescending(CustomerOrder.MERCHANT_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCustomerProfileAscending(){ - addOrderByAscending(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCustomerProfileDescending(){ - addOrderByDescending(CustomerOrder.CUSTOMER_PROFILE_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByFulfillmentStatusAscending(){ - addOrderByAscending(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByFulfillmentStatusDescending(){ - addOrderByDescending(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest orderByFulfillmentStatusAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByFulfillmentStatusDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.FULFILLMENT_STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest orderByVersionAscending(){ - addOrderByAscending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionDescending(){ - addOrderByDescending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - - public MerchantRequest rollUpToMerchant(){ - MerchantRequest merchant = Q.merchants().unlimited(); - this.internalRollUpTo("merchant", merchant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); - return merchant; - } - - public CustomerProfileRequest rollUpToCustomerProfile(){ - CustomerProfileRequest customerProfile = Q.customerProfiles().unlimited(); - this.internalRollUpTo("customer_profile", customerProfile, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerProfile", null, "customer_profile")); - return customerProfile; - } - - - - - - public CustomerOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ - return facetByMerchantAs(facetName, merchant, true); - } - - public CustomerOrderRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.MERCHANT_PROPERTY, merchant, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, CustomerOrder.MERCHANT_PROPERTY)); - return this; - } - public CustomerOrderRequest facetByCustomerProfileAs(String facetName, CustomerProfileRequest customerProfile){ - return facetByCustomerProfileAs(facetName, customerProfile, true); - } - - public CustomerOrderRequest facetByCustomerProfileAs(String facetName, CustomerProfileRequest customerProfile, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, customerProfile, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerProfileAs", facetName, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java deleted file mode 100644 index 60649102a..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfile.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerprofile; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CustomerProfile extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CustomerProfile"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5a9cde22ab27c45df77fbacebdb80f8a03759bd10053dc56f76edb4c8b61e319"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("merchant", 1), java.util.Map.entry("email", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("merchant", java.util.List.of("merchant", "merchant")), java.util.Map.entry("email", java.util.List.of("email", "email")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CustomerProfile.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String MERCHANT_PROPERTY = "merchant"; - public static final String EMAIL_PROPERTY = "email"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private Merchant merchant; - - private String email; - - private SmartList customerOrderList; - - public Merchant getMerchant(){ - return this.merchant; - } - - public String getEmail(){ - return this.email; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public CustomerProfile updateMerchant(Merchant merchant){ - if(isPropertyLoaded(MERCHANT_PROPERTY) && Objects.equals(this.merchant, merchant)){ - return this; - } - handleUpdate(MERCHANT_PROPERTY, getMerchant(), merchant); - this.merchant = merchant; - return this; - } - - public CustomerProfile updateEmail(String email){ - email = (email == null ? null : email.trim()); - if(isPropertyLoaded(EMAIL_PROPERTY) && Objects.equals(this.email, email)){ - return this; - } - handleUpdate(EMAIL_PROPERTY, getEmail(), email); - this.email = email; - return this; - } - - public CustomerProfile addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateCustomerProfile(this); - return this; - } - - public static CustomerProfile refer(Long id){ - CustomerProfile refer = new CustomerProfile(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CustomerProfile comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "merchant": this.merchant = (Merchant) value; break; - - case "email": this.email = (value == null ? null : ((String)value).trim()); break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "merchant": return this.merchant; - case "email": return this.email; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "merchant": return this.merchant; - case "email": return this.email; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java deleted file mode 100644 index cb92cd90b..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileChecker.java +++ /dev/null @@ -1,65 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerprofile; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CustomerProfileChecker implements Checker{ - - public String type(){ - return CustomerProfile.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ - if(needCheck(_context, customerProfile)){ - markAsChecked(_context, customerProfile); - doCheck(_context, customerProfile, _parentLocation); - } - } - - public void doCheck(UserContext _context, CustomerProfile customerProfile, ObjectLocation _parentLocation){ - if((customerProfile == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customerProfile); - if(customerProfile.needPersist()){ - } - if(customerProfile.newItem()){ - }else if(customerProfile.updateItem()){ - if(!customerProfile.isPropertyLoaded("merchant")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "merchant"), "Mutation requires a fully loaded entity"); - } - if(!customerProfile.isPropertyLoaded("email")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "email"), "Mutation requires a fully loaded entity"); - } - - } - checkMerchant(_context, customerProfile.getProperty(CustomerProfile.MERCHANT_PROPERTY), newLocation(_parentLocation, "merchant")); - checkEmail(_context, customerProfile.getProperty(CustomerProfile.EMAIL_PROPERTY), newLocation(_parentLocation, "email")); - for(int i = 0; customerProfile.getCustomerOrderList() != null && i < customerProfile.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = customerProfile.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkMerchant(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, merchant); - if((merchant == null)){ - return; - } - new MerchantChecker().checkAndFix(_context, merchant, _parentLocation); - } - public void checkEmail(UserContext _context, String email, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, email); - if((email == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, email); - - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java deleted file mode 100644 index 2666acf8b..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerprofile; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderListExpression; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CustomerProfileExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerProfileExpression(Expression expression){ - super(expression); - } - - public CustomerProfileExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerProfileExpression updateId(Long id){ - return new CustomerProfileExpression(this, $it -> {((CustomerProfile)$it).__internalSet("id", id); return this;}); - } - - public CustomerProfileExpression save(UserContext userContext){ - return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerProfileExpression save(String intent, UserContext userContext){ - return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public MerchantExpression getMerchant(){ - return new MerchantExpression(loaded("merchant", "getMerchant", CustomerProfile::getMerchant)); - } - - public CustomerProfileExpression updateMerchant(Merchant merchant){ - return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).updateMerchant(merchant)); - } - - public Expression getEmail(){ - return loaded("email", "getEmail", CustomerProfile::getEmail); - } - public CustomerProfileExpression updateEmail(String email){ - return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).updateEmail(email)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", CustomerProfile::getCustomerOrderList)); - } - public CustomerProfileExpression addCustomerOrder(CustomerOrder customerOrder){ - return new CustomerProfileExpression(this, $it -> ((CustomerProfile)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java deleted file mode 100644 index 410a30c3e..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerprofile; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerProfileListExpression extends SmartListExpression { - public CustomerProfileListExpression(Expression> expression){ - super(expression); - } - - public CustomerProfileListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerProfileExpression first() { - return new CustomerProfileExpression(super.first()); - } - - public CustomerProfileExpression get(int index) { - return new CustomerProfileExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java deleted file mode 100644 index 93e23a881..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/customerprofile/CustomerProfileRequest.java +++ /dev/null @@ -1,750 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.customerprofile; - -import com.teaql.merchantorderprivacyservice.Q; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest; -import com.teaql.merchantorderprivacyservice.merchant.Merchant; -import com.teaql.merchantorderprivacyservice.merchant.MerchantRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CustomerProfileRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerProfileRequest(Class returnType){ - this(returnType, () -> (T) new CustomerProfile()); - } - - protected CustomerProfileRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerProfileRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerProfileRequest copy(){ - return (CustomerProfileRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerProfileRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerProfileRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerProfileRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerProfileRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerProfileRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerProfileRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerProfileRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerProfileRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerProfileRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerProfileRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerProfileRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerProfileRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerProfileRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerProfileRequest matchingAnyOf(CustomerProfileRequest customerProfile){ - super.internalMatchAny(customerProfile); - return this; - } - - public CustomerProfileRequest matchingIdsOf(CustomerProfileRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CustomerProfile.ID_PROPERTY, request, CustomerProfile.ID_PROPERTY)); - } - - public CustomerProfileRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerProfileRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerProfileRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerProfileRequest selectSelf(){ - super.selectSelf(); - return selectId().selectMerchantIdOnly().selectEmail().selectVersion(); - } - - public CustomerProfileRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerProfileRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CustomerProfile.ID_PROPERTY); - selectProperty(CustomerProfile.MERCHANT_PROPERTY); - selectProperty(CustomerProfile.EMAIL_PROPERTY); - selectProperty(CustomerProfile.VERSION_PROPERTY); - return this; - } - - public CustomerProfileRequest selectAll(){ - super.selectAll(); - return selectId().selectMerchant().selectEmail().selectVersion(); - } - - public CustomerProfileRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectId().selectMerchant().selectEmail().selectVersion(); - } - - - public CustomerProfileRequest selectId(){ - selectProperty(CustomerProfile.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerProfileRequest unselectId(){ - unselectProperty(CustomerProfile.ID_PROPERTY); - return this; - } - public CustomerProfileRequest selectMerchantIdOnly(){ - selectProperty(CustomerProfile.MERCHANT_PROPERTY); - return this; - } - - public CustomerProfileRequest selectMerchant(){ - return selectMerchantWith(Q.merchants().unlimited().selectSelf()); - } - - public CustomerProfileRequest selectMerchantWith(MerchantRequest merchant){ - selectProperty(CustomerProfile.MERCHANT_PROPERTY); - enhanceRelation(CustomerProfile.MERCHANT_PROPERTY, merchant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectMerchantWith", null, CustomerProfile.MERCHANT_PROPERTY)); - return this; - } - - public CustomerProfileRequest unselectMerchant(){ - unselectProperty(CustomerProfile.MERCHANT_PROPERTY); - return this; - } - public CustomerProfileRequest selectEmail(){ - selectProperty(CustomerProfile.EMAIL_PROPERTY); - return this; - } - - /** - * fill the email with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS email) to fetch email property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerProfileRequest unselectEmail(){ - unselectProperty(CustomerProfile.EMAIL_PROPERTY); - return this; - } - public CustomerProfileRequest selectVersion(){ - selectProperty(CustomerProfile.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerProfileRequest unselectVersion(){ - unselectProperty(CustomerProfile.VERSION_PROPERTY); - return this; - } - public CustomerProfileRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public CustomerProfileRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerProfileRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerProfile.ID_PROPERTY, operator, values); - } - - public CustomerProfileRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerProfileRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerProfileRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerProfileRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerProfileRequest filterByMerchant(Merchant... merchant){ - if (merchant == null || merchant.length == 0) { - throw new IllegalArgumentException("filterByMerchant parameter merchant cannot be empty"); - } - return appendSearchCriteria(createMerchantCriteria(Operator.EQUAL, (Object[])merchant)); - } - - public CustomerProfileRequest withMerchant(Operator operator, Object... values){ - return appendSearchCriteria(createMerchantCriteria(operator, values)); - } - - public CustomerProfileRequest withMerchantIsUnknown(){ - return withMerchant(Operator.IS_NULL); - } - - public CustomerProfileRequest withMerchantIsKnown(){ - return withMerchant(Operator.IS_NOT_NULL); - } - - public SearchCriteria createMerchantCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerProfile.MERCHANT_PROPERTY, operator, values); - } - - public CustomerProfileRequest filterByMerchant(Long merchant){ - if(merchant == null){ - return this; - } - return withMerchant(Operator.EQUAL, merchant); - } - public CustomerProfileRequest withMerchantMatching(MerchantRequest merchant){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerProfile.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY)); - } - - public CustomerProfileRequest withoutMerchantMatching(MerchantRequest merchant){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerProfile.MERCHANT_PROPERTY, merchant, Merchant.ID_PROPERTY))); - } - - public CustomerProfileRequest filterByEmail(String... email){ - if (email == null || email.length == 0) { - throw new IllegalArgumentException("filterByEmail parameter email cannot be empty"); - } - return appendSearchCriteria(createEmailCriteria(Operator.EQUAL, (Object[])email)); - } - - public CustomerProfileRequest withEmail(Operator operator, Object... values){ - return appendSearchCriteria(createEmailCriteria(operator, values)); - } - - public CustomerProfileRequest withEmailIsUnknown(){ - return withEmail(Operator.IS_NULL); - } - - public CustomerProfileRequest withEmailIsKnown(){ - return withEmail(Operator.IS_NOT_NULL); - } - - public SearchCriteria createEmailCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerProfile.EMAIL_PROPERTY, operator, values); - } - - public CustomerProfileRequest withEmailIsNot(String email){ - return withEmail(Operator.NOT_EQUAL, email); - } - - public CustomerProfileRequest withEmailIn(String... email){ - return withEmail(Operator.IN, (Object[])email); - } - - public CustomerProfileRequest withEmailNotIn(String... email){ - return withEmail(Operator.NOT_IN, (Object[])email); - } - public CustomerProfileRequest withEmailGreaterThan(String email){ - return withEmail(Operator.GREATER_THAN, email); - } - - public CustomerProfileRequest withEmailGreaterThanOrEqualTo(String email){ - return withEmail(Operator.GREATER_THAN_OR_EQUAL, email); - } - - public CustomerProfileRequest withEmailLessThan(String email){ - return withEmail(Operator.LESS_THAN, email); - } - - public CustomerProfileRequest withEmailLessThanOrEqualTo(String email){ - return withEmail(Operator.LESS_THAN_OR_EQUAL, email); - } - - public CustomerProfileRequest withEmailBetween(String startOfEmail, String endOfEmail){ - return withEmail(Operator.BETWEEN, startOfEmail, endOfEmail); - } - public CustomerProfileRequest withEmailStartingWith(String email){ - return withEmail(Operator.BEGIN_WITH, email); - } - public CustomerProfileRequest withEmailContaining(String email){ - return withEmail(Operator.CONTAIN, email); - } - - public CustomerProfileRequest withEmailNotContaining(String email){ - return withEmail(Operator.NOT_CONTAIN, email); - } - - public CustomerProfileRequest withEmailNotStartingWith(String email){ - return withEmail(Operator.NOT_BEGIN_WITH, email); - } - - public CustomerProfileRequest withEmailEndingWith(String email){ - return withEmail(Operator.END_WITH, email); - } - - public CustomerProfileRequest withEmailNotEndingWith(String email){ - return withEmail(Operator.NOT_END_WITH, email); - } - - public CustomerProfileRequest withEmailIs(String email){ - return withEmail(Operator.EQUAL, email); - } - - public CustomerProfileRequest withEmailSoundingLike(String email){ - return withEmail(Operator.SOUNDS_LIKE, email); - } - - - - public CustomerProfileRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerProfileRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerProfileRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerProfileRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerProfile.VERSION_PROPERTY, operator, values); - } - - public CustomerProfileRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerProfileRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerProfileRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerProfileRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerProfileRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerProfileRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerProfileRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerProfileRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerProfileRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerProfileRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerProfile.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY)); - } - - public CustomerProfileRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerProfile.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY))); - } - - public CustomerProfileRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CustomerProfileRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CustomerProfileRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerProfileRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerProfileRequest groupByMerchantWithDetails(){ - return groupByMerchantWithDetails(Q.merchants().unlimited()); - } - - public CustomerProfileRequest groupByMerchantWithDetails(MerchantRequest subRequest){ - aggregate(CustomerProfile.MERCHANT_PROPERTY, subRequest); - return this; - } - - - - public CustomerProfileRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerProfileRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CustomerProfile.ID_PROPERTY); - return this; - } - public CustomerProfileRequest countDistinctMerchant(){ - return countDistinctMerchantAs("merchant_distinct_count"); - } - - public CustomerProfileRequest countDistinctMerchantAs(String alias){ - super.countDistinctProperty(alias, CustomerProfile.MERCHANT_PROPERTY); - return this; - } - public CustomerProfileRequest countDistinctEmail(){ - return countDistinctEmailAs("email_distinct_count"); - } - - public CustomerProfileRequest countDistinctEmailAs(String alias){ - super.countDistinctProperty(alias, CustomerProfile.EMAIL_PROPERTY); - return this; - } - public CustomerProfileRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerProfileRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CustomerProfile.VERSION_PROPERTY); - return this; - } - public CustomerProfileRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerProfileRequest groupById(){ - groupBy(CustomerProfile.ID_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByIdAs(String retName){ - groupBy(retName, CustomerProfile.ID_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerProfile.ID_PROPERTY, function); - return this; - } - public CustomerProfileRequest groupByMerchantWith(MerchantRequest subRequest){ - groupBy(CustomerProfile.MERCHANT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByMerchantWith", null, "merchant")); - return this; - } - public CustomerProfileRequest groupByMerchant(){ - groupBy(CustomerProfile.MERCHANT_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByMerchantAs(String retName){ - groupBy(retName, CustomerProfile.MERCHANT_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByMerchantWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerProfile.MERCHANT_PROPERTY, function); - return this; - } - - public CustomerProfileRequest groupByEmail(){ - groupBy(CustomerProfile.EMAIL_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByEmailAs(String retName){ - groupBy(retName, CustomerProfile.EMAIL_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByEmailWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerProfile.EMAIL_PROPERTY, function); - return this; - } - - public CustomerProfileRequest groupByVersion(){ - groupBy(CustomerProfile.VERSION_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByVersionAs(String retName){ - groupBy(retName, CustomerProfile.VERSION_PROPERTY); - return this; - } - - public CustomerProfileRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerProfile.VERSION_PROPERTY, function); - return this; - } - - - - public CustomerProfileRequest orderByIdAscending(){ - addOrderByAscending(CustomerProfile.ID_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByIdDescending(){ - addOrderByDescending(CustomerProfile.ID_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByMerchantAscending(){ - addOrderByAscending(CustomerProfile.MERCHANT_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByMerchantDescending(){ - addOrderByDescending(CustomerProfile.MERCHANT_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByEmailAscending(){ - addOrderByAscending(CustomerProfile.EMAIL_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByEmailDescending(){ - addOrderByDescending(CustomerProfile.EMAIL_PROPERTY); - return this; - } - public CustomerProfileRequest orderByEmailAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerProfile.EMAIL_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByEmailDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerProfile.EMAIL_PROPERTY); - return this; - } - public CustomerProfileRequest orderByVersionAscending(){ - addOrderByAscending(CustomerProfile.VERSION_PROPERTY); - return this; - } - - public CustomerProfileRequest orderByVersionDescending(){ - addOrderByDescending(CustomerProfile.VERSION_PROPERTY); - return this; - } - - - public CustomerProfileRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public CustomerProfileRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerProfileRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public MerchantRequest rollUpToMerchant(){ - MerchantRequest merchant = Q.merchants().unlimited(); - this.internalRollUpTo("merchant", merchant, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToMerchant", null, "merchant")); - return merchant; - } - - - - public CustomerProfileRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROFILE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerProfileRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROFILE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerProfileRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROFILE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, CustomerProfile.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerProfileRequest facetByMerchantAs(String facetName, MerchantRequest merchant){ - return facetByMerchantAs(facetName, merchant, true); - } - - public CustomerProfileRequest facetByMerchantAs(String facetName, MerchantRequest merchant, boolean includeAllFacets){ - addFacet(facetName, CustomerProfile.MERCHANT_PROPERTY, merchant, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByMerchantAs", facetName, CustomerProfile.MERCHANT_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerProfileRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerProfileRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerProfileRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerProfileRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerProfileRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerProfileRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java deleted file mode 100644 index 10450efd1..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/Merchant.java +++ /dev/null @@ -1,152 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.merchant; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Merchant extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Merchant"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "3825864cc8042afce6bd814bc155a414cc1fda5115c8807092b56cbb042a1e38"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_profile_list", "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Merchant.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String CUSTOMER_PROFILE_LIST_PROPERTY = "customer_profile_list"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private String name; - - private SmartList customerProfileList; - private SmartList customerOrderList; - - public String getName(){ - return this.name; - } - - public SmartList getCustomerProfileList(){ - return this.customerProfileList == null ? SmartList.unloaded() : this.customerProfileList; - } - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public Merchant updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Merchant addCustomerProfile(CustomerProfile customerProfile){ - if (customerProfile == null){ - return this; - } - - if(null == this.customerProfileList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerProfileList = teaqlUnloadedItems.map(value -> value); - } - - this.customerProfileList.add(customerProfile); - customerProfile.updateMerchant(this); - return this; - } - public Merchant addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateMerchant(this); - return this; - } - - public static Merchant refer(Long id){ - Merchant refer = new Merchant(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Merchant comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "customer_profile_list": this.customerProfileList = (SmartList) value; break; - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "customer_profile_list": return this.customerProfileList; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java deleted file mode 100644 index 7e6d403aa..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantChecker.java +++ /dev/null @@ -1,58 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.merchant; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderChecker; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class MerchantChecker implements Checker{ - - public String type(){ - return Merchant.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - if(needCheck(_context, merchant)){ - markAsChecked(_context, merchant); - doCheck(_context, merchant, _parentLocation); - } - } - - public void doCheck(UserContext _context, Merchant merchant, ObjectLocation _parentLocation){ - if((merchant == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, merchant); - if(merchant.needPersist()){ - } - if(merchant.newItem()){ - }else if(merchant.updateItem()){ - if(!merchant.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, merchant.getProperty(Merchant.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; merchant.getCustomerProfileList() != null && i < merchant.getCustomerProfileList().size(); i++){ - CustomerProfile customerProfile = merchant.getCustomerProfileList().get(i); - new CustomerProfileChecker().checkAndFix(_context, customerProfile, newLocation(_parentLocation, "customer_profile_list", i)); - } - for(int i = 0; merchant.getCustomerOrderList() != null && i < merchant.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = merchant.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java deleted file mode 100644 index 8694004fd..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantExpression.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.merchant; - -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderListExpression; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class MerchantExpression extends ExpressionAdaptor implements BaseEntityExpression { - public MerchantExpression(Expression expression){ - super(expression); - } - - public MerchantExpression(Expression expression, Function function){ - super(expression, function); - } - - public MerchantExpression updateId(Long id){ - return new MerchantExpression(this, $it -> {((Merchant)$it).__internalSet("id", id); return this;}); - } - - public MerchantExpression save(UserContext userContext){ - return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs("Saved by Expression").save(userContext)); - } - - public MerchantExpression save(String intent, UserContext userContext){ - return new MerchantExpression(this, $it -> ((Merchant)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Merchant::getName); - } - public MerchantExpression updateName(String name){ - return new MerchantExpression(this, $it -> ((Merchant)$it).updateName(name)); - } - - public CustomerProfileListExpression getCustomerProfileList(){ - return new CustomerProfileListExpression(loaded("customer_profile_list", "getCustomerProfileList", Merchant::getCustomerProfileList)); - } - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Merchant::getCustomerOrderList)); - } - public MerchantExpression addCustomerProfile(CustomerProfile customerProfile){ - return new MerchantExpression(this, $it -> ((Merchant)$it).addCustomerProfile(customerProfile)); - } - public MerchantExpression addCustomerOrder(CustomerOrder customerOrder){ - return new MerchantExpression(this, $it -> ((Merchant)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java deleted file mode 100644 index fe54b0da5..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.merchant; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class MerchantListExpression extends SmartListExpression { - public MerchantListExpression(Expression> expression){ - super(expression); - } - - public MerchantListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public MerchantExpression first() { - return new MerchantExpression(super.first()); - } - - public MerchantExpression get(int index) { - return new MerchantExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java deleted file mode 100644 index 061ee087d..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/merchant/MerchantRequest.java +++ /dev/null @@ -1,683 +0,0 @@ - -package com.teaql.merchantorderprivacyservice.merchant; - -import com.teaql.merchantorderprivacyservice.Q; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrder; -import com.teaql.merchantorderprivacyservice.customerorder.CustomerOrderRequest; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfile; -import com.teaql.merchantorderprivacyservice.customerprofile.CustomerProfileRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class MerchantRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public MerchantRequest(Class returnType){ - this(returnType, () -> (T) new Merchant()); - } - - protected MerchantRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public MerchantRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public MerchantRequest copy(){ - return (MerchantRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new MerchantRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public MerchantRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public MerchantRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public MerchantRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public MerchantRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public MerchantRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public MerchantRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public MerchantRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public MerchantRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public MerchantRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public MerchantRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (MerchantRequest)super.appendSearchCriteria(searchCriteria); - } - - public MerchantRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public MerchantRequest matchingAnyOf(MerchantRequest merchant){ - super.internalMatchAny(merchant); - return this; - } - - public MerchantRequest matchingIdsOf(MerchantRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Merchant.ID_PROPERTY, request, Merchant.ID_PROPERTY)); - } - - public MerchantRequest enhanceChildrenIfNeeded(){ - return this; - } - - public MerchantRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public MerchantRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public MerchantRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public MerchantRequest selectSelfFields(){ - return selectSelf(); - } - - public MerchantRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Merchant.ID_PROPERTY); - selectProperty(Merchant.NAME_PROPERTY); - selectProperty(Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public MerchantRequest selectChildren(){ - super.selectAny(); - selectCustomerProfileList().selectCustomerOrderList(); - return selectId().selectName().selectVersion(); - } - - - public MerchantRequest selectId(){ - selectProperty(Merchant.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public MerchantRequest unselectId(){ - unselectProperty(Merchant.ID_PROPERTY); - return this; - } - public MerchantRequest selectName(){ - selectProperty(Merchant.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public MerchantRequest unselectName(){ - unselectProperty(Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest selectVersion(){ - selectProperty(Merchant.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public MerchantRequest unselectVersion(){ - unselectProperty(Merchant.VERSION_PROPERTY); - return this; - } - public MerchantRequest selectCustomerProfileList(){ - return selectCustomerProfileListWith(Q.customerProfiles().selectSelf()); - } - - public MerchantRequest selectCustomerProfileListWith(CustomerProfileRequest customerProfileList){ - enhanceRelation(Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, customerProfileList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerProfileListWith", null, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); - return this; - } - public MerchantRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public MerchantRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(Merchant.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Merchant.ID_PROPERTY, operator, values); - } - - public MerchantRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public MerchantRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public MerchantRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public MerchantRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public MerchantRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public MerchantRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public MerchantRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public MerchantRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Merchant.NAME_PROPERTY, operator, values); - } - - public MerchantRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public MerchantRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public MerchantRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public MerchantRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public MerchantRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public MerchantRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public MerchantRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public MerchantRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public MerchantRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public MerchantRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public MerchantRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public MerchantRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public MerchantRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public MerchantRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public MerchantRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public MerchantRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public MerchantRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public MerchantRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public MerchantRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public MerchantRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Merchant.VERSION_PROPERTY, operator, values); - } - - public MerchantRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public MerchantRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public MerchantRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public MerchantRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public MerchantRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public MerchantRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public MerchantRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public MerchantRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public MerchantRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public MerchantRequest withCustomerProfileListMatching(CustomerProfileRequest customerProfileRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerProfileRequest, CustomerProfile.MERCHANT_PROPERTY)); - } - - public MerchantRequest withoutCustomerProfileListMatching(CustomerProfileRequest customerProfileRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerProfileRequest, CustomerProfile.MERCHANT_PROPERTY))); - } - - public MerchantRequest haveCustomerProfiles(){ - return withCustomerProfileListMatching(Q.customerProfiles().unlimited()); - } - - public MerchantRequest haveNoCustomerProfiles(){ - return withoutCustomerProfileListMatching(Q.customerProfiles().unlimited()); - } - public MerchantRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerOrderRequest, CustomerOrder.MERCHANT_PROPERTY)); - } - - public MerchantRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Merchant.ID_PROPERTY, customerOrderRequest, CustomerOrder.MERCHANT_PROPERTY))); - } - - public MerchantRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public MerchantRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public MerchantRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public MerchantRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public MerchantRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public MerchantRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Merchant.ID_PROPERTY); - return this; - } - public MerchantRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public MerchantRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public MerchantRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Merchant.VERSION_PROPERTY); - return this; - } - public MerchantRequest groupByCustomerProfilesWithDetails(CustomerProfileRequest subRequest){ - aggregate(Merchant.CUSTOMER_PROFILE_LIST_PROPERTY, subRequest); - return this; - } - public MerchantRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(Merchant.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public MerchantRequest groupById(){ - groupBy(Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest groupByIdAs(String retName){ - groupBy(retName, Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Merchant.ID_PROPERTY, function); - return this; - } - - public MerchantRequest groupByName(){ - groupBy(Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest groupByNameAs(String retName){ - groupBy(retName, Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Merchant.NAME_PROPERTY, function); - return this; - } - - public MerchantRequest groupByVersion(){ - groupBy(Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest groupByVersionAs(String retName){ - groupBy(retName, Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Merchant.VERSION_PROPERTY, function); - return this; - } - - - - public MerchantRequest orderByIdAscending(){ - addOrderByAscending(Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest orderByIdDescending(){ - addOrderByDescending(Merchant.ID_PROPERTY); - return this; - } - - public MerchantRequest orderByNameAscending(){ - addOrderByAscending(Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest orderByNameDescending(){ - addOrderByDescending(Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Merchant.NAME_PROPERTY); - return this; - } - - public MerchantRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Merchant.NAME_PROPERTY); - return this; - } - public MerchantRequest orderByVersionAscending(){ - addOrderByAscending(Merchant.VERSION_PROPERTY); - return this; - } - - public MerchantRequest orderByVersionDescending(){ - addOrderByDescending(Merchant.VERSION_PROPERTY); - return this; - } - - - public MerchantRequest statsFromCustomerProfilesAs(String name, CustomerProfileRequest subRequest){ - return statsFromCustomerProfilesAs(name, subRequest, false); - } - - public MerchantRequest statsFromCustomerProfilesAs(String name, CustomerProfileRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerProfile.MERCHANT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerProfilesAs", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); - return this; - } - - public MerchantRequest statsFromCustomerProfiles(CustomerProfileRequest subRequest){ - return statsFromCustomerProfilesAs(REFINEMENTS, subRequest); - } - public MerchantRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public MerchantRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.MERCHANT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public MerchantRequest countCustomerProfiles(){ - addRelationCount("Count", Q.customerProfiles().unlimited(), CustomerProfile.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfiles", null, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); - return this; - } - - public MerchantRequest countCustomerProfilesAs(String name){ - addRelationCount(name, Q.customerProfiles().unlimited(), CustomerProfile.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfilesAs", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); - return this; - } - - public MerchantRequest countCustomerProfilesWith(String name, CustomerProfileRequest subRequest){ - addRelationCount(name, subRequest, CustomerProfile.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerProfilesWith", name, Merchant.CUSTOMER_PROFILE_LIST_PROPERTY)); - return this; - } - public MerchantRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public MerchantRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.MERCHANT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Merchant.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public MerchantRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public MerchantRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public MerchantRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public MerchantRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public MerchantRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public MerchantRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java b/examples/security-foundations/java-app-console/lib/src/main/java/com/teaql/merchantorderprivacyservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 7a28a8ea1..000000000 --- a/examples/security-foundations/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.merchantorderprivacyservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/security-foundations/showcase.json b/examples/security-foundations/showcase.json index a9ffef9ee..eb604955e 100644 --- a/examples/security-foundations/showcase.json +++ b/examples/security-foundations/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "80da3356c9c341da63759603e86f6d6694bc1f974e0110bd3a298fa38553da82", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/shared-load-state/java-app-console/lib/pom.xml b/examples/shared-load-state/java-app-console/lib/pom.xml deleted file mode 100644 index 2031c7204..000000000 --- a/examples/shared-load-state/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - school-management-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java deleted file mode 100644 index bdacf16bf..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Constants.java +++ /dev/null @@ -1,13 +0,0 @@ - -package com.example.schoolmanagementservice; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.schooltype.SchoolType; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); - public static final long SCHOOL_TYPE_PRIMARY_ID = 1001l ; - public static final SchoolType SCHOOL_TYPE_PRIMARY = SchoolType.refer(SCHOOL_TYPE_PRIMARY_ID);public static final long SCHOOL_TYPE_SECONDARY_ID = 1002l ; - public static final SchoolType SCHOOL_TYPE_SECONDARY = SchoolType.refer(SCHOOL_TYPE_SECONDARY_ID); -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java deleted file mode 100644 index 6a54ceb3f..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/E.java +++ /dev/null @@ -1,28 +0,0 @@ - -package com.example.schoolmanagementservice; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolExpression; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryExpression; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static SchoolTypeExpression schoolType(SchoolType schoolType){ - return new SchoolTypeExpression(new ValueExpression(schoolType, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolType()")); - } - public static SchoolExpression school(School school){ - return new SchoolExpression(new ValueExpression(school, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.school()")); - } - public static SchoolCapacitySummaryExpression schoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ - return new SchoolCapacitySummaryExpression(new ValueExpression(schoolCapacitySummary, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.schoolCapacitySummary()")); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java deleted file mode 100644 index f5fdbff85..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/EntityMetaRegistry.java +++ /dev/null @@ -1,988 +0,0 @@ - -package com.example.schoolmanagementservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerSchoolType(); - registerSchool(); - registerSchoolCapacitySummary(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.platform.Platform::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor baseUrl = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY, String.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Campus Learning Platform") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.BASE_URL_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "https://campus.example.com") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("candidates", "createTime()") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("candidates", "updateTime()") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchoolType() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.schooltype.SchoolType.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.schooltype.SchoolType.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schooltype.SchoolType::new); - entityDescriptor.with("constant", "true") - - .with("identifier", "code") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_TYPE_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) - ; - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY, String.class) - ; - PropertyDescriptor code = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY, String.class) - ; - PropertyDescriptor displayOrder = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.PLATFORM_PROPERTY).with("candidates", "platform()") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("candidates", "1001,1002") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Primary,Secondary") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.CODE_PROPERTY).with("identifier", "true") - - .with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "PRIMARY,SECONDARY") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("optional", "true") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("candidates", "1,2") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schooltype.SchoolType.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchool() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.school.School.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.school.School.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.school.School.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.school.School::new); - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) - ; - PropertyDescriptor schoolType = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.INTERNAL_TYPE, com.example.schoolmanagementservice.schooltype.SchoolType.SCHOOL_LIST_PROPERTY, com.example.schoolmanagementservice.schooltype.SchoolType.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY, String.class) - ; - PropertyDescriptor address = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY, String.class) - ; - PropertyDescriptor establishedDate = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY, LocalDate.class) - ; - PropertyDescriptor studentCapacity = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY, Integer.class) - ; - PropertyDescriptor active = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY, Boolean.class) - ; - PropertyDescriptor createTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor updateTime = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY, LocalDateTime.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.SCHOOL_TYPE_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ADDRESS_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ESTABLISHED_DATE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDate") - - .with("sqlType", "DATE") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "Date") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.STUDENT_CAPACITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.ACTIVE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(1)") - - .with("javaType", "java.lang.Boolean") - - .with("sqlType", "BOOLEAN") - - .with("isId", "false") - - .with("isBool", "true") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "bit") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Boolean") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.CREATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.UPDATE_TIME_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("updateFunction", "now") - - .with("javaType", "java.time.LocalDateTime") - - .with("sqlType", "TIMESTAMP") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("mssql_sqlType", "dateTime") - - .with("isDateTime", "true") - - .with("createFunction", "now") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "LocalTime") - - .with("isTime", "true") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.school.School.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerSchoolCapacitySummary() { - FieldLayout.installGenerated(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class); - entityDescriptor.setEntitySupplier(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary::new); - entityDescriptor.with("name", "School Capacity Summary") - - .with("module", "Reporting") - - .with("module_key", "reporting") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.PLATFORM_PROPERTY, com.example.schoolmanagementservice.platform.Platform.INTERNAL_TYPE, com.example.schoolmanagementservice.platform.Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, com.example.schoolmanagementservice.platform.Platform.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY, String.class) - ; - PropertyDescriptor totalCapacity = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, Integer.class) - ; - PropertyDescriptor schoolCount = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, Integer.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java deleted file mode 100644 index 2c1d24ac8..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.example.schoolmanagementservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.schoolmanagementservice.platform.PlatformChecker(), new com.example.schoolmanagementservice.schooltype.SchoolTypeChecker(), new com.example.schoolmanagementservice.school.SchoolChecker(), new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:d36b1e0d50365a8a5a3654777b969de3e9e0de9673b6997e9522858ac7239249\",\"entities\":{\"Platform\":{\"labels\":{\"en\":\"platform\"},\"fields\":[{\"name\":\"base_url\",\"labels\":{\"en\":\"base url\"},\"aliases\":[\"BaseUrl\",\"baseUrl\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"school_capacity_summary_list\",\"targetType\":\"SchoolCapacitySummary\",\"labels\":{\"en\":\"School Capacity Summary\"},\"aliases\":[\"SchoolCapacitySummaryList\",\"schoolCapacitySummaryList\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"school\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"school_type_list\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"school type\"},\"aliases\":[\"SchoolTypeList\",\"schoolTypeList\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"School\":{\"labels\":{\"en\":\"school\"},\"fields\":[{\"name\":\"active\",\"labels\":{\"en\":\"active\"},\"aliases\":[\"Active\"]},{\"name\":\"address\",\"labels\":{\"en\":\"address\"},\"aliases\":[\"Address\"]},{\"name\":\"create_time\",\"labels\":{\"en\":\"create time\"},\"aliases\":[\"CreateTime\",\"createTime\"]},{\"name\":\"established_date\",\"labels\":{\"en\":\"established date\"},\"aliases\":[\"EstablishedDate\",\"establishedDate\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_type\",\"targetType\":\"SchoolType\",\"labels\":{\"en\":\"school type\"},\"aliases\":[\"SchoolType\",\"schoolType\"]},{\"name\":\"student_capacity\",\"labels\":{\"en\":\"student capacity\"},\"aliases\":[\"StudentCapacity\",\"studentCapacity\"]},{\"name\":\"update_time\",\"labels\":{\"en\":\"update time\"},\"aliases\":[\"UpdateTime\",\"updateTime\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolCapacitySummary\":{\"labels\":{\"en\":\"School Capacity Summary\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_count\",\"labels\":{\"en\":\"school count\"},\"aliases\":[\"SchoolCount\",\"schoolCount\"]},{\"name\":\"total_capacity\",\"labels\":{\"en\":\"total capacity\"},\"aliases\":[\"TotalCapacity\",\"totalCapacity\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"SchoolType\":{\"labels\":{\"en\":\"school type\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"school_list\",\"targetType\":\"School\",\"labels\":{\"en\":\"school\"},\"aliases\":[\"SchoolList\",\"schoolList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("base_url", "baseUrl"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("SchoolType", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("School", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("school_type", "schoolType"), java.util.Map.entry("name", "name"), java.util.Map.entry("address", "address"), java.util.Map.entry("established_date", "establishedDate"), java.util.Map.entry("student_capacity", "studentCapacity"), java.util.Map.entry("active", "active"), java.util.Map.entry("create_time", "createTime"), java.util.Map.entry("update_time", "updateTime"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("SchoolCapacitySummary", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("name", "name"), java.util.Map.entry("total_capacity", "totalCapacity"), java.util.Map.entry("school_count", "schoolCount"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.schoolmanagementservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.schoolmanagementservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Campus Learning Platform"); - domainRoot.updateBaseUrl("https://campus.example.com"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - var constantSchoolType1001Rows = Q.schoolTypes().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantSchoolType1001Rows.isEmpty()) { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = new com.example.schoolmanagementservice.schooltype.SchoolType(); - constantSchoolType1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1001, 1001L); - constantSchoolType1001.updatePlatform(domainRoot); - constantSchoolType1001.updateName("Primary"); - constantSchoolType1001.updateCode("PRIMARY"); - constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); - constantSchoolType1001.auditAs("create model constant SchoolType(1001)").save(context); - } else { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1001 = constantSchoolType1001Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantSchoolType1001.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1001.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1001.getName(), "Primary"))) { constantSchoolType1001.updateName("Primary"); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1001.getCode(), "PRIMARY"))) { constantSchoolType1001.updateCode("PRIMARY"); changed = true; } - if (!((constantSchoolType1001.getDisplayOrder() != null && constantSchoolType1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantSchoolType1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } - if (changed) constantSchoolType1001.auditAs("reconcile model constant SchoolType(1001)").save(context); - } - var constantSchoolType1002Rows = Q.schoolTypes().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantSchoolType1002Rows.isEmpty()) { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = new com.example.schoolmanagementservice.schooltype.SchoolType(); - constantSchoolType1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantSchoolType1002, 1002L); - constantSchoolType1002.updatePlatform(domainRoot); - constantSchoolType1002.updateName("Secondary"); - constantSchoolType1002.updateCode("SECONDARY"); - constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); - constantSchoolType1002.auditAs("create model constant SchoolType(1002)").save(context); - } else { - com.example.schoolmanagementservice.schooltype.SchoolType constantSchoolType1002 = constantSchoolType1002Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantSchoolType1002.getPlatform().getId(), domainRoot.getId()))) { constantSchoolType1002.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1002.getName(), "Secondary"))) { constantSchoolType1002.updateName("Secondary"); changed = true; } - if (!(java.util.Objects.equals(constantSchoolType1002.getCode(), "SECONDARY"))) { constantSchoolType1002.updateCode("SECONDARY"); changed = true; } - if (!((constantSchoolType1002.getDisplayOrder() != null && constantSchoolType1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantSchoolType1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } - if (changed) constantSchoolType1002.auditAs("reconcile model constant SchoolType(1002)").save(context); - } - } -} diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java deleted file mode 100644 index f65b1fb8b..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Q.java +++ /dev/null @@ -1,43 +0,0 @@ - -package com.example.schoolmanagementservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.schoolmanagementservice.platform.PlatformRequest platforms(){ - return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.example.schoolmanagementservice.platform.PlatformRequest(com.example.schoolmanagementservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypes(){ - return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.schooltype.SchoolTypeRequest schoolTypesWithMinimalFields(){ - return new com.example.schoolmanagementservice.schooltype.SchoolTypeRequest(com.example.schoolmanagementservice.schooltype.SchoolType.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.schoolmanagementservice.school.SchoolRequest schools(){ - return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.school.SchoolRequest schoolsWithMinimalFields(){ - return new com.example.schoolmanagementservice.school.SchoolRequest(com.example.schoolmanagementservice.school.School.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest schoolCapacitySummaries(){ - return new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest schoolCapacitySummariesWithMinimalFields(){ - return new com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest(com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java deleted file mode 100644 index e53bf00a7..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/SchoolManagementServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.schoolmanagementservice; - -import io.teaql.core.UserContext; -public interface SchoolManagementServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java deleted file mode 100644 index f82474eb2..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/Platform.java +++ /dev/null @@ -1,236 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e1da6639feab09f3d1ed370802410798c759f6bf13f85e0a93374c42d1646603"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("base_url", 2), java.util.Map.entry("create_time", 3), java.util.Map.entry("update_time", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("base_url", java.util.List.of("baseUrl", "base_url")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "school_type_list", "school_list", "school_capacity_summary_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String BASE_URL_PROPERTY = "base_url"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - public static final String SCHOOL_TYPE_LIST_PROPERTY = "school_type_list"; - public static final String SCHOOL_LIST_PROPERTY = "school_list"; - public static final String SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY = "school_capacity_summary_list"; - private String name; - - private String baseUrl; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - private SmartList schoolTypeList; - private SmartList schoolList; - private SmartList schoolCapacitySummaryList; - - public String getName(){ - return this.name; - } - - public String getBaseUrl(){ - return this.baseUrl; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public SmartList getSchoolTypeList(){ - return this.schoolTypeList == null ? SmartList.unloaded() : this.schoolTypeList; - } - public SmartList getSchoolList(){ - return this.schoolList == null ? SmartList.unloaded() : this.schoolList; - } - public SmartList getSchoolCapacitySummaryList(){ - return this.schoolCapacitySummaryList == null ? SmartList.unloaded() : this.schoolCapacitySummaryList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform updateBaseUrl(String baseUrl){ - baseUrl = (baseUrl == null ? null : baseUrl.trim()); - if(isPropertyLoaded(BASE_URL_PROPERTY) && Objects.equals(this.baseUrl, baseUrl)){ - return this; - } - handleUpdate(BASE_URL_PROPERTY, getBaseUrl(), baseUrl); - this.baseUrl = baseUrl; - return this; - } - - public Platform updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public Platform updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public Platform addSchoolType(SchoolType schoolType){ - if (schoolType == null){ - return this; - } - - if(null == this.schoolTypeList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolTypeList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolTypeList.add(schoolType); - schoolType.updatePlatform(this); - return this; - } - public Platform addSchool(School school){ - if (school == null){ - return this; - } - - if(null == this.schoolList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolList.add(school); - school.updatePlatform(this); - return this; - } - public Platform addSchoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ - if (schoolCapacitySummary == null){ - return this; - } - - if(null == this.schoolCapacitySummaryList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolCapacitySummaryList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolCapacitySummaryList.add(schoolCapacitySummary); - schoolCapacitySummary.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "base_url": this.baseUrl = (value == null ? null : ((String)value).trim()); break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - case "school_type_list": this.schoolTypeList = (SmartList) value; break; - case "school_list": this.schoolList = (SmartList) value; break; - case "school_capacity_summary_list": this.schoolCapacitySummaryList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "base_url": return this.baseUrl; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - case "school_type_list": return this.schoolTypeList; - case "school_list": return this.schoolList; - case "school_capacity_summary_list": return this.schoolCapacitySummaryList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - case "baseUrl": return this.baseUrl; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java deleted file mode 100644 index 21ee416f3..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformChecker.java +++ /dev/null @@ -1,120 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolChecker; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryChecker; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDateTime; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - platform.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - platform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(platform.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - platform.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("base_url")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "base_url"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!platform.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkBaseUrl(_context, platform.getProperty(Platform.BASE_URL_PROPERTY), newLocation(_parentLocation, "base_url")); - checkCreateTime(_context, platform.getProperty(Platform.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, platform.getProperty(Platform.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - for(int i = 0; platform.getSchoolTypeList() != null && i < platform.getSchoolTypeList().size(); i++){ - SchoolType schoolType = platform.getSchoolTypeList().get(i); - new SchoolTypeChecker().checkAndFix(_context, schoolType, newLocation(_parentLocation, "school_type_list", i)); - } - for(int i = 0; platform.getSchoolList() != null && i < platform.getSchoolList().size(); i++){ - School school = platform.getSchoolList().get(i); - new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); - } - for(int i = 0; platform.getSchoolCapacitySummaryList() != null && i < platform.getSchoolCapacitySummaryList().size(); i++){ - SchoolCapacitySummary schoolCapacitySummary = platform.getSchoolCapacitySummaryList().get(i); - new SchoolCapacitySummaryChecker().checkAndFix(_context, schoolCapacitySummary, newLocation(_parentLocation, "school_capacity_summary_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkBaseUrl(UserContext _context, String baseUrl, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, baseUrl); - if((baseUrl == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, baseUrl); - - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java deleted file mode 100644 index c3533c97b..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformExpression.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolListExpression; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryListExpression; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public Expression getBaseUrl(){ - return loaded("base_url", "getBaseUrl", Platform::getBaseUrl); - } - public PlatformExpression updateBaseUrl(String baseUrl){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateBaseUrl(baseUrl)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", Platform::getCreateTime); - } - public PlatformExpression updateCreateTime(LocalDateTime createTime){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", Platform::getUpdateTime); - } - public PlatformExpression updateUpdateTime(LocalDateTime updateTime){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateUpdateTime(updateTime)); - } - - public SchoolTypeListExpression getSchoolTypeList(){ - return new SchoolTypeListExpression(loaded("school_type_list", "getSchoolTypeList", Platform::getSchoolTypeList)); - } - public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("school_list", "getSchoolList", Platform::getSchoolList)); - } - public SchoolCapacitySummaryListExpression getSchoolCapacitySummaryList(){ - return new SchoolCapacitySummaryListExpression(loaded("school_capacity_summary_list", "getSchoolCapacitySummaryList", Platform::getSchoolCapacitySummaryList)); - } - public PlatformExpression addSchoolType(SchoolType schoolType){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolType(schoolType)); - } - public PlatformExpression addSchool(School school){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchool(school)); - } - public PlatformExpression addSchoolCapacitySummary(SchoolCapacitySummary schoolCapacitySummary){ - return new PlatformExpression(this, $it -> ((Platform)$it).addSchoolCapacitySummary(schoolCapacitySummary)); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java deleted file mode 100644 index 14e4a4c13..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java deleted file mode 100644 index 3e9c17602..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/platform/PlatformRequest.java +++ /dev/null @@ -1,1760 +0,0 @@ - -package com.example.schoolmanagementservice.platform; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolRequest; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummary; -import com.example.schoolmanagementservice.schoolcapacitysummary.SchoolCapacitySummaryRequest; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.BASE_URL_PROPERTY); - selectProperty(Platform.CREATE_TIME_PROPERTY); - selectProperty(Platform.UPDATE_TIME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectSchoolTypeList().selectSchoolList().selectSchoolCapacitySummaryList(); - return selectId().selectName().selectBaseUrl().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectBaseUrl(){ - selectProperty(Platform.BASE_URL_PROPERTY); - return this; - } - - /** - * fill the baseUrl with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS baseUrl) to fetch baseUrl property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectBaseUrl(){ - unselectProperty(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest selectCreateTime(){ - selectProperty(Platform.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectCreateTime(){ - unselectProperty(Platform.CREATE_TIME_PROPERTY); - return this; - } - public PlatformRequest selectUpdateTime(){ - selectProperty(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectUpdateTime(){ - unselectProperty(Platform.UPDATE_TIME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectSchoolTypeList(){ - return selectSchoolTypeListWith(Q.schoolTypes().selectSelf()); - } - - public PlatformRequest selectSchoolTypeListWith(SchoolTypeRequest schoolTypeList){ - enhanceRelation(Platform.SCHOOL_TYPE_LIST_PROPERTY, schoolTypeList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeListWith", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest selectSchoolList(){ - return selectSchoolListWith(Q.schools().selectSelf()); - } - - public PlatformRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(Platform.SCHOOL_LIST_PROPERTY, schoolList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest selectSchoolCapacitySummaryList(){ - return selectSchoolCapacitySummaryListWith(Q.schoolCapacitySummaries().selectSelf()); - } - - public PlatformRequest selectSchoolCapacitySummaryListWith(SchoolCapacitySummaryRequest schoolCapacitySummaryList){ - enhanceRelation(Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, schoolCapacitySummaryList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolCapacitySummaryListWith", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByBaseUrl(String... baseUrl){ - if (baseUrl == null || baseUrl.length == 0) { - throw new IllegalArgumentException("filterByBaseUrl parameter baseUrl cannot be empty"); - } - return appendSearchCriteria(createBaseUrlCriteria(Operator.EQUAL, (Object[])baseUrl)); - } - - public PlatformRequest withBaseUrl(Operator operator, Object... values){ - return appendSearchCriteria(createBaseUrlCriteria(operator, values)); - } - - public PlatformRequest withBaseUrlIsUnknown(){ - return withBaseUrl(Operator.IS_NULL); - } - - public PlatformRequest withBaseUrlIsKnown(){ - return withBaseUrl(Operator.IS_NOT_NULL); - } - - public SearchCriteria createBaseUrlCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.BASE_URL_PROPERTY, operator, values); - } - - public PlatformRequest withBaseUrlIsNot(String baseUrl){ - return withBaseUrl(Operator.NOT_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlIn(String... baseUrl){ - return withBaseUrl(Operator.IN, (Object[])baseUrl); - } - - public PlatformRequest withBaseUrlNotIn(String... baseUrl){ - return withBaseUrl(Operator.NOT_IN, (Object[])baseUrl); - } - public PlatformRequest withBaseUrlGreaterThan(String baseUrl){ - return withBaseUrl(Operator.GREATER_THAN, baseUrl); - } - - public PlatformRequest withBaseUrlGreaterThanOrEqualTo(String baseUrl){ - return withBaseUrl(Operator.GREATER_THAN_OR_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlLessThan(String baseUrl){ - return withBaseUrl(Operator.LESS_THAN, baseUrl); - } - - public PlatformRequest withBaseUrlLessThanOrEqualTo(String baseUrl){ - return withBaseUrl(Operator.LESS_THAN_OR_EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlBetween(String startOfBaseUrl, String endOfBaseUrl){ - return withBaseUrl(Operator.BETWEEN, startOfBaseUrl, endOfBaseUrl); - } - public PlatformRequest withBaseUrlStartingWith(String baseUrl){ - return withBaseUrl(Operator.BEGIN_WITH, baseUrl); - } - public PlatformRequest withBaseUrlContaining(String baseUrl){ - return withBaseUrl(Operator.CONTAIN, baseUrl); - } - - public PlatformRequest withBaseUrlNotContaining(String baseUrl){ - return withBaseUrl(Operator.NOT_CONTAIN, baseUrl); - } - - public PlatformRequest withBaseUrlNotStartingWith(String baseUrl){ - return withBaseUrl(Operator.NOT_BEGIN_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlEndingWith(String baseUrl){ - return withBaseUrl(Operator.END_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlNotEndingWith(String baseUrl){ - return withBaseUrl(Operator.NOT_END_WITH, baseUrl); - } - - public PlatformRequest withBaseUrlIs(String baseUrl){ - return withBaseUrl(Operator.EQUAL, baseUrl); - } - - public PlatformRequest withBaseUrlSoundingLike(String baseUrl){ - return withBaseUrl(Operator.SOUNDS_LIKE, baseUrl); - } - - - - public PlatformRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public PlatformRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public PlatformRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public PlatformRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.CREATE_TIME_PROPERTY, operator, values); - } - - public PlatformRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public PlatformRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public PlatformRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public PlatformRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public PlatformRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PlatformRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public PlatformRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PlatformRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public PlatformRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public PlatformRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PlatformRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public PlatformRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PlatformRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public PlatformRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public PlatformRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public PlatformRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public PlatformRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public PlatformRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.UPDATE_TIME_PROPERTY, operator, values); - } - - public PlatformRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public PlatformRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public PlatformRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public PlatformRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public PlatformRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public PlatformRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolTypeListMatching(SchoolTypeRequest schoolTypeRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolTypeRequest, SchoolType.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchoolTypes(){ - return withSchoolTypeListMatching(Q.schoolTypes().unlimited()); - } - - public PlatformRequest haveNoSchoolTypes(){ - return withoutSchoolTypeListMatching(Q.schoolTypes().unlimited()); - } - public PlatformRequest withSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolRequest, School.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchools(){ - return withSchoolListMatching(Q.schools().unlimited()); - } - - public PlatformRequest haveNoSchools(){ - return withoutSchoolListMatching(Q.schools().unlimited()); - } - public PlatformRequest withSchoolCapacitySummaryListMatching(SchoolCapacitySummaryRequest schoolCapacitySummaryRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolCapacitySummaryRequest, SchoolCapacitySummary.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutSchoolCapacitySummaryListMatching(SchoolCapacitySummaryRequest schoolCapacitySummaryRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, schoolCapacitySummaryRequest, SchoolCapacitySummary.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveSchoolCapacitySummaries(){ - return withSchoolCapacitySummaryListMatching(Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest haveNoSchoolCapacitySummaries(){ - return withoutSchoolCapacitySummaryListMatching(Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctBaseUrl(){ - return countDistinctBaseUrlAs("base_url_distinct_count"); - } - - public PlatformRequest countDistinctBaseUrlAs(String alias){ - super.countDistinctProperty(alias, Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public PlatformRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, Platform.CREATE_TIME_PROPERTY); - return this; - } - public PlatformRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public PlatformRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, Platform.UPDATE_TIME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupBySchoolTypesWithDetails(SchoolTypeRequest subRequest){ - aggregate(Platform.SCHOOL_TYPE_LIST_PROPERTY, subRequest); - return this; - } - public PlatformRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ - aggregate(Platform.SCHOOL_LIST_PROPERTY, subRequest); - return this; - } - public PlatformRequest groupBySchoolCapacitySummariesWithDetails(SchoolCapacitySummaryRequest subRequest){ - aggregate(Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByBaseUrl(){ - groupBy(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest groupByBaseUrlAs(String retName){ - groupBy(retName, Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest groupByBaseUrlWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.BASE_URL_PROPERTY, function); - return this; - } - - public PlatformRequest groupByCreateTime(){ - groupBy(Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByCreateTimeAs(String retName){ - groupBy(retName, Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.CREATE_TIME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByUpdateTime(){ - groupBy(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.UPDATE_TIME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByBaseUrlAscending(){ - addOrderByAscending(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest orderByBaseUrlDescending(){ - addOrderByDescending(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest orderByBaseUrlAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.BASE_URL_PROPERTY); - return this; - } - - public PlatformRequest orderByBaseUrlDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.BASE_URL_PROPERTY); - return this; - } - public PlatformRequest orderByCreateTimeAscending(){ - addOrderByAscending(Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByCreateTimeDescending(){ - addOrderByDescending(Platform.CREATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByUpdateTimeAscending(){ - addOrderByAscending(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByUpdateTimeDescending(){ - addOrderByDescending(Platform.UPDATE_TIME_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolTypesAs(String name, SchoolTypeRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchoolTypes(SchoolTypeRequest subRequest){ - return statsFromSchoolTypesAs(REFINEMENTS, subRequest); - } - public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, School.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchools(SchoolRequest subRequest){ - return statsFromSchoolsAs(REFINEMENTS, subRequest); - } - public PlatformRequest statsFromSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - return statsFromSchoolCapacitySummariesAs(name, subRequest, false); - } - - public PlatformRequest statsFromSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromSchoolCapacitySummaries(SchoolCapacitySummaryRequest subRequest){ - return statsFromSchoolCapacitySummariesAs(REFINEMENTS, subRequest); - } - public PlatformRequest countSchoolTypes(){ - addRelationCount("Count", Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolTypesAs(String name){ - addRelationCount(name, Q.schoolTypes().unlimited(), SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolTypesWith(String name, SchoolTypeRequest subRequest){ - addRelationCount(name, subRequest, SchoolType.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolTypesWith", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest countSchools(){ - addRelationCount("Count", Q.schools().unlimited(), School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolsAs(String name){ - addRelationCount(name, Q.schools().unlimited(), School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolsWith(String name, SchoolRequest subRequest){ - addRelationCount(name, subRequest, School.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest countSchoolCapacitySummaries(){ - addRelationCount("Count", Q.schoolCapacitySummaries().unlimited(), SchoolCapacitySummary.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolCapacitySummariesAs(String name){ - addRelationCount(name, Q.schoolCapacitySummaries().unlimited(), SchoolCapacitySummary.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countSchoolCapacitySummariesWith(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationCount(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolCapacitySummariesWith", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest minDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("minDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name){ - return minDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest minDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("maxDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name){ - return maxDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest maxDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("sumDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name){ - return sumDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest sumDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("avgDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name){ - return avgDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest avgDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("stdDevDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name){ - return standardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest standardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("stdDevPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name){ - return squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("varSampDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name){ - return sampleVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest sampleVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypes(){ - addRelationScalarAggregate("varPopDisplayOrderOfSchoolTypes", Q.schoolTypes().unlimited(), - SchoolType.PLATFORM_PROPERTY, SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypes", null, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name){ - return samplePopulationVarianceDisplayOrderOfSchoolTypesAs(name, Q.schoolTypes().unlimited()); - } - - public PlatformRequest samplePopulationVarianceDisplayOrderOfSchoolTypesAs(String name, SchoolTypeRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolType.PLATFORM_PROPERTY, - SchoolType.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfSchoolTypesAs", name, Platform.SCHOOL_TYPE_LIST_PROPERTY)); - return this; - } - public PlatformRequest minStudentCapacityOfSchools(){ - addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minStudentCapacityOfSchoolsAs(String name){ - return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxStudentCapacityOfSchools(){ - addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxStudentCapacityOfSchoolsAs(String name){ - return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumStudentCapacityOfSchools(){ - addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumStudentCapacityOfSchoolsAs(String name){ - return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgStudentCapacityOfSchools(){ - addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgStudentCapacityOfSchoolsAs(String name){ - return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ - return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ - return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.PLATFORM_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public PlatformRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.PLATFORM_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, Platform.SCHOOL_LIST_PROPERTY)); - return this; - } - public PlatformRequest minTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("minTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return minTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest minTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("maxTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return maxTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest maxTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("sumTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return sumTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest sumTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("avgTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return avgTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest avgTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("stdDevTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest standardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("stdDevPopTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("varSampTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("varPopTotalCapacityOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalCapacityOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name){ - return samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalCapacityOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest minSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("minSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minSchoolCountOfSchoolCapacitySummariesAs(String name){ - return minSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest minSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("maxSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxSchoolCountOfSchoolCapacitySummariesAs(String name){ - return maxSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest maxSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("sumSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumSchoolCountOfSchoolCapacitySummariesAs(String name){ - return sumSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest sumSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("avgSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgSchoolCountOfSchoolCapacitySummariesAs(String name){ - return avgSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest avgSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("stdDevSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name){ - return standardDeviationSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest standardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("stdDevPopSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name){ - return squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("varSampSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(String name){ - return sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest sampleVarianceSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummaries(){ - addRelationScalarAggregate("varPopSchoolCountOfSchoolCapacitySummaries", Q.schoolCapacitySummaries().unlimited(), - SchoolCapacitySummary.PLATFORM_PROPERTY, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceSchoolCountOfSchoolCapacitySummaries", null, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(String name){ - return samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(name, Q.schoolCapacitySummaries().unlimited()); - } - - public PlatformRequest samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs(String name, SchoolCapacitySummaryRequest subRequest){ - addRelationScalarAggregate(name, subRequest, SchoolCapacitySummary.PLATFORM_PROPERTY, - SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceSchoolCountOfSchoolCapacitySummariesAs", name, Platform.SCHOOL_CAPACITY_SUMMARY_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java deleted file mode 100644 index 3923b042c..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/School.java +++ /dev/null @@ -1,287 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.Constants; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class School extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "School"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "14b4bfbb4cda258779665e3bc38ab991040fe75793a416d29eddd06f8fa8f586"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("school_type", 2), java.util.Map.entry("name", 3), java.util.Map.entry("address", 4), java.util.Map.entry("established_date", 5), java.util.Map.entry("student_capacity", 6), java.util.Map.entry("active", 7), java.util.Map.entry("create_time", 8), java.util.Map.entry("update_time", 9), java.util.Map.entry("version", 10)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("school_type", java.util.List.of("schoolType", "school_type")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("address", java.util.List.of("address", "address")), java.util.Map.entry("established_date", java.util.List.of("establishedDate", "established_date")), java.util.Map.entry("student_capacity", java.util.List.of("studentCapacity", "student_capacity")), java.util.Map.entry("active", java.util.List.of("active", "active")), java.util.Map.entry("create_time", java.util.List.of("createTime", "create_time")), java.util.Map.entry("update_time", java.util.List.of("updateTime", "update_time")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - School.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String SCHOOL_TYPE_PROPERTY = "school_type"; - public static final String NAME_PROPERTY = "name"; - public static final String ADDRESS_PROPERTY = "address"; - public static final String ESTABLISHED_DATE_PROPERTY = "established_date"; - public static final String STUDENT_CAPACITY_PROPERTY = "student_capacity"; - public static final String ACTIVE_PROPERTY = "active"; - public static final String CREATE_TIME_PROPERTY = "create_time"; - public static final String UPDATE_TIME_PROPERTY = "update_time"; - private Platform platform; - - private SchoolType schoolType; - - private String name; - - private String address; - - private LocalDate establishedDate; - - private Integer studentCapacity; - - private Boolean active; - - private LocalDateTime createTime; - - private LocalDateTime updateTime; - - - public Platform getPlatform(){ - return this.platform; - } - - public SchoolType getSchoolType(){ - return this.schoolType; - } - - public String getName(){ - return this.name; - } - - public String getAddress(){ - return this.address; - } - - public LocalDate getEstablishedDate(){ - return this.establishedDate; - } - - public Integer getStudentCapacity(){ - return this.studentCapacity; - } - - public Boolean isActive(){ - return this.active; - } - - public LocalDateTime getCreateTime(){ - return this.createTime; - } - - public LocalDateTime getUpdateTime(){ - return this.updateTime; - } - - public School updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - protected School updateSchoolType(SchoolType schoolType){ - if(isPropertyLoaded(SCHOOL_TYPE_PROPERTY) && Objects.equals(this.schoolType, schoolType)){ - return this; - } - handleUpdate(SCHOOL_TYPE_PROPERTY, getSchoolType(), schoolType); - this.schoolType = schoolType; - return this; - } - - public School updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public School updateAddress(String address){ - address = (address == null ? null : address.trim()); - if(isPropertyLoaded(ADDRESS_PROPERTY) && Objects.equals(this.address, address)){ - return this; - } - handleUpdate(ADDRESS_PROPERTY, getAddress(), address); - this.address = address; - return this; - } - - public School updateEstablishedDate(LocalDate establishedDate){ - if(isPropertyLoaded(ESTABLISHED_DATE_PROPERTY) && Objects.equals(this.establishedDate, establishedDate)){ - return this; - } - handleUpdate(ESTABLISHED_DATE_PROPERTY, getEstablishedDate(), establishedDate); - this.establishedDate = establishedDate; - return this; - } - - public School updateStudentCapacity(Integer studentCapacity){ - if(isPropertyLoaded(STUDENT_CAPACITY_PROPERTY) && Objects.equals(this.studentCapacity, studentCapacity)){ - return this; - } - handleUpdate(STUDENT_CAPACITY_PROPERTY, getStudentCapacity(), studentCapacity); - this.studentCapacity = studentCapacity; - return this; - } - - public School updateActive(Boolean active){ - if(isPropertyLoaded(ACTIVE_PROPERTY) && Objects.equals(this.active, active)){ - return this; - } - handleUpdate(ACTIVE_PROPERTY, isActive(), active); - this.active = active; - return this; - } - - public School updateCreateTime(LocalDateTime createTime){ - if(isPropertyLoaded(CREATE_TIME_PROPERTY) && Objects.equals(this.createTime, createTime)){ - return this; - } - handleUpdate(CREATE_TIME_PROPERTY, getCreateTime(), createTime); - this.createTime = createTime; - return this; - } - - public School updateUpdateTime(LocalDateTime updateTime){ - if(isPropertyLoaded(UPDATE_TIME_PROPERTY) && Objects.equals(this.updateTime, updateTime)){ - return this; - } - handleUpdate(UPDATE_TIME_PROPERTY, getUpdateTime(), updateTime); - this.updateTime = updateTime; - return this; - } - - public boolean isSchoolTypePrimary(){ - return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_PRIMARY); - } - - public School updateSchoolTypeToPrimary(){ - return updateSchoolType(Constants.SCHOOL_TYPE_PRIMARY); - } - public boolean isSchoolTypeSecondary(){ - return Objects.equals(getSchoolType(), Constants.SCHOOL_TYPE_SECONDARY); - } - - public School updateSchoolTypeToSecondary(){ - return updateSchoolType(Constants.SCHOOL_TYPE_SECONDARY); - } - - public static School refer(Long id){ - School refer = new School(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public School comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "school_type": this.schoolType = (SchoolType) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "address": this.address = (value == null ? null : ((String)value).trim()); break; - - case "established_date": this.establishedDate = (LocalDate) value; break; - - case "student_capacity": this.studentCapacity = (Integer) value; break; - - case "active": this.active = (Boolean) value; break; - - case "create_time": this.createTime = (LocalDateTime) value; break; - - case "update_time": this.updateTime = (LocalDateTime) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "school_type": return this.schoolType; - case "name": return this.name; - case "address": return this.address; - case "established_date": return this.establishedDate; - case "student_capacity": return this.studentCapacity; - case "active": return this.active; - case "create_time": return this.createTime; - case "update_time": return this.updateTime; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "schoolType": return this.schoolType; - case "name": return this.name; - case "address": return this.address; - case "establishedDate": return this.establishedDate; - case "studentCapacity": return this.studentCapacity; - case "active": return this.active; - case "createTime": return this.createTime; - case "updateTime": return this.updateTime; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java deleted file mode 100644 index df8d0faa3..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolChecker.java +++ /dev/null @@ -1,159 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformChecker; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.time.LocalDate; -import java.time.LocalDateTime; - -public class SchoolChecker implements Checker{ - - public String type(){ - return School.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, School school, ObjectLocation _parentLocation){ - if(needCheck(_context, school)){ - markAsChecked(_context, school); - doCheck(_context, school, _parentLocation); - } - } - - public void doCheck(UserContext _context, School school, ObjectLocation _parentLocation){ - if((school == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, school); - if(school.needPersist()){ - } - if(school.newItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "create_time"), () -> { - school.updateCreateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "create_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - }if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - school.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - }else if(school.updateItem()){ - if(_contextFixEligible){ - applyContextFix(_context, newLocation(_parentLocation, "update_time"), () -> { - school.updateUpdateTime(_context.evaluate("now")); - _context.recordFixEvidence(new io.teaql.core.checker.FixEvidence(type(), "update_time", - "now".equalsIgnoreCase("now") ? io.teaql.core.checker.FixEvidence.Source.CLOCK : io.teaql.core.checker.FixEvidence.Source.CONTEXT, - "now".equalsIgnoreCase("now") ? "graphClock" : "contextFunction:now")); - }); - } - if(!school.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("school_type")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "school_type"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("address")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "address"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("established_date")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "established_date"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("student_capacity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "student_capacity"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("active")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "active"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("create_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "create_time"), "Mutation requires a fully loaded entity"); - } - if(!school.isPropertyLoaded("update_time")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "update_time"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, school.getProperty(School.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkSchoolType(_context, school.getProperty(School.SCHOOL_TYPE_PROPERTY), newLocation(_parentLocation, "school_type")); - checkName(_context, school.getProperty(School.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkAddress(_context, school.getProperty(School.ADDRESS_PROPERTY), newLocation(_parentLocation, "address")); - checkEstablishedDate(_context, school.getProperty(School.ESTABLISHED_DATE_PROPERTY), newLocation(_parentLocation, "established_date")); - checkStudentCapacity(_context, school.getProperty(School.STUDENT_CAPACITY_PROPERTY), newLocation(_parentLocation, "student_capacity")); - checkActive(_context, school.getProperty(School.ACTIVE_PROPERTY), newLocation(_parentLocation, "active")); - checkCreateTime(_context, school.getProperty(School.CREATE_TIME_PROPERTY), newLocation(_parentLocation, "create_time")); - checkUpdateTime(_context, school.getProperty(School.UPDATE_TIME_PROPERTY), newLocation(_parentLocation, "update_time")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkSchoolType(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, schoolType); - if((schoolType == null)){ - return; - } - new SchoolTypeChecker().checkAndFix(_context, schoolType, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkAddress(UserContext _context, String address, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, address); - if((address == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, address); - - } - public void checkEstablishedDate(UserContext _context, LocalDate establishedDate, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, establishedDate); - if((establishedDate == null)){ - return; - } - } - public void checkStudentCapacity(UserContext _context, Integer studentCapacity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, studentCapacity); - if((studentCapacity == null)){ - return; - } - } - public void checkActive(UserContext _context, Boolean active, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, active); - if((active == null)){ - return; - } - } - public void checkCreateTime(UserContext _context, LocalDateTime createTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, createTime); - if((createTime == null)){ - return; - } - } - public void checkUpdateTime(UserContext _context, LocalDateTime updateTime, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, updateTime); - if((updateTime == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java deleted file mode 100644 index 381a4e119..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolExpression.java +++ /dev/null @@ -1,110 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.function.Function; - -public class SchoolExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolExpression(Expression expression){ - super(expression); - } - - public SchoolExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolExpression updateId(Long id){ - return new SchoolExpression(this, $it -> {((School)$it).__internalSet("id", id); return this;}); - } - - public SchoolExpression save(UserContext userContext){ - return new SchoolExpression(this, $it -> ((School)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolExpression save(String intent, UserContext userContext){ - return new SchoolExpression(this, $it -> ((School)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", School::getPlatform)); - } - - public SchoolExpression updatePlatform(Platform platform){ - return new SchoolExpression(this, $it -> ((School)$it).updatePlatform(platform)); - } - - public SchoolTypeExpression getSchoolType(){ - return new SchoolTypeExpression(loaded("school_type", "getSchoolType", School::getSchoolType)); - } - - public SchoolExpression updateSchoolTypeToPrimary(){ - return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToPrimary()); - } - public SchoolExpression updateSchoolTypeToSecondary(){ - return new SchoolExpression(this, $it -> ((School)$it).updateSchoolTypeToSecondary()); - } - - public Expression getName(){ - return loaded("name", "getName", School::getName); - } - public SchoolExpression updateName(String name){ - return new SchoolExpression(this, $it -> ((School)$it).updateName(name)); - } - - public Expression getAddress(){ - return loaded("address", "getAddress", School::getAddress); - } - public SchoolExpression updateAddress(String address){ - return new SchoolExpression(this, $it -> ((School)$it).updateAddress(address)); - } - - public Expression getEstablishedDate(){ - return loaded("established_date", "getEstablishedDate", School::getEstablishedDate); - } - public SchoolExpression updateEstablishedDate(LocalDate establishedDate){ - return new SchoolExpression(this, $it -> ((School)$it).updateEstablishedDate(establishedDate)); - } - - public Expression getStudentCapacity(){ - return loaded("student_capacity", "getStudentCapacity", School::getStudentCapacity); - } - public SchoolExpression updateStudentCapacity(Integer studentCapacity){ - return new SchoolExpression(this, $it -> ((School)$it).updateStudentCapacity(studentCapacity)); - } - - public Expression isActive(){ - return loaded("active", "isActive", School::isActive); - } - public SchoolExpression updateActive(Boolean active){ - return new SchoolExpression(this, $it -> ((School)$it).updateActive(active)); - } - - public Expression getCreateTime(){ - return loaded("create_time", "getCreateTime", School::getCreateTime); - } - public SchoolExpression updateCreateTime(LocalDateTime createTime){ - return new SchoolExpression(this, $it -> ((School)$it).updateCreateTime(createTime)); - } - - public Expression getUpdateTime(){ - return loaded("update_time", "getUpdateTime", School::getUpdateTime); - } - public SchoolExpression updateUpdateTime(LocalDateTime updateTime){ - return new SchoolExpression(this, $it -> ((School)$it).updateUpdateTime(updateTime)); - } - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java deleted file mode 100644 index c41793f7b..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolListExpression extends SmartListExpression { - public SchoolListExpression(Expression> expression){ - super(expression); - } - - public SchoolListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolExpression first() { - return new SchoolExpression(super.first()); - } - - public SchoolExpression get(int index) { - return new SchoolExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java deleted file mode 100644 index c5ad3c9c4..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/school/SchoolRequest.java +++ /dev/null @@ -1,1643 +0,0 @@ - -package com.example.schoolmanagementservice.school; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformRequest; -import com.example.schoolmanagementservice.schooltype.SchoolType; -import com.example.schoolmanagementservice.schooltype.SchoolTypeRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Date; -import java.util.Objects; - -public class SchoolRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolRequest(Class returnType){ - this(returnType, () -> (T) new School()); - } - - protected SchoolRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolRequest copy(){ - return (SchoolRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolRequest matchingAnyOf(SchoolRequest school){ - super.internalMatchAny(school); - return this; - } - - public SchoolRequest matchingIdsOf(SchoolRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - School.ID_PROPERTY, request, School.ID_PROPERTY)); - } - - public SchoolRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SchoolRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectSchoolTypeIdOnly().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public SchoolRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(School.ID_PROPERTY); - selectProperty(School.PLATFORM_PROPERTY); - selectProperty(School.SCHOOL_TYPE_PROPERTY); - selectProperty(School.NAME_PROPERTY); - selectProperty(School.ADDRESS_PROPERTY); - selectProperty(School.ESTABLISHED_DATE_PROPERTY); - selectProperty(School.STUDENT_CAPACITY_PROPERTY); - selectProperty(School.ACTIVE_PROPERTY); - selectProperty(School.CREATE_TIME_PROPERTY); - selectProperty(School.UPDATE_TIME_PROPERTY); - selectProperty(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); - } - - public SchoolRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectSchoolType().selectName().selectAddress().selectEstablishedDate().selectStudentCapacity().selectActive().selectCreateTime().selectUpdateTime().selectVersion(); - } - - - public SchoolRequest selectId(){ - selectProperty(School.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectId(){ - unselectProperty(School.ID_PROPERTY); - return this; - } - public SchoolRequest selectPlatformIdOnly(){ - selectProperty(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(School.PLATFORM_PROPERTY); - enhanceRelation(School.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, School.PLATFORM_PROPERTY)); - return this; - } - - public SchoolRequest unselectPlatform(){ - unselectProperty(School.PLATFORM_PROPERTY); - return this; - } - public SchoolRequest selectSchoolTypeIdOnly(){ - selectProperty(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest selectSchoolType(){ - return selectSchoolTypeWith(Q.schoolTypes().unlimited().selectSelf()); - } - - public SchoolRequest selectSchoolTypeWith(SchoolTypeRequest schoolType){ - selectProperty(School.SCHOOL_TYPE_PROPERTY); - enhanceRelation(School.SCHOOL_TYPE_PROPERTY, schoolType, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolTypeWith", null, School.SCHOOL_TYPE_PROPERTY)); - return this; - } - - public SchoolRequest unselectSchoolType(){ - unselectProperty(School.SCHOOL_TYPE_PROPERTY); - return this; - } - public SchoolRequest selectName(){ - selectProperty(School.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectName(){ - unselectProperty(School.NAME_PROPERTY); - return this; - } - public SchoolRequest selectAddress(){ - selectProperty(School.ADDRESS_PROPERTY); - return this; - } - - /** - * fill the address with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS address) to fetch address property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectAddress(){ - unselectProperty(School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest selectEstablishedDate(){ - selectProperty(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - /** - * fill the establishedDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS establishedDate) to fetch establishedDate property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectEstablishedDate(){ - unselectProperty(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - public SchoolRequest selectStudentCapacity(){ - selectProperty(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - /** - * fill the studentCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS studentCapacity) to fetch studentCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the studentCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(studentCapacity) AS studentCapacity to fetch studentCapacity property. - * @param aggrFunction aggrFunction - */ - public SchoolRequest selectStudentCapacity(AggrFunction aggrFunction){ - selectProperty(School.STUDENT_CAPACITY_PROPERTY, aggrFunction); - return this; - } - - - public SchoolRequest unselectStudentCapacity(){ - unselectProperty(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest selectActive(){ - selectProperty(School.ACTIVE_PROPERTY); - return this; - } - - /** - * fill the active with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS active) to fetch active property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectActive(){ - unselectProperty(School.ACTIVE_PROPERTY); - return this; - } - public SchoolRequest selectCreateTime(){ - selectProperty(School.CREATE_TIME_PROPERTY); - return this; - } - - /** - * fill the createTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS createTime) to fetch createTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectCreateTime(){ - unselectProperty(School.CREATE_TIME_PROPERTY); - return this; - } - public SchoolRequest selectUpdateTime(){ - selectProperty(School.UPDATE_TIME_PROPERTY); - return this; - } - - /** - * fill the updateTime with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS updateTime) to fetch updateTime property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectUpdateTime(){ - unselectProperty(School.UPDATE_TIME_PROPERTY); - return this; - } - public SchoolRequest selectVersion(){ - selectProperty(School.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolRequest unselectVersion(){ - unselectProperty(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ID_PROPERTY, operator, values); - } - - public SchoolRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.PLATFORM_PROPERTY, operator, values); - } - - public SchoolRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(School.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolRequest filterBySchoolType(SchoolType... schoolType){ - if (schoolType == null || schoolType.length == 0) { - throw new IllegalArgumentException("filterBySchoolType parameter schoolType cannot be empty"); - } - return appendSearchCriteria(createSchoolTypeCriteria(Operator.EQUAL, (Object[])schoolType)); - } - - public SchoolRequest withSchoolType(Operator operator, Object... values){ - return appendSearchCriteria(createSchoolTypeCriteria(operator, values)); - } - - public SchoolRequest withSchoolTypeIsUnknown(){ - return withSchoolType(Operator.IS_NULL); - } - - public SchoolRequest withSchoolTypeIsKnown(){ - return withSchoolType(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSchoolTypeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.SCHOOL_TYPE_PROPERTY, operator, values); - } - - public SchoolRequest filterBySchoolType(Long schoolType){ - if(schoolType == null){ - return this; - } - return withSchoolType(Operator.EQUAL, schoolType); - } - public SchoolRequest withSchoolTypeMatching(SchoolTypeRequest schoolType){ - return appendSearchCriteria(new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY)); - } - - public SchoolRequest withoutSchoolTypeMatching(SchoolTypeRequest schoolType){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(School.SCHOOL_TYPE_PROPERTY, schoolType, SchoolType.ID_PROPERTY))); - } - - public SchoolRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.NAME_PROPERTY, operator, values); - } - - public SchoolRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolRequest filterByAddress(String... address){ - if (address == null || address.length == 0) { - throw new IllegalArgumentException("filterByAddress parameter address cannot be empty"); - } - return appendSearchCriteria(createAddressCriteria(Operator.EQUAL, (Object[])address)); - } - - public SchoolRequest withAddress(Operator operator, Object... values){ - return appendSearchCriteria(createAddressCriteria(operator, values)); - } - - public SchoolRequest withAddressIsUnknown(){ - return withAddress(Operator.IS_NULL); - } - - public SchoolRequest withAddressIsKnown(){ - return withAddress(Operator.IS_NOT_NULL); - } - - public SearchCriteria createAddressCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ADDRESS_PROPERTY, operator, values); - } - - public SchoolRequest withAddressIsNot(String address){ - return withAddress(Operator.NOT_EQUAL, address); - } - - public SchoolRequest withAddressIn(String... address){ - return withAddress(Operator.IN, (Object[])address); - } - - public SchoolRequest withAddressNotIn(String... address){ - return withAddress(Operator.NOT_IN, (Object[])address); - } - public SchoolRequest withAddressGreaterThan(String address){ - return withAddress(Operator.GREATER_THAN, address); - } - - public SchoolRequest withAddressGreaterThanOrEqualTo(String address){ - return withAddress(Operator.GREATER_THAN_OR_EQUAL, address); - } - - public SchoolRequest withAddressLessThan(String address){ - return withAddress(Operator.LESS_THAN, address); - } - - public SchoolRequest withAddressLessThanOrEqualTo(String address){ - return withAddress(Operator.LESS_THAN_OR_EQUAL, address); - } - - public SchoolRequest withAddressBetween(String startOfAddress, String endOfAddress){ - return withAddress(Operator.BETWEEN, startOfAddress, endOfAddress); - } - public SchoolRequest withAddressStartingWith(String address){ - return withAddress(Operator.BEGIN_WITH, address); - } - public SchoolRequest withAddressContaining(String address){ - return withAddress(Operator.CONTAIN, address); - } - - public SchoolRequest withAddressNotContaining(String address){ - return withAddress(Operator.NOT_CONTAIN, address); - } - - public SchoolRequest withAddressNotStartingWith(String address){ - return withAddress(Operator.NOT_BEGIN_WITH, address); - } - - public SchoolRequest withAddressEndingWith(String address){ - return withAddress(Operator.END_WITH, address); - } - - public SchoolRequest withAddressNotEndingWith(String address){ - return withAddress(Operator.NOT_END_WITH, address); - } - - public SchoolRequest withAddressIs(String address){ - return withAddress(Operator.EQUAL, address); - } - - public SchoolRequest withAddressSoundingLike(String address){ - return withAddress(Operator.SOUNDS_LIKE, address); - } - - - - public SchoolRequest filterByEstablishedDate(LocalDate... establishedDate){ - if (establishedDate == null || establishedDate.length == 0) { - throw new IllegalArgumentException("filterByEstablishedDate parameter establishedDate cannot be empty"); - } - return appendSearchCriteria(createEstablishedDateCriteria(Operator.EQUAL, (Object[])establishedDate)); - } - - public SchoolRequest withEstablishedDate(Operator operator, Object... values){ - return appendSearchCriteria(createEstablishedDateCriteria(operator, values)); - } - - public SchoolRequest withEstablishedDateIsUnknown(){ - return withEstablishedDate(Operator.IS_NULL); - } - - public SchoolRequest withEstablishedDateIsKnown(){ - return withEstablishedDate(Operator.IS_NOT_NULL); - } - - public SearchCriteria createEstablishedDateCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ESTABLISHED_DATE_PROPERTY, operator, values); - } - - public SchoolRequest withEstablishedDateIs(LocalDate establishedDate){ - return withEstablishedDate(Operator.EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateIsNot(LocalDate establishedDate){ - return withEstablishedDate(Operator.NOT_EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateIn(LocalDate... establishedDate){ - return withEstablishedDate(Operator.IN, (Object[])establishedDate); - } - - public SchoolRequest withEstablishedDateNotIn(LocalDate... establishedDate){ - return withEstablishedDate(Operator.NOT_IN, (Object[])establishedDate); - } - public SchoolRequest withEstablishedDateGreaterThan(LocalDate establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateGreaterThanOrEqualTo(LocalDate establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN_OR_EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateLessThan(LocalDate establishedDate){ - return withEstablishedDate(Operator.LESS_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateLessThanOrEqualTo(LocalDate establishedDate){ - return withEstablishedDate(Operator.LESS_THAN_OR_EQUAL, establishedDate); - } - - public SchoolRequest withEstablishedDateBetween(LocalDate startOfEstablishedDate, LocalDate endOfEstablishedDate){ - return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); - } - public SchoolRequest withEstablishedDateBefore(LocalDate establishedDate){ - return withEstablishedDate(Operator.LESS_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateBefore(Date establishedDate){ - return withEstablishedDate(Operator.LESS_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateAfter(LocalDate establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateAfter(Date establishedDate){ - return withEstablishedDate(Operator.GREATER_THAN, establishedDate); - } - - public SchoolRequest withEstablishedDateBetween(Date startOfEstablishedDate, Date endOfEstablishedDate){ - return withEstablishedDate(Operator.BETWEEN, startOfEstablishedDate, endOfEstablishedDate); - } - - - - - public SchoolRequest filterByStudentCapacity(Integer... studentCapacity){ - if (studentCapacity == null || studentCapacity.length == 0) { - throw new IllegalArgumentException("filterByStudentCapacity parameter studentCapacity cannot be empty"); - } - return appendSearchCriteria(createStudentCapacityCriteria(Operator.EQUAL, (Object[])studentCapacity)); - } - - public SchoolRequest withStudentCapacity(Operator operator, Object... values){ - return appendSearchCriteria(createStudentCapacityCriteria(operator, values)); - } - - public SchoolRequest withStudentCapacityIsUnknown(){ - return withStudentCapacity(Operator.IS_NULL); - } - - public SchoolRequest withStudentCapacityIsKnown(){ - return withStudentCapacity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createStudentCapacityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.STUDENT_CAPACITY_PROPERTY, operator, values); - } - - public SchoolRequest withStudentCapacityIs(Integer studentCapacity){ - return withStudentCapacity(Operator.EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityIsNot(Integer studentCapacity){ - return withStudentCapacity(Operator.NOT_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityIn(Integer... studentCapacity){ - return withStudentCapacity(Operator.IN, (Object[])studentCapacity); - } - - public SchoolRequest withStudentCapacityNotIn(Integer... studentCapacity){ - return withStudentCapacity(Operator.NOT_IN, (Object[])studentCapacity); - } - public SchoolRequest withStudentCapacityGreaterThan(Integer studentCapacity){ - return withStudentCapacity(Operator.GREATER_THAN, studentCapacity); - } - - public SchoolRequest withStudentCapacityGreaterThanOrEqualTo(Integer studentCapacity){ - return withStudentCapacity(Operator.GREATER_THAN_OR_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityLessThan(Integer studentCapacity){ - return withStudentCapacity(Operator.LESS_THAN, studentCapacity); - } - - public SchoolRequest withStudentCapacityLessThanOrEqualTo(Integer studentCapacity){ - return withStudentCapacity(Operator.LESS_THAN_OR_EQUAL, studentCapacity); - } - - public SchoolRequest withStudentCapacityBetween(Integer startOfStudentCapacity, Integer endOfStudentCapacity){ - return withStudentCapacity(Operator.BETWEEN, startOfStudentCapacity, endOfStudentCapacity); - } - - - - public SchoolRequest filterByActive(Boolean... active){ - if (active == null || active.length == 0) { - throw new IllegalArgumentException("filterByActive parameter active cannot be empty"); - } - return appendSearchCriteria(createActiveCriteria(Operator.EQUAL, (Object[])active)); - } - - public SchoolRequest withActive(Operator operator, Object... values){ - return appendSearchCriteria(createActiveCriteria(operator, values)); - } - - public SchoolRequest withActiveIsUnknown(){ - return withActive(Operator.IS_NULL); - } - - public SchoolRequest withActiveIsKnown(){ - return withActive(Operator.IS_NOT_NULL); - } - - public SearchCriteria createActiveCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.ACTIVE_PROPERTY, operator, values); - } - - public SchoolRequest whichAreActive(){ - return withActive(Operator.EQUAL, true); - } - - public SchoolRequest whichAreNotActive(){ - return withActive(Operator.EQUAL, false); - } - - - public SchoolRequest filterByCreateTime(LocalDateTime... createTime){ - if (createTime == null || createTime.length == 0) { - throw new IllegalArgumentException("filterByCreateTime parameter createTime cannot be empty"); - } - return appendSearchCriteria(createCreateTimeCriteria(Operator.EQUAL, (Object[])createTime)); - } - - public SchoolRequest withCreateTime(Operator operator, Object... values){ - return appendSearchCriteria(createCreateTimeCriteria(operator, values)); - } - - public SchoolRequest withCreateTimeIsUnknown(){ - return withCreateTime(Operator.IS_NULL); - } - - public SchoolRequest withCreateTimeIsKnown(){ - return withCreateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCreateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.CREATE_TIME_PROPERTY, operator, values); - } - - public SchoolRequest withCreateTimeIs(LocalDateTime createTime){ - return withCreateTime(Operator.EQUAL, createTime); - } - - public SchoolRequest withCreateTimeIsNot(LocalDateTime createTime){ - return withCreateTime(Operator.NOT_EQUAL, createTime); - } - - public SchoolRequest withCreateTimeIn(LocalDateTime... createTime){ - return withCreateTime(Operator.IN, (Object[])createTime); - } - - public SchoolRequest withCreateTimeNotIn(LocalDateTime... createTime){ - return withCreateTime(Operator.NOT_IN, (Object[])createTime); - } - public SchoolRequest withCreateTimeGreaterThan(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public SchoolRequest withCreateTimeGreaterThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN_OR_EQUAL, createTime); - } - - public SchoolRequest withCreateTimeLessThan(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public SchoolRequest withCreateTimeLessThanOrEqualTo(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN_OR_EQUAL, createTime); - } - - public SchoolRequest withCreateTimeBetween(LocalDateTime startOfCreateTime, LocalDateTime endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - public SchoolRequest withCreateTimeBefore(LocalDateTime createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public SchoolRequest withCreateTimeBefore(Date createTime){ - return withCreateTime(Operator.LESS_THAN, createTime); - } - - public SchoolRequest withCreateTimeAfter(LocalDateTime createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public SchoolRequest withCreateTimeAfter(Date createTime){ - return withCreateTime(Operator.GREATER_THAN, createTime); - } - - public SchoolRequest withCreateTimeBetween(Date startOfCreateTime, Date endOfCreateTime){ - return withCreateTime(Operator.BETWEEN, startOfCreateTime, endOfCreateTime); - } - - - - - public SchoolRequest filterByUpdateTime(LocalDateTime... updateTime){ - if (updateTime == null || updateTime.length == 0) { - throw new IllegalArgumentException("filterByUpdateTime parameter updateTime cannot be empty"); - } - return appendSearchCriteria(createUpdateTimeCriteria(Operator.EQUAL, (Object[])updateTime)); - } - - public SchoolRequest withUpdateTime(Operator operator, Object... values){ - return appendSearchCriteria(createUpdateTimeCriteria(operator, values)); - } - - public SchoolRequest withUpdateTimeIsUnknown(){ - return withUpdateTime(Operator.IS_NULL); - } - - public SchoolRequest withUpdateTimeIsKnown(){ - return withUpdateTime(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUpdateTimeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.UPDATE_TIME_PROPERTY, operator, values); - } - - public SchoolRequest withUpdateTimeIs(LocalDateTime updateTime){ - return withUpdateTime(Operator.EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeIsNot(LocalDateTime updateTime){ - return withUpdateTime(Operator.NOT_EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.IN, (Object[])updateTime); - } - - public SchoolRequest withUpdateTimeNotIn(LocalDateTime... updateTime){ - return withUpdateTime(Operator.NOT_IN, (Object[])updateTime); - } - public SchoolRequest withUpdateTimeGreaterThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeGreaterThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN_OR_EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeLessThan(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeLessThanOrEqualTo(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN_OR_EQUAL, updateTime); - } - - public SchoolRequest withUpdateTimeBetween(LocalDateTime startOfUpdateTime, LocalDateTime endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - public SchoolRequest withUpdateTimeBefore(LocalDateTime updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeBefore(Date updateTime){ - return withUpdateTime(Operator.LESS_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeAfter(LocalDateTime updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeAfter(Date updateTime){ - return withUpdateTime(Operator.GREATER_THAN, updateTime); - } - - public SchoolRequest withUpdateTimeBetween(Date startOfUpdateTime, Date endOfUpdateTime){ - return withUpdateTime(Operator.BETWEEN, startOfUpdateTime, endOfUpdateTime); - } - - - - - public SchoolRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(School.VERSION_PROPERTY, operator, values); - } - - public SchoolRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public SchoolRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolRequest minStudentCapacity(){ - return minStudentCapacityAs(prefix("minOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest minStudentCapacityAs(String retName){ - super.min(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest maxStudentCapacity(){ - return maxStudentCapacityAs(prefix("maxOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest maxStudentCapacityAs(String retName){ - super.max(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest sumStudentCapacity(){ - return sumStudentCapacityAs(prefix("sumOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest sumStudentCapacityAs(String retName){ - super.sum(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest avgStudentCapacity(){ - return avgStudentCapacityAs(prefix("avgOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest avgStudentCapacityAs(String retName){ - super.avg(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest standardDeviationStudentCapacity(){ - return standardDeviationStudentCapacityAs(prefix("standardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest standardDeviationStudentCapacityAs(String retName){ - super.standardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacity(){ - return squareRootOfPopulationStandardDeviationStudentCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest squareRootOfPopulationStandardDeviationStudentCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest sampleVarianceStudentCapacity(){ - return sampleVarianceStudentCapacityAs(prefix("sampleVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest sampleVarianceStudentCapacityAs(String retName){ - super.sampleVariance(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest samplePopulationVarianceStudentCapacity(){ - return samplePopulationVarianceStudentCapacityAs(prefix("samplePopulationVarianceOf",School.STUDENT_CAPACITY_PROPERTY)); - } - - public SchoolRequest samplePopulationVarianceStudentCapacityAs(String retName){ - super.samplePopulationVariance(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(School.PLATFORM_PROPERTY, subRequest); - return this; - } - - public SchoolRequest groupBySchoolTypeWithDetails(){ - return groupBySchoolTypeWithDetails(Q.schoolTypes().unlimited()); - } - - public SchoolRequest groupBySchoolTypeWithDetails(SchoolTypeRequest subRequest){ - aggregate(School.SCHOOL_TYPE_PROPERTY, subRequest); - return this; - } - - - - - - - - - - public SchoolRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, School.ID_PROPERTY); - return this; - } - public SchoolRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, School.PLATFORM_PROPERTY); - return this; - } - public SchoolRequest countDistinctSchoolType(){ - return countDistinctSchoolTypeAs("school_type_distinct_count"); - } - - public SchoolRequest countDistinctSchoolTypeAs(String alias){ - super.countDistinctProperty(alias, School.SCHOOL_TYPE_PROPERTY); - return this; - } - public SchoolRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, School.NAME_PROPERTY); - return this; - } - public SchoolRequest countDistinctAddress(){ - return countDistinctAddressAs("address_distinct_count"); - } - - public SchoolRequest countDistinctAddressAs(String alias){ - super.countDistinctProperty(alias, School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest countDistinctEstablishedDate(){ - return countDistinctEstablishedDateAs("established_date_distinct_count"); - } - - public SchoolRequest countDistinctEstablishedDateAs(String alias){ - super.countDistinctProperty(alias, School.ESTABLISHED_DATE_PROPERTY); - return this; - } - public SchoolRequest countDistinctStudentCapacity(){ - return countDistinctStudentCapacityAs("student_capacity_distinct_count"); - } - - public SchoolRequest countDistinctStudentCapacityAs(String alias){ - super.countDistinctProperty(alias, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - public SchoolRequest countDistinctActive(){ - return countDistinctActiveAs("active_distinct_count"); - } - - public SchoolRequest countDistinctActiveAs(String alias){ - super.countDistinctProperty(alias, School.ACTIVE_PROPERTY); - return this; - } - public SchoolRequest countDistinctCreateTime(){ - return countDistinctCreateTimeAs("create_time_distinct_count"); - } - - public SchoolRequest countDistinctCreateTimeAs(String alias){ - super.countDistinctProperty(alias, School.CREATE_TIME_PROPERTY); - return this; - } - public SchoolRequest countDistinctUpdateTime(){ - return countDistinctUpdateTimeAs("update_time_distinct_count"); - } - - public SchoolRequest countDistinctUpdateTimeAs(String alias){ - super.countDistinctProperty(alias, School.UPDATE_TIME_PROPERTY); - return this; - } - public SchoolRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupById(){ - groupBy(School.ID_PROPERTY); - return this; - } - - public SchoolRequest groupByIdAs(String retName){ - groupBy(retName, School.ID_PROPERTY); - return this; - } - - public SchoolRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ID_PROPERTY, function); - return this; - } - public SchoolRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(School.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolRequest groupByPlatform(){ - groupBy(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest groupByPlatformAs(String retName){ - groupBy(retName, School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.PLATFORM_PROPERTY, function); - return this; - } - public SchoolRequest groupBySchoolTypeWith(SchoolTypeRequest subRequest){ - groupBy(School.SCHOOL_TYPE_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupBySchoolTypeWith", null, "school_type")); - return this; - } - public SchoolRequest groupBySchoolType(){ - groupBy(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest groupBySchoolTypeAs(String retName){ - groupBy(retName, School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest groupBySchoolTypeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.SCHOOL_TYPE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByName(){ - groupBy(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest groupByNameAs(String retName){ - groupBy(retName, School.NAME_PROPERTY); - return this; - } - - public SchoolRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.NAME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByAddress(){ - groupBy(School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest groupByAddressAs(String retName){ - groupBy(retName, School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest groupByAddressWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ADDRESS_PROPERTY, function); - return this; - } - - public SchoolRequest groupByEstablishedDate(){ - groupBy(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest groupByEstablishedDateAs(String retName){ - groupBy(retName, School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest groupByEstablishedDateWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ESTABLISHED_DATE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByStudentCapacity(){ - groupBy(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest groupByStudentCapacityAs(String retName){ - groupBy(retName, School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest groupByStudentCapacityWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.STUDENT_CAPACITY_PROPERTY, function); - return this; - } - - public SchoolRequest groupByActive(){ - groupBy(School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest groupByActiveAs(String retName){ - groupBy(retName, School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest groupByActiveWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.ACTIVE_PROPERTY, function); - return this; - } - - public SchoolRequest groupByCreateTime(){ - groupBy(School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByCreateTimeAs(String retName){ - groupBy(retName, School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByCreateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.CREATE_TIME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByUpdateTime(){ - groupBy(School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByUpdateTimeAs(String retName){ - groupBy(retName, School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest groupByUpdateTimeWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.UPDATE_TIME_PROPERTY, function); - return this; - } - - public SchoolRequest groupByVersion(){ - groupBy(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupByVersionAs(String retName){ - groupBy(retName, School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, School.VERSION_PROPERTY, function); - return this; - } - - public SchoolRequest withSchoolTypeIsPrimary(){ - filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_PRIMARY); - return this; - } - - - public SchoolRequest withSchoolTypeIsSecondary(){ - filterBySchoolType(com.example.schoolmanagementservice.Constants.SCHOOL_TYPE_SECONDARY); - return this; - } - - - - - public SchoolRequest orderByIdAscending(){ - addOrderByAscending(School.ID_PROPERTY); - return this; - } - - public SchoolRequest orderByIdDescending(){ - addOrderByDescending(School.ID_PROPERTY); - return this; - } - - public SchoolRequest orderByPlatformAscending(){ - addOrderByAscending(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest orderByPlatformDescending(){ - addOrderByDescending(School.PLATFORM_PROPERTY); - return this; - } - - public SchoolRequest orderBySchoolTypeAscending(){ - addOrderByAscending(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest orderBySchoolTypeDescending(){ - addOrderByDescending(School.SCHOOL_TYPE_PROPERTY); - return this; - } - - public SchoolRequest orderByNameAscending(){ - addOrderByAscending(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest orderByNameDescending(){ - addOrderByDescending(School.NAME_PROPERTY); - return this; - } - public SchoolRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(School.NAME_PROPERTY); - return this; - } - - public SchoolRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(School.NAME_PROPERTY); - return this; - } - public SchoolRequest orderByAddressAscending(){ - addOrderByAscending(School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest orderByAddressDescending(){ - addOrderByDescending(School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest orderByAddressAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(School.ADDRESS_PROPERTY); - return this; - } - - public SchoolRequest orderByAddressDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(School.ADDRESS_PROPERTY); - return this; - } - public SchoolRequest orderByEstablishedDateAscending(){ - addOrderByAscending(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest orderByEstablishedDateDescending(){ - addOrderByDescending(School.ESTABLISHED_DATE_PROPERTY); - return this; - } - - public SchoolRequest orderByStudentCapacityAscending(){ - addOrderByAscending(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest orderByStudentCapacityDescending(){ - addOrderByDescending(School.STUDENT_CAPACITY_PROPERTY); - return this; - } - - public SchoolRequest orderByActiveAscending(){ - addOrderByAscending(School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest orderByActiveDescending(){ - addOrderByDescending(School.ACTIVE_PROPERTY); - return this; - } - - public SchoolRequest orderByCreateTimeAscending(){ - addOrderByAscending(School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByCreateTimeDescending(){ - addOrderByDescending(School.CREATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByUpdateTimeAscending(){ - addOrderByAscending(School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByUpdateTimeDescending(){ - addOrderByDescending(School.UPDATE_TIME_PROPERTY); - return this; - } - - public SchoolRequest orderByVersionAscending(){ - addOrderByAscending(School.VERSION_PROPERTY); - return this; - } - - public SchoolRequest orderByVersionDescending(){ - addOrderByDescending(School.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - public SchoolTypeRequest rollUpToSchoolType(){ - SchoolTypeRequest schoolType = Q.schoolTypes().unlimited(); - this.internalRollUpTo("school_type", schoolType, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToSchoolType", null, "school_type")); - return schoolType; - } - - - - - - - - - - - public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, School.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, School.PLATFORM_PROPERTY)); - return this; - } - public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType){ - return facetBySchoolTypeAs(facetName, schoolType, true); - } - - public SchoolRequest facetBySchoolTypeAs(String facetName, SchoolTypeRequest schoolType, boolean includeAllFacets){ - addFacet(facetName, School.SCHOOL_TYPE_PROPERTY, schoolType, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetBySchoolTypeAs", facetName, School.SCHOOL_TYPE_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java deleted file mode 100644 index 5cf69e771..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummary.java +++ /dev/null @@ -1,168 +0,0 @@ - -package com.example.schoolmanagementservice.schoolcapacitysummary; - -import com.example.schoolmanagementservice.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class SchoolCapacitySummary extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "SchoolCapacitySummary"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f571f4dcc37bd33fc29f0aa97e881485bf74a0130eef2c5230fe6c7e15c257f4"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("name", 2), java.util.Map.entry("total_capacity", 3), java.util.Map.entry("school_count", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("total_capacity", java.util.List.of("totalCapacity", "total_capacity")), java.util.Map.entry("school_count", java.util.List.of("schoolCount", "school_count")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - SchoolCapacitySummary.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String NAME_PROPERTY = "name"; - public static final String TOTAL_CAPACITY_PROPERTY = "total_capacity"; - public static final String SCHOOL_COUNT_PROPERTY = "school_count"; - private Platform platform; - - private String name; - - private Integer totalCapacity; - - private Integer schoolCount; - - - public Platform getPlatform(){ - return this.platform; - } - - public String getName(){ - return this.name; - } - - public Integer getTotalCapacity(){ - return this.totalCapacity; - } - - public Integer getSchoolCount(){ - return this.schoolCount; - } - - public SchoolCapacitySummary updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public SchoolCapacitySummary updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public SchoolCapacitySummary updateTotalCapacity(Integer totalCapacity){ - if(isPropertyLoaded(TOTAL_CAPACITY_PROPERTY) && Objects.equals(this.totalCapacity, totalCapacity)){ - return this; - } - handleUpdate(TOTAL_CAPACITY_PROPERTY, getTotalCapacity(), totalCapacity); - this.totalCapacity = totalCapacity; - return this; - } - - public SchoolCapacitySummary updateSchoolCount(Integer schoolCount){ - if(isPropertyLoaded(SCHOOL_COUNT_PROPERTY) && Objects.equals(this.schoolCount, schoolCount)){ - return this; - } - handleUpdate(SCHOOL_COUNT_PROPERTY, getSchoolCount(), schoolCount); - this.schoolCount = schoolCount; - return this; - } - - - public static SchoolCapacitySummary refer(Long id){ - SchoolCapacitySummary refer = new SchoolCapacitySummary(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public SchoolCapacitySummary comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "total_capacity": this.totalCapacity = (Integer) value; break; - - case "school_count": this.schoolCount = (Integer) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "total_capacity": return this.totalCapacity; - case "school_count": return this.schoolCount; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "totalCapacity": return this.totalCapacity; - case "schoolCount": return this.schoolCount; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java deleted file mode 100644 index f7a93a383..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryChecker.java +++ /dev/null @@ -1,79 +0,0 @@ - -package com.example.schoolmanagementservice.schoolcapacitysummary; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class SchoolCapacitySummaryChecker implements Checker{ - - public String type(){ - return SchoolCapacitySummary.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, SchoolCapacitySummary schoolCapacitySummary, ObjectLocation _parentLocation){ - if(needCheck(_context, schoolCapacitySummary)){ - markAsChecked(_context, schoolCapacitySummary); - doCheck(_context, schoolCapacitySummary, _parentLocation); - } - } - - public void doCheck(UserContext _context, SchoolCapacitySummary schoolCapacitySummary, ObjectLocation _parentLocation){ - if((schoolCapacitySummary == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, schoolCapacitySummary); - if(schoolCapacitySummary.needPersist()){ - } - if(schoolCapacitySummary.newItem()){ - }else if(schoolCapacitySummary.updateItem()){ - if(!schoolCapacitySummary.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!schoolCapacitySummary.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!schoolCapacitySummary.isPropertyLoaded("total_capacity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "total_capacity"), "Mutation requires a fully loaded entity"); - } - if(!schoolCapacitySummary.isPropertyLoaded("school_count")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "school_count"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkName(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkTotalCapacity(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY), newLocation(_parentLocation, "total_capacity")); - checkSchoolCount(_context, schoolCapacitySummary.getProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY), newLocation(_parentLocation, "school_count")); - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkTotalCapacity(UserContext _context, Integer totalCapacity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, totalCapacity); - if((totalCapacity == null)){ - return; - } - } - public void checkSchoolCount(UserContext _context, Integer schoolCount, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, schoolCount); - if((schoolCount == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java deleted file mode 100644 index 349f2c3c7..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryExpression.java +++ /dev/null @@ -1,67 +0,0 @@ - -package com.example.schoolmanagementservice.schoolcapacitysummary; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class SchoolCapacitySummaryExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolCapacitySummaryExpression(Expression expression){ - super(expression); - } - - public SchoolCapacitySummaryExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolCapacitySummaryExpression updateId(Long id){ - return new SchoolCapacitySummaryExpression(this, $it -> {((SchoolCapacitySummary)$it).__internalSet("id", id); return this;}); - } - - public SchoolCapacitySummaryExpression save(UserContext userContext){ - return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolCapacitySummaryExpression save(String intent, UserContext userContext){ - return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", SchoolCapacitySummary::getPlatform)); - } - - public SchoolCapacitySummaryExpression updatePlatform(Platform platform){ - return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updatePlatform(platform)); - } - - public Expression getName(){ - return loaded("name", "getName", SchoolCapacitySummary::getName); - } - public SchoolCapacitySummaryExpression updateName(String name){ - return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateName(name)); - } - - public Expression getTotalCapacity(){ - return loaded("total_capacity", "getTotalCapacity", SchoolCapacitySummary::getTotalCapacity); - } - public SchoolCapacitySummaryExpression updateTotalCapacity(Integer totalCapacity){ - return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateTotalCapacity(totalCapacity)); - } - - public Expression getSchoolCount(){ - return loaded("school_count", "getSchoolCount", SchoolCapacitySummary::getSchoolCount); - } - public SchoolCapacitySummaryExpression updateSchoolCount(Integer schoolCount){ - return new SchoolCapacitySummaryExpression(this, $it -> ((SchoolCapacitySummary)$it).updateSchoolCount(schoolCount)); - } - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java deleted file mode 100644 index 6c88d14c5..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.schoolcapacitysummary; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolCapacitySummaryListExpression extends SmartListExpression { - public SchoolCapacitySummaryListExpression(Expression> expression){ - super(expression); - } - - public SchoolCapacitySummaryListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolCapacitySummaryExpression first() { - return new SchoolCapacitySummaryExpression(super.first()); - } - - public SchoolCapacitySummaryExpression get(int index) { - return new SchoolCapacitySummaryExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java deleted file mode 100644 index a0a8e7086..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schoolcapacitysummary/SchoolCapacitySummaryRequest.java +++ /dev/null @@ -1,1059 +0,0 @@ - -package com.example.schoolmanagementservice.schoolcapacitysummary; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class SchoolCapacitySummaryRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolCapacitySummaryRequest(Class returnType){ - this(returnType, () -> (T) new SchoolCapacitySummary()); - } - - protected SchoolCapacitySummaryRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolCapacitySummaryRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolCapacitySummaryRequest copy(){ - return (SchoolCapacitySummaryRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolCapacitySummaryRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolCapacitySummaryRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolCapacitySummaryRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolCapacitySummaryRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolCapacitySummaryRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolCapacitySummaryRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolCapacitySummaryRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolCapacitySummaryRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolCapacitySummaryRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolCapacitySummaryRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolCapacitySummaryRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolCapacitySummaryRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolCapacitySummaryRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolCapacitySummaryRequest matchingAnyOf(SchoolCapacitySummaryRequest schoolCapacitySummary){ - super.internalMatchAny(schoolCapacitySummary); - return this; - } - - public SchoolCapacitySummaryRequest matchingIdsOf(SchoolCapacitySummaryRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - SchoolCapacitySummary.ID_PROPERTY, request, SchoolCapacitySummary.ID_PROPERTY)); - } - - public SchoolCapacitySummaryRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SchoolCapacitySummaryRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolCapacitySummaryRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolCapacitySummaryRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); - } - - public SchoolCapacitySummaryRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolCapacitySummaryRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(SchoolCapacitySummary.ID_PROPERTY); - selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); - selectProperty(SchoolCapacitySummary.NAME_PROPERTY); - selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - selectProperty(SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); - } - - public SchoolCapacitySummaryRequest selectChildren(){ - super.selectAny(); - return selectId().selectPlatform().selectName().selectTotalCapacity().selectSchoolCount().selectVersion(); - } - - - public SchoolCapacitySummaryRequest selectId(){ - selectProperty(SchoolCapacitySummary.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolCapacitySummaryRequest unselectId(){ - unselectProperty(SchoolCapacitySummary.ID_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest selectPlatformIdOnly(){ - selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolCapacitySummaryRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); - enhanceRelation(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolCapacitySummary.PLATFORM_PROPERTY)); - return this; - } - - public SchoolCapacitySummaryRequest unselectPlatform(){ - unselectProperty(SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest selectName(){ - selectProperty(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolCapacitySummaryRequest unselectName(){ - unselectProperty(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest selectTotalCapacity(){ - selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - - /** - * fill the totalCapacity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalCapacity) to fetch totalCapacity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the totalCapacity with customized aggrFunction, TEAQL uses ({aggrFunction}(totalCapacity) AS totalCapacity to fetch totalCapacity property. - * @param aggrFunction aggrFunction - */ - public SchoolCapacitySummaryRequest selectTotalCapacity(AggrFunction aggrFunction){ - selectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, aggrFunction); - return this; - } - - - public SchoolCapacitySummaryRequest unselectTotalCapacity(){ - unselectProperty(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest selectSchoolCount(){ - selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - - /** - * fill the schoolCount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS schoolCount) to fetch schoolCount property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the schoolCount with customized aggrFunction, TEAQL uses ({aggrFunction}(schoolCount) AS schoolCount to fetch schoolCount property. - * @param aggrFunction aggrFunction - */ - public SchoolCapacitySummaryRequest selectSchoolCount(AggrFunction aggrFunction){ - selectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, aggrFunction); - return this; - } - - - public SchoolCapacitySummaryRequest unselectSchoolCount(){ - unselectProperty(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest selectVersion(){ - selectProperty(SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolCapacitySummaryRequest unselectVersion(){ - unselectProperty(SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolCapacitySummary.ID_PROPERTY, operator, values); - } - - public SchoolCapacitySummaryRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolCapacitySummaryRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolCapacitySummaryRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolCapacitySummaryRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolCapacitySummaryRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolCapacitySummaryRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolCapacitySummaryRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolCapacitySummaryRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, operator, values); - } - - public SchoolCapacitySummaryRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolCapacitySummaryRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolCapacitySummaryRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(SchoolCapacitySummary.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolCapacitySummaryRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolCapacitySummaryRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolCapacitySummaryRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolCapacitySummaryRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolCapacitySummary.NAME_PROPERTY, operator, values); - } - - public SchoolCapacitySummaryRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolCapacitySummaryRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolCapacitySummaryRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolCapacitySummaryRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolCapacitySummaryRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolCapacitySummaryRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolCapacitySummaryRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolCapacitySummaryRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolCapacitySummaryRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolCapacitySummaryRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolCapacitySummaryRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolCapacitySummaryRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolCapacitySummaryRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolCapacitySummaryRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolCapacitySummaryRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolCapacitySummaryRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolCapacitySummaryRequest filterByTotalCapacity(Integer... totalCapacity){ - if (totalCapacity == null || totalCapacity.length == 0) { - throw new IllegalArgumentException("filterByTotalCapacity parameter totalCapacity cannot be empty"); - } - return appendSearchCriteria(createTotalCapacityCriteria(Operator.EQUAL, (Object[])totalCapacity)); - } - - public SchoolCapacitySummaryRequest withTotalCapacity(Operator operator, Object... values){ - return appendSearchCriteria(createTotalCapacityCriteria(operator, values)); - } - - public SchoolCapacitySummaryRequest withTotalCapacityIsUnknown(){ - return withTotalCapacity(Operator.IS_NULL); - } - - public SchoolCapacitySummaryRequest withTotalCapacityIsKnown(){ - return withTotalCapacity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTotalCapacityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, operator, values); - } - - public SchoolCapacitySummaryRequest withTotalCapacityIs(Integer totalCapacity){ - return withTotalCapacity(Operator.EQUAL, totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityIsNot(Integer totalCapacity){ - return withTotalCapacity(Operator.NOT_EQUAL, totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityIn(Integer... totalCapacity){ - return withTotalCapacity(Operator.IN, (Object[])totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityNotIn(Integer... totalCapacity){ - return withTotalCapacity(Operator.NOT_IN, (Object[])totalCapacity); - } - public SchoolCapacitySummaryRequest withTotalCapacityGreaterThan(Integer totalCapacity){ - return withTotalCapacity(Operator.GREATER_THAN, totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityGreaterThanOrEqualTo(Integer totalCapacity){ - return withTotalCapacity(Operator.GREATER_THAN_OR_EQUAL, totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityLessThan(Integer totalCapacity){ - return withTotalCapacity(Operator.LESS_THAN, totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityLessThanOrEqualTo(Integer totalCapacity){ - return withTotalCapacity(Operator.LESS_THAN_OR_EQUAL, totalCapacity); - } - - public SchoolCapacitySummaryRequest withTotalCapacityBetween(Integer startOfTotalCapacity, Integer endOfTotalCapacity){ - return withTotalCapacity(Operator.BETWEEN, startOfTotalCapacity, endOfTotalCapacity); - } - - - - public SchoolCapacitySummaryRequest filterBySchoolCount(Integer... schoolCount){ - if (schoolCount == null || schoolCount.length == 0) { - throw new IllegalArgumentException("filterBySchoolCount parameter schoolCount cannot be empty"); - } - return appendSearchCriteria(createSchoolCountCriteria(Operator.EQUAL, (Object[])schoolCount)); - } - - public SchoolCapacitySummaryRequest withSchoolCount(Operator operator, Object... values){ - return appendSearchCriteria(createSchoolCountCriteria(operator, values)); - } - - public SchoolCapacitySummaryRequest withSchoolCountIsUnknown(){ - return withSchoolCount(Operator.IS_NULL); - } - - public SchoolCapacitySummaryRequest withSchoolCountIsKnown(){ - return withSchoolCount(Operator.IS_NOT_NULL); - } - - public SearchCriteria createSchoolCountCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, operator, values); - } - - public SchoolCapacitySummaryRequest withSchoolCountIs(Integer schoolCount){ - return withSchoolCount(Operator.EQUAL, schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountIsNot(Integer schoolCount){ - return withSchoolCount(Operator.NOT_EQUAL, schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountIn(Integer... schoolCount){ - return withSchoolCount(Operator.IN, (Object[])schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountNotIn(Integer... schoolCount){ - return withSchoolCount(Operator.NOT_IN, (Object[])schoolCount); - } - public SchoolCapacitySummaryRequest withSchoolCountGreaterThan(Integer schoolCount){ - return withSchoolCount(Operator.GREATER_THAN, schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountGreaterThanOrEqualTo(Integer schoolCount){ - return withSchoolCount(Operator.GREATER_THAN_OR_EQUAL, schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountLessThan(Integer schoolCount){ - return withSchoolCount(Operator.LESS_THAN, schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountLessThanOrEqualTo(Integer schoolCount){ - return withSchoolCount(Operator.LESS_THAN_OR_EQUAL, schoolCount); - } - - public SchoolCapacitySummaryRequest withSchoolCountBetween(Integer startOfSchoolCount, Integer endOfSchoolCount){ - return withSchoolCount(Operator.BETWEEN, startOfSchoolCount, endOfSchoolCount); - } - - - - public SchoolCapacitySummaryRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolCapacitySummaryRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolCapacitySummaryRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolCapacitySummaryRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolCapacitySummary.VERSION_PROPERTY, operator, values); - } - - public SchoolCapacitySummaryRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolCapacitySummaryRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolCapacitySummaryRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolCapacitySummaryRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolCapacitySummaryRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolCapacitySummaryRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolCapacitySummaryRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolCapacitySummaryRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolCapacitySummaryRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public SchoolCapacitySummaryRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolCapacitySummaryRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolCapacitySummaryRequest minTotalCapacity(){ - return minTotalCapacityAs(prefix("minOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest minTotalCapacityAs(String retName){ - super.min(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest maxTotalCapacity(){ - return maxTotalCapacityAs(prefix("maxOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest maxTotalCapacityAs(String retName){ - super.max(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest sumTotalCapacity(){ - return sumTotalCapacityAs(prefix("sumOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest sumTotalCapacityAs(String retName){ - super.sum(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest avgTotalCapacity(){ - return avgTotalCapacityAs(prefix("avgOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest avgTotalCapacityAs(String retName){ - super.avg(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest standardDeviationTotalCapacity(){ - return standardDeviationTotalCapacityAs(prefix("standardDeviationOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest standardDeviationTotalCapacityAs(String retName){ - super.standardDeviation(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationTotalCapacity(){ - return squareRootOfPopulationStandardDeviationTotalCapacityAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationTotalCapacityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest sampleVarianceTotalCapacity(){ - return sampleVarianceTotalCapacityAs(prefix("sampleVarianceOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest sampleVarianceTotalCapacityAs(String retName){ - super.sampleVariance(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest samplePopulationVarianceTotalCapacity(){ - return samplePopulationVarianceTotalCapacityAs(prefix("samplePopulationVarianceOf",SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY)); - } - - public SchoolCapacitySummaryRequest samplePopulationVarianceTotalCapacityAs(String retName){ - super.samplePopulationVariance(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest minSchoolCount(){ - return minSchoolCountAs(prefix("minOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest minSchoolCountAs(String retName){ - super.min(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest maxSchoolCount(){ - return maxSchoolCountAs(prefix("maxOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest maxSchoolCountAs(String retName){ - super.max(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest sumSchoolCount(){ - return sumSchoolCountAs(prefix("sumOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest sumSchoolCountAs(String retName){ - super.sum(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest avgSchoolCount(){ - return avgSchoolCountAs(prefix("avgOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest avgSchoolCountAs(String retName){ - super.avg(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest standardDeviationSchoolCount(){ - return standardDeviationSchoolCountAs(prefix("standardDeviationOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest standardDeviationSchoolCountAs(String retName){ - super.standardDeviation(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationSchoolCount(){ - return squareRootOfPopulationStandardDeviationSchoolCountAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest squareRootOfPopulationStandardDeviationSchoolCountAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest sampleVarianceSchoolCount(){ - return sampleVarianceSchoolCountAs(prefix("sampleVarianceOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest sampleVarianceSchoolCountAs(String retName){ - super.sampleVariance(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest samplePopulationVarianceSchoolCount(){ - return samplePopulationVarianceSchoolCountAs(prefix("samplePopulationVarianceOf",SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY)); - } - - public SchoolCapacitySummaryRequest samplePopulationVarianceSchoolCountAs(String retName){ - super.samplePopulationVariance(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolCapacitySummaryRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(SchoolCapacitySummary.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - - public SchoolCapacitySummaryRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolCapacitySummaryRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, SchoolCapacitySummary.ID_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolCapacitySummaryRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolCapacitySummaryRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest countDistinctTotalCapacity(){ - return countDistinctTotalCapacityAs("total_capacity_distinct_count"); - } - - public SchoolCapacitySummaryRequest countDistinctTotalCapacityAs(String alias){ - super.countDistinctProperty(alias, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest countDistinctSchoolCount(){ - return countDistinctSchoolCountAs("school_count_distinct_count"); - } - - public SchoolCapacitySummaryRequest countDistinctSchoolCountAs(String alias){ - super.countDistinctProperty(alias, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolCapacitySummaryRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupById(){ - groupBy(SchoolCapacitySummary.ID_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByIdAs(String retName){ - groupBy(retName, SchoolCapacitySummary.ID_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolCapacitySummary.ID_PROPERTY, function); - return this; - } - public SchoolCapacitySummaryRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(SchoolCapacitySummary.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolCapacitySummaryRequest groupByPlatform(){ - groupBy(SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByPlatformAs(String retName){ - groupBy(retName, SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolCapacitySummary.PLATFORM_PROPERTY, function); - return this; - } - - public SchoolCapacitySummaryRequest groupByName(){ - groupBy(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByNameAs(String retName){ - groupBy(retName, SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolCapacitySummary.NAME_PROPERTY, function); - return this; - } - - public SchoolCapacitySummaryRequest groupByTotalCapacity(){ - groupBy(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByTotalCapacityAs(String retName){ - groupBy(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByTotalCapacityWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY, function); - return this; - } - - public SchoolCapacitySummaryRequest groupBySchoolCount(){ - groupBy(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupBySchoolCountAs(String retName){ - groupBy(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupBySchoolCountWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY, function); - return this; - } - - public SchoolCapacitySummaryRequest groupByVersion(){ - groupBy(SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByVersionAs(String retName){ - groupBy(retName, SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolCapacitySummary.VERSION_PROPERTY, function); - return this; - } - - - - public SchoolCapacitySummaryRequest orderByIdAscending(){ - addOrderByAscending(SchoolCapacitySummary.ID_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByIdDescending(){ - addOrderByDescending(SchoolCapacitySummary.ID_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByPlatformAscending(){ - addOrderByAscending(SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByPlatformDescending(){ - addOrderByDescending(SchoolCapacitySummary.PLATFORM_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByNameAscending(){ - addOrderByAscending(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByNameDescending(){ - addOrderByDescending(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolCapacitySummary.NAME_PROPERTY); - return this; - } - public SchoolCapacitySummaryRequest orderByTotalCapacityAscending(){ - addOrderByAscending(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByTotalCapacityDescending(){ - addOrderByDescending(SchoolCapacitySummary.TOTAL_CAPACITY_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderBySchoolCountAscending(){ - addOrderByAscending(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderBySchoolCountDescending(){ - addOrderByDescending(SchoolCapacitySummary.SCHOOL_COUNT_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByVersionAscending(){ - addOrderByAscending(SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - public SchoolCapacitySummaryRequest orderByVersionDescending(){ - addOrderByDescending(SchoolCapacitySummary.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - - public SchoolCapacitySummaryRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolCapacitySummaryRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, SchoolCapacitySummary.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolCapacitySummary.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolCapacitySummaryRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolCapacitySummaryRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolCapacitySummaryRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolCapacitySummaryRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolCapacitySummaryRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolCapacitySummaryRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java deleted file mode 100644 index 082e03793..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolType.java +++ /dev/null @@ -1,193 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.school.School; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class SchoolType extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "SchoolType"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "36f5b35e840d2f9ef89c6ee13c7d936fa10abc12a139d7f0373f9acabc9eac12"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("display_order", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "school_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - SchoolType.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String NAME_PROPERTY = "name"; - public static final String CODE_PROPERTY = "code"; - public static final String DISPLAY_ORDER_PROPERTY = "display_order"; - public static final String SCHOOL_LIST_PROPERTY = "school_list"; - private Platform platform; - - private String name; - - private String code; - - private BigDecimal displayOrder; - - private SmartList schoolList; - - public Platform getPlatform(){ - return this.platform; - } - - public String getName(){ - return this.name; - } - - public String getCode(){ - return this.code; - } - - public BigDecimal getDisplayOrder(){ - return this.displayOrder; - } - - public SmartList getSchoolList(){ - return this.schoolList == null ? SmartList.unloaded() : this.schoolList; - } - public SchoolType updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public SchoolType updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public SchoolType updateCode(String code){ - code = (code == null ? null : code.trim()); - if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ - return this; - } - handleUpdate(CODE_PROPERTY, getCode(), code); - this.code = code; - return this; - } - - public SchoolType updateDisplayOrder(BigDecimal displayOrder){ - if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ - return this; - } - handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); - this.displayOrder = displayOrder; - return this; - } - - public SchoolType addSchool(School school){ - if (school == null){ - return this; - } - - if(null == this.schoolList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.schoolList = teaqlUnloadedItems.map(value -> value); - } - - this.schoolList.add(school); - school.updateProperty(School.SCHOOL_TYPE_PROPERTY, this); - return this; - } - - public static SchoolType refer(Long id){ - SchoolType refer = new SchoolType(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public SchoolType comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "code": this.code = (value == null ? null : ((String)value).trim()); break; - - case "display_order": this.displayOrder = (BigDecimal) value; break; - - case "school_list": this.schoolList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "display_order": return this.displayOrder; - case "school_list": return this.schoolList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "displayOrder": return this.displayOrder; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java deleted file mode 100644 index daffc14d5..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeChecker.java +++ /dev/null @@ -1,87 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformChecker; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; - -public class SchoolTypeChecker implements Checker{ - - public String type(){ - return SchoolType.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - if(needCheck(_context, schoolType)){ - markAsChecked(_context, schoolType); - doCheck(_context, schoolType, _parentLocation); - } - } - - public void doCheck(UserContext _context, SchoolType schoolType, ObjectLocation _parentLocation){ - if((schoolType == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, schoolType); - if(schoolType.needPersist()){ - } - if(schoolType.newItem()){ - }else if(schoolType.updateItem()){ - if(!schoolType.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); - } - if(!schoolType.isPropertyLoaded("display_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, schoolType.getProperty(SchoolType.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkName(_context, schoolType.getProperty(SchoolType.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCode(_context, schoolType.getProperty(SchoolType.CODE_PROPERTY), newLocation(_parentLocation, "code")); - checkDisplayOrder(_context, schoolType.getProperty(SchoolType.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); - for(int i = 0; schoolType.getSchoolList() != null && i < schoolType.getSchoolList().size(); i++){ - School school = schoolType.getSchoolList().get(i); - new SchoolChecker().checkAndFix(_context, school, newLocation(_parentLocation, "school_list", i)); - } - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, code); - if((code == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, code); - - } - public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ - if((displayOrder == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java deleted file mode 100644 index f77c8c705..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeExpression.java +++ /dev/null @@ -1,76 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformExpression; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.util.function.Function; - -public class SchoolTypeExpression extends ExpressionAdaptor implements BaseEntityExpression { - public SchoolTypeExpression(Expression expression){ - super(expression); - } - - public SchoolTypeExpression(Expression expression, Function function){ - super(expression, function); - } - - public SchoolTypeExpression updateId(Long id){ - return new SchoolTypeExpression(this, $it -> {((SchoolType)$it).__internalSet("id", id); return this;}); - } - - public SchoolTypeExpression save(UserContext userContext){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs("Saved by Expression").save(userContext)); - } - - public SchoolTypeExpression save(String intent, UserContext userContext){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", SchoolType::getPlatform)); - } - - public SchoolTypeExpression updatePlatform(Platform platform){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updatePlatform(platform)); - } - - public Expression getName(){ - return loaded("name", "getName", SchoolType::getName); - } - public SchoolTypeExpression updateName(String name){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateName(name)); - } - - public Expression getCode(){ - return loaded("code", "getCode", SchoolType::getCode); - } - public SchoolTypeExpression updateCode(String code){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateCode(code)); - } - - public Expression getDisplayOrder(){ - return loaded("display_order", "getDisplayOrder", SchoolType::getDisplayOrder); - } - public SchoolTypeExpression updateDisplayOrder(BigDecimal displayOrder){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).updateDisplayOrder(displayOrder)); - } - - public SchoolListExpression getSchoolList(){ - return new SchoolListExpression(loaded("school_list", "getSchoolList", SchoolType::getSchoolList)); - } - public SchoolTypeExpression addSchool(School school){ - return new SchoolTypeExpression(this, $it -> ((SchoolType)$it).addSchool(school)); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java deleted file mode 100644 index 55fdae628..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class SchoolTypeListExpression extends SmartListExpression { - public SchoolTypeListExpression(Expression> expression){ - super(expression); - } - - public SchoolTypeListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public SchoolTypeExpression first() { - return new SchoolTypeExpression(super.first()); - } - - public SchoolTypeExpression get(int index) { - return new SchoolTypeExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java b/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java deleted file mode 100644 index 1b91f030f..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/java/com/example/schoolmanagementservice/schooltype/SchoolTypeRequest.java +++ /dev/null @@ -1,1238 +0,0 @@ - -package com.example.schoolmanagementservice.schooltype; - -import com.example.schoolmanagementservice.Q; -import com.example.schoolmanagementservice.platform.Platform; -import com.example.schoolmanagementservice.platform.PlatformRequest; -import com.example.schoolmanagementservice.school.School; -import com.example.schoolmanagementservice.school.SchoolRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.util.Objects; - -public class SchoolTypeRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public SchoolTypeRequest(Class returnType){ - this(returnType, () -> (T) new SchoolType()); - } - - protected SchoolTypeRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public SchoolTypeRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public SchoolTypeRequest copy(){ - return (SchoolTypeRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new SchoolTypeRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public SchoolTypeRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public SchoolTypeRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public SchoolTypeRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public SchoolTypeRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public SchoolTypeRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public SchoolTypeRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public SchoolTypeRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public SchoolTypeRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public SchoolTypeRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public SchoolTypeRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (SchoolTypeRequest)super.appendSearchCriteria(searchCriteria); - } - - public SchoolTypeRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public SchoolTypeRequest matchingAnyOf(SchoolTypeRequest schoolType){ - super.internalMatchAny(schoolType); - return this; - } - - public SchoolTypeRequest matchingIdsOf(SchoolTypeRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - SchoolType.ID_PROPERTY, request, SchoolType.ID_PROPERTY)); - } - - public SchoolTypeRequest enhanceChildrenIfNeeded(){ - return this; - } - - public SchoolTypeRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public SchoolTypeRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public SchoolTypeRequest selectSelf(){ - super.selectSelf(); - return selectPlatformIdOnly().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); - } - - public SchoolTypeRequest selectSelfFields(){ - return selectSelf(); - } - - public SchoolTypeRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(SchoolType.PLATFORM_PROPERTY); - selectProperty(SchoolType.ID_PROPERTY); - selectProperty(SchoolType.NAME_PROPERTY); - selectProperty(SchoolType.CODE_PROPERTY); - selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); - selectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest selectAll(){ - super.selectAll(); - return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); - } - - public SchoolTypeRequest selectChildren(){ - super.selectAny(); - selectSchoolList(); - return selectPlatform().selectId().selectName().selectCode().selectDisplayOrder().selectVersion(); - } - - - public SchoolTypeRequest selectPlatformIdOnly(){ - selectProperty(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public SchoolTypeRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(SchoolType.PLATFORM_PROPERTY); - enhanceRelation(SchoolType.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, SchoolType.PLATFORM_PROPERTY)); - return this; - } - - public SchoolTypeRequest unselectPlatform(){ - unselectProperty(SchoolType.PLATFORM_PROPERTY); - return this; - } - public SchoolTypeRequest selectId(){ - selectProperty(SchoolType.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectId(){ - unselectProperty(SchoolType.ID_PROPERTY); - return this; - } - public SchoolTypeRequest selectName(){ - selectProperty(SchoolType.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectName(){ - unselectProperty(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest selectCode(){ - selectProperty(SchoolType.CODE_PROPERTY); - return this; - } - - /** - * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectCode(){ - unselectProperty(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest selectDisplayOrder(){ - selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - /** - * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. - * @param aggrFunction aggrFunction - */ - public SchoolTypeRequest selectDisplayOrder(AggrFunction aggrFunction){ - selectProperty(SchoolType.DISPLAY_ORDER_PROPERTY, aggrFunction); - return this; - } - - - public SchoolTypeRequest unselectDisplayOrder(){ - unselectProperty(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest selectVersion(){ - selectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public SchoolTypeRequest unselectVersion(){ - unselectProperty(SchoolType.VERSION_PROPERTY); - return this; - } - public SchoolTypeRequest selectSchoolList(){ - return selectSchoolListWith(Q.schools().selectSelf()); - } - - public SchoolTypeRequest selectSchoolListWith(SchoolRequest schoolList){ - enhanceRelation(SchoolType.SCHOOL_LIST_PROPERTY, schoolList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectSchoolListWith", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public SchoolTypeRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public SchoolTypeRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public SchoolTypeRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.PLATFORM_PROPERTY, operator, values); - } - - public SchoolTypeRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public SchoolTypeRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public SchoolTypeRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(SchoolType.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public SchoolTypeRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.ID_PROPERTY, operator, values); - } - - public SchoolTypeRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public SchoolTypeRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public SchoolTypeRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public SchoolTypeRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public SchoolTypeRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public SchoolTypeRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public SchoolTypeRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public SchoolTypeRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.NAME_PROPERTY, operator, values); - } - - public SchoolTypeRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public SchoolTypeRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public SchoolTypeRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public SchoolTypeRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public SchoolTypeRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public SchoolTypeRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public SchoolTypeRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public SchoolTypeRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public SchoolTypeRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public SchoolTypeRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public SchoolTypeRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public SchoolTypeRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public SchoolTypeRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public SchoolTypeRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public SchoolTypeRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public SchoolTypeRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public SchoolTypeRequest filterByCode(String... code){ - if (code == null || code.length == 0) { - throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); - } - return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); - } - - public SchoolTypeRequest withCode(Operator operator, Object... values){ - return appendSearchCriteria(createCodeCriteria(operator, values)); - } - - public SchoolTypeRequest withCodeIsUnknown(){ - return withCode(Operator.IS_NULL); - } - - public SchoolTypeRequest withCodeIsKnown(){ - return withCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.CODE_PROPERTY, operator, values); - } - - public SchoolTypeRequest withCodeIsNot(String code){ - return withCode(Operator.NOT_EQUAL, code); - } - - public SchoolTypeRequest withCodeIn(String... code){ - return withCode(Operator.IN, (Object[])code); - } - - public SchoolTypeRequest withCodeNotIn(String... code){ - return withCode(Operator.NOT_IN, (Object[])code); - } - public SchoolTypeRequest withCodeGreaterThan(String code){ - return withCode(Operator.GREATER_THAN, code); - } - - public SchoolTypeRequest withCodeGreaterThanOrEqualTo(String code){ - return withCode(Operator.GREATER_THAN_OR_EQUAL, code); - } - - public SchoolTypeRequest withCodeLessThan(String code){ - return withCode(Operator.LESS_THAN, code); - } - - public SchoolTypeRequest withCodeLessThanOrEqualTo(String code){ - return withCode(Operator.LESS_THAN_OR_EQUAL, code); - } - - public SchoolTypeRequest withCodeBetween(String startOfCode, String endOfCode){ - return withCode(Operator.BETWEEN, startOfCode, endOfCode); - } - public SchoolTypeRequest withCodeStartingWith(String code){ - return withCode(Operator.BEGIN_WITH, code); - } - public SchoolTypeRequest withCodeContaining(String code){ - return withCode(Operator.CONTAIN, code); - } - - public SchoolTypeRequest withCodeNotContaining(String code){ - return withCode(Operator.NOT_CONTAIN, code); - } - - public SchoolTypeRequest withCodeNotStartingWith(String code){ - return withCode(Operator.NOT_BEGIN_WITH, code); - } - - public SchoolTypeRequest withCodeEndingWith(String code){ - return withCode(Operator.END_WITH, code); - } - - public SchoolTypeRequest withCodeNotEndingWith(String code){ - return withCode(Operator.NOT_END_WITH, code); - } - - public SchoolTypeRequest withCodeIs(String code){ - return withCode(Operator.EQUAL, code); - } - - public SchoolTypeRequest withCodeSoundingLike(String code){ - return withCode(Operator.SOUNDS_LIKE, code); - } - - - - public SchoolTypeRequest filterByDisplayOrder(BigDecimal... displayOrder){ - if (displayOrder == null || displayOrder.length == 0) { - throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); - } - return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); - } - - public SchoolTypeRequest withDisplayOrder(Operator operator, Object... values){ - return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); - } - - public SchoolTypeRequest withDisplayOrderIsUnknown(){ - return withDisplayOrder(Operator.IS_NULL); - } - - public SchoolTypeRequest withDisplayOrderIsKnown(){ - return withDisplayOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.DISPLAY_ORDER_PROPERTY, operator, values); - } - - public SchoolTypeRequest withDisplayOrderIs(BigDecimal displayOrder){ - return withDisplayOrder(Operator.EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderIsNot(BigDecimal displayOrder){ - return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.IN, (Object[])displayOrder); - } - - public SchoolTypeRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); - } - public SchoolTypeRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderLessThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); - } - - public SchoolTypeRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ - return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); - } - - - - public SchoolTypeRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public SchoolTypeRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public SchoolTypeRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public SchoolTypeRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(SchoolType.VERSION_PROPERTY, operator, values); - } - - public SchoolTypeRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public SchoolTypeRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public SchoolTypeRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public SchoolTypeRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public SchoolTypeRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public SchoolTypeRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public SchoolTypeRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public SchoolTypeRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public SchoolTypeRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public SchoolTypeRequest withSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY)); - } - - public SchoolTypeRequest withoutSchoolListMatching(SchoolRequest schoolRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(SchoolType.ID_PROPERTY, schoolRequest, School.SCHOOL_TYPE_PROPERTY))); - } - - public SchoolTypeRequest haveSchools(){ - return withSchoolListMatching(Q.schools().unlimited()); - } - - public SchoolTypeRequest haveNoSchools(){ - return withoutSchoolListMatching(Q.schools().unlimited()); - } - - public SchoolTypeRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public SchoolTypeRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public SchoolTypeRequest minDisplayOrder(){ - return minDisplayOrderAs(prefix("minOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest minDisplayOrderAs(String retName){ - super.min(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest maxDisplayOrder(){ - return maxDisplayOrderAs(prefix("maxOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest maxDisplayOrderAs(String retName){ - super.max(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest sumDisplayOrder(){ - return sumDisplayOrderAs(prefix("sumOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest sumDisplayOrderAs(String retName){ - super.sum(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest avgDisplayOrder(){ - return avgDisplayOrderAs(prefix("avgOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest avgDisplayOrderAs(String retName){ - super.avg(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest standardDeviationDisplayOrder(){ - return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest standardDeviationDisplayOrderAs(String retName){ - super.standardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ - return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest sampleVarianceDisplayOrder(){ - return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest sampleVarianceDisplayOrderAs(String retName){ - super.sampleVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest samplePopulationVarianceDisplayOrder(){ - return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",SchoolType.DISPLAY_ORDER_PROPERTY)); - } - - public SchoolTypeRequest samplePopulationVarianceDisplayOrderAs(String retName){ - super.samplePopulationVariance(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public SchoolTypeRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(SchoolType.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - - - public SchoolTypeRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public SchoolTypeRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, SchoolType.PLATFORM_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public SchoolTypeRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, SchoolType.ID_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public SchoolTypeRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctCode(){ - return countDistinctCodeAs("code_distinct_count"); - } - - public SchoolTypeRequest countDistinctCodeAs(String alias){ - super.countDistinctProperty(alias, SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctDisplayOrder(){ - return countDistinctDisplayOrderAs("display_order_distinct_count"); - } - - public SchoolTypeRequest countDistinctDisplayOrderAs(String alias){ - super.countDistinctProperty(alias, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - public SchoolTypeRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public SchoolTypeRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, SchoolType.VERSION_PROPERTY); - return this; - } - public SchoolTypeRequest groupBySchoolsWithDetails(SchoolRequest subRequest){ - aggregate(SchoolType.SCHOOL_LIST_PROPERTY, subRequest); - return this; - } - - public SchoolTypeRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(SchoolType.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public SchoolTypeRequest groupByPlatform(){ - groupBy(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByPlatformAs(String retName){ - groupBy(retName, SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.PLATFORM_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupById(){ - groupBy(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByIdAs(String retName){ - groupBy(retName, SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.ID_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByName(){ - groupBy(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByNameAs(String retName){ - groupBy(retName, SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.NAME_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByCode(){ - groupBy(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByCodeAs(String retName){ - groupBy(retName, SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.CODE_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByDisplayOrder(){ - groupBy(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByDisplayOrderAs(String retName){ - groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.DISPLAY_ORDER_PROPERTY, function); - return this; - } - - public SchoolTypeRequest groupByVersion(){ - groupBy(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByVersionAs(String retName){ - groupBy(retName, SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, SchoolType.VERSION_PROPERTY, function); - return this; - } - - - - public SchoolTypeRequest orderByPlatformAscending(){ - addOrderByAscending(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByPlatformDescending(){ - addOrderByDescending(SchoolType.PLATFORM_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByIdAscending(){ - addOrderByAscending(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByIdDescending(){ - addOrderByDescending(SchoolType.ID_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameAscending(){ - addOrderByAscending(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameDescending(){ - addOrderByDescending(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolType.NAME_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolType.NAME_PROPERTY); - return this; - } - public SchoolTypeRequest orderByCodeAscending(){ - addOrderByAscending(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByCodeDescending(){ - addOrderByDescending(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest orderByCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(SchoolType.CODE_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(SchoolType.CODE_PROPERTY); - return this; - } - public SchoolTypeRequest orderByDisplayOrderAscending(){ - addOrderByAscending(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByDisplayOrderDescending(){ - addOrderByDescending(SchoolType.DISPLAY_ORDER_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByVersionAscending(){ - addOrderByAscending(SchoolType.VERSION_PROPERTY); - return this; - } - - public SchoolTypeRequest orderByVersionDescending(){ - addOrderByDescending(SchoolType.VERSION_PROPERTY); - return this; - } - - - public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest){ - return statsFromSchoolsAs(name, subRequest, false); - } - - public SchoolTypeRequest statsFromSchoolsAs(String name, SchoolRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest statsFromSchools(SchoolRequest subRequest){ - return statsFromSchoolsAs(REFINEMENTS, subRequest); - } - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - - public SchoolTypeRequest countSchools(){ - addRelationCount("Count", Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest countSchoolsAs(String name){ - addRelationCount(name, Q.schools().unlimited(), School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest countSchoolsWith(String name, SchoolRequest subRequest){ - addRelationCount(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countSchoolsWith", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest minStudentCapacityOfSchools(){ - addRelationScalarAggregate("minStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name){ - return minStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest minStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest maxStudentCapacityOfSchools(){ - addRelationScalarAggregate("maxStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name){ - return maxStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest maxStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest sumStudentCapacityOfSchools(){ - addRelationScalarAggregate("sumStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name){ - return sumStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest sumStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest avgStudentCapacityOfSchools(){ - addRelationScalarAggregate("avgStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name){ - return avgStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest avgStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest standardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name){ - return standardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest standardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchools(){ - addRelationScalarAggregate("stdDevPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name){ - return squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varSampStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name){ - return sampleVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest sampleVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchools(){ - addRelationScalarAggregate("varPopStudentCapacityOfSchools", Q.schools().unlimited(), - School.SCHOOL_TYPE_PROPERTY, School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchools", null, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name){ - return samplePopulationVarianceStudentCapacityOfSchoolsAs(name, Q.schools().unlimited()); - } - - public SchoolTypeRequest samplePopulationVarianceStudentCapacityOfSchoolsAs(String name, SchoolRequest subRequest){ - addRelationScalarAggregate(name, subRequest, School.SCHOOL_TYPE_PROPERTY, - School.STUDENT_CAPACITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceStudentCapacityOfSchoolsAs", name, SchoolType.SCHOOL_LIST_PROPERTY)); - return this; - } - - public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public SchoolTypeRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, SchoolType.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, SchoolType.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public SchoolTypeRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public SchoolTypeRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public SchoolTypeRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public SchoolTypeRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public SchoolTypeRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public SchoolTypeRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 29fd0dd7c..000000000 --- a/examples/shared-load-state/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.schoolmanagementservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/shared-load-state/showcase.json b/examples/shared-load-state/showcase.json index 35d129453..5c48925b6 100644 --- a/examples/shared-load-state/showcase.json +++ b/examples/shared-load-state/showcase.json @@ -43,6 +43,7 @@ ], "generatedFilesManifestSHA256": "d775132150c44c4ad87a568c69c62c71d9d4a8454e80977b020c9a9c1c761b4f", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/standard-order/AGENTS.md b/examples/standard-order/AGENTS.md index 150d444e9..8d3932d5a 100644 --- a/examples/standard-order/AGENTS.md +++ b/examples/standard-order/AGENTS.md @@ -1,7 +1,7 @@ # Java Standard Order Example Rules -Implement only application-owned code. The files under `java-lib-core` and `java-app-console/lib` are -read-only. Discover generated APIs using progressive model-aware Assist with +Implement only application-owned code. The workspace uses the sibling `java-lib-core/lib` Maven +module as its read-only generated domain library. Discover generated APIs using progressive model-aware Assist with `models/model.xml`; never read generated source to discover methods. ```bash diff --git a/examples/standard-order/java-app-console/lib/pom.xml b/examples/standard-order/java-app-console/lib/pom.xml deleted file mode 100644 index 066245b26..000000000 --- a/examples/standard-order/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.example - request-tree-order-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Constants.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Constants.java deleted file mode 100644 index bdd12b2ef..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Constants.java +++ /dev/null @@ -1,14 +0,0 @@ - -package com.example.requesttreeorderservice; - -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.platform.Platform; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); - public static final long ORDER_STATUS_NEW_ID = 1001l ; - public static final OrderStatus ORDER_STATUS_NEW = OrderStatus.refer(ORDER_STATUS_NEW_ID);public static final long ORDER_STATUS_PAID_ID = 1002l ; - public static final OrderStatus ORDER_STATUS_PAID = OrderStatus.refer(ORDER_STATUS_PAID_ID);public static final long ORDER_STATUS_CANCELLED_ID = 1003l ; - public static final OrderStatus ORDER_STATUS_CANCELLED = OrderStatus.refer(ORDER_STATUS_CANCELLED_ID); -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/E.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/E.java deleted file mode 100644 index b7f4b2984..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/E.java +++ /dev/null @@ -1,33 +0,0 @@ - -package com.example.requesttreeorderservice; - -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerExpression; -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderExpression; -import com.example.requesttreeorderservice.orderitem.OrderItem; -import com.example.requesttreeorderservice.orderitem.OrderItemExpression; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusExpression; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static OrderStatusExpression orderStatus(OrderStatus orderStatus){ - return new OrderStatusExpression(new ValueExpression(orderStatus, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderStatus()")); - } - public static CustomerExpression customer(Customer customer){ - return new CustomerExpression(new ValueExpression(customer, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customer()")); - } - public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); - } - public static OrderItemExpression orderItem(OrderItem orderItem){ - return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java deleted file mode 100644 index f263ba221..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/EntityMetaRegistry.java +++ /dev/null @@ -1,907 +0,0 @@ - -package com.example.requesttreeorderservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; -import java.math.BigDecimal; -import java.time.LocalDate; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerOrderStatus(); - registerCustomer(); - registerCustomerOrder(); - registerOrderItem(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.example.requesttreeorderservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.requesttreeorderservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.requesttreeorderservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.platform.Platform::new); - entityDescriptor.with("name", "Commerce Platform") - - .with("module", "Commerce") - - .with("module_key", "commerce") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Commerce Test Platform") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderStatus() { - FieldLayout.installGenerated(com.example.requesttreeorderservice.orderstatus.OrderStatus.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.requesttreeorderservice.orderstatus.OrderStatus.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.requesttreeorderservice.orderstatus.OrderStatus.class); - entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.orderstatus.OrderStatus::new); - entityDescriptor.with("name", "Order Status") - - .with("module", "Commerce") - - .with("module_key", "commerce") - - .with("constant", "true") - - .with("identifier", "code") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY, com.example.requesttreeorderservice.platform.Platform.INTERNAL_TYPE, com.example.requesttreeorderservice.platform.Platform.ORDER_STATUS_LIST_PROPERTY, com.example.requesttreeorderservice.platform.Platform.class) - ; - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY, String.class) - ; - PropertyDescriptor code = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY, String.class) - ; - PropertyDescriptor color = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY, String.class) - ; - PropertyDescriptor displayOrder = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.PLATFORM_PROPERTY).with("candidates", "platform()") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("candidates", "1001,1002,1003") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "New,Paid,Cancelled") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.CODE_PROPERTY).with("identifier", "true") - - .with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "NEW,PAID,CANCELLED") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.COLOR_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "#94A3B8,#22C55E,#EF4444") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.DISPLAY_ORDER_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("candidates", "1,2,3") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderstatus.OrderStatus.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomer() { - FieldLayout.installGenerated(com.example.requesttreeorderservice.customer.Customer.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.requesttreeorderservice.customer.Customer.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.requesttreeorderservice.customer.Customer.class); - entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.customer.Customer::new); - entityDescriptor.with("name", "Customer") - - .with("module", "Commerce") - - .with("module_key", "commerce") - - .with("audit_mask_fields", "name") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.customer.Customer.PLATFORM_PROPERTY, com.example.requesttreeorderservice.platform.Platform.INTERNAL_TYPE, com.example.requesttreeorderservice.platform.Platform.CUSTOMER_LIST_PROPERTY, com.example.requesttreeorderservice.platform.Platform.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customer.Customer.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomerOrder() { - FieldLayout.installGenerated(com.example.requesttreeorderservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.requesttreeorderservice.customerorder.CustomerOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.requesttreeorderservice.customerorder.CustomerOrder.class); - entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.customerorder.CustomerOrder::new); - entityDescriptor.with("name", "Customer Order") - - .with("module", "Commerce") - - .with("module_key", "commerce") - - .with("audit_mask_fields", "order_number") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customer = - entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY, com.example.requesttreeorderservice.customer.Customer.INTERNAL_TYPE, com.example.requesttreeorderservice.customer.Customer.CUSTOMER_ORDER_LIST_PROPERTY, com.example.requesttreeorderservice.customer.Customer.class) - ; - PropertyDescriptor status = - entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.customerorder.CustomerOrder.STATUS_PROPERTY, com.example.requesttreeorderservice.orderstatus.OrderStatus.INTERNAL_TYPE, com.example.requesttreeorderservice.orderstatus.OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, com.example.requesttreeorderservice.orderstatus.OrderStatus.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor orderDate = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY, LocalDate.class) - ; - PropertyDescriptor totalAmount = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.CUSTOMER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.STATUS_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_DATE_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("javaType", "java.time.LocalDate") - - .with("sqlType", "DATE") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isDate", "true") - - .with("isString", "false") - - .with("graphqlType", "Date") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.TOTAL_AMOUNT_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderItem() { - FieldLayout.installGenerated(com.example.requesttreeorderservice.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.example.requesttreeorderservice.orderitem.OrderItem.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.example.requesttreeorderservice.orderitem.OrderItem.class); - entityDescriptor.setEntitySupplier(com.example.requesttreeorderservice.orderitem.OrderItem::new); - entityDescriptor.with("name", "Order Item") - - .with("module", "Commerce") - - .with("module_key", "commerce") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customerOrder = - entityDescriptor.addObjectProperty($factory, com.example.requesttreeorderservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY, com.example.requesttreeorderservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.example.requesttreeorderservice.customerorder.CustomerOrder.ORDER_ITEM_LIST_PROPERTY, com.example.requesttreeorderservice.customerorder.CustomerOrder.class) - ; - PropertyDescriptor productName = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY, String.class) - ; - PropertyDescriptor quantity = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY, Integer.class) - ; - PropertyDescriptor unitPrice = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY, BigDecimal.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.PRODUCT_NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.QUANTITY_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.lang.Integer") - - .with("sqlType", "INTEGER") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isInt", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "Int") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.UNIT_PRICE_PROPERTY).with("isPassword", "false") - - .with("db2_sqlType", "decimal(19,7)") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(19,7)") - - .with("javaType", "java.math.BigDecimal") - - .with("sqlType", "NUMERIC(19,7)") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "true") - - .with("isString", "false") - - .with("isDate", "false") - - .with("graphqlType", "BigDecimal") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.example.requesttreeorderservice.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java deleted file mode 100644 index 50e4a262d..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.example.requesttreeorderservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.example.requesttreeorderservice.platform.PlatformChecker(), new com.example.requesttreeorderservice.orderstatus.OrderStatusChecker(), new com.example.requesttreeorderservice.customer.CustomerChecker(), new com.example.requesttreeorderservice.customerorder.CustomerOrderChecker(), new com.example.requesttreeorderservice.orderitem.OrderItemChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:dd69b1927859f89b828bf1e7fb802e68157655ac0eca216e5aee11f0e8667aa8\",\"entities\":{\"Customer\":{\"labels\":{\"en\":\"Customer\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Commerce Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"customer\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"Customer\"},\"aliases\":[\"Customer\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_date\",\"labels\":{\"en\":\"order date\"},\"aliases\":[\"OrderDate\",\"orderDate\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"Order Item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"status\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"Order Status\"},\"aliases\":[\"Status\"]},{\"name\":\"total_amount\",\"labels\":{\"en\":\"total amount\"},\"aliases\":[\"TotalAmount\",\"totalAmount\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"Order Item\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"product_name\",\"labels\":{\"en\":\"product name\"},\"aliases\":[\"ProductName\",\"productName\"]},{\"name\":\"quantity\",\"labels\":{\"en\":\"quantity\"},\"aliases\":[\"Quantity\"]},{\"name\":\"unit_price\",\"labels\":{\"en\":\"unit price\"},\"aliases\":[\"UnitPrice\",\"unitPrice\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderStatus\":{\"labels\":{\"en\":\"Order Status\"},\"fields\":[{\"name\":\"code\",\"labels\":{\"en\":\"code\"},\"aliases\":[\"Code\"]},{\"name\":\"color\",\"labels\":{\"en\":\"color\"},\"aliases\":[\"Color\"]},{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"display_order\",\"labels\":{\"en\":\"display order\"},\"aliases\":[\"DisplayOrder\",\"displayOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Commerce Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Commerce Platform\"},\"fields\":[{\"name\":\"customer_list\",\"targetType\":\"Customer\",\"labels\":{\"en\":\"Customer\"},\"aliases\":[\"CustomerList\",\"customerList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"order_status_list\",\"targetType\":\"OrderStatus\",\"labels\":{\"en\":\"Order Status\"},\"aliases\":[\"OrderStatusList\",\"orderStatusList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderStatus", java.util.Map.ofEntries(java.util.Map.entry("platform", "platform"), java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("code", "code"), java.util.Map.entry("color", "color"), java.util.Map.entry("display_order", "displayOrder"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Customer", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer", "customer"), java.util.Map.entry("status", "status"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("order_date", "orderDate"), java.util.Map.entry("total_amount", "totalAmount"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("product_name", "productName"), java.util.Map.entry("quantity", "quantity"), java.util.Map.entry("unit_price", "unitPrice"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.example.requesttreeorderservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.example.requesttreeorderservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Commerce Test Platform"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - var constantOrderStatus1001Rows = Q.orderStatuses().withIdIs(1001L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantOrderStatus1001Rows.isEmpty()) { - com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1001 = new com.example.requesttreeorderservice.orderstatus.OrderStatus(); - constantOrderStatus1001 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1001, 1001L); - constantOrderStatus1001.updatePlatform(domainRoot); - constantOrderStatus1001.updateName("New"); - constantOrderStatus1001.updateCode("NEW"); - constantOrderStatus1001.updateColor("#94A3B8"); - constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); - constantOrderStatus1001.auditAs("create model constant OrderStatus(1001)").save(context); - } else { - com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1001 = constantOrderStatus1001Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantOrderStatus1001.getPlatform().getId(), domainRoot.getId()))) { constantOrderStatus1001.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1001.getName(), "New"))) { constantOrderStatus1001.updateName("New"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1001.getCode(), "NEW"))) { constantOrderStatus1001.updateCode("NEW"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1001.getColor(), "#94A3B8"))) { constantOrderStatus1001.updateColor("#94A3B8"); changed = true; } - if (!((constantOrderStatus1001.getDisplayOrder() != null && constantOrderStatus1001.getDisplayOrder().compareTo(new java.math.BigDecimal("1")) == 0))) { constantOrderStatus1001.updateDisplayOrder(new java.math.BigDecimal("1")); changed = true; } - if (changed) constantOrderStatus1001.auditAs("reconcile model constant OrderStatus(1001)").save(context); - } - var constantOrderStatus1002Rows = Q.orderStatuses().withIdIs(1002L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantOrderStatus1002Rows.isEmpty()) { - com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1002 = new com.example.requesttreeorderservice.orderstatus.OrderStatus(); - constantOrderStatus1002 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1002, 1002L); - constantOrderStatus1002.updatePlatform(domainRoot); - constantOrderStatus1002.updateName("Paid"); - constantOrderStatus1002.updateCode("PAID"); - constantOrderStatus1002.updateColor("#22C55E"); - constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); - constantOrderStatus1002.auditAs("create model constant OrderStatus(1002)").save(context); - } else { - com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1002 = constantOrderStatus1002Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantOrderStatus1002.getPlatform().getId(), domainRoot.getId()))) { constantOrderStatus1002.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1002.getName(), "Paid"))) { constantOrderStatus1002.updateName("Paid"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1002.getCode(), "PAID"))) { constantOrderStatus1002.updateCode("PAID"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1002.getColor(), "#22C55E"))) { constantOrderStatus1002.updateColor("#22C55E"); changed = true; } - if (!((constantOrderStatus1002.getDisplayOrder() != null && constantOrderStatus1002.getDisplayOrder().compareTo(new java.math.BigDecimal("2")) == 0))) { constantOrderStatus1002.updateDisplayOrder(new java.math.BigDecimal("2")); changed = true; } - if (changed) constantOrderStatus1002.auditAs("reconcile model constant OrderStatus(1002)").save(context); - } - var constantOrderStatus1003Rows = Q.orderStatuses().withIdIs(1003L).comment("what: locate generated constant").purpose("why: idempotent runtime bootstrap").executeForList(context); - if (constantOrderStatus1003Rows.isEmpty()) { - com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1003 = new com.example.requesttreeorderservice.orderstatus.OrderStatus(); - constantOrderStatus1003 = io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, constantOrderStatus1003, 1003L); - constantOrderStatus1003.updatePlatform(domainRoot); - constantOrderStatus1003.updateName("Cancelled"); - constantOrderStatus1003.updateCode("CANCELLED"); - constantOrderStatus1003.updateColor("#EF4444"); - constantOrderStatus1003.updateDisplayOrder(new java.math.BigDecimal("3")); - constantOrderStatus1003.auditAs("create model constant OrderStatus(1003)").save(context); - } else { - com.example.requesttreeorderservice.orderstatus.OrderStatus constantOrderStatus1003 = constantOrderStatus1003Rows.get(0); - boolean changed = false; - if (!(java.util.Objects.equals(constantOrderStatus1003.getPlatform().getId(), domainRoot.getId()))) { constantOrderStatus1003.updatePlatform(domainRoot); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1003.getName(), "Cancelled"))) { constantOrderStatus1003.updateName("Cancelled"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1003.getCode(), "CANCELLED"))) { constantOrderStatus1003.updateCode("CANCELLED"); changed = true; } - if (!(java.util.Objects.equals(constantOrderStatus1003.getColor(), "#EF4444"))) { constantOrderStatus1003.updateColor("#EF4444"); changed = true; } - if (!((constantOrderStatus1003.getDisplayOrder() != null && constantOrderStatus1003.getDisplayOrder().compareTo(new java.math.BigDecimal("3")) == 0))) { constantOrderStatus1003.updateDisplayOrder(new java.math.BigDecimal("3")); changed = true; } - if (changed) constantOrderStatus1003.auditAs("reconcile model constant OrderStatus(1003)").save(context); - } - } -} diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Q.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Q.java deleted file mode 100644 index d170581a1..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Q.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.example.requesttreeorderservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.example.requesttreeorderservice.platform.PlatformRequest platforms(){ - return new com.example.requesttreeorderservice.platform.PlatformRequest(com.example.requesttreeorderservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.requesttreeorderservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.example.requesttreeorderservice.platform.PlatformRequest(com.example.requesttreeorderservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.requesttreeorderservice.orderstatus.OrderStatusRequest orderStatuses(){ - return new com.example.requesttreeorderservice.orderstatus.OrderStatusRequest(com.example.requesttreeorderservice.orderstatus.OrderStatus.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.requesttreeorderservice.orderstatus.OrderStatusRequest orderStatusesWithMinimalFields(){ - return new com.example.requesttreeorderservice.orderstatus.OrderStatusRequest(com.example.requesttreeorderservice.orderstatus.OrderStatus.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.requesttreeorderservice.customer.CustomerRequest customers(){ - return new com.example.requesttreeorderservice.customer.CustomerRequest(com.example.requesttreeorderservice.customer.Customer.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.requesttreeorderservice.customer.CustomerRequest customersWithMinimalFields(){ - return new com.example.requesttreeorderservice.customer.CustomerRequest(com.example.requesttreeorderservice.customer.Customer.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.requesttreeorderservice.customerorder.CustomerOrderRequest customerOrders(){ - return new com.example.requesttreeorderservice.customerorder.CustomerOrderRequest(com.example.requesttreeorderservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.requesttreeorderservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ - return new com.example.requesttreeorderservice.customerorder.CustomerOrderRequest(com.example.requesttreeorderservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.example.requesttreeorderservice.orderitem.OrderItemRequest orderItems(){ - return new com.example.requesttreeorderservice.orderitem.OrderItemRequest(com.example.requesttreeorderservice.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.example.requesttreeorderservice.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ - return new com.example.requesttreeorderservice.orderitem.OrderItemRequest(com.example.requesttreeorderservice.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java deleted file mode 100644 index 673d21a57..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/RequestTreeOrderServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.example.requesttreeorderservice; - -import io.teaql.core.UserContext; -public interface RequestTreeOrderServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java deleted file mode 100644 index 4499d623c..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/Customer.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.example.requesttreeorderservice.customer; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Customer extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Customer"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "52190974dcef386c9676cd86cd564677c6cb5bb058e7e13bfea8b26db14f86a2"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("name", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Customer.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String NAME_PROPERTY = "name"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private Platform platform; - - private String name; - - private SmartList customerOrderList; - - public Platform getPlatform(){ - return this.platform; - } - - public String getName(){ - return this.name; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public Customer updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public Customer updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Customer addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateCustomer(this); - return this; - } - - public static Customer refer(Long id){ - Customer refer = new Customer(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Customer comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java deleted file mode 100644 index 81246067f..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerChecker.java +++ /dev/null @@ -1,65 +0,0 @@ - -package com.example.requesttreeorderservice.customer; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderChecker; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CustomerChecker implements Checker{ - - public String type(){ - return Customer.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Customer customer, ObjectLocation _parentLocation){ - if(needCheck(_context, customer)){ - markAsChecked(_context, customer); - doCheck(_context, customer, _parentLocation); - } - } - - public void doCheck(UserContext _context, Customer customer, ObjectLocation _parentLocation){ - if((customer == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customer); - if(customer.needPersist()){ - } - if(customer.newItem()){ - }else if(customer.updateItem()){ - if(!customer.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!customer.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, customer.getProperty(Customer.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkName(_context, customer.getProperty(Customer.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; customer.getCustomerOrderList() != null && i < customer.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = customer.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java deleted file mode 100644 index c0e0888d4..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.example.requesttreeorderservice.customer; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderListExpression; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CustomerExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerExpression(Expression expression){ - super(expression); - } - - public CustomerExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerExpression updateId(Long id){ - return new CustomerExpression(this, $it -> {((Customer)$it).__internalSet("id", id); return this;}); - } - - public CustomerExpression save(UserContext userContext){ - return new CustomerExpression(this, $it -> ((Customer)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerExpression save(String intent, UserContext userContext){ - return new CustomerExpression(this, $it -> ((Customer)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", Customer::getPlatform)); - } - - public CustomerExpression updatePlatform(Platform platform){ - return new CustomerExpression(this, $it -> ((Customer)$it).updatePlatform(platform)); - } - - public Expression getName(){ - return loaded("name", "getName", Customer::getName); - } - public CustomerExpression updateName(String name){ - return new CustomerExpression(this, $it -> ((Customer)$it).updateName(name)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Customer::getCustomerOrderList)); - } - public CustomerExpression addCustomerOrder(CustomerOrder customerOrder){ - return new CustomerExpression(this, $it -> ((Customer)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java deleted file mode 100644 index 7c856e198..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.requesttreeorderservice.customer; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerListExpression extends SmartListExpression { - public CustomerListExpression(Expression> expression){ - super(expression); - } - - public CustomerListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerExpression first() { - return new CustomerExpression(super.first()); - } - - public CustomerExpression get(int index) { - return new CustomerExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java deleted file mode 100644 index b6752cacc..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customer/CustomerRequest.java +++ /dev/null @@ -1,902 +0,0 @@ - -package com.example.requesttreeorderservice.customer; - -import com.example.requesttreeorderservice.Q; -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderRequest; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CustomerRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerRequest(Class returnType){ - this(returnType, () -> (T) new Customer()); - } - - protected CustomerRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerRequest copy(){ - return (CustomerRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerRequest matchingAnyOf(CustomerRequest customer){ - super.internalMatchAny(customer); - return this; - } - - public CustomerRequest matchingIdsOf(CustomerRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Customer.ID_PROPERTY, request, Customer.ID_PROPERTY)); - } - - public CustomerRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectName().selectVersion(); - } - - public CustomerRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Customer.ID_PROPERTY); - selectProperty(Customer.PLATFORM_PROPERTY); - selectProperty(Customer.NAME_PROPERTY); - selectProperty(Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectName().selectVersion(); - } - - public CustomerRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectId().selectPlatform().selectName().selectVersion(); - } - - - public CustomerRequest selectId(){ - selectProperty(Customer.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectId(){ - unselectProperty(Customer.ID_PROPERTY); - return this; - } - public CustomerRequest selectPlatformIdOnly(){ - selectProperty(Customer.PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public CustomerRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(Customer.PLATFORM_PROPERTY); - enhanceRelation(Customer.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, Customer.PLATFORM_PROPERTY)); - return this; - } - - public CustomerRequest unselectPlatform(){ - unselectProperty(Customer.PLATFORM_PROPERTY); - return this; - } - public CustomerRequest selectName(){ - selectProperty(Customer.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectName(){ - unselectProperty(Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest selectVersion(){ - selectProperty(Customer.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerRequest unselectVersion(){ - unselectProperty(Customer.VERSION_PROPERTY); - return this; - } - public CustomerRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public CustomerRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(Customer.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.ID_PROPERTY, operator, values); - } - - public CustomerRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public CustomerRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public CustomerRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public CustomerRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.PLATFORM_PROPERTY, operator, values); - } - - public CustomerRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public CustomerRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(Customer.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public CustomerRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Customer.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public CustomerRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public CustomerRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public CustomerRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public CustomerRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.NAME_PROPERTY, operator, values); - } - - public CustomerRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public CustomerRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public CustomerRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public CustomerRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public CustomerRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public CustomerRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public CustomerRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public CustomerRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public CustomerRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public CustomerRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public CustomerRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public CustomerRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public CustomerRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public CustomerRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public CustomerRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public CustomerRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public CustomerRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Customer.VERSION_PROPERTY, operator, values); - } - - public CustomerRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY)); - } - - public CustomerRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Customer.ID_PROPERTY, customerOrderRequest, CustomerOrder.CUSTOMER_PROPERTY))); - } - - public CustomerRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CustomerRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public CustomerRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public CustomerRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(Customer.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - public CustomerRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Customer.ID_PROPERTY); - return this; - } - public CustomerRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public CustomerRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, Customer.PLATFORM_PROPERTY); - return this; - } - public CustomerRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public CustomerRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Customer.VERSION_PROPERTY); - return this; - } - public CustomerRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(Customer.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerRequest groupById(){ - groupBy(Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest groupByIdAs(String retName){ - groupBy(retName, Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.ID_PROPERTY, function); - return this; - } - public CustomerRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(Customer.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public CustomerRequest groupByPlatform(){ - groupBy(Customer.PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest groupByPlatformAs(String retName){ - groupBy(retName, Customer.PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.PLATFORM_PROPERTY, function); - return this; - } - - public CustomerRequest groupByName(){ - groupBy(Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest groupByNameAs(String retName){ - groupBy(retName, Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.NAME_PROPERTY, function); - return this; - } - - public CustomerRequest groupByVersion(){ - groupBy(Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest groupByVersionAs(String retName){ - groupBy(retName, Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Customer.VERSION_PROPERTY, function); - return this; - } - - - - public CustomerRequest orderByIdAscending(){ - addOrderByAscending(Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest orderByIdDescending(){ - addOrderByDescending(Customer.ID_PROPERTY); - return this; - } - - public CustomerRequest orderByPlatformAscending(){ - addOrderByAscending(Customer.PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest orderByPlatformDescending(){ - addOrderByDescending(Customer.PLATFORM_PROPERTY); - return this; - } - - public CustomerRequest orderByNameAscending(){ - addOrderByAscending(Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest orderByNameDescending(){ - addOrderByDescending(Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Customer.NAME_PROPERTY); - return this; - } - - public CustomerRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Customer.NAME_PROPERTY); - return this; - } - public CustomerRequest orderByVersionAscending(){ - addOrderByAscending(Customer.VERSION_PROPERTY); - return this; - } - - public CustomerRequest orderByVersionDescending(){ - addOrderByDescending(Customer.VERSION_PROPERTY); - return this; - } - - - public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public CustomerRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - public CustomerRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.CUSTOMER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest minTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name){ - return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest maxTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name){ - return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest sumTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name){ - return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest avgTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name){ - return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest standardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest sampleVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ - return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.CUSTOMER_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public CustomerRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.CUSTOMER_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, Customer.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public CustomerRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public CustomerRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, Customer.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, Customer.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java deleted file mode 100644 index 686cdce0a..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrder.java +++ /dev/null @@ -1,236 +0,0 @@ - -package com.example.requesttreeorderservice.customerorder; - -import com.example.requesttreeorderservice.Constants; -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.orderitem.OrderItem; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CustomerOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CustomerOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "835b87e26813b0d288c20fbcd3ab52649d0d32277d4f1740fac610ad0b9432bb"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer", 1), java.util.Map.entry("status", 2), java.util.Map.entry("order_number", 3), java.util.Map.entry("order_date", 4), java.util.Map.entry("total_amount", 5), java.util.Map.entry("version", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer", java.util.List.of("customer", "customer")), java.util.Map.entry("status", java.util.List.of("status", "status")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("order_date", java.util.List.of("orderDate", "order_date")), java.util.Map.entry("total_amount", java.util.List.of("totalAmount", "total_amount")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_item_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_PROPERTY = "customer"; - public static final String STATUS_PROPERTY = "status"; - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - public static final String ORDER_DATE_PROPERTY = "order_date"; - public static final String TOTAL_AMOUNT_PROPERTY = "total_amount"; - public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; - private Customer customer; - - private OrderStatus status; - - private String orderNumber; - - private LocalDate orderDate; - - private BigDecimal totalAmount; - - private SmartList orderItemList; - - public Customer getCustomer(){ - return this.customer; - } - - public OrderStatus getStatus(){ - return this.status; - } - - public String getOrderNumber(){ - return this.orderNumber; - } - - public LocalDate getOrderDate(){ - return this.orderDate; - } - - public BigDecimal getTotalAmount(){ - return this.totalAmount; - } - - public SmartList getOrderItemList(){ - return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; - } - public CustomerOrder updateCustomer(Customer customer){ - if(isPropertyLoaded(CUSTOMER_PROPERTY) && Objects.equals(this.customer, customer)){ - return this; - } - handleUpdate(CUSTOMER_PROPERTY, getCustomer(), customer); - this.customer = customer; - return this; - } - - protected CustomerOrder updateStatus(OrderStatus status){ - if(isPropertyLoaded(STATUS_PROPERTY) && Objects.equals(this.status, status)){ - return this; - } - handleUpdate(STATUS_PROPERTY, getStatus(), status); - this.status = status; - return this; - } - - public CustomerOrder updateOrderNumber(String orderNumber){ - orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); - this.orderNumber = orderNumber; - return this; - } - - public CustomerOrder updateOrderDate(LocalDate orderDate){ - if(isPropertyLoaded(ORDER_DATE_PROPERTY) && Objects.equals(this.orderDate, orderDate)){ - return this; - } - handleUpdate(ORDER_DATE_PROPERTY, getOrderDate(), orderDate); - this.orderDate = orderDate; - return this; - } - - public CustomerOrder updateTotalAmount(BigDecimal totalAmount){ - if(isPropertyLoaded(TOTAL_AMOUNT_PROPERTY) && Objects.equals(this.totalAmount, totalAmount)){ - return this; - } - handleUpdate(TOTAL_AMOUNT_PROPERTY, getTotalAmount(), totalAmount); - this.totalAmount = totalAmount; - return this; - } - - public CustomerOrder addOrderItem(OrderItem orderItem){ - if (orderItem == null){ - return this; - } - - if(null == this.orderItemList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderItemList = teaqlUnloadedItems.map(value -> value); - } - - this.orderItemList.add(orderItem); - orderItem.updateCustomerOrder(this); - return this; - } - public boolean isStatusNew(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_NEW); - } - - public CustomerOrder updateStatusToNew(){ - return updateStatus(Constants.ORDER_STATUS_NEW); - } - public boolean isStatusPaid(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_PAID); - } - - public CustomerOrder updateStatusToPaid(){ - return updateStatus(Constants.ORDER_STATUS_PAID); - } - public boolean isStatusCancelled(){ - return Objects.equals(getStatus(), Constants.ORDER_STATUS_CANCELLED); - } - - public CustomerOrder updateStatusToCancelled(){ - return updateStatus(Constants.ORDER_STATUS_CANCELLED); - } - - public static CustomerOrder refer(Long id){ - CustomerOrder refer = new CustomerOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CustomerOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer": this.customer = (Customer) value; break; - - case "status": this.status = (OrderStatus) value; break; - - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - case "order_date": this.orderDate = (LocalDate) value; break; - - case "total_amount": this.totalAmount = (BigDecimal) value; break; - - case "order_item_list": this.orderItemList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer": return this.customer; - case "status": return this.status; - case "order_number": return this.orderNumber; - case "order_date": return this.orderDate; - case "total_amount": return this.totalAmount; - case "order_item_list": return this.orderItemList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customer": return this.customer; - case "status": return this.status; - case "orderNumber": return this.orderNumber; - case "orderDate": return this.orderDate; - case "totalAmount": return this.totalAmount; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java deleted file mode 100644 index e18674ef8..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderChecker.java +++ /dev/null @@ -1,100 +0,0 @@ - -package com.example.requesttreeorderservice.customerorder; - -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerChecker; -import com.example.requesttreeorderservice.orderitem.OrderItem; -import com.example.requesttreeorderservice.orderitem.OrderItemChecker; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; -import java.time.LocalDate; - -public class CustomerOrderChecker implements Checker{ - - public String type(){ - return CustomerOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, customerOrder)){ - markAsChecked(_context, customerOrder); - doCheck(_context, customerOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if((customerOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customerOrder); - if(customerOrder.needPersist()){ - } - if(customerOrder.newItem()){ - }else if(customerOrder.updateItem()){ - if(!customerOrder.isPropertyLoaded("customer")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("status")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "status"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("order_date")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_date"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("total_amount")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "total_amount"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomer(_context, customerOrder.getProperty(CustomerOrder.CUSTOMER_PROPERTY), newLocation(_parentLocation, "customer")); - checkStatus(_context, customerOrder.getProperty(CustomerOrder.STATUS_PROPERTY), newLocation(_parentLocation, "status")); - checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); - checkOrderDate(_context, customerOrder.getProperty(CustomerOrder.ORDER_DATE_PROPERTY), newLocation(_parentLocation, "order_date")); - checkTotalAmount(_context, customerOrder.getProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY), newLocation(_parentLocation, "total_amount")); - for(int i = 0; customerOrder.getOrderItemList() != null && i < customerOrder.getOrderItemList().size(); i++){ - OrderItem orderItem = customerOrder.getOrderItemList().get(i); - new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); - } - } - - public void checkCustomer(UserContext _context, Customer customer, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customer); - if((customer == null)){ - return; - } - new CustomerChecker().checkAndFix(_context, customer, _parentLocation); - } - public void checkStatus(UserContext _context, OrderStatus status, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, status); - if((status == null)){ - return; - } - new OrderStatusChecker().checkAndFix(_context, status, _parentLocation); - } - public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, orderNumber); - - } - public void checkOrderDate(UserContext _context, LocalDate orderDate, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderDate); - if((orderDate == null)){ - return; - } - } - public void checkTotalAmount(UserContext _context, BigDecimal totalAmount, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, totalAmount); - if((totalAmount == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java deleted file mode 100644 index 470e8b5bf..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderExpression.java +++ /dev/null @@ -1,93 +0,0 @@ - -package com.example.requesttreeorderservice.customerorder; - -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerExpression; -import com.example.requesttreeorderservice.orderitem.OrderItem; -import com.example.requesttreeorderservice.orderitem.OrderItemListExpression; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.util.function.Function; - -public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerOrderExpression(Expression expression){ - super(expression); - } - - public CustomerOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerOrderExpression updateId(Long id){ - return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); - } - - public CustomerOrderExpression save(UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerOrderExpression save(String intent, UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerExpression getCustomer(){ - return new CustomerExpression(loaded("customer", "getCustomer", CustomerOrder::getCustomer)); - } - - public CustomerOrderExpression updateCustomer(Customer customer){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateCustomer(customer)); - } - - public OrderStatusExpression getStatus(){ - return new OrderStatusExpression(loaded("status", "getStatus", CustomerOrder::getStatus)); - } - - public CustomerOrderExpression updateStatusToNew(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToNew()); - } - public CustomerOrderExpression updateStatusToPaid(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToPaid()); - } - public CustomerOrderExpression updateStatusToCancelled(){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateStatusToCancelled()); - } - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); - } - public CustomerOrderExpression updateOrderNumber(String orderNumber){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); - } - - public Expression getOrderDate(){ - return loaded("order_date", "getOrderDate", CustomerOrder::getOrderDate); - } - public CustomerOrderExpression updateOrderDate(LocalDate orderDate){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderDate(orderDate)); - } - - public Expression getTotalAmount(){ - return loaded("total_amount", "getTotalAmount", CustomerOrder::getTotalAmount); - } - public CustomerOrderExpression updateTotalAmount(BigDecimal totalAmount){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateTotalAmount(totalAmount)); - } - - public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", CustomerOrder::getOrderItemList)); - } - public CustomerOrderExpression addOrderItem(OrderItem orderItem){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderItem(orderItem)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java deleted file mode 100644 index 959f52594..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.requesttreeorderservice.customerorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerOrderListExpression extends SmartListExpression { - public CustomerOrderListExpression(Expression> expression){ - super(expression); - } - - public CustomerOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerOrderExpression first() { - return new CustomerOrderExpression(super.first()); - } - - public CustomerOrderExpression get(int index) { - return new CustomerOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java deleted file mode 100644 index baeab4690..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/customerorder/CustomerOrderRequest.java +++ /dev/null @@ -1,1516 +0,0 @@ - -package com.example.requesttreeorderservice.customerorder; - -import com.example.requesttreeorderservice.Q; -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerRequest; -import com.example.requesttreeorderservice.orderitem.OrderItem; -import com.example.requesttreeorderservice.orderitem.OrderItemRequest; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.util.Date; -import java.util.Objects; - -public class CustomerOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerOrderRequest(Class returnType){ - this(returnType, () -> (T) new CustomerOrder()); - } - - protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerOrderRequest copy(){ - return (CustomerOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ - super.internalMatchAny(customerOrder); - return this; - } - - public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); - } - - public CustomerOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerIdOnly().selectStatusIdOnly().selectOrderNumber().selectOrderDate().selectTotalAmount().selectVersion(); - } - - public CustomerOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CustomerOrder.ID_PROPERTY); - selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - selectProperty(CustomerOrder.STATUS_PROPERTY); - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); - selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomer().selectStatus().selectOrderNumber().selectOrderDate().selectTotalAmount().selectVersion(); - } - - public CustomerOrderRequest selectChildren(){ - super.selectAny(); - selectOrderItemList(); - return selectId().selectCustomer().selectStatus().selectOrderNumber().selectOrderDate().selectTotalAmount().selectVersion(); - } - - - public CustomerOrderRequest selectId(){ - selectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectId(){ - unselectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest selectCustomerIdOnly(){ - selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest selectCustomer(){ - return selectCustomerWith(Q.customers().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectCustomerWith(CustomerRequest customer){ - selectProperty(CustomerOrder.CUSTOMER_PROPERTY); - enhanceRelation(CustomerOrder.CUSTOMER_PROPERTY, customer, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerWith", null, CustomerOrder.CUSTOMER_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectCustomer(){ - unselectProperty(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - public CustomerOrderRequest selectStatusIdOnly(){ - selectProperty(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest selectStatus(){ - return selectStatusWith(Q.orderStatuses().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectStatusWith(OrderStatusRequest status){ - selectProperty(CustomerOrder.STATUS_PROPERTY); - enhanceRelation(CustomerOrder.STATUS_PROPERTY, status, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectStatusWith", null, CustomerOrder.STATUS_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectStatus(){ - unselectProperty(CustomerOrder.STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderNumber(){ - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderNumber(){ - unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderDate(){ - selectProperty(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - /** - * fill the orderDate with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderDate) to fetch orderDate property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderDate(){ - unselectProperty(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - public CustomerOrderRequest selectTotalAmount(){ - selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - /** - * fill the totalAmount with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS totalAmount) to fetch totalAmount property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the totalAmount with customized aggrFunction, TEAQL uses ({aggrFunction}(totalAmount) AS totalAmount to fetch totalAmount property. - * @param aggrFunction aggrFunction - */ - public CustomerOrderRequest selectTotalAmount(AggrFunction aggrFunction){ - selectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY, aggrFunction); - return this; - } - - - public CustomerOrderRequest unselectTotalAmount(){ - unselectProperty(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest selectVersion(){ - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectVersion(){ - unselectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderItemList(){ - return selectOrderItemListWith(Q.orderItems().selectSelf()); - } - - public CustomerOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ - enhanceRelation(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); - } - - public CustomerOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerOrderRequest filterByCustomer(Customer... customer){ - if (customer == null || customer.length == 0) { - throw new IllegalArgumentException("filterByCustomer parameter customer cannot be empty"); - } - return appendSearchCriteria(createCustomerCriteria(Operator.EQUAL, (Object[])customer)); - } - - public CustomerOrderRequest withCustomer(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerCriteria(operator, values)); - } - - public CustomerOrderRequest withCustomerIsUnknown(){ - return withCustomer(Operator.IS_NULL); - } - - public CustomerOrderRequest withCustomerIsKnown(){ - return withCustomer(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByCustomer(Long customer){ - if(customer == null){ - return this; - } - return withCustomer(Operator.EQUAL, customer); - } - public CustomerOrderRequest withCustomerMatching(CustomerRequest customer){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutCustomerMatching(CustomerRequest customer){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.CUSTOMER_PROPERTY, customer, Customer.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByStatus(OrderStatus... status){ - if (status == null || status.length == 0) { - throw new IllegalArgumentException("filterByStatus parameter status cannot be empty"); - } - return appendSearchCriteria(createStatusCriteria(Operator.EQUAL, (Object[])status)); - } - - public CustomerOrderRequest withStatus(Operator operator, Object... values){ - return appendSearchCriteria(createStatusCriteria(operator, values)); - } - - public CustomerOrderRequest withStatusIsUnknown(){ - return withStatus(Operator.IS_NULL); - } - - public CustomerOrderRequest withStatusIsKnown(){ - return withStatus(Operator.IS_NOT_NULL); - } - - public SearchCriteria createStatusCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.STATUS_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByStatus(Long status){ - if(status == null){ - return this; - } - return withStatus(Operator.EQUAL, status); - } - public CustomerOrderRequest withStatusMatching(OrderStatusRequest status){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutStatusMatching(OrderStatusRequest status){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.STATUS_PROPERTY, status, OrderStatus.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ - if (orderNumber == null || orderNumber.length == 0) { - throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); - } - return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); - } - - public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ - return appendSearchCriteria(createOrderNumberCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderNumberIsUnknown(){ - return withOrderNumber(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderNumberIsKnown(){ - return withOrderNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ - return withOrderNumber(Operator.NOT_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ - return withOrderNumber(Operator.IN, (Object[])orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ - return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); - } - public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ - return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); - } - public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ - return withOrderNumber(Operator.BEGIN_WITH, orderNumber); - } - public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ - return withOrderNumber(Operator.CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ - return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ - return withOrderNumber(Operator.END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIs(String orderNumber){ - return withOrderNumber(Operator.EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ - return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); - } - - - - public CustomerOrderRequest filterByOrderDate(LocalDate... orderDate){ - if (orderDate == null || orderDate.length == 0) { - throw new IllegalArgumentException("filterByOrderDate parameter orderDate cannot be empty"); - } - return appendSearchCriteria(createOrderDateCriteria(Operator.EQUAL, (Object[])orderDate)); - } - - public CustomerOrderRequest withOrderDate(Operator operator, Object... values){ - return appendSearchCriteria(createOrderDateCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderDateIsUnknown(){ - return withOrderDate(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderDateIsKnown(){ - return withOrderDate(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderDateCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_DATE_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderDateIs(LocalDate orderDate){ - return withOrderDate(Operator.EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateIsNot(LocalDate orderDate){ - return withOrderDate(Operator.NOT_EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateIn(LocalDate... orderDate){ - return withOrderDate(Operator.IN, (Object[])orderDate); - } - - public CustomerOrderRequest withOrderDateNotIn(LocalDate... orderDate){ - return withOrderDate(Operator.NOT_IN, (Object[])orderDate); - } - public CustomerOrderRequest withOrderDateGreaterThan(LocalDate orderDate){ - return withOrderDate(Operator.GREATER_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateGreaterThanOrEqualTo(LocalDate orderDate){ - return withOrderDate(Operator.GREATER_THAN_OR_EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateLessThan(LocalDate orderDate){ - return withOrderDate(Operator.LESS_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateLessThanOrEqualTo(LocalDate orderDate){ - return withOrderDate(Operator.LESS_THAN_OR_EQUAL, orderDate); - } - - public CustomerOrderRequest withOrderDateBetween(LocalDate startOfOrderDate, LocalDate endOfOrderDate){ - return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); - } - public CustomerOrderRequest withOrderDateBefore(LocalDate orderDate){ - return withOrderDate(Operator.LESS_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateBefore(Date orderDate){ - return withOrderDate(Operator.LESS_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateAfter(LocalDate orderDate){ - return withOrderDate(Operator.GREATER_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateAfter(Date orderDate){ - return withOrderDate(Operator.GREATER_THAN, orderDate); - } - - public CustomerOrderRequest withOrderDateBetween(Date startOfOrderDate, Date endOfOrderDate){ - return withOrderDate(Operator.BETWEEN, startOfOrderDate, endOfOrderDate); - } - - - - - public CustomerOrderRequest filterByTotalAmount(BigDecimal... totalAmount){ - if (totalAmount == null || totalAmount.length == 0) { - throw new IllegalArgumentException("filterByTotalAmount parameter totalAmount cannot be empty"); - } - return appendSearchCriteria(createTotalAmountCriteria(Operator.EQUAL, (Object[])totalAmount)); - } - - public CustomerOrderRequest withTotalAmount(Operator operator, Object... values){ - return appendSearchCriteria(createTotalAmountCriteria(operator, values)); - } - - public CustomerOrderRequest withTotalAmountIsUnknown(){ - return withTotalAmount(Operator.IS_NULL); - } - - public CustomerOrderRequest withTotalAmountIsKnown(){ - return withTotalAmount(Operator.IS_NOT_NULL); - } - - public SearchCriteria createTotalAmountCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.TOTAL_AMOUNT_PROPERTY, operator, values); - } - - public CustomerOrderRequest withTotalAmountIs(BigDecimal totalAmount){ - return withTotalAmount(Operator.EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountIsNot(BigDecimal totalAmount){ - return withTotalAmount(Operator.NOT_EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountIn(BigDecimal... totalAmount){ - return withTotalAmount(Operator.IN, (Object[])totalAmount); - } - - public CustomerOrderRequest withTotalAmountNotIn(BigDecimal... totalAmount){ - return withTotalAmount(Operator.NOT_IN, (Object[])totalAmount); - } - public CustomerOrderRequest withTotalAmountGreaterThan(BigDecimal totalAmount){ - return withTotalAmount(Operator.GREATER_THAN, totalAmount); - } - - public CustomerOrderRequest withTotalAmountGreaterThanOrEqualTo(BigDecimal totalAmount){ - return withTotalAmount(Operator.GREATER_THAN_OR_EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountLessThan(BigDecimal totalAmount){ - return withTotalAmount(Operator.LESS_THAN, totalAmount); - } - - public CustomerOrderRequest withTotalAmountLessThanOrEqualTo(BigDecimal totalAmount){ - return withTotalAmount(Operator.LESS_THAN_OR_EQUAL, totalAmount); - } - - public CustomerOrderRequest withTotalAmountBetween(BigDecimal startOfTotalAmount, BigDecimal endOfTotalAmount){ - return withTotalAmount(Operator.BETWEEN, startOfTotalAmount, endOfTotalAmount); - } - - - - public CustomerOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); - } - - public CustomerOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY)); - } - - public CustomerOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY))); - } - - public CustomerOrderRequest haveOrderItems(){ - return withOrderItemListMatching(Q.orderItems().unlimited()); - } - - public CustomerOrderRequest haveNoOrderItems(){ - return withoutOrderItemListMatching(Q.orderItems().unlimited()); - } - - public CustomerOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerOrderRequest minTotalAmount(){ - return minTotalAmountAs(prefix("minOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest minTotalAmountAs(String retName){ - super.min(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest maxTotalAmount(){ - return maxTotalAmountAs(prefix("maxOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest maxTotalAmountAs(String retName){ - super.max(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest sumTotalAmount(){ - return sumTotalAmountAs(prefix("sumOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest sumTotalAmountAs(String retName){ - super.sum(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest avgTotalAmount(){ - return avgTotalAmountAs(prefix("avgOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest avgTotalAmountAs(String retName){ - super.avg(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest standardDeviationTotalAmount(){ - return standardDeviationTotalAmountAs(prefix("standardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest standardDeviationTotalAmountAs(String retName){ - super.standardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmount(){ - return squareRootOfPopulationStandardDeviationTotalAmountAs(prefix("squareRootOfPopulationStandardDeviationOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationTotalAmountAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest sampleVarianceTotalAmount(){ - return sampleVarianceTotalAmountAs(prefix("sampleVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest sampleVarianceTotalAmountAs(String retName){ - super.sampleVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest samplePopulationVarianceTotalAmount(){ - return samplePopulationVarianceTotalAmountAs(prefix("samplePopulationVarianceOf",CustomerOrder.TOTAL_AMOUNT_PROPERTY)); - } - - public CustomerOrderRequest samplePopulationVarianceTotalAmountAs(String retName){ - super.samplePopulationVariance(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest groupByCustomerWithDetails(){ - return groupByCustomerWithDetails(Q.customers().unlimited()); - } - - public CustomerOrderRequest groupByCustomerWithDetails(CustomerRequest subRequest){ - aggregate(CustomerOrder.CUSTOMER_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupByStatusWithDetails(){ - return groupByStatusWithDetails(Q.orderStatuses().unlimited()); - } - - public CustomerOrderRequest groupByStatusWithDetails(OrderStatusRequest subRequest){ - aggregate(CustomerOrder.STATUS_PROPERTY, subRequest); - return this; - } - - - - - - public CustomerOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctCustomer(){ - return countDistinctCustomerAs("customer_distinct_count"); - } - - public CustomerOrderRequest countDistinctCustomerAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctStatus(){ - return countDistinctStatusAs("status_distinct_count"); - } - - public CustomerOrderRequest countDistinctStatusAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.STATUS_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderDate(){ - return countDistinctOrderDateAs("order_date_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderDateAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctTotalAmount(){ - return countDistinctTotalAmountAs("total_amount_distinct_count"); - } - - public CustomerOrderRequest countDistinctTotalAmountAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ - aggregate(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupById(){ - groupBy(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdAs(String retName){ - groupBy(retName, CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ID_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByCustomerWith(CustomerRequest subRequest){ - groupBy(CustomerOrder.CUSTOMER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerWith", null, "customer")); - return this; - } - public CustomerOrderRequest groupByCustomer(){ - groupBy(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCustomerAs(String retName){ - groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByCustomerWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.CUSTOMER_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByStatusWith(OrderStatusRequest subRequest){ - groupBy(CustomerOrder.STATUS_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByStatusWith", null, "status")); - return this; - } - public CustomerOrderRequest groupByStatus(){ - groupBy(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByStatusAs(String retName){ - groupBy(retName, CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByStatusWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.STATUS_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderNumber(){ - groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderDate(){ - groupBy(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderDateAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderDateWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_DATE_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByTotalAmount(){ - groupBy(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByTotalAmountAs(String retName){ - groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByTotalAmountWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.TOTAL_AMOUNT_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByVersion(){ - groupBy(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionAs(String retName){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); - return this; - } - - public CustomerOrderRequest withStatusIsNew(){ - filterByStatus(com.example.requesttreeorderservice.Constants.ORDER_STATUS_NEW); - return this; - } - - - public CustomerOrderRequest withStatusIsPaid(){ - filterByStatus(com.example.requesttreeorderservice.Constants.ORDER_STATUS_PAID); - return this; - } - - - public CustomerOrderRequest withStatusIsCancelled(){ - filterByStatus(com.example.requesttreeorderservice.Constants.ORDER_STATUS_CANCELLED); - return this; - } - - - - - public CustomerOrderRequest orderByIdAscending(){ - addOrderByAscending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByIdDescending(){ - addOrderByDescending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCustomerAscending(){ - addOrderByAscending(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByCustomerDescending(){ - addOrderByDescending(CustomerOrder.CUSTOMER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByStatusAscending(){ - addOrderByAscending(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByStatusDescending(){ - addOrderByDescending(CustomerOrder.STATUS_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderDateAscending(){ - addOrderByAscending(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderDateDescending(){ - addOrderByDescending(CustomerOrder.ORDER_DATE_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByTotalAmountAscending(){ - addOrderByAscending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByTotalAmountDescending(){ - addOrderByDescending(CustomerOrder.TOTAL_AMOUNT_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionAscending(){ - addOrderByAscending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionDescending(){ - addOrderByDescending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ - return statsFromOrderItemsAs(name, subRequest, false); - } - - public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ - return statsFromOrderItemsAs(REFINEMENTS, subRequest); - } - public CustomerRequest rollUpToCustomer(){ - CustomerRequest customer = Q.customers().unlimited(); - this.internalRollUpTo("customer", customer, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomer", null, "customer")); - return customer; - } - - public OrderStatusRequest rollUpToStatus(){ - OrderStatusRequest status = Q.orderStatuses().unlimited(); - this.internalRollUpTo("status", status, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToStatus", null, "status")); - return status; - } - - - - - - public CustomerOrderRequest countOrderItems(){ - addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderItemsAs(String name){ - addRelationCount(name, Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ - addRelationCount(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest minQuantityOfOrderItems(){ - addRelationScalarAggregate("minQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest minQuantityOfOrderItemsAs(String name){ - return minQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest minQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest maxQuantityOfOrderItems(){ - addRelationScalarAggregate("maxQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest maxQuantityOfOrderItemsAs(String name){ - return maxQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest maxQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sumQuantityOfOrderItems(){ - addRelationScalarAggregate("sumQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sumQuantityOfOrderItemsAs(String name){ - return sumQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest sumQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest avgQuantityOfOrderItems(){ - addRelationScalarAggregate("avgQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest avgQuantityOfOrderItemsAs(String name){ - return avgQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest avgQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest standardDeviationQuantityOfOrderItems(){ - addRelationScalarAggregate("stdDevQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest standardDeviationQuantityOfOrderItemsAs(String name){ - return standardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest standardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItems(){ - addRelationScalarAggregate("stdDevPopQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name){ - return squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sampleVarianceQuantityOfOrderItems(){ - addRelationScalarAggregate("varSampQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name){ - return sampleVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest sampleVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderItems(){ - addRelationScalarAggregate("varPopQuantityOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name){ - return samplePopulationVarianceQuantityOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest samplePopulationVarianceQuantityOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.QUANTITY_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceQuantityOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest minUnitPriceOfOrderItems(){ - addRelationScalarAggregate("minUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest minUnitPriceOfOrderItemsAs(String name){ - return minUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest minUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest maxUnitPriceOfOrderItems(){ - addRelationScalarAggregate("maxUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest maxUnitPriceOfOrderItemsAs(String name){ - return maxUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest maxUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sumUnitPriceOfOrderItems(){ - addRelationScalarAggregate("sumUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sumUnitPriceOfOrderItemsAs(String name){ - return sumUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest sumUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest avgUnitPriceOfOrderItems(){ - addRelationScalarAggregate("avgUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest avgUnitPriceOfOrderItemsAs(String name){ - return avgUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest avgUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest standardDeviationUnitPriceOfOrderItems(){ - addRelationScalarAggregate("stdDevUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name){ - return standardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest standardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems(){ - addRelationScalarAggregate("stdDevPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name){ - return squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest sampleVarianceUnitPriceOfOrderItems(){ - addRelationScalarAggregate("varSampUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name){ - return sampleVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest sampleVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest samplePopulationVarianceUnitPriceOfOrderItems(){ - addRelationScalarAggregate("varPopUnitPriceOfOrderItems", Q.orderItems().unlimited(), - OrderItem.CUSTOMER_ORDER_PROPERTY, OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name){ - return samplePopulationVarianceUnitPriceOfOrderItemsAs(name, Q.orderItems().unlimited()); - } - - public CustomerOrderRequest samplePopulationVarianceUnitPriceOfOrderItemsAs(String name, OrderItemRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - OrderItem.UNIT_PRICE_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceUnitPriceOfOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer){ - return facetByCustomerAs(facetName, customer, true); - } - - public CustomerOrderRequest facetByCustomerAs(String facetName, CustomerRequest customer, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.CUSTOMER_PROPERTY, customer, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerAs", facetName, CustomerOrder.CUSTOMER_PROPERTY)); - return this; - } - public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status){ - return facetByStatusAs(facetName, status, true); - } - - public CustomerOrderRequest facetByStatusAs(String facetName, OrderStatusRequest status, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.STATUS_PROPERTY, status, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByStatusAs", facetName, CustomerOrder.STATUS_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java deleted file mode 100644 index c601b176d..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItem.java +++ /dev/null @@ -1,169 +0,0 @@ - -package com.example.requesttreeorderservice.orderitem; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderItem extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderItem"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c42b4bc2252ab616b0b006ad2560900a40e2ca87d71ad860bab689f0b16b1795"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("product_name", 2), java.util.Map.entry("quantity", 3), java.util.Map.entry("unit_price", 4), java.util.Map.entry("version", 5)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("product_name", java.util.List.of("productName", "product_name")), java.util.Map.entry("quantity", java.util.List.of("quantity", "quantity")), java.util.Map.entry("unit_price", java.util.List.of("unitPrice", "unit_price")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; - public static final String PRODUCT_NAME_PROPERTY = "product_name"; - public static final String QUANTITY_PROPERTY = "quantity"; - public static final String UNIT_PRICE_PROPERTY = "unit_price"; - private CustomerOrder customerOrder; - - private String productName; - - private Integer quantity; - - private BigDecimal unitPrice; - - - public CustomerOrder getCustomerOrder(){ - return this.customerOrder; - } - - public String getProductName(){ - return this.productName; - } - - public Integer getQuantity(){ - return this.quantity; - } - - public BigDecimal getUnitPrice(){ - return this.unitPrice; - } - - public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ - if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ - return this; - } - handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); - this.customerOrder = customerOrder; - return this; - } - - public OrderItem updateProductName(String productName){ - productName = (productName == null ? null : productName.trim()); - if(isPropertyLoaded(PRODUCT_NAME_PROPERTY) && Objects.equals(this.productName, productName)){ - return this; - } - handleUpdate(PRODUCT_NAME_PROPERTY, getProductName(), productName); - this.productName = productName; - return this; - } - - public OrderItem updateQuantity(Integer quantity){ - if(isPropertyLoaded(QUANTITY_PROPERTY) && Objects.equals(this.quantity, quantity)){ - return this; - } - handleUpdate(QUANTITY_PROPERTY, getQuantity(), quantity); - this.quantity = quantity; - return this; - } - - public OrderItem updateUnitPrice(BigDecimal unitPrice){ - if(isPropertyLoaded(UNIT_PRICE_PROPERTY) && Objects.equals(this.unitPrice, unitPrice)){ - return this; - } - handleUpdate(UNIT_PRICE_PROPERTY, getUnitPrice(), unitPrice); - this.unitPrice = unitPrice; - return this; - } - - - public static OrderItem refer(Long id){ - OrderItem refer = new OrderItem(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderItem comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer_order": this.customerOrder = (CustomerOrder) value; break; - - case "product_name": this.productName = (value == null ? null : ((String)value).trim()); break; - - case "quantity": this.quantity = (Integer) value; break; - - case "unit_price": this.unitPrice = (BigDecimal) value; break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer_order": return this.customerOrder; - case "product_name": return this.productName; - case "quantity": return this.quantity; - case "unit_price": return this.unitPrice; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customerOrder": return this.customerOrder; - case "productName": return this.productName; - case "quantity": return this.quantity; - case "unitPrice": return this.unitPrice; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java deleted file mode 100644 index 31528fa21..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemChecker.java +++ /dev/null @@ -1,80 +0,0 @@ - -package com.example.requesttreeorderservice.orderitem; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; - -public class OrderItemChecker implements Checker{ - - public String type(){ - return OrderItem.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if(needCheck(_context, orderItem)){ - markAsChecked(_context, orderItem); - doCheck(_context, orderItem, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if((orderItem == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderItem); - if(orderItem.needPersist()){ - } - if(orderItem.newItem()){ - }else if(orderItem.updateItem()){ - if(!orderItem.isPropertyLoaded("customer_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("product_name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "product_name"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("quantity")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "quantity"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("unit_price")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "unit_price"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomerOrder(_context, orderItem.getProperty(OrderItem.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); - checkProductName(_context, orderItem.getProperty(OrderItem.PRODUCT_NAME_PROPERTY), newLocation(_parentLocation, "product_name")); - checkQuantity(_context, orderItem.getProperty(OrderItem.QUANTITY_PROPERTY), newLocation(_parentLocation, "quantity")); - checkUnitPrice(_context, orderItem.getProperty(OrderItem.UNIT_PRICE_PROPERTY), newLocation(_parentLocation, "unit_price")); - } - - public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerOrder); - if((customerOrder == null)){ - return; - } - new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); - } - public void checkProductName(UserContext _context, String productName, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, productName); - if((productName == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, productName); - - } - public void checkQuantity(UserContext _context, Integer quantity, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, quantity); - if((quantity == null)){ - return; - } - } - public void checkUnitPrice(UserContext _context, BigDecimal unitPrice, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, unitPrice); - if((unitPrice == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java deleted file mode 100644 index f8b30f5e6..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemExpression.java +++ /dev/null @@ -1,68 +0,0 @@ - -package com.example.requesttreeorderservice.orderitem; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.util.function.Function; - -public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderItemExpression(Expression expression){ - super(expression); - } - - public OrderItemExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderItemExpression updateId(Long id){ - return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); - } - - public OrderItemExpression save(UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderItemExpression save(String intent, UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderItem::getCustomerOrder)); - } - - public OrderItemExpression updateCustomerOrder(CustomerOrder customerOrder){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCustomerOrder(customerOrder)); - } - - public Expression getProductName(){ - return loaded("product_name", "getProductName", OrderItem::getProductName); - } - public OrderItemExpression updateProductName(String productName){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateProductName(productName)); - } - - public Expression getQuantity(){ - return loaded("quantity", "getQuantity", OrderItem::getQuantity); - } - public OrderItemExpression updateQuantity(Integer quantity){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateQuantity(quantity)); - } - - public Expression getUnitPrice(){ - return loaded("unit_price", "getUnitPrice", OrderItem::getUnitPrice); - } - public OrderItemExpression updateUnitPrice(BigDecimal unitPrice){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateUnitPrice(unitPrice)); - } - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java deleted file mode 100644 index da7c16f15..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.requesttreeorderservice.orderitem; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderItemListExpression extends SmartListExpression { - public OrderItemListExpression(Expression> expression){ - super(expression); - } - - public OrderItemListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderItemExpression first() { - return new OrderItemExpression(super.first()); - } - - public OrderItemExpression get(int index) { - return new OrderItemExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java deleted file mode 100644 index 158c0afe9..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderitem/OrderItemRequest.java +++ /dev/null @@ -1,1060 +0,0 @@ - -package com.example.requesttreeorderservice.orderitem; - -import com.example.requesttreeorderservice.Q; -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.util.Objects; - -public class OrderItemRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderItemRequest(Class returnType){ - this(returnType, () -> (T) new OrderItem()); - } - - protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderItemRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderItemRequest copy(){ - return (OrderItemRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderItemRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderItemRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderItemRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderItemRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderItemRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ - super.internalMatchAny(orderItem); - return this; - } - - public OrderItemRequest matchingIdsOf(OrderItemRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); - } - - public OrderItemRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderItemRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderItemRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderItemRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerOrderIdOnly().selectProductName().selectQuantity().selectUnitPrice().selectVersion(); - } - - public OrderItemRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderItemRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderItem.ID_PROPERTY); - selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); - selectProperty(OrderItem.QUANTITY_PROPERTY); - selectProperty(OrderItem.UNIT_PRICE_PROPERTY); - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomerOrder().selectProductName().selectQuantity().selectUnitPrice().selectVersion(); - } - - public OrderItemRequest selectChildren(){ - super.selectAny(); - return selectId().selectCustomerOrder().selectProductName().selectQuantity().selectUnitPrice().selectVersion(); - } - - - public OrderItemRequest selectId(){ - selectProperty(OrderItem.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectId(){ - unselectProperty(OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest selectCustomerOrderIdOnly(){ - selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest selectCustomerOrder(){ - return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); - } - - public OrderItemRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ - selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderItem.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - public OrderItemRequest unselectCustomerOrder(){ - unselectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderItemRequest selectProductName(){ - selectProperty(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - /** - * fill the productName with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS productName) to fetch productName property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectProductName(){ - unselectProperty(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest selectQuantity(){ - selectProperty(OrderItem.QUANTITY_PROPERTY); - return this; - } - - /** - * fill the quantity with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS quantity) to fetch quantity property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the quantity with customized aggrFunction, TEAQL uses ({aggrFunction}(quantity) AS quantity to fetch quantity property. - * @param aggrFunction aggrFunction - */ - public OrderItemRequest selectQuantity(AggrFunction aggrFunction){ - selectProperty(OrderItem.QUANTITY_PROPERTY, aggrFunction); - return this; - } - - - public OrderItemRequest unselectQuantity(){ - unselectProperty(OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest selectUnitPrice(){ - selectProperty(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - /** - * fill the unitPrice with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS unitPrice) to fetch unitPrice property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the unitPrice with customized aggrFunction, TEAQL uses ({aggrFunction}(unitPrice) AS unitPrice to fetch unitPrice property. - * @param aggrFunction aggrFunction - */ - public OrderItemRequest selectUnitPrice(AggrFunction aggrFunction){ - selectProperty(OrderItem.UNIT_PRICE_PROPERTY, aggrFunction); - return this; - } - - - public OrderItemRequest unselectUnitPrice(){ - unselectProperty(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest selectVersion(){ - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectVersion(){ - unselectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); - } - - public OrderItemRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderItemRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderItemRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderItemRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderItemRequest filterByCustomerOrder(CustomerOrder... customerOrder){ - if (customerOrder == null || customerOrder.length == 0) { - throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); - } - return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); - } - - public OrderItemRequest withCustomerOrder(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); - } - - public OrderItemRequest withCustomerOrderIsUnknown(){ - return withCustomerOrder(Operator.IS_NULL); - } - - public OrderItemRequest withCustomerOrderIsKnown(){ - return withCustomerOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, operator, values); - } - - public OrderItemRequest filterByCustomerOrder(Long customerOrder){ - if(customerOrder == null){ - return this; - } - return withCustomerOrder(Operator.EQUAL, customerOrder); - } - public OrderItemRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); - } - - public OrderItemRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); - } - - public OrderItemRequest filterByProductName(String... productName){ - if (productName == null || productName.length == 0) { - throw new IllegalArgumentException("filterByProductName parameter productName cannot be empty"); - } - return appendSearchCriteria(createProductNameCriteria(Operator.EQUAL, (Object[])productName)); - } - - public OrderItemRequest withProductName(Operator operator, Object... values){ - return appendSearchCriteria(createProductNameCriteria(operator, values)); - } - - public OrderItemRequest withProductNameIsUnknown(){ - return withProductName(Operator.IS_NULL); - } - - public OrderItemRequest withProductNameIsKnown(){ - return withProductName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createProductNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.PRODUCT_NAME_PROPERTY, operator, values); - } - - public OrderItemRequest withProductNameIsNot(String productName){ - return withProductName(Operator.NOT_EQUAL, productName); - } - - public OrderItemRequest withProductNameIn(String... productName){ - return withProductName(Operator.IN, (Object[])productName); - } - - public OrderItemRequest withProductNameNotIn(String... productName){ - return withProductName(Operator.NOT_IN, (Object[])productName); - } - public OrderItemRequest withProductNameGreaterThan(String productName){ - return withProductName(Operator.GREATER_THAN, productName); - } - - public OrderItemRequest withProductNameGreaterThanOrEqualTo(String productName){ - return withProductName(Operator.GREATER_THAN_OR_EQUAL, productName); - } - - public OrderItemRequest withProductNameLessThan(String productName){ - return withProductName(Operator.LESS_THAN, productName); - } - - public OrderItemRequest withProductNameLessThanOrEqualTo(String productName){ - return withProductName(Operator.LESS_THAN_OR_EQUAL, productName); - } - - public OrderItemRequest withProductNameBetween(String startOfProductName, String endOfProductName){ - return withProductName(Operator.BETWEEN, startOfProductName, endOfProductName); - } - public OrderItemRequest withProductNameStartingWith(String productName){ - return withProductName(Operator.BEGIN_WITH, productName); - } - public OrderItemRequest withProductNameContaining(String productName){ - return withProductName(Operator.CONTAIN, productName); - } - - public OrderItemRequest withProductNameNotContaining(String productName){ - return withProductName(Operator.NOT_CONTAIN, productName); - } - - public OrderItemRequest withProductNameNotStartingWith(String productName){ - return withProductName(Operator.NOT_BEGIN_WITH, productName); - } - - public OrderItemRequest withProductNameEndingWith(String productName){ - return withProductName(Operator.END_WITH, productName); - } - - public OrderItemRequest withProductNameNotEndingWith(String productName){ - return withProductName(Operator.NOT_END_WITH, productName); - } - - public OrderItemRequest withProductNameIs(String productName){ - return withProductName(Operator.EQUAL, productName); - } - - public OrderItemRequest withProductNameSoundingLike(String productName){ - return withProductName(Operator.SOUNDS_LIKE, productName); - } - - - - public OrderItemRequest filterByQuantity(Integer... quantity){ - if (quantity == null || quantity.length == 0) { - throw new IllegalArgumentException("filterByQuantity parameter quantity cannot be empty"); - } - return appendSearchCriteria(createQuantityCriteria(Operator.EQUAL, (Object[])quantity)); - } - - public OrderItemRequest withQuantity(Operator operator, Object... values){ - return appendSearchCriteria(createQuantityCriteria(operator, values)); - } - - public OrderItemRequest withQuantityIsUnknown(){ - return withQuantity(Operator.IS_NULL); - } - - public OrderItemRequest withQuantityIsKnown(){ - return withQuantity(Operator.IS_NOT_NULL); - } - - public SearchCriteria createQuantityCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.QUANTITY_PROPERTY, operator, values); - } - - public OrderItemRequest withQuantityIs(Integer quantity){ - return withQuantity(Operator.EQUAL, quantity); - } - - public OrderItemRequest withQuantityIsNot(Integer quantity){ - return withQuantity(Operator.NOT_EQUAL, quantity); - } - - public OrderItemRequest withQuantityIn(Integer... quantity){ - return withQuantity(Operator.IN, (Object[])quantity); - } - - public OrderItemRequest withQuantityNotIn(Integer... quantity){ - return withQuantity(Operator.NOT_IN, (Object[])quantity); - } - public OrderItemRequest withQuantityGreaterThan(Integer quantity){ - return withQuantity(Operator.GREATER_THAN, quantity); - } - - public OrderItemRequest withQuantityGreaterThanOrEqualTo(Integer quantity){ - return withQuantity(Operator.GREATER_THAN_OR_EQUAL, quantity); - } - - public OrderItemRequest withQuantityLessThan(Integer quantity){ - return withQuantity(Operator.LESS_THAN, quantity); - } - - public OrderItemRequest withQuantityLessThanOrEqualTo(Integer quantity){ - return withQuantity(Operator.LESS_THAN_OR_EQUAL, quantity); - } - - public OrderItemRequest withQuantityBetween(Integer startOfQuantity, Integer endOfQuantity){ - return withQuantity(Operator.BETWEEN, startOfQuantity, endOfQuantity); - } - - - - public OrderItemRequest filterByUnitPrice(BigDecimal... unitPrice){ - if (unitPrice == null || unitPrice.length == 0) { - throw new IllegalArgumentException("filterByUnitPrice parameter unitPrice cannot be empty"); - } - return appendSearchCriteria(createUnitPriceCriteria(Operator.EQUAL, (Object[])unitPrice)); - } - - public OrderItemRequest withUnitPrice(Operator operator, Object... values){ - return appendSearchCriteria(createUnitPriceCriteria(operator, values)); - } - - public OrderItemRequest withUnitPriceIsUnknown(){ - return withUnitPrice(Operator.IS_NULL); - } - - public OrderItemRequest withUnitPriceIsKnown(){ - return withUnitPrice(Operator.IS_NOT_NULL); - } - - public SearchCriteria createUnitPriceCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.UNIT_PRICE_PROPERTY, operator, values); - } - - public OrderItemRequest withUnitPriceIs(BigDecimal unitPrice){ - return withUnitPrice(Operator.EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceIsNot(BigDecimal unitPrice){ - return withUnitPrice(Operator.NOT_EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceIn(BigDecimal... unitPrice){ - return withUnitPrice(Operator.IN, (Object[])unitPrice); - } - - public OrderItemRequest withUnitPriceNotIn(BigDecimal... unitPrice){ - return withUnitPrice(Operator.NOT_IN, (Object[])unitPrice); - } - public OrderItemRequest withUnitPriceGreaterThan(BigDecimal unitPrice){ - return withUnitPrice(Operator.GREATER_THAN, unitPrice); - } - - public OrderItemRequest withUnitPriceGreaterThanOrEqualTo(BigDecimal unitPrice){ - return withUnitPrice(Operator.GREATER_THAN_OR_EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceLessThan(BigDecimal unitPrice){ - return withUnitPrice(Operator.LESS_THAN, unitPrice); - } - - public OrderItemRequest withUnitPriceLessThanOrEqualTo(BigDecimal unitPrice){ - return withUnitPrice(Operator.LESS_THAN_OR_EQUAL, unitPrice); - } - - public OrderItemRequest withUnitPriceBetween(BigDecimal startOfUnitPrice, BigDecimal endOfUnitPrice){ - return withUnitPrice(Operator.BETWEEN, startOfUnitPrice, endOfUnitPrice); - } - - - - public OrderItemRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderItemRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderItemRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderItemRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); - } - - public OrderItemRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderItemRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderItemRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderItemRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderItemRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderItemRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderItemRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderItemRequest minQuantity(){ - return minQuantityAs(prefix("minOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest minQuantityAs(String retName){ - super.min(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest maxQuantity(){ - return maxQuantityAs(prefix("maxOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest maxQuantityAs(String retName){ - super.max(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest sumQuantity(){ - return sumQuantityAs(prefix("sumOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest sumQuantityAs(String retName){ - super.sum(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest avgQuantity(){ - return avgQuantityAs(prefix("avgOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest avgQuantityAs(String retName){ - super.avg(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest standardDeviationQuantity(){ - return standardDeviationQuantityAs(prefix("standardDeviationOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest standardDeviationQuantityAs(String retName){ - super.standardDeviation(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest squareRootOfPopulationStandardDeviationQuantity(){ - return squareRootOfPopulationStandardDeviationQuantityAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest squareRootOfPopulationStandardDeviationQuantityAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest sampleVarianceQuantity(){ - return sampleVarianceQuantityAs(prefix("sampleVarianceOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest sampleVarianceQuantityAs(String retName){ - super.sampleVariance(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest samplePopulationVarianceQuantity(){ - return samplePopulationVarianceQuantityAs(prefix("samplePopulationVarianceOf",OrderItem.QUANTITY_PROPERTY)); - } - - public OrderItemRequest samplePopulationVarianceQuantityAs(String retName){ - super.samplePopulationVariance(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest minUnitPrice(){ - return minUnitPriceAs(prefix("minOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest minUnitPriceAs(String retName){ - super.min(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest maxUnitPrice(){ - return maxUnitPriceAs(prefix("maxOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest maxUnitPriceAs(String retName){ - super.max(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest sumUnitPrice(){ - return sumUnitPriceAs(prefix("sumOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest sumUnitPriceAs(String retName){ - super.sum(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest avgUnitPrice(){ - return avgUnitPriceAs(prefix("avgOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest avgUnitPriceAs(String retName){ - super.avg(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest standardDeviationUnitPrice(){ - return standardDeviationUnitPriceAs(prefix("standardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest standardDeviationUnitPriceAs(String retName){ - super.standardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPrice(){ - return squareRootOfPopulationStandardDeviationUnitPriceAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest squareRootOfPopulationStandardDeviationUnitPriceAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest sampleVarianceUnitPrice(){ - return sampleVarianceUnitPriceAs(prefix("sampleVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest sampleVarianceUnitPriceAs(String retName){ - super.sampleVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest samplePopulationVarianceUnitPrice(){ - return samplePopulationVarianceUnitPriceAs(prefix("samplePopulationVarianceOf",OrderItem.UNIT_PRICE_PROPERTY)); - } - - public OrderItemRequest samplePopulationVarianceUnitPriceAs(String retName){ - super.samplePopulationVariance(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest groupByCustomerOrderWithDetails(){ - return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); - } - - public OrderItemRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ - aggregate(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest); - return this; - } - - - - - - public OrderItemRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderItemRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest countDistinctCustomerOrder(){ - return countDistinctCustomerOrderAs("customer_order_distinct_count"); - } - - public OrderItemRequest countDistinctCustomerOrderAs(String alias){ - super.countDistinctProperty(alias, OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderItemRequest countDistinctProductName(){ - return countDistinctProductNameAs("product_name_distinct_count"); - } - - public OrderItemRequest countDistinctProductNameAs(String alias){ - super.countDistinctProperty(alias, OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest countDistinctQuantity(){ - return countDistinctQuantityAs("quantity_distinct_count"); - } - - public OrderItemRequest countDistinctQuantityAs(String alias){ - super.countDistinctProperty(alias, OrderItem.QUANTITY_PROPERTY); - return this; - } - public OrderItemRequest countDistinctUnitPrice(){ - return countDistinctUnitPriceAs("unit_price_distinct_count"); - } - - public OrderItemRequest countDistinctUnitPriceAs(String alias){ - super.countDistinctProperty(alias, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - public OrderItemRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderItemRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupById(){ - groupBy(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdAs(String retName){ - groupBy(retName, OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.ID_PROPERTY, function); - return this; - } - public OrderItemRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); - return this; - } - public OrderItemRequest groupByCustomerOrder(){ - groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupByCustomerOrderAs(String retName){ - groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByProductName(){ - groupBy(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest groupByProductNameAs(String retName){ - groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest groupByProductNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.PRODUCT_NAME_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByQuantity(){ - groupBy(OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest groupByQuantityAs(String retName){ - groupBy(retName, OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest groupByQuantityWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.QUANTITY_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByUnitPrice(){ - groupBy(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest groupByUnitPriceAs(String retName){ - groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest groupByUnitPriceWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.UNIT_PRICE_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByVersion(){ - groupBy(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionAs(String retName){ - groupBy(retName, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.VERSION_PROPERTY, function); - return this; - } - - - - public OrderItemRequest orderByIdAscending(){ - addOrderByAscending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByIdDescending(){ - addOrderByDescending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByCustomerOrderAscending(){ - addOrderByAscending(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderByCustomerOrderDescending(){ - addOrderByDescending(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderByProductNameAscending(){ - addOrderByAscending(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest orderByProductNameDescending(){ - addOrderByDescending(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest orderByProductNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - - public OrderItemRequest orderByProductNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderItem.PRODUCT_NAME_PROPERTY); - return this; - } - public OrderItemRequest orderByQuantityAscending(){ - addOrderByAscending(OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest orderByQuantityDescending(){ - addOrderByDescending(OrderItem.QUANTITY_PROPERTY); - return this; - } - - public OrderItemRequest orderByUnitPriceAscending(){ - addOrderByAscending(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest orderByUnitPriceDescending(){ - addOrderByDescending(OrderItem.UNIT_PRICE_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionAscending(){ - addOrderByAscending(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionDescending(){ - addOrderByDescending(OrderItem.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest rollUpToCustomerOrder(){ - CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.internalRollUpTo("customer_order", customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); - return customerOrder; - } - - - - - - - public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ - return facetByCustomerOrderAs(facetName, customerOrder, true); - } - - public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderItem.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderItemRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderItemRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderItemRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderItemRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderItemRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderItemRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java deleted file mode 100644 index 83fbdfb38..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatus.java +++ /dev/null @@ -1,214 +0,0 @@ - -package com.example.requesttreeorderservice.orderstatus; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.platform.Platform; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.math.BigDecimal; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderStatus extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderStatus"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "81304ab2e3fd61964bc163a850a2a321e1c0bfe204f85f36aedc4e1b5d8cebcd"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("platform", 0), java.util.Map.entry("id", 1), java.util.Map.entry("name", 2), java.util.Map.entry("code", 3), java.util.Map.entry("color", 4), java.util.Map.entry("display_order", 5), java.util.Map.entry("version", 6)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("code", java.util.List.of("code", "code")), java.util.Map.entry("color", java.util.List.of("color", "color")), java.util.Map.entry("display_order", java.util.List.of("displayOrder", "display_order")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderStatus.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String NAME_PROPERTY = "name"; - public static final String CODE_PROPERTY = "code"; - public static final String COLOR_PROPERTY = "color"; - public static final String DISPLAY_ORDER_PROPERTY = "display_order"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private Platform platform; - - private String name; - - private String code; - - private String color; - - private BigDecimal displayOrder; - - private SmartList customerOrderList; - - public Platform getPlatform(){ - return this.platform; - } - - public String getName(){ - return this.name; - } - - public String getCode(){ - return this.code; - } - - public String getColor(){ - return this.color; - } - - public BigDecimal getDisplayOrder(){ - return this.displayOrder; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public OrderStatus updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public OrderStatus updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public OrderStatus updateCode(String code){ - code = (code == null ? null : code.trim()); - if(isPropertyLoaded(CODE_PROPERTY) && Objects.equals(this.code, code)){ - return this; - } - handleUpdate(CODE_PROPERTY, getCode(), code); - this.code = code; - return this; - } - - public OrderStatus updateColor(String color){ - color = (color == null ? null : color.trim()); - if(isPropertyLoaded(COLOR_PROPERTY) && Objects.equals(this.color, color)){ - return this; - } - handleUpdate(COLOR_PROPERTY, getColor(), color); - this.color = color; - return this; - } - - public OrderStatus updateDisplayOrder(BigDecimal displayOrder){ - if(isPropertyLoaded(DISPLAY_ORDER_PROPERTY) && Objects.equals(this.displayOrder, displayOrder)){ - return this; - } - handleUpdate(DISPLAY_ORDER_PROPERTY, getDisplayOrder(), displayOrder); - this.displayOrder = displayOrder; - return this; - } - - public OrderStatus addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updateProperty(CustomerOrder.STATUS_PROPERTY, this); - return this; - } - - public static OrderStatus refer(Long id){ - OrderStatus refer = new OrderStatus(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderStatus comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "code": this.code = (value == null ? null : ((String)value).trim()); break; - - case "color": this.color = (value == null ? null : ((String)value).trim()); break; - - case "display_order": this.displayOrder = (BigDecimal) value; break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "color": return this.color; - case "display_order": return this.displayOrder; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "name": return this.name; - case "code": return this.code; - case "color": return this.color; - case "displayOrder": return this.displayOrder; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java deleted file mode 100644 index 0f2645a76..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusChecker.java +++ /dev/null @@ -1,100 +0,0 @@ - -package com.example.requesttreeorderservice.orderstatus; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderChecker; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; -import java.math.BigDecimal; - -public class OrderStatusChecker implements Checker{ - - public String type(){ - return OrderStatus.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ - if(needCheck(_context, orderStatus)){ - markAsChecked(_context, orderStatus); - doCheck(_context, orderStatus, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderStatus orderStatus, ObjectLocation _parentLocation){ - if((orderStatus == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderStatus); - if(orderStatus.needPersist()){ - } - if(orderStatus.newItem()){ - }else if(orderStatus.updateItem()){ - if(!orderStatus.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "code"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("color")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "color"), "Mutation requires a fully loaded entity"); - } - if(!orderStatus.isPropertyLoaded("display_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "display_order"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, orderStatus.getProperty(OrderStatus.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkName(_context, orderStatus.getProperty(OrderStatus.NAME_PROPERTY), newLocation(_parentLocation, "name")); - checkCode(_context, orderStatus.getProperty(OrderStatus.CODE_PROPERTY), newLocation(_parentLocation, "code")); - checkColor(_context, orderStatus.getProperty(OrderStatus.COLOR_PROPERTY), newLocation(_parentLocation, "color")); - checkDisplayOrder(_context, orderStatus.getProperty(OrderStatus.DISPLAY_ORDER_PROPERTY), newLocation(_parentLocation, "display_order")); - for(int i = 0; orderStatus.getCustomerOrderList() != null && i < orderStatus.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = orderStatus.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } - public void checkCode(UserContext _context, String code, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, code); - if((code == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, code); - - } - public void checkColor(UserContext _context, String color, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, color); - if((color == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, color); - - } - public void checkDisplayOrder(UserContext _context, BigDecimal displayOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, displayOrder); - if((displayOrder == null)){ - return; - } - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java deleted file mode 100644 index b251f692b..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusExpression.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.example.requesttreeorderservice.orderstatus; - -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderListExpression; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.math.BigDecimal; -import java.util.function.Function; - -public class OrderStatusExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderStatusExpression(Expression expression){ - super(expression); - } - - public OrderStatusExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderStatusExpression updateId(Long id){ - return new OrderStatusExpression(this, $it -> {((OrderStatus)$it).__internalSet("id", id); return this;}); - } - - public OrderStatusExpression save(UserContext userContext){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderStatusExpression save(String intent, UserContext userContext){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", OrderStatus::getPlatform)); - } - - public OrderStatusExpression updatePlatform(Platform platform){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updatePlatform(platform)); - } - - public Expression getName(){ - return loaded("name", "getName", OrderStatus::getName); - } - public OrderStatusExpression updateName(String name){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateName(name)); - } - - public Expression getCode(){ - return loaded("code", "getCode", OrderStatus::getCode); - } - public OrderStatusExpression updateCode(String code){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateCode(code)); - } - - public Expression getColor(){ - return loaded("color", "getColor", OrderStatus::getColor); - } - public OrderStatusExpression updateColor(String color){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateColor(color)); - } - - public Expression getDisplayOrder(){ - return loaded("display_order", "getDisplayOrder", OrderStatus::getDisplayOrder); - } - public OrderStatusExpression updateDisplayOrder(BigDecimal displayOrder){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).updateDisplayOrder(displayOrder)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", OrderStatus::getCustomerOrderList)); - } - public OrderStatusExpression addCustomerOrder(CustomerOrder customerOrder){ - return new OrderStatusExpression(this, $it -> ((OrderStatus)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java deleted file mode 100644 index 483767e21..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.requesttreeorderservice.orderstatus; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderStatusListExpression extends SmartListExpression { - public OrderStatusListExpression(Expression> expression){ - super(expression); - } - - public OrderStatusListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderStatusExpression first() { - return new OrderStatusExpression(super.first()); - } - - public OrderStatusExpression get(int index) { - return new OrderStatusExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java deleted file mode 100644 index 05a90f705..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/orderstatus/OrderStatusRequest.java +++ /dev/null @@ -1,1385 +0,0 @@ - -package com.example.requesttreeorderservice.orderstatus; - -import com.example.requesttreeorderservice.Q; -import com.example.requesttreeorderservice.customerorder.CustomerOrder; -import com.example.requesttreeorderservice.customerorder.CustomerOrderRequest; -import com.example.requesttreeorderservice.platform.Platform; -import com.example.requesttreeorderservice.platform.PlatformRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.math.BigDecimal; -import java.util.Objects; - -public class OrderStatusRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderStatusRequest(Class returnType){ - this(returnType, () -> (T) new OrderStatus()); - } - - protected OrderStatusRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderStatusRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderStatusRequest copy(){ - return (OrderStatusRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderStatusRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderStatusRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderStatusRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderStatusRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderStatusRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderStatusRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderStatusRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderStatusRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderStatusRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderStatusRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderStatusRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderStatusRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderStatusRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderStatusRequest matchingAnyOf(OrderStatusRequest orderStatus){ - super.internalMatchAny(orderStatus); - return this; - } - - public OrderStatusRequest matchingIdsOf(OrderStatusRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderStatus.ID_PROPERTY, request, OrderStatus.ID_PROPERTY)); - } - - public OrderStatusRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderStatusRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderStatusRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderStatusRequest selectSelf(){ - super.selectSelf(); - return selectPlatformIdOnly().selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectVersion(); - } - - public OrderStatusRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderStatusRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderStatus.PLATFORM_PROPERTY); - selectProperty(OrderStatus.ID_PROPERTY); - selectProperty(OrderStatus.NAME_PROPERTY); - selectProperty(OrderStatus.CODE_PROPERTY); - selectProperty(OrderStatus.COLOR_PROPERTY); - selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); - selectProperty(OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest selectAll(){ - super.selectAll(); - return selectPlatform().selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectVersion(); - } - - public OrderStatusRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectPlatform().selectId().selectName().selectCode().selectColor().selectDisplayOrder().selectVersion(); - } - - - public OrderStatusRequest selectPlatformIdOnly(){ - selectProperty(OrderStatus.PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public OrderStatusRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(OrderStatus.PLATFORM_PROPERTY); - enhanceRelation(OrderStatus.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, OrderStatus.PLATFORM_PROPERTY)); - return this; - } - - public OrderStatusRequest unselectPlatform(){ - unselectProperty(OrderStatus.PLATFORM_PROPERTY); - return this; - } - public OrderStatusRequest selectId(){ - selectProperty(OrderStatus.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectId(){ - unselectProperty(OrderStatus.ID_PROPERTY); - return this; - } - public OrderStatusRequest selectName(){ - selectProperty(OrderStatus.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectName(){ - unselectProperty(OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest selectCode(){ - selectProperty(OrderStatus.CODE_PROPERTY); - return this; - } - - /** - * fill the code with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS code) to fetch code property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectCode(){ - unselectProperty(OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest selectColor(){ - selectProperty(OrderStatus.COLOR_PROPERTY); - return this; - } - - /** - * fill the color with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS color) to fetch color property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectColor(){ - unselectProperty(OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest selectDisplayOrder(){ - selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - /** - * fill the displayOrder with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS displayOrder) to fetch displayOrder property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - /** - * fill the displayOrder with customized aggrFunction, TEAQL uses ({aggrFunction}(displayOrder) AS displayOrder to fetch displayOrder property. - * @param aggrFunction aggrFunction - */ - public OrderStatusRequest selectDisplayOrder(AggrFunction aggrFunction){ - selectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY, aggrFunction); - return this; - } - - - public OrderStatusRequest unselectDisplayOrder(){ - unselectProperty(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest selectVersion(){ - selectProperty(OrderStatus.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderStatusRequest unselectVersion(){ - unselectProperty(OrderStatus.VERSION_PROPERTY); - return this; - } - public OrderStatusRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public OrderStatusRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public OrderStatusRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public OrderStatusRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public OrderStatusRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.PLATFORM_PROPERTY, operator, values); - } - - public OrderStatusRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public OrderStatusRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public OrderStatusRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderStatus.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public OrderStatusRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.ID_PROPERTY, operator, values); - } - - public OrderStatusRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderStatusRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderStatusRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderStatusRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderStatusRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public OrderStatusRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public OrderStatusRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public OrderStatusRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.NAME_PROPERTY, operator, values); - } - - public OrderStatusRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public OrderStatusRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public OrderStatusRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public OrderStatusRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public OrderStatusRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public OrderStatusRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public OrderStatusRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public OrderStatusRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public OrderStatusRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public OrderStatusRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public OrderStatusRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public OrderStatusRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public OrderStatusRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public OrderStatusRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public OrderStatusRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public OrderStatusRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public OrderStatusRequest filterByCode(String... code){ - if (code == null || code.length == 0) { - throw new IllegalArgumentException("filterByCode parameter code cannot be empty"); - } - return appendSearchCriteria(createCodeCriteria(Operator.EQUAL, (Object[])code)); - } - - public OrderStatusRequest withCode(Operator operator, Object... values){ - return appendSearchCriteria(createCodeCriteria(operator, values)); - } - - public OrderStatusRequest withCodeIsUnknown(){ - return withCode(Operator.IS_NULL); - } - - public OrderStatusRequest withCodeIsKnown(){ - return withCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.CODE_PROPERTY, operator, values); - } - - public OrderStatusRequest withCodeIsNot(String code){ - return withCode(Operator.NOT_EQUAL, code); - } - - public OrderStatusRequest withCodeIn(String... code){ - return withCode(Operator.IN, (Object[])code); - } - - public OrderStatusRequest withCodeNotIn(String... code){ - return withCode(Operator.NOT_IN, (Object[])code); - } - public OrderStatusRequest withCodeGreaterThan(String code){ - return withCode(Operator.GREATER_THAN, code); - } - - public OrderStatusRequest withCodeGreaterThanOrEqualTo(String code){ - return withCode(Operator.GREATER_THAN_OR_EQUAL, code); - } - - public OrderStatusRequest withCodeLessThan(String code){ - return withCode(Operator.LESS_THAN, code); - } - - public OrderStatusRequest withCodeLessThanOrEqualTo(String code){ - return withCode(Operator.LESS_THAN_OR_EQUAL, code); - } - - public OrderStatusRequest withCodeBetween(String startOfCode, String endOfCode){ - return withCode(Operator.BETWEEN, startOfCode, endOfCode); - } - public OrderStatusRequest withCodeStartingWith(String code){ - return withCode(Operator.BEGIN_WITH, code); - } - public OrderStatusRequest withCodeContaining(String code){ - return withCode(Operator.CONTAIN, code); - } - - public OrderStatusRequest withCodeNotContaining(String code){ - return withCode(Operator.NOT_CONTAIN, code); - } - - public OrderStatusRequest withCodeNotStartingWith(String code){ - return withCode(Operator.NOT_BEGIN_WITH, code); - } - - public OrderStatusRequest withCodeEndingWith(String code){ - return withCode(Operator.END_WITH, code); - } - - public OrderStatusRequest withCodeNotEndingWith(String code){ - return withCode(Operator.NOT_END_WITH, code); - } - - public OrderStatusRequest withCodeIs(String code){ - return withCode(Operator.EQUAL, code); - } - - public OrderStatusRequest withCodeSoundingLike(String code){ - return withCode(Operator.SOUNDS_LIKE, code); - } - - - - public OrderStatusRequest filterByColor(String... color){ - if (color == null || color.length == 0) { - throw new IllegalArgumentException("filterByColor parameter color cannot be empty"); - } - return appendSearchCriteria(createColorCriteria(Operator.EQUAL, (Object[])color)); - } - - public OrderStatusRequest withColor(Operator operator, Object... values){ - return appendSearchCriteria(createColorCriteria(operator, values)); - } - - public OrderStatusRequest withColorIsUnknown(){ - return withColor(Operator.IS_NULL); - } - - public OrderStatusRequest withColorIsKnown(){ - return withColor(Operator.IS_NOT_NULL); - } - - public SearchCriteria createColorCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.COLOR_PROPERTY, operator, values); - } - - public OrderStatusRequest withColorIsNot(String color){ - return withColor(Operator.NOT_EQUAL, color); - } - - public OrderStatusRequest withColorIn(String... color){ - return withColor(Operator.IN, (Object[])color); - } - - public OrderStatusRequest withColorNotIn(String... color){ - return withColor(Operator.NOT_IN, (Object[])color); - } - public OrderStatusRequest withColorGreaterThan(String color){ - return withColor(Operator.GREATER_THAN, color); - } - - public OrderStatusRequest withColorGreaterThanOrEqualTo(String color){ - return withColor(Operator.GREATER_THAN_OR_EQUAL, color); - } - - public OrderStatusRequest withColorLessThan(String color){ - return withColor(Operator.LESS_THAN, color); - } - - public OrderStatusRequest withColorLessThanOrEqualTo(String color){ - return withColor(Operator.LESS_THAN_OR_EQUAL, color); - } - - public OrderStatusRequest withColorBetween(String startOfColor, String endOfColor){ - return withColor(Operator.BETWEEN, startOfColor, endOfColor); - } - public OrderStatusRequest withColorStartingWith(String color){ - return withColor(Operator.BEGIN_WITH, color); - } - public OrderStatusRequest withColorContaining(String color){ - return withColor(Operator.CONTAIN, color); - } - - public OrderStatusRequest withColorNotContaining(String color){ - return withColor(Operator.NOT_CONTAIN, color); - } - - public OrderStatusRequest withColorNotStartingWith(String color){ - return withColor(Operator.NOT_BEGIN_WITH, color); - } - - public OrderStatusRequest withColorEndingWith(String color){ - return withColor(Operator.END_WITH, color); - } - - public OrderStatusRequest withColorNotEndingWith(String color){ - return withColor(Operator.NOT_END_WITH, color); - } - - public OrderStatusRequest withColorIs(String color){ - return withColor(Operator.EQUAL, color); - } - - public OrderStatusRequest withColorSoundingLike(String color){ - return withColor(Operator.SOUNDS_LIKE, color); - } - - - - public OrderStatusRequest filterByDisplayOrder(BigDecimal... displayOrder){ - if (displayOrder == null || displayOrder.length == 0) { - throw new IllegalArgumentException("filterByDisplayOrder parameter displayOrder cannot be empty"); - } - return appendSearchCriteria(createDisplayOrderCriteria(Operator.EQUAL, (Object[])displayOrder)); - } - - public OrderStatusRequest withDisplayOrder(Operator operator, Object... values){ - return appendSearchCriteria(createDisplayOrderCriteria(operator, values)); - } - - public OrderStatusRequest withDisplayOrderIsUnknown(){ - return withDisplayOrder(Operator.IS_NULL); - } - - public OrderStatusRequest withDisplayOrderIsKnown(){ - return withDisplayOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDisplayOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.DISPLAY_ORDER_PROPERTY, operator, values); - } - - public OrderStatusRequest withDisplayOrderIs(BigDecimal displayOrder){ - return withDisplayOrder(Operator.EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderIsNot(BigDecimal displayOrder){ - return withDisplayOrder(Operator.NOT_EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.IN, (Object[])displayOrder); - } - - public OrderStatusRequest withDisplayOrderNotIn(BigDecimal... displayOrder){ - return withDisplayOrder(Operator.NOT_IN, (Object[])displayOrder); - } - public OrderStatusRequest withDisplayOrderGreaterThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN, displayOrder); - } - - public OrderStatusRequest withDisplayOrderGreaterThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.GREATER_THAN_OR_EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderLessThan(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN, displayOrder); - } - - public OrderStatusRequest withDisplayOrderLessThanOrEqualTo(BigDecimal displayOrder){ - return withDisplayOrder(Operator.LESS_THAN_OR_EQUAL, displayOrder); - } - - public OrderStatusRequest withDisplayOrderBetween(BigDecimal startOfDisplayOrder, BigDecimal endOfDisplayOrder){ - return withDisplayOrder(Operator.BETWEEN, startOfDisplayOrder, endOfDisplayOrder); - } - - - - public OrderStatusRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderStatusRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderStatusRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderStatusRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderStatus.VERSION_PROPERTY, operator, values); - } - - public OrderStatusRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderStatusRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderStatusRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderStatusRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderStatusRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderStatusRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderStatusRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderStatusRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderStatusRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public OrderStatusRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY)); - } - - public OrderStatusRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(OrderStatus.ID_PROPERTY, customerOrderRequest, CustomerOrder.STATUS_PROPERTY))); - } - - public OrderStatusRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public OrderStatusRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public OrderStatusRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderStatusRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderStatusRequest minDisplayOrder(){ - return minDisplayOrderAs(prefix("minOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest minDisplayOrderAs(String retName){ - super.min(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest maxDisplayOrder(){ - return maxDisplayOrderAs(prefix("maxOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest maxDisplayOrderAs(String retName){ - super.max(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest sumDisplayOrder(){ - return sumDisplayOrderAs(prefix("sumOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest sumDisplayOrderAs(String retName){ - super.sum(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest avgDisplayOrder(){ - return avgDisplayOrderAs(prefix("avgOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest avgDisplayOrderAs(String retName){ - super.avg(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest standardDeviationDisplayOrder(){ - return standardDeviationDisplayOrderAs(prefix("standardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest standardDeviationDisplayOrderAs(String retName){ - super.standardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrder(){ - return squareRootOfPopulationStandardDeviationDisplayOrderAs(prefix("squareRootOfPopulationStandardDeviationOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest squareRootOfPopulationStandardDeviationDisplayOrderAs(String retName){ - super.squareRootOfPopulationStandardDeviation(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest sampleVarianceDisplayOrder(){ - return sampleVarianceDisplayOrderAs(prefix("sampleVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest sampleVarianceDisplayOrderAs(String retName){ - super.sampleVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest samplePopulationVarianceDisplayOrder(){ - return samplePopulationVarianceDisplayOrderAs(prefix("samplePopulationVarianceOf",OrderStatus.DISPLAY_ORDER_PROPERTY)); - } - - public OrderStatusRequest samplePopulationVarianceDisplayOrderAs(String retName){ - super.samplePopulationVariance(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public OrderStatusRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(OrderStatus.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - - - - public OrderStatusRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public OrderStatusRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.PLATFORM_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderStatusRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.ID_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public OrderStatusRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctCode(){ - return countDistinctCodeAs("code_distinct_count"); - } - - public OrderStatusRequest countDistinctCodeAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctColor(){ - return countDistinctColorAs("color_distinct_count"); - } - - public OrderStatusRequest countDistinctColorAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctDisplayOrder(){ - return countDistinctDisplayOrderAs("display_order_distinct_count"); - } - - public OrderStatusRequest countDistinctDisplayOrderAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - public OrderStatusRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderStatusRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderStatus.VERSION_PROPERTY); - return this; - } - public OrderStatusRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public OrderStatusRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(OrderStatus.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public OrderStatusRequest groupByPlatform(){ - groupBy(OrderStatus.PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest groupByPlatformAs(String retName){ - groupBy(retName, OrderStatus.PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.PLATFORM_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupById(){ - groupBy(OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest groupByIdAs(String retName){ - groupBy(retName, OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.ID_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByName(){ - groupBy(OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest groupByNameAs(String retName){ - groupBy(retName, OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.NAME_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByCode(){ - groupBy(OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest groupByCodeAs(String retName){ - groupBy(retName, OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest groupByCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.CODE_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByColor(){ - groupBy(OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest groupByColorAs(String retName){ - groupBy(retName, OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest groupByColorWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.COLOR_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByDisplayOrder(){ - groupBy(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest groupByDisplayOrderAs(String retName){ - groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest groupByDisplayOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.DISPLAY_ORDER_PROPERTY, function); - return this; - } - - public OrderStatusRequest groupByVersion(){ - groupBy(OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest groupByVersionAs(String retName){ - groupBy(retName, OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderStatus.VERSION_PROPERTY, function); - return this; - } - - - - public OrderStatusRequest orderByPlatformAscending(){ - addOrderByAscending(OrderStatus.PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest orderByPlatformDescending(){ - addOrderByDescending(OrderStatus.PLATFORM_PROPERTY); - return this; - } - - public OrderStatusRequest orderByIdAscending(){ - addOrderByAscending(OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest orderByIdDescending(){ - addOrderByDescending(OrderStatus.ID_PROPERTY); - return this; - } - - public OrderStatusRequest orderByNameAscending(){ - addOrderByAscending(OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest orderByNameDescending(){ - addOrderByDescending(OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderStatus.NAME_PROPERTY); - return this; - } - - public OrderStatusRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderStatus.NAME_PROPERTY); - return this; - } - public OrderStatusRequest orderByCodeAscending(){ - addOrderByAscending(OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest orderByCodeDescending(){ - addOrderByDescending(OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest orderByCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderStatus.CODE_PROPERTY); - return this; - } - - public OrderStatusRequest orderByCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderStatus.CODE_PROPERTY); - return this; - } - public OrderStatusRequest orderByColorAscending(){ - addOrderByAscending(OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest orderByColorDescending(){ - addOrderByDescending(OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest orderByColorAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderStatus.COLOR_PROPERTY); - return this; - } - - public OrderStatusRequest orderByColorDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderStatus.COLOR_PROPERTY); - return this; - } - public OrderStatusRequest orderByDisplayOrderAscending(){ - addOrderByAscending(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest orderByDisplayOrderDescending(){ - addOrderByDescending(OrderStatus.DISPLAY_ORDER_PROPERTY); - return this; - } - - public OrderStatusRequest orderByVersionAscending(){ - addOrderByAscending(OrderStatus.VERSION_PROPERTY); - return this; - } - - public OrderStatusRequest orderByVersionDescending(){ - addOrderByDescending(OrderStatus.VERSION_PROPERTY); - return this; - } - - - public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public OrderStatusRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - - - - public OrderStatusRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.STATUS_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.STATUS_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest minTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("minTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name){ - return minTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest minTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest maxTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("maxTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name){ - return maxTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest maxTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest sumTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("sumTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name){ - return sumTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest sumTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest avgTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("avgTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name){ - return avgTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest avgTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return standardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest standardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("stdDevPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name){ - return squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varSampTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name){ - return sampleVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest sampleVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrders(){ - addRelationScalarAggregate("varPopTotalAmountOfCustomerOrders", Q.customerOrders().unlimited(), - CustomerOrder.STATUS_PROPERTY, CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrders", null, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name){ - return samplePopulationVarianceTotalAmountOfCustomerOrdersAs(name, Q.customerOrders().unlimited()); - } - - public OrderStatusRequest samplePopulationVarianceTotalAmountOfCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - addRelationScalarAggregate(name, subRequest, CustomerOrder.STATUS_PROPERTY, - CustomerOrder.TOTAL_AMOUNT_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceTotalAmountOfCustomerOrdersAs", name, OrderStatus.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public OrderStatusRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public OrderStatusRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, OrderStatus.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, OrderStatus.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderStatusRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderStatusRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderStatusRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderStatusRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderStatusRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderStatusRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java deleted file mode 100644 index 41af7d99f..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/Platform.java +++ /dev/null @@ -1,152 +0,0 @@ - -package com.example.requesttreeorderservice.platform; - -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "5fc644cb1f2eea3001a51825735535d27d0cefa47fe9e256c92d24309fc93c0f"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_status_list", "customer_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String ORDER_STATUS_LIST_PROPERTY = "order_status_list"; - public static final String CUSTOMER_LIST_PROPERTY = "customer_list"; - private String name; - - private SmartList orderStatusList; - private SmartList customerList; - - public String getName(){ - return this.name; - } - - public SmartList getOrderStatusList(){ - return this.orderStatusList == null ? SmartList.unloaded() : this.orderStatusList; - } - public SmartList getCustomerList(){ - return this.customerList == null ? SmartList.unloaded() : this.customerList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform addOrderStatus(OrderStatus orderStatus){ - if (orderStatus == null){ - return this; - } - - if(null == this.orderStatusList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderStatusList = teaqlUnloadedItems.map(value -> value); - } - - this.orderStatusList.add(orderStatus); - orderStatus.updatePlatform(this); - return this; - } - public Platform addCustomer(Customer customer){ - if (customer == null){ - return this; - } - - if(null == this.customerList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerList = teaqlUnloadedItems.map(value -> value); - } - - this.customerList.add(customer); - customer.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "order_status_list": this.orderStatusList = (SmartList) value; break; - case "customer_list": this.customerList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "order_status_list": return this.orderStatusList; - case "customer_list": return this.customerList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java deleted file mode 100644 index 21ff31db5..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformChecker.java +++ /dev/null @@ -1,58 +0,0 @@ - -package com.example.requesttreeorderservice.platform; - -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerChecker; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; platform.getOrderStatusList() != null && i < platform.getOrderStatusList().size(); i++){ - OrderStatus orderStatus = platform.getOrderStatusList().get(i); - new OrderStatusChecker().checkAndFix(_context, orderStatus, newLocation(_parentLocation, "order_status_list", i)); - } - for(int i = 0; platform.getCustomerList() != null && i < platform.getCustomerList().size(); i++){ - Customer customer = platform.getCustomerList().get(i); - new CustomerChecker().checkAndFix(_context, customer, newLocation(_parentLocation, "customer_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java deleted file mode 100644 index 7f1880f43..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformExpression.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.example.requesttreeorderservice.platform; - -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerListExpression; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public OrderStatusListExpression getOrderStatusList(){ - return new OrderStatusListExpression(loaded("order_status_list", "getOrderStatusList", Platform::getOrderStatusList)); - } - public CustomerListExpression getCustomerList(){ - return new CustomerListExpression(loaded("customer_list", "getCustomerList", Platform::getCustomerList)); - } - public PlatformExpression addOrderStatus(OrderStatus orderStatus){ - return new PlatformExpression(this, $it -> ((Platform)$it).addOrderStatus(orderStatus)); - } - public PlatformExpression addCustomer(Customer customer){ - return new PlatformExpression(this, $it -> ((Platform)$it).addCustomer(customer)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java deleted file mode 100644 index 67a967af2..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.example.requesttreeorderservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java deleted file mode 100644 index e2b4cae1f..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/platform/PlatformRequest.java +++ /dev/null @@ -1,835 +0,0 @@ - -package com.example.requesttreeorderservice.platform; - -import com.example.requesttreeorderservice.Q; -import com.example.requesttreeorderservice.customer.Customer; -import com.example.requesttreeorderservice.customer.CustomerRequest; -import com.example.requesttreeorderservice.orderstatus.OrderStatus; -import com.example.requesttreeorderservice.orderstatus.OrderStatusRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectOrderStatusList().selectCustomerList(); - return selectId().selectName().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectOrderStatusList(){ - return selectOrderStatusListWith(Q.orderStatuses().selectSelf()); - } - - public PlatformRequest selectOrderStatusListWith(OrderStatusRequest orderStatusList){ - enhanceRelation(Platform.ORDER_STATUS_LIST_PROPERTY, orderStatusList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderStatusListWith", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest selectCustomerList(){ - return selectCustomerListWith(Q.customers().selectSelf()); - } - - public PlatformRequest selectCustomerListWith(CustomerRequest customerList){ - enhanceRelation(Platform.CUSTOMER_LIST_PROPERTY, customerList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerListWith", null, Platform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, orderStatusRequest, OrderStatus.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutOrderStatusListMatching(OrderStatusRequest orderStatusRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, orderStatusRequest, OrderStatus.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveOrderStatuses(){ - return withOrderStatusListMatching(Q.orderStatuses().unlimited()); - } - - public PlatformRequest haveNoOrderStatuses(){ - return withoutOrderStatusListMatching(Q.orderStatuses().unlimited()); - } - public PlatformRequest withCustomerListMatching(CustomerRequest customerRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerRequest, Customer.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutCustomerListMatching(CustomerRequest customerRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerRequest, Customer.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveCustomers(){ - return withCustomerListMatching(Q.customers().unlimited()); - } - - public PlatformRequest haveNoCustomers(){ - return withoutCustomerListMatching(Q.customers().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupByOrderStatusesWithDetails(OrderStatusRequest subRequest){ - aggregate(Platform.ORDER_STATUS_LIST_PROPERTY, subRequest); - return this; - } - public PlatformRequest groupByCustomersWithDetails(CustomerRequest subRequest){ - aggregate(Platform.CUSTOMER_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(name, subRequest, false); - } - - public PlatformRequest statsFromOrderStatusesAs(String name, OrderStatusRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromOrderStatuses(OrderStatusRequest subRequest){ - return statsFromOrderStatusesAs(REFINEMENTS, subRequest); - } - public PlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest){ - return statsFromCustomersAs(name, subRequest, false); - } - - public PlatformRequest statsFromCustomersAs(String name, CustomerRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Customer.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomersAs", name, Platform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromCustomers(CustomerRequest subRequest){ - return statsFromCustomersAs(REFINEMENTS, subRequest); - } - public PlatformRequest countOrderStatuses(){ - addRelationCount("Count", Q.orderStatuses().unlimited(), OrderStatus.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countOrderStatusesAs(String name){ - addRelationCount(name, Q.orderStatuses().unlimited(), OrderStatus.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countOrderStatusesWith(String name, OrderStatusRequest subRequest){ - addRelationCount(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderStatusesWith", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest countCustomers(){ - addRelationCount("Count", Q.customers().unlimited(), Customer.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomers", null, Platform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countCustomersAs(String name){ - addRelationCount(name, Q.customers().unlimited(), Customer.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersAs", name, Platform.CUSTOMER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countCustomersWith(String name, CustomerRequest subRequest){ - addRelationCount(name, subRequest, Customer.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomersWith", name, Platform.CUSTOMER_LIST_PROPERTY)); - return this; - } - public PlatformRequest minDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("minDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest minDisplayOrderOfOrderStatusesAs(String name){ - return minDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest minDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("min".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "minDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest maxDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("maxDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest maxDisplayOrderOfOrderStatusesAs(String name){ - return maxDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest maxDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("max".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "maxDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest sumDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("sumDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sumDisplayOrderOfOrderStatusesAs(String name){ - return sumDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest sumDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("sum".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sumDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest avgDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("avgDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest avgDisplayOrderOfOrderStatusesAs(String name){ - return avgDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest avgDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("avg".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "avgDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest standardDeviationDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("stdDevDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name){ - return standardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest standardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "standardDeviationDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("stdDevPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name){ - return squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("stddev_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "squareRootOfPopulationStandardDeviationDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest sampleVarianceDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("varSampDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name){ - return sampleVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest sampleVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_samp".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "sampleVarianceDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - public PlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatuses(){ - addRelationScalarAggregate("varPopDisplayOrderOfOrderStatuses", Q.orderStatuses().unlimited(), - OrderStatus.PLATFORM_PROPERTY, OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatuses", null, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - public PlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name){ - return samplePopulationVarianceDisplayOrderOfOrderStatusesAs(name, Q.orderStatuses().unlimited()); - } - - public PlatformRequest samplePopulationVarianceDisplayOrderOfOrderStatusesAs(String name, OrderStatusRequest subRequest){ - addRelationScalarAggregate(name, subRequest, OrderStatus.PLATFORM_PROPERTY, - OrderStatus.DISPLAY_ORDER_PROPERTY, - io.teaql.core.AggrFunction.valueOf("var_pop".toUpperCase(java.util.Locale.ROOT)), - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "samplePopulationVarianceDisplayOrderOfOrderStatusesAs", name, Platform.ORDER_STATUS_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java b/examples/standard-order/java-app-console/lib/src/main/java/com/example/requesttreeorderservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/standard-order/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/standard-order/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index 492cc4412..000000000 --- a/examples/standard-order/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.example.requesttreeorderservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/standard-order/showcase.json b/examples/standard-order/showcase.json index e8ef87f95..2c82adbf7 100644 --- a/examples/standard-order/showcase.json +++ b/examples/standard-order/showcase.json @@ -44,6 +44,7 @@ ], "generatedFilesManifestSHA256": "0f6b10bd4045061b0caf8f1434c305b3bac40e34cfb7a93463242c99a85b87cd", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } diff --git a/examples/standard-order/verify.sh b/examples/standard-order/verify.sh index b1469c49c..773cb3316 100644 --- a/examples/standard-order/verify.sh +++ b/examples/standard-order/verify.sh @@ -19,7 +19,7 @@ else unset TEAQL_TELEMETRY_ENABLED TEAQL_TELEMETRY_SERVICE_NAME TEAQL_TELEMETRY_OTLP_ENDPOINT fi hash_library() { - (cd "$example" && find java-lib-core java-app-console/lib -type f \ + (cd "$example" && find java-lib-core -type f \ ! -path '*/target/*' -print0 | sort -z | xargs -0 sha256sum) } hash_library > "$evidence/generated-before.sha256" diff --git a/examples/trace-chain/java-app-console/lib/pom.xml b/examples/trace-chain/java-app-console/lib/pom.xml deleted file mode 100644 index 178e63624..000000000 --- a/examples/trace-chain/java-app-console/lib/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - 4.0.0 - - com.teaql - trace-chain-service-core - 0.0.1-SNAPSHOT - jar - - - 21 - 6.3.0 - UTF-8 - true - - - - - teaql - https://maven.teaql.io/repository/maven-releases/ - - - - - - io.teaql - teaql-sqlite - 6.3.0 - - - io.teaql - teaql-core - ${teaql.version} - - - io.teaql - teaql-runtime - ${teaql.version} - - - cn.hutool - hutool-all - 5.8.20 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.12.1 - - ${java.version} - ${maven.compiler.parameters} - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.5.0 - - - enforce-java-version - - enforce - - - - - [${java.version},) - - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.0 - - - attach-sources - - jar-no-fork - - - - - - - - - - target-repo - https://maven.teaql.io/repository/maven-releases/ - - - \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/BaseServiceConfiguration.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Checkers.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Checkers.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Constants.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Constants.java deleted file mode 100644 index 75826fd12..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Constants.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.teaql.tracechainservice; - -import com.teaql.tracechainservice.platform.Platform; - -public interface Constants { - public static final long PLATFORM_ID = 1l; - public static final Platform PLATFORM = Platform.refer(PLATFORM_ID); -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/E.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/E.java deleted file mode 100644 index 0ae2c18a9..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/E.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.teaql.tracechainservice; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; -import com.teaql.tracechainservice.orderitem.OrderItem; -import com.teaql.tracechainservice.orderitem.OrderItemExpression; -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentExpression; -import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; -import com.teaql.tracechainservice.paymentattempt.PaymentAttemptExpression; -import com.teaql.tracechainservice.platform.Platform; -import com.teaql.tracechainservice.platform.PlatformExpression; -import com.teaql.tracechainservice.shipment.Shipment; -import com.teaql.tracechainservice.shipment.ShipmentExpression; -import io.teaql.core.checker.JsonFieldNamingProfile; -import io.teaql.core.value.ValueExpression; - -public class E { - public static PlatformExpression platform(Platform platform){ - return new PlatformExpression(new ValueExpression(platform, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.platform()")); - } - public static CustomerOrderExpression customerOrder(CustomerOrder customerOrder){ - return new CustomerOrderExpression(new ValueExpression(customerOrder, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.customerOrder()")); - } - public static OrderItemExpression orderItem(OrderItem orderItem){ - return new OrderItemExpression(new ValueExpression(orderItem, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.orderItem()")); - } - public static PaymentExpression payment(Payment payment){ - return new PaymentExpression(new ValueExpression(payment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.payment()")); - } - public static PaymentAttemptExpression paymentAttempt(PaymentAttempt paymentAttempt){ - return new PaymentAttemptExpression(new ValueExpression(paymentAttempt, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.paymentAttempt()")); - } - public static ShipmentExpression shipment(Shipment shipment){ - return new ShipmentExpression(new ValueExpression(shipment, JsonFieldNamingProfile.fromModelValue("camelCase"), "E.shipment()")); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java deleted file mode 100644 index 75a93b749..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/EntityMetaRegistry.java +++ /dev/null @@ -1,799 +0,0 @@ - -package com.teaql.tracechainservice; - -import io.teaql.core.FieldLayout; -import io.teaql.core.meta.EntityDescriptor; -import io.teaql.core.meta.EntityMetaAssembler; -import io.teaql.core.meta.EntityMetaFactory; -import io.teaql.core.meta.PropertyDescriptor; - -public class EntityMetaRegistry implements EntityMetaAssembler { - private EntityMetaFactory $factory; - - @Override - public void assemble(EntityMetaFactory factory) { - this.$factory = factory; - registerPlatform(); - registerCustomerOrder(); - registerOrderItem(); - registerPayment(); - registerPaymentAttempt(); - registerShipment(); - } - private void registerPlatform() { - FieldLayout.installGenerated(com.teaql.tracechainservice.platform.Platform.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.tracechainservice.platform.Platform.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.tracechainservice.platform.Platform.class); - entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.platform.Platform::new); - entityDescriptor.with("name", "Platform") - - .with("module", "Trace Chain") - - .with("module_key", "trace-chain") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY, Long.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("candidates", "Trace Chain Verification") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.platform.Platform.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerCustomerOrder() { - FieldLayout.installGenerated(com.teaql.tracechainservice.customerorder.CustomerOrder.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.tracechainservice.customerorder.CustomerOrder.class); - entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.customerorder.CustomerOrder::new); - entityDescriptor.with("name", "Customer Order") - - .with("module", "Trace Chain") - - .with("module_key", "trace-chain") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY, Long.class) - ; - PropertyDescriptor platform = - entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.customerorder.CustomerOrder.PLATFORM_PROPERTY, com.teaql.tracechainservice.platform.Platform.INTERNAL_TYPE, com.teaql.tracechainservice.platform.Platform.CUSTOMER_ORDER_LIST_PROPERTY, com.teaql.tracechainservice.platform.Platform.class) - ; - PropertyDescriptor orderNumber = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY, String.class) - ; - PropertyDescriptor description = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.PLATFORM_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_NUMBER_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.DESCRIPTION_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.customerorder.CustomerOrder.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerOrderItem() { - FieldLayout.installGenerated(com.teaql.tracechainservice.orderitem.OrderItem.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.tracechainservice.orderitem.OrderItem.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.tracechainservice.orderitem.OrderItem.class); - entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.orderitem.OrderItem::new); - entityDescriptor.with("name", "Order Item") - - .with("module", "Trace Chain") - - .with("module_key", "trace-chain") - - .with("audit_mask_fields", "name") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY)); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customerOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.tracechainservice.customerorder.CustomerOrder.ORDER_ITEM_LIST_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.class) - ; - PropertyDescriptor name = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.CUSTOMER_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.NAME_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.orderitem.OrderItem.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerPayment() { - FieldLayout.installGenerated(com.teaql.tracechainservice.payment.Payment.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.tracechainservice.payment.Payment.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.tracechainservice.payment.Payment.class); - entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.payment.Payment::new); - entityDescriptor.with("name", "Payment") - - .with("module", "Trace Chain") - - .with("module_key", "trace-chain") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customerOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.payment.Payment.CUSTOMER_ORDER_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.tracechainservice.customerorder.CustomerOrder.PAYMENT_LIST_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.class) - ; - PropertyDescriptor referenceCode = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.REFERENCE_CODE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.payment.Payment.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerPaymentAttempt() { - FieldLayout.installGenerated(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class); - entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.paymentattempt.PaymentAttempt::new); - entityDescriptor.with("name", "Payment Attempt") - - .with("module", "Trace Chain") - - .with("module_key", "trace-chain") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY, Long.class) - ; - PropertyDescriptor payment = - entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.paymentattempt.PaymentAttempt.PAYMENT_PROPERTY, com.teaql.tracechainservice.payment.Payment.INTERNAL_TYPE, com.teaql.tracechainservice.payment.Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, com.teaql.tracechainservice.payment.Payment.class) - ; - PropertyDescriptor referenceCode = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.PAYMENT_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.REFERENCE_CODE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } - private void registerShipment() { - FieldLayout.installGenerated(com.teaql.tracechainservice.shipment.Shipment.__TEAQL_FIELD_LAYOUT); - EntityDescriptor entityDescriptor = new EntityDescriptor(); - entityDescriptor.setType(com.teaql.tracechainservice.shipment.Shipment.INTERNAL_TYPE); - entityDescriptor.setTargetType(com.teaql.tracechainservice.shipment.Shipment.class); - entityDescriptor.setEntitySupplier(com.teaql.tracechainservice.shipment.Shipment::new); - entityDescriptor.with("name", "Shipment") - - .with("module", "Trace Chain") - - .with("module_key", "trace-chain") - ; - - entityDescriptor.setAuditMaskFields(java.util.List.of()); - PropertyDescriptor id = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY, Long.class) - ; - PropertyDescriptor customerOrder = - entityDescriptor.addObjectProperty($factory, com.teaql.tracechainservice.shipment.Shipment.CUSTOMER_ORDER_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.INTERNAL_TYPE, com.teaql.tracechainservice.customerorder.CustomerOrder.SHIPMENT_LIST_PROPERTY, com.teaql.tracechainservice.customerorder.CustomerOrder.class) - ; - PropertyDescriptor referenceCode = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY, String.class) - ; - PropertyDescriptor version = - entityDescriptor.addSimpleProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY, Long.class) - ; - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.ID_PROPERTY).with("isPassword", "false") - - .with("isVersion", "false") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "true") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.CUSTOMER_ORDER_PROPERTY).with("required", "true"); - - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.REFERENCE_CODE_PROPERTY).with("isPassword", "false") - - .with("max", "100") - - .with("isVersion", "false") - - .with("javaType", "java.lang.String") - - .with("sqlType", "VARCHAR()") - - .with("isId", "false") - - .with("isBool", "false") - - .with("isBaseEntityField", "false") - - .with("isNumber", "false") - - .with("isString", "true") - - .with("isDate", "false") - - .with("graphqlType", "String") - - .with("isTime", "false") - - .with("isText", "false") - ; - - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY).with("required", "true"); - entityDescriptor.findProperty(com.teaql.tracechainservice.shipment.Shipment.VERSION_PROPERTY).with("isPassword", "false") - - .with("isVersion", "true") - - .with("oracle_sqlType", "number(11)") - - .with("javaType", "java.lang.Long") - - .with("sqlType", "BIGINT") - - .with("isId", "false") - - .with("isBaseEntityField", "true") - - .with("isBool", "false") - - .with("isNumber", "false") - - .with("isString", "false") - - .with("isDate", "false") - - .with("snowflake_sqlType", "number") - - .with("graphqlType", "Long") - - .with("isTime", "false") - - .with("isText", "false") - ; - - $factory.register(entityDescriptor); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java deleted file mode 100644 index b55a80e8f..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/GeneratedRuntimeModule.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.teaql.tracechainservice; - -/** Passive generated manifest. Database changes require context.ensureSchema(). */ -public final class GeneratedRuntimeModule { - private static final io.teaql.core.RuntimeModule MODULE = io.teaql.core.RuntimeModule.of(new EntityMetaRegistry()) - .withCheckers(new com.teaql.tracechainservice.platform.PlatformChecker(), new com.teaql.tracechainservice.customerorder.CustomerOrderChecker(), new com.teaql.tracechainservice.orderitem.OrderItemChecker(), new com.teaql.tracechainservice.payment.PaymentChecker(), new com.teaql.tracechainservice.paymentattempt.PaymentAttemptChecker(), new com.teaql.tracechainservice.shipment.ShipmentChecker()) - .withCheckerPresentation(io.teaql.core.checker.CheckerPresentation.Model.fromJson(String.join("", "{\"schema\":\"teaql.checker-model/v1\",\"revision\":\"sha256:3360338e7162e546ad5c97348770bb50933b4da775b55b99a9707d39f93c8b0a\",\"entities\":{\"CustomerOrder\":{\"labels\":{\"en\":\"Customer Order\"},\"fields\":[{\"name\":\"description\",\"labels\":{\"en\":\"description\"},\"aliases\":[\"Description\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"order_item_list\",\"targetType\":\"OrderItem\",\"labels\":{\"en\":\"Order Item\"},\"aliases\":[\"OrderItemList\",\"orderItemList\"]},{\"name\":\"order_number\",\"labels\":{\"en\":\"order number\"},\"aliases\":[\"OrderNumber\",\"orderNumber\"]},{\"name\":\"payment_list\",\"targetType\":\"Payment\",\"labels\":{\"en\":\"Payment\"},\"aliases\":[\"PaymentList\",\"paymentList\"]},{\"name\":\"platform\",\"targetType\":\"Platform\",\"labels\":{\"en\":\"Platform\"},\"aliases\":[\"Platform\"]},{\"name\":\"shipment_list\",\"targetType\":\"Shipment\",\"labels\":{\"en\":\"Shipment\"},\"aliases\":[\"ShipmentList\",\"shipmentList\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"OrderItem\":{\"labels\":{\"en\":\"Order Item\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Payment\":{\"labels\":{\"en\":\"Payment\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"payment_attempt_list\",\"targetType\":\"PaymentAttempt\",\"labels\":{\"en\":\"Payment Attempt\"},\"aliases\":[\"PaymentAttemptList\",\"paymentAttemptList\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"PaymentAttempt\":{\"labels\":{\"en\":\"Payment Attempt\"},\"fields\":[{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"payment\",\"targetType\":\"Payment\",\"labels\":{\"en\":\"Payment\"},\"aliases\":[\"Payment\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Platform\":{\"labels\":{\"en\":\"Platform\"},\"fields\":[{\"name\":\"customer_order_list\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrderList\",\"customerOrderList\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"name\",\"labels\":{\"en\":\"name\"},\"aliases\":[\"Name\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]},\"Shipment\":{\"labels\":{\"en\":\"Shipment\"},\"fields\":[{\"name\":\"customer_order\",\"targetType\":\"CustomerOrder\",\"labels\":{\"en\":\"Customer Order\"},\"aliases\":[\"CustomerOrder\",\"customerOrder\"]},{\"name\":\"id\",\"labels\":{\"en\":\"id\"},\"aliases\":[\"Id\"]},{\"name\":\"reference_code\",\"labels\":{\"en\":\"reference code\"},\"aliases\":[\"ReferenceCode\",\"referenceCode\"]},{\"name\":\"version\",\"labels\":{\"en\":\"version\"},\"aliases\":[\"Version\"]}]}}}"))) - .withBootstrap(GeneratedRuntimeModule::ensureGeneratedBootstrap); - - private GeneratedRuntimeModule() {} - public static io.teaql.core.RuntimeModule module() { return MODULE; } - - /** Canonical KSML field to selected JSON wire name, consumed by HTTP/TFP adapters. */ - public static java.util.Map> wireFieldMappings() { - return java.util.Map.ofEntries( - java.util.Map.entry("Platform", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("CustomerOrder", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("platform", "platform"), java.util.Map.entry("order_number", "orderNumber"), java.util.Map.entry("description", "description"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("OrderItem", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("name", "name"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Payment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("reference_code", "referenceCode"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("PaymentAttempt", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("payment", "payment"), java.util.Map.entry("reference_code", "referenceCode"), java.util.Map.entry("version", "version"))), - java.util.Map.entry("Shipment", java.util.Map.ofEntries(java.util.Map.entry("id", "id"), java.util.Map.entry("customer_order", "customerOrder"), java.util.Map.entry("reference_code", "referenceCode"), java.util.Map.entry("version", "version"))) - ); - } - - /** Accepted legacy aliases; empty until explicitly declared by the model. */ - public static java.util.Map> wireFieldAliases() { - return java.util.Map.of(); - } - - private static void ensureGeneratedBootstrap(io.teaql.core.UserContext context) { - var domainRoots = Q.platforms().withIdIs(1L).comment("what: locate generated Domain Root").purpose("why: idempotent runtime bootstrap").executeForList(context); - com.teaql.tracechainservice.platform.Platform domainRoot; - if (domainRoots.isEmpty()) { - domainRoot = new com.teaql.tracechainservice.platform.Platform(); - io.teaql.core.GeneratedSchemaBootstrap.initializeFixedId(context, domainRoot, 1L); - domainRoot.updateName("Trace Chain Verification"); - domainRoot.auditAs("create generated Domain Root Platform").save(context); - } else { domainRoot = domainRoots.get(0); } - context.withActiveRoot(new io.teaql.core.ContextEntityRef("Platform", domainRoot.getId())); - } -} diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Q.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Q.java deleted file mode 100644 index ba794b229..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Q.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.teaql.tracechainservice; - -import io.teaql.core.criteria.Operator; - -public class Q { - public static com.teaql.tracechainservice.platform.PlatformRequest platforms(){ - return new com.teaql.tracechainservice.platform.PlatformRequest(com.teaql.tracechainservice.platform.Platform.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.tracechainservice.platform.PlatformRequest platformsWithMinimalFields(){ - return new com.teaql.tracechainservice.platform.PlatformRequest(com.teaql.tracechainservice.platform.Platform.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.tracechainservice.customerorder.CustomerOrderRequest customerOrders(){ - return new com.teaql.tracechainservice.customerorder.CustomerOrderRequest(com.teaql.tracechainservice.customerorder.CustomerOrder.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.tracechainservice.customerorder.CustomerOrderRequest customerOrdersWithMinimalFields(){ - return new com.teaql.tracechainservice.customerorder.CustomerOrderRequest(com.teaql.tracechainservice.customerorder.CustomerOrder.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.tracechainservice.orderitem.OrderItemRequest orderItems(){ - return new com.teaql.tracechainservice.orderitem.OrderItemRequest(com.teaql.tracechainservice.orderitem.OrderItem.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.tracechainservice.orderitem.OrderItemRequest orderItemsWithMinimalFields(){ - return new com.teaql.tracechainservice.orderitem.OrderItemRequest(com.teaql.tracechainservice.orderitem.OrderItem.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.tracechainservice.payment.PaymentRequest payments(){ - return new com.teaql.tracechainservice.payment.PaymentRequest(com.teaql.tracechainservice.payment.Payment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.tracechainservice.payment.PaymentRequest paymentsWithMinimalFields(){ - return new com.teaql.tracechainservice.payment.PaymentRequest(com.teaql.tracechainservice.payment.Payment.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest paymentAttempts(){ - return new com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest paymentAttemptsWithMinimalFields(){ - return new com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest(com.teaql.tracechainservice.paymentattempt.PaymentAttempt.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - - public static com.teaql.tracechainservice.shipment.ShipmentRequest shipments(){ - return new com.teaql.tracechainservice.shipment.ShipmentRequest(com.teaql.tracechainservice.shipment.Shipment.class).selectSelf().withVersion(Operator.GREATER_THAN, 0l); - } - public static com.teaql.tracechainservice.shipment.ShipmentRequest shipmentsWithMinimalFields(){ - return new com.teaql.tracechainservice.shipment.ShipmentRequest(com.teaql.tracechainservice.shipment.Shipment.class).withVersion(Operator.GREATER_THAN, 0l); - } - - - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Repositories.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/Repositories.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java deleted file mode 100644 index 0fb4cb2ae..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/TraceChainServiceUserContext.java +++ /dev/null @@ -1,10 +0,0 @@ - -package com.teaql.tracechainservice; - -import io.teaql.core.UserContext; -public interface TraceChainServiceUserContext extends UserContext{ - - - - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java deleted file mode 100644 index 7d8b00783..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrder.java +++ /dev/null @@ -1,216 +0,0 @@ - -package com.teaql.tracechainservice.customerorder; - -import com.teaql.tracechainservice.orderitem.OrderItem; -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.platform.Platform; -import com.teaql.tracechainservice.shipment.Shipment; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class CustomerOrder extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "CustomerOrder"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f10d535b66998395625745c0c3f6032ed01350e7f851687673b5ff1eb94a4337"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("platform", 1), java.util.Map.entry("order_number", 2), java.util.Map.entry("description", 3), java.util.Map.entry("version", 4)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("platform", java.util.List.of("platform", "platform")), java.util.Map.entry("order_number", java.util.List.of("orderNumber", "order_number")), java.util.Map.entry("description", java.util.List.of("description", "description")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "order_item_list", "payment_list", "shipment_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - CustomerOrder.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PLATFORM_PROPERTY = "platform"; - public static final String ORDER_NUMBER_PROPERTY = "order_number"; - public static final String DESCRIPTION_PROPERTY = "description"; - public static final String ORDER_ITEM_LIST_PROPERTY = "order_item_list"; - public static final String PAYMENT_LIST_PROPERTY = "payment_list"; - public static final String SHIPMENT_LIST_PROPERTY = "shipment_list"; - private Platform platform; - - private String orderNumber; - - private String description; - - private SmartList orderItemList; - private SmartList paymentList; - private SmartList shipmentList; - - public Platform getPlatform(){ - return this.platform; - } - - public String getOrderNumber(){ - return this.orderNumber; - } - - public String getDescription(){ - return this.description; - } - - public SmartList getOrderItemList(){ - return this.orderItemList == null ? SmartList.unloaded() : this.orderItemList; - } - public SmartList getPaymentList(){ - return this.paymentList == null ? SmartList.unloaded() : this.paymentList; - } - public SmartList getShipmentList(){ - return this.shipmentList == null ? SmartList.unloaded() : this.shipmentList; - } - public CustomerOrder updatePlatform(Platform platform){ - if(isPropertyLoaded(PLATFORM_PROPERTY) && Objects.equals(this.platform, platform)){ - return this; - } - handleUpdate(PLATFORM_PROPERTY, getPlatform(), platform); - this.platform = platform; - return this; - } - - public CustomerOrder updateOrderNumber(String orderNumber){ - orderNumber = (orderNumber == null ? null : orderNumber.trim()); - if(isPropertyLoaded(ORDER_NUMBER_PROPERTY) && Objects.equals(this.orderNumber, orderNumber)){ - return this; - } - handleUpdate(ORDER_NUMBER_PROPERTY, getOrderNumber(), orderNumber); - this.orderNumber = orderNumber; - return this; - } - - public CustomerOrder updateDescription(String description){ - description = (description == null ? null : description.trim()); - if(isPropertyLoaded(DESCRIPTION_PROPERTY) && Objects.equals(this.description, description)){ - return this; - } - handleUpdate(DESCRIPTION_PROPERTY, getDescription(), description); - this.description = description; - return this; - } - - public CustomerOrder addOrderItem(OrderItem orderItem){ - if (orderItem == null){ - return this; - } - - if(null == this.orderItemList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.orderItemList = teaqlUnloadedItems.map(value -> value); - } - - this.orderItemList.add(orderItem); - orderItem.updateCustomerOrder(this); - return this; - } - public CustomerOrder addPayment(Payment payment){ - if (payment == null){ - return this; - } - - if(null == this.paymentList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.paymentList = teaqlUnloadedItems.map(value -> value); - } - - this.paymentList.add(payment); - payment.updateCustomerOrder(this); - return this; - } - public CustomerOrder addShipment(Shipment shipment){ - if (shipment == null){ - return this; - } - - if(null == this.shipmentList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.shipmentList = teaqlUnloadedItems.map(value -> value); - } - - this.shipmentList.add(shipment); - shipment.updateCustomerOrder(this); - return this; - } - - public static CustomerOrder refer(Long id){ - CustomerOrder refer = new CustomerOrder(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public CustomerOrder comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "platform": this.platform = (Platform) value; break; - - case "order_number": this.orderNumber = (value == null ? null : ((String)value).trim()); break; - - case "description": this.description = (value == null ? null : ((String)value).trim()); break; - - case "order_item_list": this.orderItemList = (SmartList) value; break; - case "payment_list": this.paymentList = (SmartList) value; break; - case "shipment_list": this.shipmentList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "platform": return this.platform; - case "order_number": return this.orderNumber; - case "description": return this.description; - case "order_item_list": return this.orderItemList; - case "payment_list": return this.paymentList; - case "shipment_list": return this.shipmentList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "platform": return this.platform; - case "orderNumber": return this.orderNumber; - case "description": return this.description; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java deleted file mode 100644 index 2dbe2f874..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderChecker.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.teaql.tracechainservice.customerorder; - -import com.teaql.tracechainservice.orderitem.OrderItem; -import com.teaql.tracechainservice.orderitem.OrderItemChecker; -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentChecker; -import com.teaql.tracechainservice.platform.Platform; -import com.teaql.tracechainservice.platform.PlatformChecker; -import com.teaql.tracechainservice.shipment.Shipment; -import com.teaql.tracechainservice.shipment.ShipmentChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class CustomerOrderChecker implements Checker{ - - public String type(){ - return CustomerOrder.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if(needCheck(_context, customerOrder)){ - markAsChecked(_context, customerOrder); - doCheck(_context, customerOrder, _parentLocation); - } - } - - public void doCheck(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - if((customerOrder == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, customerOrder); - if(customerOrder.needPersist()){ - } - if(customerOrder.newItem()){ - }else if(customerOrder.updateItem()){ - if(!customerOrder.isPropertyLoaded("platform")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "platform"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("order_number")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "order_number"), "Mutation requires a fully loaded entity"); - } - if(!customerOrder.isPropertyLoaded("description")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "description"), "Mutation requires a fully loaded entity"); - } - - } - checkPlatform(_context, customerOrder.getProperty(CustomerOrder.PLATFORM_PROPERTY), newLocation(_parentLocation, "platform")); - checkOrderNumber(_context, customerOrder.getProperty(CustomerOrder.ORDER_NUMBER_PROPERTY), newLocation(_parentLocation, "order_number")); - checkDescription(_context, customerOrder.getProperty(CustomerOrder.DESCRIPTION_PROPERTY), newLocation(_parentLocation, "description")); - for(int i = 0; customerOrder.getOrderItemList() != null && i < customerOrder.getOrderItemList().size(); i++){ - OrderItem orderItem = customerOrder.getOrderItemList().get(i); - new OrderItemChecker().checkAndFix(_context, orderItem, newLocation(_parentLocation, "order_item_list", i)); - } - for(int i = 0; customerOrder.getPaymentList() != null && i < customerOrder.getPaymentList().size(); i++){ - Payment payment = customerOrder.getPaymentList().get(i); - new PaymentChecker().checkAndFix(_context, payment, newLocation(_parentLocation, "payment_list", i)); - } - for(int i = 0; customerOrder.getShipmentList() != null && i < customerOrder.getShipmentList().size(); i++){ - Shipment shipment = customerOrder.getShipmentList().get(i); - new ShipmentChecker().checkAndFix(_context, shipment, newLocation(_parentLocation, "shipment_list", i)); - } - } - - public void checkPlatform(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, platform); - if((platform == null)){ - return; - } - new PlatformChecker().checkAndFix(_context, platform, _parentLocation); - } - public void checkOrderNumber(UserContext _context, String orderNumber, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, orderNumber); - if((orderNumber == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, orderNumber); - - } - public void checkDescription(UserContext _context, String description, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, description); - if((description == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, description); - - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java deleted file mode 100644 index 05cb88590..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderExpression.java +++ /dev/null @@ -1,84 +0,0 @@ - -package com.teaql.tracechainservice.customerorder; - -import com.teaql.tracechainservice.orderitem.OrderItem; -import com.teaql.tracechainservice.orderitem.OrderItemListExpression; -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentListExpression; -import com.teaql.tracechainservice.platform.Platform; -import com.teaql.tracechainservice.platform.PlatformExpression; -import com.teaql.tracechainservice.shipment.Shipment; -import com.teaql.tracechainservice.shipment.ShipmentListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class CustomerOrderExpression extends ExpressionAdaptor implements BaseEntityExpression { - public CustomerOrderExpression(Expression expression){ - super(expression); - } - - public CustomerOrderExpression(Expression expression, Function function){ - super(expression, function); - } - - public CustomerOrderExpression updateId(Long id){ - return new CustomerOrderExpression(this, $it -> {((CustomerOrder)$it).__internalSet("id", id); return this;}); - } - - public CustomerOrderExpression save(UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs("Saved by Expression").save(userContext)); - } - - public CustomerOrderExpression save(String intent, UserContext userContext){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PlatformExpression getPlatform(){ - return new PlatformExpression(loaded("platform", "getPlatform", CustomerOrder::getPlatform)); - } - - public CustomerOrderExpression updatePlatform(Platform platform){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updatePlatform(platform)); - } - - public Expression getOrderNumber(){ - return loaded("order_number", "getOrderNumber", CustomerOrder::getOrderNumber); - } - public CustomerOrderExpression updateOrderNumber(String orderNumber){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateOrderNumber(orderNumber)); - } - - public Expression getDescription(){ - return loaded("description", "getDescription", CustomerOrder::getDescription); - } - public CustomerOrderExpression updateDescription(String description){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).updateDescription(description)); - } - - public OrderItemListExpression getOrderItemList(){ - return new OrderItemListExpression(loaded("order_item_list", "getOrderItemList", CustomerOrder::getOrderItemList)); - } - public PaymentListExpression getPaymentList(){ - return new PaymentListExpression(loaded("payment_list", "getPaymentList", CustomerOrder::getPaymentList)); - } - public ShipmentListExpression getShipmentList(){ - return new ShipmentListExpression(loaded("shipment_list", "getShipmentList", CustomerOrder::getShipmentList)); - } - public CustomerOrderExpression addOrderItem(OrderItem orderItem){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addOrderItem(orderItem)); - } - public CustomerOrderExpression addPayment(Payment payment){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addPayment(payment)); - } - public CustomerOrderExpression addShipment(Shipment shipment){ - return new CustomerOrderExpression(this, $it -> ((CustomerOrder)$it).addShipment(shipment)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java deleted file mode 100644 index 2d57458eb..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.tracechainservice.customerorder; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class CustomerOrderListExpression extends SmartListExpression { - public CustomerOrderListExpression(Expression> expression){ - super(expression); - } - - public CustomerOrderListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public CustomerOrderExpression first() { - return new CustomerOrderExpression(super.first()); - } - - public CustomerOrderExpression get(int index) { - return new CustomerOrderExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java deleted file mode 100644 index 59adf8813..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/customerorder/CustomerOrderRequest.java +++ /dev/null @@ -1,1017 +0,0 @@ - -package com.teaql.tracechainservice.customerorder; - -import com.teaql.tracechainservice.Q; -import com.teaql.tracechainservice.orderitem.OrderItem; -import com.teaql.tracechainservice.orderitem.OrderItemRequest; -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentRequest; -import com.teaql.tracechainservice.platform.Platform; -import com.teaql.tracechainservice.platform.PlatformRequest; -import com.teaql.tracechainservice.shipment.Shipment; -import com.teaql.tracechainservice.shipment.ShipmentRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class CustomerOrderRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public CustomerOrderRequest(Class returnType){ - this(returnType, () -> (T) new CustomerOrder()); - } - - protected CustomerOrderRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public CustomerOrderRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public CustomerOrderRequest copy(){ - return (CustomerOrderRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new CustomerOrderRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public CustomerOrderRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public CustomerOrderRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public CustomerOrderRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public CustomerOrderRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public CustomerOrderRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public CustomerOrderRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public CustomerOrderRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public CustomerOrderRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public CustomerOrderRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (CustomerOrderRequest)super.appendSearchCriteria(searchCriteria); - } - - public CustomerOrderRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public CustomerOrderRequest matchingAnyOf(CustomerOrderRequest customerOrder){ - super.internalMatchAny(customerOrder); - return this; - } - - public CustomerOrderRequest matchingIdsOf(CustomerOrderRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - CustomerOrder.ID_PROPERTY, request, CustomerOrder.ID_PROPERTY)); - } - - public CustomerOrderRequest enhanceChildrenIfNeeded(){ - return this; - } - - public CustomerOrderRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public CustomerOrderRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public CustomerOrderRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPlatformIdOnly().selectOrderNumber().selectDescription().selectVersion(); - } - - public CustomerOrderRequest selectSelfFields(){ - return selectSelf(); - } - - public CustomerOrderRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(CustomerOrder.ID_PROPERTY); - selectProperty(CustomerOrder.PLATFORM_PROPERTY); - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - selectProperty(CustomerOrder.DESCRIPTION_PROPERTY); - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest selectAll(){ - super.selectAll(); - return selectId().selectPlatform().selectOrderNumber().selectDescription().selectVersion(); - } - - public CustomerOrderRequest selectChildren(){ - super.selectAny(); - selectOrderItemList().selectPaymentList().selectShipmentList(); - return selectId().selectPlatform().selectOrderNumber().selectDescription().selectVersion(); - } - - - public CustomerOrderRequest selectId(){ - selectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectId(){ - unselectProperty(CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest selectPlatformIdOnly(){ - selectProperty(CustomerOrder.PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest selectPlatform(){ - return selectPlatformWith(Q.platforms().unlimited().selectSelf()); - } - - public CustomerOrderRequest selectPlatformWith(PlatformRequest platform){ - selectProperty(CustomerOrder.PLATFORM_PROPERTY); - enhanceRelation(CustomerOrder.PLATFORM_PROPERTY, platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPlatformWith", null, CustomerOrder.PLATFORM_PROPERTY)); - return this; - } - - public CustomerOrderRequest unselectPlatform(){ - unselectProperty(CustomerOrder.PLATFORM_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderNumber(){ - selectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - /** - * fill the orderNumber with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS orderNumber) to fetch orderNumber property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectOrderNumber(){ - unselectProperty(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest selectDescription(){ - selectProperty(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - - /** - * fill the description with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS description) to fetch description property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectDescription(){ - unselectProperty(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - public CustomerOrderRequest selectVersion(){ - selectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public CustomerOrderRequest unselectVersion(){ - unselectProperty(CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest selectOrderItemList(){ - return selectOrderItemListWith(Q.orderItems().selectSelf()); - } - - public CustomerOrderRequest selectOrderItemListWith(OrderItemRequest orderItemList){ - enhanceRelation(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, orderItemList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectOrderItemListWith", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest selectPaymentList(){ - return selectPaymentListWith(Q.payments().selectSelf()); - } - - public CustomerOrderRequest selectPaymentListWith(PaymentRequest paymentList){ - enhanceRelation(CustomerOrder.PAYMENT_LIST_PROPERTY, paymentList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentListWith", null, CustomerOrder.PAYMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest selectShipmentList(){ - return selectShipmentListWith(Q.shipments().selectSelf()); - } - - public CustomerOrderRequest selectShipmentListWith(ShipmentRequest shipmentList){ - enhanceRelation(CustomerOrder.SHIPMENT_LIST_PROPERTY, shipmentList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectShipmentListWith", null, CustomerOrder.SHIPMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ID_PROPERTY, operator, values); - } - - public CustomerOrderRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public CustomerOrderRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public CustomerOrderRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public CustomerOrderRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public CustomerOrderRequest filterByPlatform(Platform... platform){ - if (platform == null || platform.length == 0) { - throw new IllegalArgumentException("filterByPlatform parameter platform cannot be empty"); - } - return appendSearchCriteria(createPlatformCriteria(Operator.EQUAL, (Object[])platform)); - } - - public CustomerOrderRequest withPlatform(Operator operator, Object... values){ - return appendSearchCriteria(createPlatformCriteria(operator, values)); - } - - public CustomerOrderRequest withPlatformIsUnknown(){ - return withPlatform(Operator.IS_NULL); - } - - public CustomerOrderRequest withPlatformIsKnown(){ - return withPlatform(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPlatformCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.PLATFORM_PROPERTY, operator, values); - } - - public CustomerOrderRequest filterByPlatform(Long platform){ - if(platform == null){ - return this; - } - return withPlatform(Operator.EQUAL, platform); - } - public CustomerOrderRequest withPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY)); - } - - public CustomerOrderRequest withoutPlatformMatching(PlatformRequest platform){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(CustomerOrder.PLATFORM_PROPERTY, platform, Platform.ID_PROPERTY))); - } - - public CustomerOrderRequest filterByOrderNumber(String... orderNumber){ - if (orderNumber == null || orderNumber.length == 0) { - throw new IllegalArgumentException("filterByOrderNumber parameter orderNumber cannot be empty"); - } - return appendSearchCriteria(createOrderNumberCriteria(Operator.EQUAL, (Object[])orderNumber)); - } - - public CustomerOrderRequest withOrderNumber(Operator operator, Object... values){ - return appendSearchCriteria(createOrderNumberCriteria(operator, values)); - } - - public CustomerOrderRequest withOrderNumberIsUnknown(){ - return withOrderNumber(Operator.IS_NULL); - } - - public CustomerOrderRequest withOrderNumberIsKnown(){ - return withOrderNumber(Operator.IS_NOT_NULL); - } - - public SearchCriteria createOrderNumberCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.ORDER_NUMBER_PROPERTY, operator, values); - } - - public CustomerOrderRequest withOrderNumberIsNot(String orderNumber){ - return withOrderNumber(Operator.NOT_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIn(String... orderNumber){ - return withOrderNumber(Operator.IN, (Object[])orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotIn(String... orderNumber){ - return withOrderNumber(Operator.NOT_IN, (Object[])orderNumber); - } - public CustomerOrderRequest withOrderNumberGreaterThan(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberGreaterThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.GREATER_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThan(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberLessThanOrEqualTo(String orderNumber){ - return withOrderNumber(Operator.LESS_THAN_OR_EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberBetween(String startOfOrderNumber, String endOfOrderNumber){ - return withOrderNumber(Operator.BETWEEN, startOfOrderNumber, endOfOrderNumber); - } - public CustomerOrderRequest withOrderNumberStartingWith(String orderNumber){ - return withOrderNumber(Operator.BEGIN_WITH, orderNumber); - } - public CustomerOrderRequest withOrderNumberContaining(String orderNumber){ - return withOrderNumber(Operator.CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotContaining(String orderNumber){ - return withOrderNumber(Operator.NOT_CONTAIN, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotStartingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_BEGIN_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberEndingWith(String orderNumber){ - return withOrderNumber(Operator.END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberNotEndingWith(String orderNumber){ - return withOrderNumber(Operator.NOT_END_WITH, orderNumber); - } - - public CustomerOrderRequest withOrderNumberIs(String orderNumber){ - return withOrderNumber(Operator.EQUAL, orderNumber); - } - - public CustomerOrderRequest withOrderNumberSoundingLike(String orderNumber){ - return withOrderNumber(Operator.SOUNDS_LIKE, orderNumber); - } - - - - public CustomerOrderRequest filterByDescription(String... description){ - if (description == null || description.length == 0) { - throw new IllegalArgumentException("filterByDescription parameter description cannot be empty"); - } - return appendSearchCriteria(createDescriptionCriteria(Operator.EQUAL, (Object[])description)); - } - - public CustomerOrderRequest withDescription(Operator operator, Object... values){ - return appendSearchCriteria(createDescriptionCriteria(operator, values)); - } - - public CustomerOrderRequest withDescriptionIsUnknown(){ - return withDescription(Operator.IS_NULL); - } - - public CustomerOrderRequest withDescriptionIsKnown(){ - return withDescription(Operator.IS_NOT_NULL); - } - - public SearchCriteria createDescriptionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.DESCRIPTION_PROPERTY, operator, values); - } - - public CustomerOrderRequest withDescriptionIsNot(String description){ - return withDescription(Operator.NOT_EQUAL, description); - } - - public CustomerOrderRequest withDescriptionIn(String... description){ - return withDescription(Operator.IN, (Object[])description); - } - - public CustomerOrderRequest withDescriptionNotIn(String... description){ - return withDescription(Operator.NOT_IN, (Object[])description); - } - public CustomerOrderRequest withDescriptionGreaterThan(String description){ - return withDescription(Operator.GREATER_THAN, description); - } - - public CustomerOrderRequest withDescriptionGreaterThanOrEqualTo(String description){ - return withDescription(Operator.GREATER_THAN_OR_EQUAL, description); - } - - public CustomerOrderRequest withDescriptionLessThan(String description){ - return withDescription(Operator.LESS_THAN, description); - } - - public CustomerOrderRequest withDescriptionLessThanOrEqualTo(String description){ - return withDescription(Operator.LESS_THAN_OR_EQUAL, description); - } - - public CustomerOrderRequest withDescriptionBetween(String startOfDescription, String endOfDescription){ - return withDescription(Operator.BETWEEN, startOfDescription, endOfDescription); - } - public CustomerOrderRequest withDescriptionStartingWith(String description){ - return withDescription(Operator.BEGIN_WITH, description); - } - public CustomerOrderRequest withDescriptionContaining(String description){ - return withDescription(Operator.CONTAIN, description); - } - - public CustomerOrderRequest withDescriptionNotContaining(String description){ - return withDescription(Operator.NOT_CONTAIN, description); - } - - public CustomerOrderRequest withDescriptionNotStartingWith(String description){ - return withDescription(Operator.NOT_BEGIN_WITH, description); - } - - public CustomerOrderRequest withDescriptionEndingWith(String description){ - return withDescription(Operator.END_WITH, description); - } - - public CustomerOrderRequest withDescriptionNotEndingWith(String description){ - return withDescription(Operator.NOT_END_WITH, description); - } - - public CustomerOrderRequest withDescriptionIs(String description){ - return withDescription(Operator.EQUAL, description); - } - - public CustomerOrderRequest withDescriptionSoundingLike(String description){ - return withDescription(Operator.SOUNDS_LIKE, description); - } - - - - public CustomerOrderRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public CustomerOrderRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public CustomerOrderRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public CustomerOrderRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(CustomerOrder.VERSION_PROPERTY, operator, values); - } - - public CustomerOrderRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public CustomerOrderRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public CustomerOrderRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public CustomerOrderRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public CustomerOrderRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public CustomerOrderRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public CustomerOrderRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public CustomerOrderRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public CustomerOrderRequest withOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY)); - } - - public CustomerOrderRequest withoutOrderItemListMatching(OrderItemRequest orderItemRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, orderItemRequest, OrderItem.CUSTOMER_ORDER_PROPERTY))); - } - - public CustomerOrderRequest haveOrderItems(){ - return withOrderItemListMatching(Q.orderItems().unlimited()); - } - - public CustomerOrderRequest haveNoOrderItems(){ - return withoutOrderItemListMatching(Q.orderItems().unlimited()); - } - public CustomerOrderRequest withPaymentListMatching(PaymentRequest paymentRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, paymentRequest, Payment.CUSTOMER_ORDER_PROPERTY)); - } - - public CustomerOrderRequest withoutPaymentListMatching(PaymentRequest paymentRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, paymentRequest, Payment.CUSTOMER_ORDER_PROPERTY))); - } - - public CustomerOrderRequest havePayments(){ - return withPaymentListMatching(Q.payments().unlimited()); - } - - public CustomerOrderRequest haveNoPayments(){ - return withoutPaymentListMatching(Q.payments().unlimited()); - } - public CustomerOrderRequest withShipmentListMatching(ShipmentRequest shipmentRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, shipmentRequest, Shipment.CUSTOMER_ORDER_PROPERTY)); - } - - public CustomerOrderRequest withoutShipmentListMatching(ShipmentRequest shipmentRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(CustomerOrder.ID_PROPERTY, shipmentRequest, Shipment.CUSTOMER_ORDER_PROPERTY))); - } - - public CustomerOrderRequest haveShipments(){ - return withShipmentListMatching(Q.shipments().unlimited()); - } - - public CustomerOrderRequest haveNoShipments(){ - return withoutShipmentListMatching(Q.shipments().unlimited()); - } - - public CustomerOrderRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public CustomerOrderRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public CustomerOrderRequest groupByPlatformWithDetails(){ - return groupByPlatformWithDetails(Q.platforms().unlimited()); - } - - public CustomerOrderRequest groupByPlatformWithDetails(PlatformRequest subRequest){ - aggregate(CustomerOrder.PLATFORM_PROPERTY, subRequest); - return this; - } - - - - - public CustomerOrderRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public CustomerOrderRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ID_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctPlatform(){ - return countDistinctPlatformAs("platform_distinct_count"); - } - - public CustomerOrderRequest countDistinctPlatformAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.PLATFORM_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctOrderNumber(){ - return countDistinctOrderNumberAs("order_number_distinct_count"); - } - - public CustomerOrderRequest countDistinctOrderNumberAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctDescription(){ - return countDistinctDescriptionAs("description_distinct_count"); - } - - public CustomerOrderRequest countDistinctDescriptionAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - public CustomerOrderRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public CustomerOrderRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, CustomerOrder.VERSION_PROPERTY); - return this; - } - public CustomerOrderRequest groupByOrderItemsWithDetails(OrderItemRequest subRequest){ - aggregate(CustomerOrder.ORDER_ITEM_LIST_PROPERTY, subRequest); - return this; - } - public CustomerOrderRequest groupByPaymentsWithDetails(PaymentRequest subRequest){ - aggregate(CustomerOrder.PAYMENT_LIST_PROPERTY, subRequest); - return this; - } - public CustomerOrderRequest groupByShipmentsWithDetails(ShipmentRequest subRequest){ - aggregate(CustomerOrder.SHIPMENT_LIST_PROPERTY, subRequest); - return this; - } - - public CustomerOrderRequest groupById(){ - groupBy(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdAs(String retName){ - groupBy(retName, CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ID_PROPERTY, function); - return this; - } - public CustomerOrderRequest groupByPlatformWith(PlatformRequest subRequest){ - groupBy(CustomerOrder.PLATFORM_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPlatformWith", null, "platform")); - return this; - } - public CustomerOrderRequest groupByPlatform(){ - groupBy(CustomerOrder.PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByPlatformAs(String retName){ - groupBy(retName, CustomerOrder.PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByPlatformWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.PLATFORM_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByOrderNumber(){ - groupBy(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberAs(String retName){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByOrderNumberWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.ORDER_NUMBER_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByDescription(){ - groupBy(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByDescriptionAs(String retName){ - groupBy(retName, CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByDescriptionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.DESCRIPTION_PROPERTY, function); - return this; - } - - public CustomerOrderRequest groupByVersion(){ - groupBy(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionAs(String retName){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, CustomerOrder.VERSION_PROPERTY, function); - return this; - } - - - - public CustomerOrderRequest orderByIdAscending(){ - addOrderByAscending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByIdDescending(){ - addOrderByDescending(CustomerOrder.ID_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByPlatformAscending(){ - addOrderByAscending(CustomerOrder.PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByPlatformDescending(){ - addOrderByDescending(CustomerOrder.PLATFORM_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberAscending(){ - addOrderByAscending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescending(){ - addOrderByDescending(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByOrderNumberAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByOrderNumberDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.ORDER_NUMBER_PROPERTY); - return this; - } - public CustomerOrderRequest orderByDescriptionAscending(){ - addOrderByAscending(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByDescriptionDescending(){ - addOrderByDescending(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - public CustomerOrderRequest orderByDescriptionAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByDescriptionDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(CustomerOrder.DESCRIPTION_PROPERTY); - return this; - } - public CustomerOrderRequest orderByVersionAscending(){ - addOrderByAscending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - public CustomerOrderRequest orderByVersionDescending(){ - addOrderByDescending(CustomerOrder.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest){ - return statsFromOrderItemsAs(name, subRequest, false); - } - - public CustomerOrderRequest statsFromOrderItemsAs(String name, OrderItemRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest statsFromOrderItems(OrderItemRequest subRequest){ - return statsFromOrderItemsAs(REFINEMENTS, subRequest); - } - public CustomerOrderRequest statsFromPaymentsAs(String name, PaymentRequest subRequest){ - return statsFromPaymentsAs(name, subRequest, false); - } - - public CustomerOrderRequest statsFromPaymentsAs(String name, PaymentRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Payment.CUSTOMER_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPaymentsAs", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest statsFromPayments(PaymentRequest subRequest){ - return statsFromPaymentsAs(REFINEMENTS, subRequest); - } - public CustomerOrderRequest statsFromShipmentsAs(String name, ShipmentRequest subRequest){ - return statsFromShipmentsAs(name, subRequest, false); - } - - public CustomerOrderRequest statsFromShipmentsAs(String name, ShipmentRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, Shipment.CUSTOMER_ORDER_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromShipmentsAs", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest statsFromShipments(ShipmentRequest subRequest){ - return statsFromShipmentsAs(REFINEMENTS, subRequest); - } - public PlatformRequest rollUpToPlatform(){ - PlatformRequest platform = Q.platforms().unlimited(); - this.internalRollUpTo("platform", platform, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPlatform", null, "platform")); - return platform; - } - - - - - public CustomerOrderRequest countOrderItems(){ - addRelationCount("Count", Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItems", null, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderItemsAs(String name){ - addRelationCount(name, Q.orderItems().unlimited(), OrderItem.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsAs", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countOrderItemsWith(String name, OrderItemRequest subRequest){ - addRelationCount(name, subRequest, OrderItem.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countOrderItemsWith", name, CustomerOrder.ORDER_ITEM_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest countPayments(){ - addRelationCount("Count", Q.payments().unlimited(), Payment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPayments", null, CustomerOrder.PAYMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countPaymentsAs(String name){ - addRelationCount(name, Q.payments().unlimited(), Payment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentsAs", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countPaymentsWith(String name, PaymentRequest subRequest){ - addRelationCount(name, subRequest, Payment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentsWith", name, CustomerOrder.PAYMENT_LIST_PROPERTY)); - return this; - } - public CustomerOrderRequest countShipments(){ - addRelationCount("Count", Q.shipments().unlimited(), Shipment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipments", null, CustomerOrder.SHIPMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countShipmentsAs(String name){ - addRelationCount(name, Q.shipments().unlimited(), Shipment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipmentsAs", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest countShipmentsWith(String name, ShipmentRequest subRequest){ - addRelationCount(name, subRequest, Shipment.CUSTOMER_ORDER_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countShipmentsWith", name, CustomerOrder.SHIPMENT_LIST_PROPERTY)); - return this; - } - - public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform){ - return facetByPlatformAs(facetName, platform, true); - } - - public CustomerOrderRequest facetByPlatformAs(String facetName, PlatformRequest platform, boolean includeAllFacets){ - addFacet(facetName, CustomerOrder.PLATFORM_PROPERTY, platform, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPlatformAs", facetName, CustomerOrder.PLATFORM_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public CustomerOrderRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public CustomerOrderRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public CustomerOrderRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public CustomerOrderRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public CustomerOrderRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public CustomerOrderRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java deleted file mode 100644 index 2284e067e..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItem.java +++ /dev/null @@ -1,128 +0,0 @@ - -package com.teaql.tracechainservice.orderitem; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class OrderItem extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "OrderItem"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "f1e0aaf75e3389eec4a68edadfb443fdc23c5cce2449a98cf55d935ed897b6fb"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("name", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - OrderItem.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; - public static final String NAME_PROPERTY = "name"; - private CustomerOrder customerOrder; - - private String name; - - - public CustomerOrder getCustomerOrder(){ - return this.customerOrder; - } - - public String getName(){ - return this.name; - } - - public OrderItem updateCustomerOrder(CustomerOrder customerOrder){ - if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ - return this; - } - handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); - this.customerOrder = customerOrder; - return this; - } - - public OrderItem updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - - public static OrderItem refer(Long id){ - OrderItem refer = new OrderItem(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public OrderItem comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer_order": this.customerOrder = (CustomerOrder) value; break; - - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer_order": return this.customerOrder; - case "name": return this.name; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customerOrder": return this.customerOrder; - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java deleted file mode 100644 index be1b79b87..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemChecker.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.teaql.tracechainservice.orderitem; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class OrderItemChecker implements Checker{ - - public String type(){ - return OrderItem.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if(needCheck(_context, orderItem)){ - markAsChecked(_context, orderItem); - doCheck(_context, orderItem, _parentLocation); - } - } - - public void doCheck(UserContext _context, OrderItem orderItem, ObjectLocation _parentLocation){ - if((orderItem == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, orderItem); - if(orderItem.needPersist()){ - } - if(orderItem.newItem()){ - }else if(orderItem.updateItem()){ - if(!orderItem.isPropertyLoaded("customer_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); - } - if(!orderItem.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomerOrder(_context, orderItem.getProperty(OrderItem.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); - checkName(_context, orderItem.getProperty(OrderItem.NAME_PROPERTY), newLocation(_parentLocation, "name")); - } - - public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerOrder); - if((customerOrder == null)){ - return; - } - new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); - } - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java deleted file mode 100644 index f89f73eae..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemExpression.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.teaql.tracechainservice.orderitem; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class OrderItemExpression extends ExpressionAdaptor implements BaseEntityExpression { - public OrderItemExpression(Expression expression){ - super(expression); - } - - public OrderItemExpression(Expression expression, Function function){ - super(expression, function); - } - - public OrderItemExpression updateId(Long id){ - return new OrderItemExpression(this, $it -> {((OrderItem)$it).__internalSet("id", id); return this;}); - } - - public OrderItemExpression save(UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs("Saved by Expression").save(userContext)); - } - - public OrderItemExpression save(String intent, UserContext userContext){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", OrderItem::getCustomerOrder)); - } - - public OrderItemExpression updateCustomerOrder(CustomerOrder customerOrder){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateCustomerOrder(customerOrder)); - } - - public Expression getName(){ - return loaded("name", "getName", OrderItem::getName); - } - public OrderItemExpression updateName(String name){ - return new OrderItemExpression(this, $it -> ((OrderItem)$it).updateName(name)); - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java deleted file mode 100644 index ae16d0f16..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.tracechainservice.orderitem; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class OrderItemListExpression extends SmartListExpression { - public OrderItemListExpression(Expression> expression){ - super(expression); - } - - public OrderItemListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public OrderItemExpression first() { - return new OrderItemExpression(super.first()); - } - - public OrderItemExpression get(int index) { - return new OrderItemExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java deleted file mode 100644 index 7c957950e..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/orderitem/OrderItemRequest.java +++ /dev/null @@ -1,689 +0,0 @@ - -package com.teaql.tracechainservice.orderitem; - -import com.teaql.tracechainservice.Q; -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class OrderItemRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public OrderItemRequest(Class returnType){ - this(returnType, () -> (T) new OrderItem()); - } - - protected OrderItemRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public OrderItemRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public OrderItemRequest copy(){ - return (OrderItemRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new OrderItemRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public OrderItemRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public OrderItemRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public OrderItemRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public OrderItemRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public OrderItemRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public OrderItemRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public OrderItemRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public OrderItemRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public OrderItemRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (OrderItemRequest)super.appendSearchCriteria(searchCriteria); - } - - public OrderItemRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public OrderItemRequest matchingAnyOf(OrderItemRequest orderItem){ - super.internalMatchAny(orderItem); - return this; - } - - public OrderItemRequest matchingIdsOf(OrderItemRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - OrderItem.ID_PROPERTY, request, OrderItem.ID_PROPERTY)); - } - - public OrderItemRequest enhanceChildrenIfNeeded(){ - return this; - } - - public OrderItemRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public OrderItemRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public OrderItemRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerOrderIdOnly().selectName().selectVersion(); - } - - public OrderItemRequest selectSelfFields(){ - return selectSelf(); - } - - public OrderItemRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(OrderItem.ID_PROPERTY); - selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - selectProperty(OrderItem.NAME_PROPERTY); - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomerOrder().selectName().selectVersion(); - } - - public OrderItemRequest selectChildren(){ - super.selectAny(); - return selectId().selectCustomerOrder().selectName().selectVersion(); - } - - - public OrderItemRequest selectId(){ - selectProperty(OrderItem.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectId(){ - unselectProperty(OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest selectCustomerOrderIdOnly(){ - selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest selectCustomerOrder(){ - return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); - } - - public OrderItemRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ - selectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, OrderItem.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - public OrderItemRequest unselectCustomerOrder(){ - unselectProperty(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderItemRequest selectName(){ - selectProperty(OrderItem.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectName(){ - unselectProperty(OrderItem.NAME_PROPERTY); - return this; - } - public OrderItemRequest selectVersion(){ - selectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public OrderItemRequest unselectVersion(){ - unselectProperty(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.ID_PROPERTY, operator, values); - } - - public OrderItemRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public OrderItemRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public OrderItemRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public OrderItemRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public OrderItemRequest filterByCustomerOrder(CustomerOrder... customerOrder){ - if (customerOrder == null || customerOrder.length == 0) { - throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); - } - return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); - } - - public OrderItemRequest withCustomerOrder(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); - } - - public OrderItemRequest withCustomerOrderIsUnknown(){ - return withCustomerOrder(Operator.IS_NULL); - } - - public OrderItemRequest withCustomerOrderIsKnown(){ - return withCustomerOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, operator, values); - } - - public OrderItemRequest filterByCustomerOrder(Long customerOrder){ - if(customerOrder == null){ - return this; - } - return withCustomerOrder(Operator.EQUAL, customerOrder); - } - public OrderItemRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); - } - - public OrderItemRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); - } - - public OrderItemRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public OrderItemRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public OrderItemRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public OrderItemRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.NAME_PROPERTY, operator, values); - } - - public OrderItemRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public OrderItemRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public OrderItemRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public OrderItemRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public OrderItemRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public OrderItemRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public OrderItemRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public OrderItemRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public OrderItemRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public OrderItemRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public OrderItemRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public OrderItemRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public OrderItemRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public OrderItemRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public OrderItemRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public OrderItemRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public OrderItemRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public OrderItemRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public OrderItemRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public OrderItemRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(OrderItem.VERSION_PROPERTY, operator, values); - } - - public OrderItemRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public OrderItemRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public OrderItemRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public OrderItemRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public OrderItemRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public OrderItemRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public OrderItemRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public OrderItemRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public OrderItemRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public OrderItemRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public OrderItemRequest groupByCustomerOrderWithDetails(){ - return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); - } - - public OrderItemRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ - aggregate(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest); - return this; - } - - - - public OrderItemRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public OrderItemRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, OrderItem.ID_PROPERTY); - return this; - } - public OrderItemRequest countDistinctCustomerOrder(){ - return countDistinctCustomerOrderAs("customer_order_distinct_count"); - } - - public OrderItemRequest countDistinctCustomerOrderAs(String alias){ - super.countDistinctProperty(alias, OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - public OrderItemRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public OrderItemRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, OrderItem.NAME_PROPERTY); - return this; - } - public OrderItemRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public OrderItemRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupById(){ - groupBy(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdAs(String retName){ - groupBy(retName, OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.ID_PROPERTY, function); - return this; - } - public OrderItemRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); - return this; - } - public OrderItemRequest groupByCustomerOrder(){ - groupBy(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupByCustomerOrderAs(String retName){ - groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.CUSTOMER_ORDER_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByName(){ - groupBy(OrderItem.NAME_PROPERTY); - return this; - } - - public OrderItemRequest groupByNameAs(String retName){ - groupBy(retName, OrderItem.NAME_PROPERTY); - return this; - } - - public OrderItemRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.NAME_PROPERTY, function); - return this; - } - - public OrderItemRequest groupByVersion(){ - groupBy(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionAs(String retName){ - groupBy(retName, OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, OrderItem.VERSION_PROPERTY, function); - return this; - } - - - - public OrderItemRequest orderByIdAscending(){ - addOrderByAscending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByIdDescending(){ - addOrderByDescending(OrderItem.ID_PROPERTY); - return this; - } - - public OrderItemRequest orderByCustomerOrderAscending(){ - addOrderByAscending(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderByCustomerOrderDescending(){ - addOrderByDescending(OrderItem.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public OrderItemRequest orderByNameAscending(){ - addOrderByAscending(OrderItem.NAME_PROPERTY); - return this; - } - - public OrderItemRequest orderByNameDescending(){ - addOrderByDescending(OrderItem.NAME_PROPERTY); - return this; - } - public OrderItemRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(OrderItem.NAME_PROPERTY); - return this; - } - - public OrderItemRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(OrderItem.NAME_PROPERTY); - return this; - } - public OrderItemRequest orderByVersionAscending(){ - addOrderByAscending(OrderItem.VERSION_PROPERTY); - return this; - } - - public OrderItemRequest orderByVersionDescending(){ - addOrderByDescending(OrderItem.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest rollUpToCustomerOrder(){ - CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.internalRollUpTo("customer_order", customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); - return customerOrder; - } - - - - - public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ - return facetByCustomerOrderAs(facetName, customerOrder, true); - } - - public OrderItemRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, OrderItem.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, OrderItem.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public OrderItemRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public OrderItemRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public OrderItemRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public OrderItemRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public OrderItemRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public OrderItemRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java deleted file mode 100644 index 193bc7080..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/Payment.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.teaql.tracechainservice.payment; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Payment extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Payment"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "7a1e8a9603ba1bf577f0e3318f5c68e0b1e8d16c08f14ba596bf5292689211cb"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "payment_attempt_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Payment.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; - public static final String REFERENCE_CODE_PROPERTY = "reference_code"; - public static final String PAYMENT_ATTEMPT_LIST_PROPERTY = "payment_attempt_list"; - private CustomerOrder customerOrder; - - private String referenceCode; - - private SmartList paymentAttemptList; - - public CustomerOrder getCustomerOrder(){ - return this.customerOrder; - } - - public String getReferenceCode(){ - return this.referenceCode; - } - - public SmartList getPaymentAttemptList(){ - return this.paymentAttemptList == null ? SmartList.unloaded() : this.paymentAttemptList; - } - public Payment updateCustomerOrder(CustomerOrder customerOrder){ - if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ - return this; - } - handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); - this.customerOrder = customerOrder; - return this; - } - - public Payment updateReferenceCode(String referenceCode){ - referenceCode = (referenceCode == null ? null : referenceCode.trim()); - if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ - return this; - } - handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); - this.referenceCode = referenceCode; - return this; - } - - public Payment addPaymentAttempt(PaymentAttempt paymentAttempt){ - if (paymentAttempt == null){ - return this; - } - - if(null == this.paymentAttemptList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.paymentAttemptList = teaqlUnloadedItems.map(value -> value); - } - - this.paymentAttemptList.add(paymentAttempt); - paymentAttempt.updatePayment(this); - return this; - } - - public static Payment refer(Long id){ - Payment refer = new Payment(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Payment comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer_order": this.customerOrder = (CustomerOrder) value; break; - - case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; - - case "payment_attempt_list": this.paymentAttemptList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer_order": return this.customerOrder; - case "reference_code": return this.referenceCode; - case "payment_attempt_list": return this.paymentAttemptList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customerOrder": return this.customerOrder; - case "referenceCode": return this.referenceCode; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java deleted file mode 100644 index 2afb8566f..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentChecker.java +++ /dev/null @@ -1,65 +0,0 @@ - -package com.teaql.tracechainservice.payment; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; -import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; -import com.teaql.tracechainservice.paymentattempt.PaymentAttemptChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PaymentChecker implements Checker{ - - public String type(){ - return Payment.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Payment payment, ObjectLocation _parentLocation){ - if(needCheck(_context, payment)){ - markAsChecked(_context, payment); - doCheck(_context, payment, _parentLocation); - } - } - - public void doCheck(UserContext _context, Payment payment, ObjectLocation _parentLocation){ - if((payment == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, payment); - if(payment.needPersist()){ - } - if(payment.newItem()){ - }else if(payment.updateItem()){ - if(!payment.isPropertyLoaded("customer_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); - } - if(!payment.isPropertyLoaded("reference_code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomerOrder(_context, payment.getProperty(Payment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); - checkReferenceCode(_context, payment.getProperty(Payment.REFERENCE_CODE_PROPERTY), newLocation(_parentLocation, "reference_code")); - for(int i = 0; payment.getPaymentAttemptList() != null && i < payment.getPaymentAttemptList().size(); i++){ - PaymentAttempt paymentAttempt = payment.getPaymentAttemptList().get(i); - new PaymentAttemptChecker().checkAndFix(_context, paymentAttempt, newLocation(_parentLocation, "payment_attempt_list", i)); - } - } - - public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerOrder); - if((customerOrder == null)){ - return; - } - new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); - } - public void checkReferenceCode(UserContext _context, String referenceCode, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, referenceCode); - if((referenceCode == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, referenceCode); - - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java deleted file mode 100644 index 3d2cb6c48..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentExpression.java +++ /dev/null @@ -1,61 +0,0 @@ - -package com.teaql.tracechainservice.payment; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; -import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; -import com.teaql.tracechainservice.paymentattempt.PaymentAttemptListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PaymentExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PaymentExpression(Expression expression){ - super(expression); - } - - public PaymentExpression(Expression expression, Function function){ - super(expression, function); - } - - public PaymentExpression updateId(Long id){ - return new PaymentExpression(this, $it -> {((Payment)$it).__internalSet("id", id); return this;}); - } - - public PaymentExpression save(UserContext userContext){ - return new PaymentExpression(this, $it -> ((Payment)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PaymentExpression save(String intent, UserContext userContext){ - return new PaymentExpression(this, $it -> ((Payment)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", Payment::getCustomerOrder)); - } - - public PaymentExpression updateCustomerOrder(CustomerOrder customerOrder){ - return new PaymentExpression(this, $it -> ((Payment)$it).updateCustomerOrder(customerOrder)); - } - - public Expression getReferenceCode(){ - return loaded("reference_code", "getReferenceCode", Payment::getReferenceCode); - } - public PaymentExpression updateReferenceCode(String referenceCode){ - return new PaymentExpression(this, $it -> ((Payment)$it).updateReferenceCode(referenceCode)); - } - - public PaymentAttemptListExpression getPaymentAttemptList(){ - return new PaymentAttemptListExpression(loaded("payment_attempt_list", "getPaymentAttemptList", Payment::getPaymentAttemptList)); - } - public PaymentExpression addPaymentAttempt(PaymentAttempt paymentAttempt){ - return new PaymentExpression(this, $it -> ((Payment)$it).addPaymentAttempt(paymentAttempt)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java deleted file mode 100644 index 53bd95325..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.tracechainservice.payment; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PaymentListExpression extends SmartListExpression { - public PaymentListExpression(Expression> expression){ - super(expression); - } - - public PaymentListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PaymentExpression first() { - return new PaymentExpression(super.first()); - } - - public PaymentExpression get(int index) { - return new PaymentExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java deleted file mode 100644 index 2c2aff0a8..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/payment/PaymentRequest.java +++ /dev/null @@ -1,750 +0,0 @@ - -package com.teaql.tracechainservice.payment; - -import com.teaql.tracechainservice.Q; -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; -import com.teaql.tracechainservice.paymentattempt.PaymentAttempt; -import com.teaql.tracechainservice.paymentattempt.PaymentAttemptRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PaymentRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PaymentRequest(Class returnType){ - this(returnType, () -> (T) new Payment()); - } - - protected PaymentRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PaymentRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PaymentRequest copy(){ - return (PaymentRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PaymentRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PaymentRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PaymentRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PaymentRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PaymentRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PaymentRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PaymentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PaymentRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PaymentRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PaymentRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PaymentRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PaymentRequest)super.appendSearchCriteria(searchCriteria); - } - - public PaymentRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PaymentRequest matchingAnyOf(PaymentRequest payment){ - super.internalMatchAny(payment); - return this; - } - - public PaymentRequest matchingIdsOf(PaymentRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Payment.ID_PROPERTY, request, Payment.ID_PROPERTY)); - } - - public PaymentRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PaymentRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PaymentRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PaymentRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerOrderIdOnly().selectReferenceCode().selectVersion(); - } - - public PaymentRequest selectSelfFields(){ - return selectSelf(); - } - - public PaymentRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Payment.ID_PROPERTY); - selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); - selectProperty(Payment.REFERENCE_CODE_PROPERTY); - selectProperty(Payment.VERSION_PROPERTY); - return this; - } - - public PaymentRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); - } - - public PaymentRequest selectChildren(){ - super.selectAny(); - selectPaymentAttemptList(); - return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); - } - - - public PaymentRequest selectId(){ - selectProperty(Payment.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PaymentRequest unselectId(){ - unselectProperty(Payment.ID_PROPERTY); - return this; - } - public PaymentRequest selectCustomerOrderIdOnly(){ - selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public PaymentRequest selectCustomerOrder(){ - return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); - } - - public PaymentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ - selectProperty(Payment.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, Payment.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - public PaymentRequest unselectCustomerOrder(){ - unselectProperty(Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - public PaymentRequest selectReferenceCode(){ - selectProperty(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - - /** - * fill the referenceCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS referenceCode) to fetch referenceCode property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PaymentRequest unselectReferenceCode(){ - unselectProperty(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentRequest selectVersion(){ - selectProperty(Payment.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PaymentRequest unselectVersion(){ - unselectProperty(Payment.VERSION_PROPERTY); - return this; - } - public PaymentRequest selectPaymentAttemptList(){ - return selectPaymentAttemptListWith(Q.paymentAttempts().selectSelf()); - } - - public PaymentRequest selectPaymentAttemptListWith(PaymentAttemptRequest paymentAttemptList){ - enhanceRelation(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, paymentAttemptList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentAttemptListWith", null, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); - return this; - } - - public PaymentRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Payment.ID_PROPERTY, operator, values); - } - - public PaymentRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PaymentRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PaymentRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PaymentRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PaymentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ - if (customerOrder == null || customerOrder.length == 0) { - throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); - } - return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); - } - - public PaymentRequest withCustomerOrder(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); - } - - public PaymentRequest withCustomerOrderIsUnknown(){ - return withCustomerOrder(Operator.IS_NULL); - } - - public PaymentRequest withCustomerOrderIsKnown(){ - return withCustomerOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Payment.CUSTOMER_ORDER_PROPERTY, operator, values); - } - - public PaymentRequest filterByCustomerOrder(Long customerOrder){ - if(customerOrder == null){ - return this; - } - return withCustomerOrder(Operator.EQUAL, customerOrder); - } - public PaymentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); - } - - public PaymentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); - } - - public PaymentRequest filterByReferenceCode(String... referenceCode){ - if (referenceCode == null || referenceCode.length == 0) { - throw new IllegalArgumentException("filterByReferenceCode parameter referenceCode cannot be empty"); - } - return appendSearchCriteria(createReferenceCodeCriteria(Operator.EQUAL, (Object[])referenceCode)); - } - - public PaymentRequest withReferenceCode(Operator operator, Object... values){ - return appendSearchCriteria(createReferenceCodeCriteria(operator, values)); - } - - public PaymentRequest withReferenceCodeIsUnknown(){ - return withReferenceCode(Operator.IS_NULL); - } - - public PaymentRequest withReferenceCodeIsKnown(){ - return withReferenceCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createReferenceCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Payment.REFERENCE_CODE_PROPERTY, operator, values); - } - - public PaymentRequest withReferenceCodeIsNot(String referenceCode){ - return withReferenceCode(Operator.NOT_EQUAL, referenceCode); - } - - public PaymentRequest withReferenceCodeIn(String... referenceCode){ - return withReferenceCode(Operator.IN, (Object[])referenceCode); - } - - public PaymentRequest withReferenceCodeNotIn(String... referenceCode){ - return withReferenceCode(Operator.NOT_IN, (Object[])referenceCode); - } - public PaymentRequest withReferenceCodeGreaterThan(String referenceCode){ - return withReferenceCode(Operator.GREATER_THAN, referenceCode); - } - - public PaymentRequest withReferenceCodeGreaterThanOrEqualTo(String referenceCode){ - return withReferenceCode(Operator.GREATER_THAN_OR_EQUAL, referenceCode); - } - - public PaymentRequest withReferenceCodeLessThan(String referenceCode){ - return withReferenceCode(Operator.LESS_THAN, referenceCode); - } - - public PaymentRequest withReferenceCodeLessThanOrEqualTo(String referenceCode){ - return withReferenceCode(Operator.LESS_THAN_OR_EQUAL, referenceCode); - } - - public PaymentRequest withReferenceCodeBetween(String startOfReferenceCode, String endOfReferenceCode){ - return withReferenceCode(Operator.BETWEEN, startOfReferenceCode, endOfReferenceCode); - } - public PaymentRequest withReferenceCodeStartingWith(String referenceCode){ - return withReferenceCode(Operator.BEGIN_WITH, referenceCode); - } - public PaymentRequest withReferenceCodeContaining(String referenceCode){ - return withReferenceCode(Operator.CONTAIN, referenceCode); - } - - public PaymentRequest withReferenceCodeNotContaining(String referenceCode){ - return withReferenceCode(Operator.NOT_CONTAIN, referenceCode); - } - - public PaymentRequest withReferenceCodeNotStartingWith(String referenceCode){ - return withReferenceCode(Operator.NOT_BEGIN_WITH, referenceCode); - } - - public PaymentRequest withReferenceCodeEndingWith(String referenceCode){ - return withReferenceCode(Operator.END_WITH, referenceCode); - } - - public PaymentRequest withReferenceCodeNotEndingWith(String referenceCode){ - return withReferenceCode(Operator.NOT_END_WITH, referenceCode); - } - - public PaymentRequest withReferenceCodeIs(String referenceCode){ - return withReferenceCode(Operator.EQUAL, referenceCode); - } - - public PaymentRequest withReferenceCodeSoundingLike(String referenceCode){ - return withReferenceCode(Operator.SOUNDS_LIKE, referenceCode); - } - - - - public PaymentRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PaymentRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PaymentRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PaymentRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Payment.VERSION_PROPERTY, operator, values); - } - - public PaymentRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PaymentRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PaymentRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PaymentRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PaymentRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PaymentRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PaymentRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PaymentRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PaymentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PaymentRequest withPaymentAttemptListMatching(PaymentAttemptRequest paymentAttemptRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Payment.ID_PROPERTY, paymentAttemptRequest, PaymentAttempt.PAYMENT_PROPERTY)); - } - - public PaymentRequest withoutPaymentAttemptListMatching(PaymentAttemptRequest paymentAttemptRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Payment.ID_PROPERTY, paymentAttemptRequest, PaymentAttempt.PAYMENT_PROPERTY))); - } - - public PaymentRequest havePaymentAttempts(){ - return withPaymentAttemptListMatching(Q.paymentAttempts().unlimited()); - } - - public PaymentRequest haveNoPaymentAttempts(){ - return withoutPaymentAttemptListMatching(Q.paymentAttempts().unlimited()); - } - - public PaymentRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PaymentRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PaymentRequest groupByCustomerOrderWithDetails(){ - return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); - } - - public PaymentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ - aggregate(Payment.CUSTOMER_ORDER_PROPERTY, subRequest); - return this; - } - - - - public PaymentRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PaymentRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Payment.ID_PROPERTY); - return this; - } - public PaymentRequest countDistinctCustomerOrder(){ - return countDistinctCustomerOrderAs("customer_order_distinct_count"); - } - - public PaymentRequest countDistinctCustomerOrderAs(String alias){ - super.countDistinctProperty(alias, Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - public PaymentRequest countDistinctReferenceCode(){ - return countDistinctReferenceCodeAs("reference_code_distinct_count"); - } - - public PaymentRequest countDistinctReferenceCodeAs(String alias){ - super.countDistinctProperty(alias, Payment.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PaymentRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Payment.VERSION_PROPERTY); - return this; - } - public PaymentRequest groupByPaymentAttemptsWithDetails(PaymentAttemptRequest subRequest){ - aggregate(Payment.PAYMENT_ATTEMPT_LIST_PROPERTY, subRequest); - return this; - } - - public PaymentRequest groupById(){ - groupBy(Payment.ID_PROPERTY); - return this; - } - - public PaymentRequest groupByIdAs(String retName){ - groupBy(retName, Payment.ID_PROPERTY); - return this; - } - - public PaymentRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Payment.ID_PROPERTY, function); - return this; - } - public PaymentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(Payment.CUSTOMER_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); - return this; - } - public PaymentRequest groupByCustomerOrder(){ - groupBy(Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public PaymentRequest groupByCustomerOrderAs(String retName){ - groupBy(retName, Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public PaymentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, Payment.CUSTOMER_ORDER_PROPERTY, function); - return this; - } - - public PaymentRequest groupByReferenceCode(){ - groupBy(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentRequest groupByReferenceCodeAs(String retName){ - groupBy(retName, Payment.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentRequest groupByReferenceCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Payment.REFERENCE_CODE_PROPERTY, function); - return this; - } - - public PaymentRequest groupByVersion(){ - groupBy(Payment.VERSION_PROPERTY); - return this; - } - - public PaymentRequest groupByVersionAs(String retName){ - groupBy(retName, Payment.VERSION_PROPERTY); - return this; - } - - public PaymentRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Payment.VERSION_PROPERTY, function); - return this; - } - - - - public PaymentRequest orderByIdAscending(){ - addOrderByAscending(Payment.ID_PROPERTY); - return this; - } - - public PaymentRequest orderByIdDescending(){ - addOrderByDescending(Payment.ID_PROPERTY); - return this; - } - - public PaymentRequest orderByCustomerOrderAscending(){ - addOrderByAscending(Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public PaymentRequest orderByCustomerOrderDescending(){ - addOrderByDescending(Payment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public PaymentRequest orderByReferenceCodeAscending(){ - addOrderByAscending(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentRequest orderByReferenceCodeDescending(){ - addOrderByDescending(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentRequest orderByReferenceCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentRequest orderByReferenceCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Payment.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentRequest orderByVersionAscending(){ - addOrderByAscending(Payment.VERSION_PROPERTY); - return this; - } - - public PaymentRequest orderByVersionDescending(){ - addOrderByDescending(Payment.VERSION_PROPERTY); - return this; - } - - - public PaymentRequest statsFromPaymentAttemptsAs(String name, PaymentAttemptRequest subRequest){ - return statsFromPaymentAttemptsAs(name, subRequest, false); - } - - public PaymentRequest statsFromPaymentAttemptsAs(String name, PaymentAttemptRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, PaymentAttempt.PAYMENT_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromPaymentAttemptsAs", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); - return this; - } - - public PaymentRequest statsFromPaymentAttempts(PaymentAttemptRequest subRequest){ - return statsFromPaymentAttemptsAs(REFINEMENTS, subRequest); - } - public CustomerOrderRequest rollUpToCustomerOrder(){ - CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.internalRollUpTo("customer_order", customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); - return customerOrder; - } - - - - public PaymentRequest countPaymentAttempts(){ - addRelationCount("Count", Q.paymentAttempts().unlimited(), PaymentAttempt.PAYMENT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttempts", null, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); - return this; - } - - public PaymentRequest countPaymentAttemptsAs(String name){ - addRelationCount(name, Q.paymentAttempts().unlimited(), PaymentAttempt.PAYMENT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttemptsAs", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); - return this; - } - - public PaymentRequest countPaymentAttemptsWith(String name, PaymentAttemptRequest subRequest){ - addRelationCount(name, subRequest, PaymentAttempt.PAYMENT_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countPaymentAttemptsWith", name, Payment.PAYMENT_ATTEMPT_LIST_PROPERTY)); - return this; - } - - public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ - return facetByCustomerOrderAs(facetName, customerOrder, true); - } - - public PaymentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, Payment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, Payment.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public PaymentRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PaymentRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PaymentRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PaymentRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PaymentRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PaymentRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java deleted file mode 100644 index 1ddd7d89d..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttempt.java +++ /dev/null @@ -1,128 +0,0 @@ - -package com.teaql.tracechainservice.paymentattempt; - -import com.teaql.tracechainservice.payment.Payment; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class PaymentAttempt extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "PaymentAttempt"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "e8c46db1ccaafe0f9d90335a74f7dd234482731b27d51dbebb2e9f07bebc02eb"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("payment", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("payment", java.util.List.of("payment", "payment")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - PaymentAttempt.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String PAYMENT_PROPERTY = "payment"; - public static final String REFERENCE_CODE_PROPERTY = "reference_code"; - private Payment payment; - - private String referenceCode; - - - public Payment getPayment(){ - return this.payment; - } - - public String getReferenceCode(){ - return this.referenceCode; - } - - public PaymentAttempt updatePayment(Payment payment){ - if(isPropertyLoaded(PAYMENT_PROPERTY) && Objects.equals(this.payment, payment)){ - return this; - } - handleUpdate(PAYMENT_PROPERTY, getPayment(), payment); - this.payment = payment; - return this; - } - - public PaymentAttempt updateReferenceCode(String referenceCode){ - referenceCode = (referenceCode == null ? null : referenceCode.trim()); - if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ - return this; - } - handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); - this.referenceCode = referenceCode; - return this; - } - - - public static PaymentAttempt refer(Long id){ - PaymentAttempt refer = new PaymentAttempt(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public PaymentAttempt comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "payment": this.payment = (Payment) value; break; - - case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "payment": return this.payment; - case "reference_code": return this.referenceCode; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "payment": return this.payment; - case "referenceCode": return this.referenceCode; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java deleted file mode 100644 index 58896b529..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptChecker.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.teaql.tracechainservice.paymentattempt; - -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PaymentAttemptChecker implements Checker{ - - public String type(){ - return PaymentAttempt.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, PaymentAttempt paymentAttempt, ObjectLocation _parentLocation){ - if(needCheck(_context, paymentAttempt)){ - markAsChecked(_context, paymentAttempt); - doCheck(_context, paymentAttempt, _parentLocation); - } - } - - public void doCheck(UserContext _context, PaymentAttempt paymentAttempt, ObjectLocation _parentLocation){ - if((paymentAttempt == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, paymentAttempt); - if(paymentAttempt.needPersist()){ - } - if(paymentAttempt.newItem()){ - }else if(paymentAttempt.updateItem()){ - if(!paymentAttempt.isPropertyLoaded("payment")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "payment"), "Mutation requires a fully loaded entity"); - } - if(!paymentAttempt.isPropertyLoaded("reference_code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); - } - - } - checkPayment(_context, paymentAttempt.getProperty(PaymentAttempt.PAYMENT_PROPERTY), newLocation(_parentLocation, "payment")); - checkReferenceCode(_context, paymentAttempt.getProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY), newLocation(_parentLocation, "reference_code")); - } - - public void checkPayment(UserContext _context, Payment payment, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, payment); - if((payment == null)){ - return; - } - new PaymentChecker().checkAndFix(_context, payment, _parentLocation); - } - public void checkReferenceCode(UserContext _context, String referenceCode, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, referenceCode); - if((referenceCode == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, referenceCode); - - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java deleted file mode 100644 index cc3a5db9c..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptExpression.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.teaql.tracechainservice.paymentattempt; - -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PaymentAttemptExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PaymentAttemptExpression(Expression expression){ - super(expression); - } - - public PaymentAttemptExpression(Expression expression, Function function){ - super(expression, function); - } - - public PaymentAttemptExpression updateId(Long id){ - return new PaymentAttemptExpression(this, $it -> {((PaymentAttempt)$it).__internalSet("id", id); return this;}); - } - - public PaymentAttemptExpression save(UserContext userContext){ - return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PaymentAttemptExpression save(String intent, UserContext userContext){ - return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public PaymentExpression getPayment(){ - return new PaymentExpression(loaded("payment", "getPayment", PaymentAttempt::getPayment)); - } - - public PaymentAttemptExpression updatePayment(Payment payment){ - return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).updatePayment(payment)); - } - - public Expression getReferenceCode(){ - return loaded("reference_code", "getReferenceCode", PaymentAttempt::getReferenceCode); - } - public PaymentAttemptExpression updateReferenceCode(String referenceCode){ - return new PaymentAttemptExpression(this, $it -> ((PaymentAttempt)$it).updateReferenceCode(referenceCode)); - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java deleted file mode 100644 index 6178260e1..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.tracechainservice.paymentattempt; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PaymentAttemptListExpression extends SmartListExpression { - public PaymentAttemptListExpression(Expression> expression){ - super(expression); - } - - public PaymentAttemptListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PaymentAttemptExpression first() { - return new PaymentAttemptExpression(super.first()); - } - - public PaymentAttemptExpression get(int index) { - return new PaymentAttemptExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java deleted file mode 100644 index 6fd063951..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/paymentattempt/PaymentAttemptRequest.java +++ /dev/null @@ -1,689 +0,0 @@ - -package com.teaql.tracechainservice.paymentattempt; - -import com.teaql.tracechainservice.Q; -import com.teaql.tracechainservice.payment.Payment; -import com.teaql.tracechainservice.payment.PaymentRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PaymentAttemptRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PaymentAttemptRequest(Class returnType){ - this(returnType, () -> (T) new PaymentAttempt()); - } - - protected PaymentAttemptRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PaymentAttemptRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PaymentAttemptRequest copy(){ - return (PaymentAttemptRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PaymentAttemptRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PaymentAttemptRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PaymentAttemptRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PaymentAttemptRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PaymentAttemptRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PaymentAttemptRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PaymentAttemptRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PaymentAttemptRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PaymentAttemptRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PaymentAttemptRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PaymentAttemptRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PaymentAttemptRequest)super.appendSearchCriteria(searchCriteria); - } - - public PaymentAttemptRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PaymentAttemptRequest matchingAnyOf(PaymentAttemptRequest paymentAttempt){ - super.internalMatchAny(paymentAttempt); - return this; - } - - public PaymentAttemptRequest matchingIdsOf(PaymentAttemptRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - PaymentAttempt.ID_PROPERTY, request, PaymentAttempt.ID_PROPERTY)); - } - - public PaymentAttemptRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PaymentAttemptRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PaymentAttemptRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PaymentAttemptRequest selectSelf(){ - super.selectSelf(); - return selectId().selectPaymentIdOnly().selectReferenceCode().selectVersion(); - } - - public PaymentAttemptRequest selectSelfFields(){ - return selectSelf(); - } - - public PaymentAttemptRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(PaymentAttempt.ID_PROPERTY); - selectProperty(PaymentAttempt.PAYMENT_PROPERTY); - selectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); - selectProperty(PaymentAttempt.VERSION_PROPERTY); - return this; - } - - public PaymentAttemptRequest selectAll(){ - super.selectAll(); - return selectId().selectPayment().selectReferenceCode().selectVersion(); - } - - public PaymentAttemptRequest selectChildren(){ - super.selectAny(); - return selectId().selectPayment().selectReferenceCode().selectVersion(); - } - - - public PaymentAttemptRequest selectId(){ - selectProperty(PaymentAttempt.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PaymentAttemptRequest unselectId(){ - unselectProperty(PaymentAttempt.ID_PROPERTY); - return this; - } - public PaymentAttemptRequest selectPaymentIdOnly(){ - selectProperty(PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - - public PaymentAttemptRequest selectPayment(){ - return selectPaymentWith(Q.payments().unlimited().selectSelf()); - } - - public PaymentAttemptRequest selectPaymentWith(PaymentRequest payment){ - selectProperty(PaymentAttempt.PAYMENT_PROPERTY); - enhanceRelation(PaymentAttempt.PAYMENT_PROPERTY, payment, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectPaymentWith", null, PaymentAttempt.PAYMENT_PROPERTY)); - return this; - } - - public PaymentAttemptRequest unselectPayment(){ - unselectProperty(PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - public PaymentAttemptRequest selectReferenceCode(){ - selectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - - /** - * fill the referenceCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS referenceCode) to fetch referenceCode property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PaymentAttemptRequest unselectReferenceCode(){ - unselectProperty(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentAttemptRequest selectVersion(){ - selectProperty(PaymentAttempt.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PaymentAttemptRequest unselectVersion(){ - unselectProperty(PaymentAttempt.VERSION_PROPERTY); - return this; - } - - public PaymentAttemptRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PaymentAttempt.ID_PROPERTY, operator, values); - } - - public PaymentAttemptRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PaymentAttemptRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PaymentAttemptRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PaymentAttemptRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PaymentAttemptRequest filterByPayment(Payment... payment){ - if (payment == null || payment.length == 0) { - throw new IllegalArgumentException("filterByPayment parameter payment cannot be empty"); - } - return appendSearchCriteria(createPaymentCriteria(Operator.EQUAL, (Object[])payment)); - } - - public PaymentAttemptRequest withPayment(Operator operator, Object... values){ - return appendSearchCriteria(createPaymentCriteria(operator, values)); - } - - public PaymentAttemptRequest withPaymentIsUnknown(){ - return withPayment(Operator.IS_NULL); - } - - public PaymentAttemptRequest withPaymentIsKnown(){ - return withPayment(Operator.IS_NOT_NULL); - } - - public SearchCriteria createPaymentCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PaymentAttempt.PAYMENT_PROPERTY, operator, values); - } - - public PaymentAttemptRequest filterByPayment(Long payment){ - if(payment == null){ - return this; - } - return withPayment(Operator.EQUAL, payment); - } - public PaymentAttemptRequest withPaymentMatching(PaymentRequest payment){ - return appendSearchCriteria(new SubQuerySearchCriteria(PaymentAttempt.PAYMENT_PROPERTY, payment, Payment.ID_PROPERTY)); - } - - public PaymentAttemptRequest withoutPaymentMatching(PaymentRequest payment){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(PaymentAttempt.PAYMENT_PROPERTY, payment, Payment.ID_PROPERTY))); - } - - public PaymentAttemptRequest filterByReferenceCode(String... referenceCode){ - if (referenceCode == null || referenceCode.length == 0) { - throw new IllegalArgumentException("filterByReferenceCode parameter referenceCode cannot be empty"); - } - return appendSearchCriteria(createReferenceCodeCriteria(Operator.EQUAL, (Object[])referenceCode)); - } - - public PaymentAttemptRequest withReferenceCode(Operator operator, Object... values){ - return appendSearchCriteria(createReferenceCodeCriteria(operator, values)); - } - - public PaymentAttemptRequest withReferenceCodeIsUnknown(){ - return withReferenceCode(Operator.IS_NULL); - } - - public PaymentAttemptRequest withReferenceCodeIsKnown(){ - return withReferenceCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createReferenceCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PaymentAttempt.REFERENCE_CODE_PROPERTY, operator, values); - } - - public PaymentAttemptRequest withReferenceCodeIsNot(String referenceCode){ - return withReferenceCode(Operator.NOT_EQUAL, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeIn(String... referenceCode){ - return withReferenceCode(Operator.IN, (Object[])referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeNotIn(String... referenceCode){ - return withReferenceCode(Operator.NOT_IN, (Object[])referenceCode); - } - public PaymentAttemptRequest withReferenceCodeGreaterThan(String referenceCode){ - return withReferenceCode(Operator.GREATER_THAN, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeGreaterThanOrEqualTo(String referenceCode){ - return withReferenceCode(Operator.GREATER_THAN_OR_EQUAL, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeLessThan(String referenceCode){ - return withReferenceCode(Operator.LESS_THAN, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeLessThanOrEqualTo(String referenceCode){ - return withReferenceCode(Operator.LESS_THAN_OR_EQUAL, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeBetween(String startOfReferenceCode, String endOfReferenceCode){ - return withReferenceCode(Operator.BETWEEN, startOfReferenceCode, endOfReferenceCode); - } - public PaymentAttemptRequest withReferenceCodeStartingWith(String referenceCode){ - return withReferenceCode(Operator.BEGIN_WITH, referenceCode); - } - public PaymentAttemptRequest withReferenceCodeContaining(String referenceCode){ - return withReferenceCode(Operator.CONTAIN, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeNotContaining(String referenceCode){ - return withReferenceCode(Operator.NOT_CONTAIN, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeNotStartingWith(String referenceCode){ - return withReferenceCode(Operator.NOT_BEGIN_WITH, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeEndingWith(String referenceCode){ - return withReferenceCode(Operator.END_WITH, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeNotEndingWith(String referenceCode){ - return withReferenceCode(Operator.NOT_END_WITH, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeIs(String referenceCode){ - return withReferenceCode(Operator.EQUAL, referenceCode); - } - - public PaymentAttemptRequest withReferenceCodeSoundingLike(String referenceCode){ - return withReferenceCode(Operator.SOUNDS_LIKE, referenceCode); - } - - - - public PaymentAttemptRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PaymentAttemptRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PaymentAttemptRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PaymentAttemptRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(PaymentAttempt.VERSION_PROPERTY, operator, values); - } - - public PaymentAttemptRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PaymentAttemptRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PaymentAttemptRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PaymentAttemptRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PaymentAttemptRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PaymentAttemptRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PaymentAttemptRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PaymentAttemptRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PaymentAttemptRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public PaymentAttemptRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PaymentAttemptRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PaymentAttemptRequest groupByPaymentWithDetails(){ - return groupByPaymentWithDetails(Q.payments().unlimited()); - } - - public PaymentAttemptRequest groupByPaymentWithDetails(PaymentRequest subRequest){ - aggregate(PaymentAttempt.PAYMENT_PROPERTY, subRequest); - return this; - } - - - - public PaymentAttemptRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PaymentAttemptRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, PaymentAttempt.ID_PROPERTY); - return this; - } - public PaymentAttemptRequest countDistinctPayment(){ - return countDistinctPaymentAs("payment_distinct_count"); - } - - public PaymentAttemptRequest countDistinctPaymentAs(String alias){ - super.countDistinctProperty(alias, PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - public PaymentAttemptRequest countDistinctReferenceCode(){ - return countDistinctReferenceCodeAs("reference_code_distinct_count"); - } - - public PaymentAttemptRequest countDistinctReferenceCodeAs(String alias){ - super.countDistinctProperty(alias, PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentAttemptRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PaymentAttemptRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, PaymentAttempt.VERSION_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupById(){ - groupBy(PaymentAttempt.ID_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByIdAs(String retName){ - groupBy(retName, PaymentAttempt.ID_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, PaymentAttempt.ID_PROPERTY, function); - return this; - } - public PaymentAttemptRequest groupByPaymentWith(PaymentRequest subRequest){ - groupBy(PaymentAttempt.PAYMENT_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByPaymentWith", null, "payment")); - return this; - } - public PaymentAttemptRequest groupByPayment(){ - groupBy(PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByPaymentAs(String retName){ - groupBy(retName, PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByPaymentWithFunction(String retName, AggrFunction function){ - groupBy(retName, PaymentAttempt.PAYMENT_PROPERTY, function); - return this; - } - - public PaymentAttemptRequest groupByReferenceCode(){ - groupBy(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByReferenceCodeAs(String retName){ - groupBy(retName, PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByReferenceCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, PaymentAttempt.REFERENCE_CODE_PROPERTY, function); - return this; - } - - public PaymentAttemptRequest groupByVersion(){ - groupBy(PaymentAttempt.VERSION_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByVersionAs(String retName){ - groupBy(retName, PaymentAttempt.VERSION_PROPERTY); - return this; - } - - public PaymentAttemptRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, PaymentAttempt.VERSION_PROPERTY, function); - return this; - } - - - - public PaymentAttemptRequest orderByIdAscending(){ - addOrderByAscending(PaymentAttempt.ID_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByIdDescending(){ - addOrderByDescending(PaymentAttempt.ID_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByPaymentAscending(){ - addOrderByAscending(PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByPaymentDescending(){ - addOrderByDescending(PaymentAttempt.PAYMENT_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByReferenceCodeAscending(){ - addOrderByAscending(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByReferenceCodeDescending(){ - addOrderByDescending(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentAttemptRequest orderByReferenceCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByReferenceCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(PaymentAttempt.REFERENCE_CODE_PROPERTY); - return this; - } - public PaymentAttemptRequest orderByVersionAscending(){ - addOrderByAscending(PaymentAttempt.VERSION_PROPERTY); - return this; - } - - public PaymentAttemptRequest orderByVersionDescending(){ - addOrderByDescending(PaymentAttempt.VERSION_PROPERTY); - return this; - } - - - public PaymentRequest rollUpToPayment(){ - PaymentRequest payment = Q.payments().unlimited(); - this.internalRollUpTo("payment", payment, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToPayment", null, "payment")); - return payment; - } - - - - - public PaymentAttemptRequest facetByPaymentAs(String facetName, PaymentRequest payment){ - return facetByPaymentAs(facetName, payment, true); - } - - public PaymentAttemptRequest facetByPaymentAs(String facetName, PaymentRequest payment, boolean includeAllFacets){ - addFacet(facetName, PaymentAttempt.PAYMENT_PROPERTY, payment, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByPaymentAs", facetName, PaymentAttempt.PAYMENT_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public PaymentAttemptRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PaymentAttemptRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PaymentAttemptRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PaymentAttemptRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PaymentAttemptRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PaymentAttemptRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java deleted file mode 100644 index fbcfc1fa5..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/Platform.java +++ /dev/null @@ -1,130 +0,0 @@ - -package com.teaql.tracechainservice.platform; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.SmartList; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Platform extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Platform"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "81fa96c3f6326be443cf018cd91970555d84dce1efa01c2aaee273740033ba30"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("name", 1), java.util.Map.entry("version", 2)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("name", java.util.List.of("name", "name")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( - "customer_order_list"); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Platform.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String NAME_PROPERTY = "name"; - public static final String CUSTOMER_ORDER_LIST_PROPERTY = "customer_order_list"; - private String name; - - private SmartList customerOrderList; - - public String getName(){ - return this.name; - } - - public SmartList getCustomerOrderList(){ - return this.customerOrderList == null ? SmartList.unloaded() : this.customerOrderList; - } - public Platform updateName(String name){ - name = (name == null ? null : name.trim()); - if(isPropertyLoaded(NAME_PROPERTY) && Objects.equals(this.name, name)){ - return this; - } - handleUpdate(NAME_PROPERTY, getName(), name); - this.name = name; - return this; - } - - public Platform addCustomerOrder(CustomerOrder customerOrder){ - if (customerOrder == null){ - return this; - } - - if(null == this.customerOrderList){ - SmartList teaqlUnloadedItems = SmartList.unloaded(); - this.customerOrderList = teaqlUnloadedItems.map(value -> value); - } - - this.customerOrderList.add(customerOrder); - customerOrder.updatePlatform(this); - return this; - } - - public static Platform refer(Long id){ - Platform refer = new Platform(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Platform comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "name": this.name = (value == null ? null : ((String)value).trim()); break; - - case "customer_order_list": this.customerOrderList = (SmartList) value; break; - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "name": return this.name; - case "customer_order_list": return this.customerOrderList; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "name": return this.name; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java deleted file mode 100644 index 3ae00c5a1..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformChecker.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.teaql.tracechainservice.platform; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class PlatformChecker implements Checker{ - - public String type(){ - return Platform.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if(needCheck(_context, platform)){ - markAsChecked(_context, platform); - doCheck(_context, platform, _parentLocation); - } - } - - public void doCheck(UserContext _context, Platform platform, ObjectLocation _parentLocation){ - if((platform == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, platform); - if(platform.needPersist()){ - } - if(platform.newItem()){ - }else if(platform.updateItem()){ - if(!platform.isPropertyLoaded("name")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "name"), "Mutation requires a fully loaded entity"); - } - - } - checkName(_context, platform.getProperty(Platform.NAME_PROPERTY), newLocation(_parentLocation, "name")); - for(int i = 0; platform.getCustomerOrderList() != null && i < platform.getCustomerOrderList().size(); i++){ - CustomerOrder customerOrder = platform.getCustomerOrderList().get(i); - new CustomerOrderChecker().checkAndFix(_context, customerOrder, newLocation(_parentLocation, "customer_order_list", i)); - } - } - - public void checkName(UserContext _context, String name, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, name); - if((name == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, name); - - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java deleted file mode 100644 index dfc331232..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformExpression.java +++ /dev/null @@ -1,51 +0,0 @@ - -package com.teaql.tracechainservice.platform; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderListExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class PlatformExpression extends ExpressionAdaptor implements BaseEntityExpression { - public PlatformExpression(Expression expression){ - super(expression); - } - - public PlatformExpression(Expression expression, Function function){ - super(expression, function); - } - - public PlatformExpression updateId(Long id){ - return new PlatformExpression(this, $it -> {((Platform)$it).__internalSet("id", id); return this;}); - } - - public PlatformExpression save(UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs("Saved by Expression").save(userContext)); - } - - public PlatformExpression save(String intent, UserContext userContext){ - return new PlatformExpression(this, $it -> ((Platform)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public Expression getName(){ - return loaded("name", "getName", Platform::getName); - } - public PlatformExpression updateName(String name){ - return new PlatformExpression(this, $it -> ((Platform)$it).updateName(name)); - } - - public CustomerOrderListExpression getCustomerOrderList(){ - return new CustomerOrderListExpression(loaded("customer_order_list", "getCustomerOrderList", Platform::getCustomerOrderList)); - } - public PlatformExpression addCustomerOrder(CustomerOrder customerOrder){ - return new PlatformExpression(this, $it -> ((Platform)$it).addCustomerOrder(customerOrder)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java deleted file mode 100644 index f32743588..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.tracechainservice.platform; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class PlatformListExpression extends SmartListExpression { - public PlatformListExpression(Expression> expression){ - super(expression); - } - - public PlatformListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public PlatformExpression first() { - return new PlatformExpression(super.first()); - } - - public PlatformExpression get(int index) { - return new PlatformExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java deleted file mode 100644 index 56b45f02b..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/platform/PlatformRequest.java +++ /dev/null @@ -1,623 +0,0 @@ - -package com.teaql.tracechainservice.platform; - -import com.teaql.tracechainservice.Q; -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class PlatformRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public PlatformRequest(Class returnType){ - this(returnType, () -> (T) new Platform()); - } - - protected PlatformRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public PlatformRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public PlatformRequest copy(){ - return (PlatformRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new PlatformRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public PlatformRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public PlatformRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public PlatformRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public PlatformRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public PlatformRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public PlatformRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public PlatformRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public PlatformRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public PlatformRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (PlatformRequest)super.appendSearchCriteria(searchCriteria); - } - - public PlatformRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public PlatformRequest matchingAnyOf(PlatformRequest platform){ - super.internalMatchAny(platform); - return this; - } - - public PlatformRequest matchingIdsOf(PlatformRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Platform.ID_PROPERTY, request, Platform.ID_PROPERTY)); - } - - public PlatformRequest enhanceChildrenIfNeeded(){ - return this; - } - - public PlatformRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public PlatformRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public PlatformRequest selectSelf(){ - super.selectSelf(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectSelfFields(){ - return selectSelf(); - } - - public PlatformRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Platform.ID_PROPERTY); - selectProperty(Platform.NAME_PROPERTY); - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest selectAll(){ - super.selectAll(); - return selectId().selectName().selectVersion(); - } - - public PlatformRequest selectChildren(){ - super.selectAny(); - selectCustomerOrderList(); - return selectId().selectName().selectVersion(); - } - - - public PlatformRequest selectId(){ - selectProperty(Platform.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectId(){ - unselectProperty(Platform.ID_PROPERTY); - return this; - } - public PlatformRequest selectName(){ - selectProperty(Platform.NAME_PROPERTY); - return this; - } - - /** - * fill the name with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS name) to fetch name property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectName(){ - unselectProperty(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest selectVersion(){ - selectProperty(Platform.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public PlatformRequest unselectVersion(){ - unselectProperty(Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest selectCustomerOrderList(){ - return selectCustomerOrderListWith(Q.customerOrders().selectSelf()); - } - - public PlatformRequest selectCustomerOrderListWith(CustomerOrderRequest customerOrderList){ - enhanceRelation(Platform.CUSTOMER_ORDER_LIST_PROPERTY, customerOrderList, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderListWith", null, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.ID_PROPERTY, operator, values); - } - - public PlatformRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public PlatformRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public PlatformRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public PlatformRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public PlatformRequest filterByName(String... name){ - if (name == null || name.length == 0) { - throw new IllegalArgumentException("filterByName parameter name cannot be empty"); - } - return appendSearchCriteria(createNameCriteria(Operator.EQUAL, (Object[])name)); - } - - public PlatformRequest withName(Operator operator, Object... values){ - return appendSearchCriteria(createNameCriteria(operator, values)); - } - - public PlatformRequest withNameIsUnknown(){ - return withName(Operator.IS_NULL); - } - - public PlatformRequest withNameIsKnown(){ - return withName(Operator.IS_NOT_NULL); - } - - public SearchCriteria createNameCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.NAME_PROPERTY, operator, values); - } - - public PlatformRequest withNameIsNot(String name){ - return withName(Operator.NOT_EQUAL, name); - } - - public PlatformRequest withNameIn(String... name){ - return withName(Operator.IN, (Object[])name); - } - - public PlatformRequest withNameNotIn(String... name){ - return withName(Operator.NOT_IN, (Object[])name); - } - public PlatformRequest withNameGreaterThan(String name){ - return withName(Operator.GREATER_THAN, name); - } - - public PlatformRequest withNameGreaterThanOrEqualTo(String name){ - return withName(Operator.GREATER_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameLessThan(String name){ - return withName(Operator.LESS_THAN, name); - } - - public PlatformRequest withNameLessThanOrEqualTo(String name){ - return withName(Operator.LESS_THAN_OR_EQUAL, name); - } - - public PlatformRequest withNameBetween(String startOfName, String endOfName){ - return withName(Operator.BETWEEN, startOfName, endOfName); - } - public PlatformRequest withNameStartingWith(String name){ - return withName(Operator.BEGIN_WITH, name); - } - public PlatformRequest withNameContaining(String name){ - return withName(Operator.CONTAIN, name); - } - - public PlatformRequest withNameNotContaining(String name){ - return withName(Operator.NOT_CONTAIN, name); - } - - public PlatformRequest withNameNotStartingWith(String name){ - return withName(Operator.NOT_BEGIN_WITH, name); - } - - public PlatformRequest withNameEndingWith(String name){ - return withName(Operator.END_WITH, name); - } - - public PlatformRequest withNameNotEndingWith(String name){ - return withName(Operator.NOT_END_WITH, name); - } - - public PlatformRequest withNameIs(String name){ - return withName(Operator.EQUAL, name); - } - - public PlatformRequest withNameSoundingLike(String name){ - return withName(Operator.SOUNDS_LIKE, name); - } - - - - public PlatformRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public PlatformRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public PlatformRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public PlatformRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Platform.VERSION_PROPERTY, operator, values); - } - - public PlatformRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public PlatformRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public PlatformRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public PlatformRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public PlatformRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public PlatformRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public PlatformRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public PlatformRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - public PlatformRequest withCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerOrderRequest, CustomerOrder.PLATFORM_PROPERTY)); - } - - public PlatformRequest withoutCustomerOrderListMatching(CustomerOrderRequest customerOrderRequest){ - return appendSearchCriteria(SearchCriteria.not(new SubQuerySearchCriteria(Platform.ID_PROPERTY, customerOrderRequest, CustomerOrder.PLATFORM_PROPERTY))); - } - - public PlatformRequest haveCustomerOrders(){ - return withCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public PlatformRequest haveNoCustomerOrders(){ - return withoutCustomerOrderListMatching(Q.customerOrders().unlimited()); - } - - public PlatformRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public PlatformRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public PlatformRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public PlatformRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Platform.ID_PROPERTY); - return this; - } - public PlatformRequest countDistinctName(){ - return countDistinctNameAs("name_distinct_count"); - } - - public PlatformRequest countDistinctNameAs(String alias){ - super.countDistinctProperty(alias, Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public PlatformRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Platform.VERSION_PROPERTY); - return this; - } - public PlatformRequest groupByCustomerOrdersWithDetails(CustomerOrderRequest subRequest){ - aggregate(Platform.CUSTOMER_ORDER_LIST_PROPERTY, subRequest); - return this; - } - - public PlatformRequest groupById(){ - groupBy(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdAs(String retName){ - groupBy(retName, Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.ID_PROPERTY, function); - return this; - } - - public PlatformRequest groupByName(){ - groupBy(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameAs(String retName){ - groupBy(retName, Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest groupByNameWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.NAME_PROPERTY, function); - return this; - } - - public PlatformRequest groupByVersion(){ - groupBy(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionAs(String retName){ - groupBy(retName, Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Platform.VERSION_PROPERTY, function); - return this; - } - - - - public PlatformRequest orderByIdAscending(){ - addOrderByAscending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByIdDescending(){ - addOrderByDescending(Platform.ID_PROPERTY); - return this; - } - - public PlatformRequest orderByNameAscending(){ - addOrderByAscending(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescending(){ - addOrderByDescending(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByNameAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - - public PlatformRequest orderByNameDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Platform.NAME_PROPERTY); - return this; - } - public PlatformRequest orderByVersionAscending(){ - addOrderByAscending(Platform.VERSION_PROPERTY); - return this; - } - - public PlatformRequest orderByVersionDescending(){ - addOrderByDescending(Platform.VERSION_PROPERTY); - return this; - } - - - public PlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(name, subRequest, false); - } - - public PlatformRequest statsFromCustomerOrdersAs(String name, CustomerOrderRequest subRequest, boolean singleResult){ - addRelationAggregate(name, subRequest, CustomerOrder.PLATFORM_PROPERTY, singleResult, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "statsFromCustomerOrdersAs", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest statsFromCustomerOrders(CustomerOrderRequest subRequest){ - return statsFromCustomerOrdersAs(REFINEMENTS, subRequest); - } - public PlatformRequest countCustomerOrders(){ - addRelationCount("Count", Q.customerOrders().unlimited(), CustomerOrder.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrders", null, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countCustomerOrdersAs(String name){ - addRelationCount(name, Q.customerOrders().unlimited(), CustomerOrder.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersAs", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - public PlatformRequest countCustomerOrdersWith(String name, CustomerOrderRequest subRequest){ - addRelationCount(name, subRequest, CustomerOrder.PLATFORM_PROPERTY, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_COUNT, "countCustomerOrdersWith", name, Platform.CUSTOMER_ORDER_LIST_PROPERTY)); - return this; - } - - - - /** - * get topN records - * @param topN records number - */ - public PlatformRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public PlatformRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public PlatformRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public PlatformRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public PlatformRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public PlatformRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/sampledata/SampleDataService.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java deleted file mode 100644 index aba60f2e7..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/Shipment.java +++ /dev/null @@ -1,128 +0,0 @@ - -package com.teaql.tracechainservice.shipment; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import io.teaql.core.Audited; -import io.teaql.core.BaseEntity; -import io.teaql.core.EntityStatus; -import io.teaql.core.FieldLayout; -import io.teaql.core.FrameworkInternal; -import io.teaql.core.RemoteInput; -import io.teaql.core.checker.JsonFieldNamingProfile; -import java.util.Objects; - -/** - * [TEAQL AI WARNING] - * TeaQL was explicitly designed to PREVENT AI hallucinations and random guessing. - * DO NOT GUESS METHOD NAMES! - * The methods listed below are the ONLY valid ways to interact with this entity. - * If you encounter compilation errors (e.g., method not found), DO NOT guess another method name. - * Read the method signatures in this file before proceeding. - */ -public class Shipment extends BaseEntity implements RemoteInput { - public static String INTERNAL_TYPE = "Shipment"; - - // Framework metadata: complete fixed layout, independent of SQL/projection order. - public static final String __TEAQL_FIELD_LAYOUT_REVISION = "c70893faccb3360294f70bb0d6b23a9b27af2975a33d01706b90254feff5a0cd"; - public static final java.util.Map __TEAQL_FIXED_FIELD_INDEXES = - java.util.Map.ofEntries(java.util.Map.entry("id", 0), java.util.Map.entry("customer_order", 1), java.util.Map.entry("reference_code", 2), java.util.Map.entry("version", 3)); - public static final java.util.Map> __TEAQL_FIXED_FIELD_MAPPINGS = - java.util.Map.ofEntries(java.util.Map.entry("id", java.util.List.of("id", "id")), java.util.Map.entry("customer_order", java.util.List.of("customerOrder", "customer_order")), java.util.Map.entry("reference_code", java.util.List.of("referenceCode", "reference_code")), java.util.Map.entry("version", java.util.List.of("version", "version"))); - public static final java.util.Set __TEAQL_FIXED_RELATION_NAMES = java.util.Set.of( -); - public static final FieldLayout __TEAQL_FIELD_LAYOUT = - FieldLayout.installGenerated(FieldLayout.generated( - Shipment.class, __TEAQL_FIELD_LAYOUT_REVISION, - __TEAQL_FIXED_FIELD_INDEXES, __TEAQL_FIXED_FIELD_MAPPINGS, __TEAQL_FIXED_RELATION_NAMES, - JsonFieldNamingProfile.fromModelValue("camelCase"))); - - - public static final String CUSTOMER_ORDER_PROPERTY = "customer_order"; - public static final String REFERENCE_CODE_PROPERTY = "reference_code"; - private CustomerOrder customerOrder; - - private String referenceCode; - - - public CustomerOrder getCustomerOrder(){ - return this.customerOrder; - } - - public String getReferenceCode(){ - return this.referenceCode; - } - - public Shipment updateCustomerOrder(CustomerOrder customerOrder){ - if(isPropertyLoaded(CUSTOMER_ORDER_PROPERTY) && Objects.equals(this.customerOrder, customerOrder)){ - return this; - } - handleUpdate(CUSTOMER_ORDER_PROPERTY, getCustomerOrder(), customerOrder); - this.customerOrder = customerOrder; - return this; - } - - public Shipment updateReferenceCode(String referenceCode){ - referenceCode = (referenceCode == null ? null : referenceCode.trim()); - if(isPropertyLoaded(REFERENCE_CODE_PROPERTY) && Objects.equals(this.referenceCode, referenceCode)){ - return this; - } - handleUpdate(REFERENCE_CODE_PROPERTY, getReferenceCode(), referenceCode); - this.referenceCode = referenceCode; - return this; - } - - - public static Shipment refer(Long id){ - Shipment refer = new Shipment(); - refer.__internalSet("id", id); - refer.set$status(EntityStatus.REFER); - return refer; - } - @Override - public String typeName(){ - return INTERNAL_TYPE; - } - - public Shipment comment(String comment){ - this.setComment(comment); - return this; - } - - @Override - @SuppressWarnings("unchecked") - public Audited auditAs(String action) { - return new Audited<>(this, action); - } - - // ===== Framework Internal: generated switch dispatch ===== - @Override - @FrameworkInternal - public void __internalSet(String property, Object value) { - markPropertyLoaded(property); - switch (property) { - case "customer_order": this.customerOrder = (CustomerOrder) value; break; - - case "reference_code": this.referenceCode = (value == null ? null : ((String)value).trim()); break; - - default: super.__internalSet(property, value); - } - } - - @Override - @FrameworkInternal - public Object __internalGet(String property) { - switch (property) { - case "customer_order": return this.customerOrder; - case "reference_code": return this.referenceCode; - default: - // Presentation uses the installed Java member mapping; SQL and - // hydration retain canonical names. These aliases only read. - switch (property) { - case "customerOrder": return this.customerOrder; - case "referenceCode": return this.referenceCode; - default: return super.__internalGet(property); - } - } - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java deleted file mode 100644 index aed815082..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentChecker.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.teaql.tracechainservice.shipment; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderChecker; -import io.teaql.core.UserContext; -import io.teaql.core.checker.Checker; -import io.teaql.core.checker.ObjectLocation; - -public class ShipmentChecker implements Checker{ - - public String type(){ - return Shipment.INTERNAL_TYPE; - } - - public void checkAndFix(UserContext _context, Shipment shipment, ObjectLocation _parentLocation){ - if(needCheck(_context, shipment)){ - markAsChecked(_context, shipment); - doCheck(_context, shipment, _parentLocation); - } - } - - public void doCheck(UserContext _context, Shipment shipment, ObjectLocation _parentLocation){ - if((shipment == null)){ - return; - } - boolean _contextFixEligible = needContextFix(_context, shipment); - if(shipment.needPersist()){ - } - if(shipment.newItem()){ - }else if(shipment.updateItem()){ - if(!shipment.isPropertyLoaded("customer_order")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "customer_order"), "Mutation requires a fully loaded entity"); - } - if(!shipment.isPropertyLoaded("reference_code")){ - invalidTypeCheck(_context, newLocation(_parentLocation, "reference_code"), "Mutation requires a fully loaded entity"); - } - - } - checkCustomerOrder(_context, shipment.getProperty(Shipment.CUSTOMER_ORDER_PROPERTY), newLocation(_parentLocation, "customer_order")); - checkReferenceCode(_context, shipment.getProperty(Shipment.REFERENCE_CODE_PROPERTY), newLocation(_parentLocation, "reference_code")); - } - - public void checkCustomerOrder(UserContext _context, CustomerOrder customerOrder, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, customerOrder); - if((customerOrder == null)){ - return; - } - new CustomerOrderChecker().checkAndFix(_context, customerOrder, _parentLocation); - } - public void checkReferenceCode(UserContext _context, String referenceCode, ObjectLocation _parentLocation){ - requiredCheck(_context, _parentLocation, referenceCode); - if((referenceCode == null)){ - return; - } - maxStringCheck(_context, _parentLocation, 100, referenceCode); - - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java deleted file mode 100644 index 61cbd74f8..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentExpression.java +++ /dev/null @@ -1,53 +0,0 @@ - -package com.teaql.tracechainservice.shipment; - -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderExpression; -import io.teaql.core.UserContext; -import io.teaql.core.value.BaseEntityExpression; -import io.teaql.core.value.Expression; -import io.teaql.core.value.ExpressionAdaptor; -import java.util.function.Function; - -public class ShipmentExpression extends ExpressionAdaptor implements BaseEntityExpression { - public ShipmentExpression(Expression expression){ - super(expression); - } - - public ShipmentExpression(Expression expression, Function function){ - super(expression, function); - } - - public ShipmentExpression updateId(Long id){ - return new ShipmentExpression(this, $it -> {((Shipment)$it).__internalSet("id", id); return this;}); - } - - public ShipmentExpression save(UserContext userContext){ - return new ShipmentExpression(this, $it -> ((Shipment)$it).auditAs("Saved by Expression").save(userContext)); - } - - public ShipmentExpression save(String intent, UserContext userContext){ - return new ShipmentExpression(this, $it -> ((Shipment)$it).auditAs(intent).save(userContext)); - } - - public boolean isNull() { - return resolve() == null; - } - - - public CustomerOrderExpression getCustomerOrder(){ - return new CustomerOrderExpression(loaded("customer_order", "getCustomerOrder", Shipment::getCustomerOrder)); - } - - public ShipmentExpression updateCustomerOrder(CustomerOrder customerOrder){ - return new ShipmentExpression(this, $it -> ((Shipment)$it).updateCustomerOrder(customerOrder)); - } - - public Expression getReferenceCode(){ - return loaded("reference_code", "getReferenceCode", Shipment::getReferenceCode); - } - public ShipmentExpression updateReferenceCode(String referenceCode){ - return new ShipmentExpression(this, $it -> ((Shipment)$it).updateReferenceCode(referenceCode)); - } - -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java deleted file mode 100644 index 01969ef0f..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentListExpression.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.teaql.tracechainservice.shipment; - -import io.teaql.core.SmartList; -import io.teaql.core.value.Expression; -import io.teaql.core.value.SmartListExpression; -import java.util.function.Function; - -public class ShipmentListExpression extends SmartListExpression { - public ShipmentListExpression(Expression> expression){ - super(expression); - } - - public ShipmentListExpression(Expression expression, Function> function){ - super(expression, function); - } - - public ShipmentExpression first() { - return new ShipmentExpression(super.first()); - } - - public ShipmentExpression get(int index) { - return new ShipmentExpression(super.get(index)); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java b/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java deleted file mode 100644 index 458288c02..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/java/com/teaql/tracechainservice/shipment/ShipmentRequest.java +++ /dev/null @@ -1,689 +0,0 @@ - -package com.teaql.tracechainservice.shipment; - -import com.teaql.tracechainservice.Q; -import com.teaql.tracechainservice.customerorder.CustomerOrder; -import com.teaql.tracechainservice.customerorder.CustomerOrderRequest; -import io.teaql.core.AggrFunction; -import io.teaql.core.BaseRequest; -import io.teaql.core.PropertyReference; -import io.teaql.core.SearchCriteria; -import io.teaql.core.SubQuerySearchCriteria; -import io.teaql.core.criteria.Operator; -import io.teaql.core.criteria.TwoOperatorCriteria; -import java.util.Objects; - -public class ShipmentRequest extends BaseRequest { - - /** - * @deprecated AI agents and business code must use the generated Q facade - * instead of constructing request builders directly. - */ - @Deprecated - @SuppressWarnings("unchecked") - public ShipmentRequest(Class returnType){ - this(returnType, () -> (T) new Shipment()); - } - - protected ShipmentRequest(Class returnType, java.util.function.Supplier factory){ - super(returnType, factory); - selectId(); - selectVersion(); - } - - public ShipmentRequest comment(String comment){ - super.internalComment(comment); - return this; - } - - /** Independent query graph; ordinary roll-up handles remain live. */ - @Override - @SuppressWarnings("unchecked") - public ShipmentRequest copy(){ - return (ShipmentRequest) super.copy(); - } - - @Override - @SuppressWarnings("unchecked") - protected io.teaql.core.BaseRequest internalCopyTarget(){ - return new ShipmentRequest<>((Class) returnType(), this::internalNewEntity); - } - - // purpose() 继承自 BaseRequest,返回 ExecutableRequest(终结方法) - - public ShipmentRequest returnType(Class returnType){ - super.setReturnType(returnType); - return this; - } - - public ShipmentRequest enableAggregationCache(long cacheExpiredMillis){ - super.enableAggregationCache(); - super.aggregateCacheTime(cacheExpiredMillis); - return this; - } - - public ShipmentRequest enableAggregationCache(){ - return enableAggregationCache(0l); - } - - - public ShipmentRequest propagateAggregationCache(long cacheExpiredMillis){ - super.propagateAggregationCache(cacheExpiredMillis); - return this; - } - - /** - * Accept best-effort stateful seek optimization for browsing consecutive pages. - * Do not use this for business processing that must visit every row exactly once. - */ - public ShipmentRequest optimizeForContinuousPageFetch(){ - super.optimizeForContinuousPageFetch(); - return this; - } - - public ShipmentRequest optimizeForContinuousPageFetch(String namespace, int ttlSeconds){ - super.optimizeForContinuousPageFetch(namespace, ttlSeconds); - return this; - } - - public ShipmentRequest optimizePaginationWithIdSet(){ - super.optimizePaginationWithIdSet(); - return this; - } - - public ShipmentRequest optimizePaginationWithIdSet( - String namespace, int ttlSeconds, int maxIds){ - super.optimizePaginationWithIdSet(namespace, ttlSeconds, maxIds); - return this; - } - - public ShipmentRequest topNProbeParentThreshold(int threshold){ - super.topNProbeParentThreshold(threshold); - return this; - } - - public ShipmentRequest appendSearchCriteria(SearchCriteria searchCriteria){ - return (ShipmentRequest)super.appendSearchCriteria(searchCriteria); - } - - public ShipmentRequest filter(String property1, Operator operator, String property2){ - return appendSearchCriteria(new TwoOperatorCriteria(operator, new PropertyReference(property1), new PropertyReference(property2))); - } - - - public ShipmentRequest matchingAnyOf(ShipmentRequest shipment){ - super.internalMatchAny(shipment); - return this; - } - - public ShipmentRequest matchingIdsOf(ShipmentRequest request){ - Objects.requireNonNull(request, "matching request"); - return appendSearchCriteria(new SubQuerySearchCriteria( - Shipment.ID_PROPERTY, request, Shipment.ID_PROPERTY)); - } - - public ShipmentRequest enhanceChildrenIfNeeded(){ - return this; - } - - public ShipmentRequest withDeletedRows(){ - super.withDeletedRows(); - return this; - } - - public ShipmentRequest deletedRowsOnly(){ - super.deletedRowsOnly(); - return this; - } - - public ShipmentRequest selectSelf(){ - super.selectSelf(); - return selectId().selectCustomerOrderIdOnly().selectReferenceCode().selectVersion(); - } - - public ShipmentRequest selectSelfFields(){ - return selectSelf(); - } - - public ShipmentRequest selectSelfWithoutParent(){ - selectId(); - selectVersion(); - selectProperty(Shipment.ID_PROPERTY); - selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); - selectProperty(Shipment.REFERENCE_CODE_PROPERTY); - selectProperty(Shipment.VERSION_PROPERTY); - return this; - } - - public ShipmentRequest selectAll(){ - super.selectAll(); - return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); - } - - public ShipmentRequest selectChildren(){ - super.selectAny(); - return selectId().selectCustomerOrder().selectReferenceCode().selectVersion(); - } - - - public ShipmentRequest selectId(){ - selectProperty(Shipment.ID_PROPERTY); - return this; - } - - /** - * fill the id with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS id) to fetch id property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ShipmentRequest unselectId(){ - unselectProperty(Shipment.ID_PROPERTY); - return this; - } - public ShipmentRequest selectCustomerOrderIdOnly(){ - selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public ShipmentRequest selectCustomerOrder(){ - return selectCustomerOrderWith(Q.customerOrders().unlimited().selectSelf()); - } - - public ShipmentRequest selectCustomerOrderWith(CustomerOrderRequest customerOrder){ - selectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); - enhanceRelation(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.RELATION_SELECT, "selectCustomerOrderWith", null, Shipment.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - public ShipmentRequest unselectCustomerOrder(){ - unselectProperty(Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - public ShipmentRequest selectReferenceCode(){ - selectProperty(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - - /** - * fill the referenceCode with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS referenceCode) to fetch referenceCode property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ShipmentRequest unselectReferenceCode(){ - unselectProperty(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - public ShipmentRequest selectVersion(){ - selectProperty(Shipment.VERSION_PROPERTY); - return this; - } - - /** - * fill the version with customized rawSqlSegment, TEAQL uses ({rawSqlSegment} AS version) to fetch version property. - * @param rawSqlSegment customized rawSqlSegment - */ - - - - - public ShipmentRequest unselectVersion(){ - unselectProperty(Shipment.VERSION_PROPERTY); - return this; - } - - public ShipmentRequest withId(Operator operator, Object... values){ - return appendSearchCriteria(createIdCriteria(operator, values)); - } - - public SearchCriteria createIdCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Shipment.ID_PROPERTY, operator, values); - } - - public ShipmentRequest withIdIsNot(Long id){ - return withId(Operator.NOT_EQUAL, id); - } - - public ShipmentRequest withIdIn(Long... id){ - return withId(Operator.IN, (Object[])id); - } - - public ShipmentRequest withIdNotIn(Long... id){ - return withId(Operator.NOT_IN, (Object[])id); - } - public ShipmentRequest withIdIs(Long id){ - return withId(Operator.EQUAL, id); - } - - - - public ShipmentRequest filterByCustomerOrder(CustomerOrder... customerOrder){ - if (customerOrder == null || customerOrder.length == 0) { - throw new IllegalArgumentException("filterByCustomerOrder parameter customerOrder cannot be empty"); - } - return appendSearchCriteria(createCustomerOrderCriteria(Operator.EQUAL, (Object[])customerOrder)); - } - - public ShipmentRequest withCustomerOrder(Operator operator, Object... values){ - return appendSearchCriteria(createCustomerOrderCriteria(operator, values)); - } - - public ShipmentRequest withCustomerOrderIsUnknown(){ - return withCustomerOrder(Operator.IS_NULL); - } - - public ShipmentRequest withCustomerOrderIsKnown(){ - return withCustomerOrder(Operator.IS_NOT_NULL); - } - - public SearchCriteria createCustomerOrderCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Shipment.CUSTOMER_ORDER_PROPERTY, operator, values); - } - - public ShipmentRequest filterByCustomerOrder(Long customerOrder){ - if(customerOrder == null){ - return this; - } - return withCustomerOrder(Operator.EQUAL, customerOrder); - } - public ShipmentRequest withCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(new SubQuerySearchCriteria(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY)); - } - - public ShipmentRequest withoutCustomerOrderMatching(CustomerOrderRequest customerOrder){ - return appendSearchCriteria(SearchCriteria.not( - new SubQuerySearchCriteria(Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, CustomerOrder.ID_PROPERTY))); - } - - public ShipmentRequest filterByReferenceCode(String... referenceCode){ - if (referenceCode == null || referenceCode.length == 0) { - throw new IllegalArgumentException("filterByReferenceCode parameter referenceCode cannot be empty"); - } - return appendSearchCriteria(createReferenceCodeCriteria(Operator.EQUAL, (Object[])referenceCode)); - } - - public ShipmentRequest withReferenceCode(Operator operator, Object... values){ - return appendSearchCriteria(createReferenceCodeCriteria(operator, values)); - } - - public ShipmentRequest withReferenceCodeIsUnknown(){ - return withReferenceCode(Operator.IS_NULL); - } - - public ShipmentRequest withReferenceCodeIsKnown(){ - return withReferenceCode(Operator.IS_NOT_NULL); - } - - public SearchCriteria createReferenceCodeCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Shipment.REFERENCE_CODE_PROPERTY, operator, values); - } - - public ShipmentRequest withReferenceCodeIsNot(String referenceCode){ - return withReferenceCode(Operator.NOT_EQUAL, referenceCode); - } - - public ShipmentRequest withReferenceCodeIn(String... referenceCode){ - return withReferenceCode(Operator.IN, (Object[])referenceCode); - } - - public ShipmentRequest withReferenceCodeNotIn(String... referenceCode){ - return withReferenceCode(Operator.NOT_IN, (Object[])referenceCode); - } - public ShipmentRequest withReferenceCodeGreaterThan(String referenceCode){ - return withReferenceCode(Operator.GREATER_THAN, referenceCode); - } - - public ShipmentRequest withReferenceCodeGreaterThanOrEqualTo(String referenceCode){ - return withReferenceCode(Operator.GREATER_THAN_OR_EQUAL, referenceCode); - } - - public ShipmentRequest withReferenceCodeLessThan(String referenceCode){ - return withReferenceCode(Operator.LESS_THAN, referenceCode); - } - - public ShipmentRequest withReferenceCodeLessThanOrEqualTo(String referenceCode){ - return withReferenceCode(Operator.LESS_THAN_OR_EQUAL, referenceCode); - } - - public ShipmentRequest withReferenceCodeBetween(String startOfReferenceCode, String endOfReferenceCode){ - return withReferenceCode(Operator.BETWEEN, startOfReferenceCode, endOfReferenceCode); - } - public ShipmentRequest withReferenceCodeStartingWith(String referenceCode){ - return withReferenceCode(Operator.BEGIN_WITH, referenceCode); - } - public ShipmentRequest withReferenceCodeContaining(String referenceCode){ - return withReferenceCode(Operator.CONTAIN, referenceCode); - } - - public ShipmentRequest withReferenceCodeNotContaining(String referenceCode){ - return withReferenceCode(Operator.NOT_CONTAIN, referenceCode); - } - - public ShipmentRequest withReferenceCodeNotStartingWith(String referenceCode){ - return withReferenceCode(Operator.NOT_BEGIN_WITH, referenceCode); - } - - public ShipmentRequest withReferenceCodeEndingWith(String referenceCode){ - return withReferenceCode(Operator.END_WITH, referenceCode); - } - - public ShipmentRequest withReferenceCodeNotEndingWith(String referenceCode){ - return withReferenceCode(Operator.NOT_END_WITH, referenceCode); - } - - public ShipmentRequest withReferenceCodeIs(String referenceCode){ - return withReferenceCode(Operator.EQUAL, referenceCode); - } - - public ShipmentRequest withReferenceCodeSoundingLike(String referenceCode){ - return withReferenceCode(Operator.SOUNDS_LIKE, referenceCode); - } - - - - public ShipmentRequest filterByVersion(Long... version){ - if (version == null || version.length == 0) { - throw new IllegalArgumentException("filterByVersion parameter version cannot be empty"); - } - return appendSearchCriteria(createVersionCriteria(Operator.EQUAL, (Object[])version)); - } - - public ShipmentRequest withVersion(Operator operator, Object... values){ - return appendSearchCriteria(createVersionCriteria(operator, values)); - } - - public ShipmentRequest withVersionIsUnknown(){ - return withVersion(Operator.IS_NULL); - } - - public ShipmentRequest withVersionIsKnown(){ - return withVersion(Operator.IS_NOT_NULL); - } - - public SearchCriteria createVersionCriteria(Operator operator, Object... values) { - return createBasicSearchCriteria(Shipment.VERSION_PROPERTY, operator, values); - } - - public ShipmentRequest withVersionIs(Long version){ - return withVersion(Operator.EQUAL, version); - } - - public ShipmentRequest withVersionIsNot(Long version){ - return withVersion(Operator.NOT_EQUAL, version); - } - - public ShipmentRequest withVersionIn(Long... version){ - return withVersion(Operator.IN, (Object[])version); - } - - public ShipmentRequest withVersionNotIn(Long... version){ - return withVersion(Operator.NOT_IN, (Object[])version); - } - public ShipmentRequest withVersionGreaterThan(Long version){ - return withVersion(Operator.GREATER_THAN, version); - } - - public ShipmentRequest withVersionGreaterThanOrEqualTo(Long version){ - return withVersion(Operator.GREATER_THAN_OR_EQUAL, version); - } - - public ShipmentRequest withVersionLessThan(Long version){ - return withVersion(Operator.LESS_THAN, version); - } - - public ShipmentRequest withVersionLessThanOrEqualTo(Long version){ - return withVersion(Operator.LESS_THAN_OR_EQUAL, version); - } - - public ShipmentRequest withVersionBetween(Long startOfVersion, Long endOfVersion){ - return withVersion(Operator.BETWEEN, startOfVersion, endOfVersion); - } - - - - public ShipmentRequest count(){ - super.count(); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "count", null, null)); - return this; - } - public ShipmentRequest countAs(String retName){ - super.count(retName); - setPageCountOperation(io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.NAMED_COUNT, "countAs", retName, null)); - return this; - } - public ShipmentRequest groupByCustomerOrderWithDetails(){ - return groupByCustomerOrderWithDetails(Q.customerOrders().unlimited()); - } - - public ShipmentRequest groupByCustomerOrderWithDetails(CustomerOrderRequest subRequest){ - aggregate(Shipment.CUSTOMER_ORDER_PROPERTY, subRequest); - return this; - } - - - - public ShipmentRequest countDistinctId(){ - return countDistinctIdAs("id_distinct_count"); - } - - public ShipmentRequest countDistinctIdAs(String alias){ - super.countDistinctProperty(alias, Shipment.ID_PROPERTY); - return this; - } - public ShipmentRequest countDistinctCustomerOrder(){ - return countDistinctCustomerOrderAs("customer_order_distinct_count"); - } - - public ShipmentRequest countDistinctCustomerOrderAs(String alias){ - super.countDistinctProperty(alias, Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - public ShipmentRequest countDistinctReferenceCode(){ - return countDistinctReferenceCodeAs("reference_code_distinct_count"); - } - - public ShipmentRequest countDistinctReferenceCodeAs(String alias){ - super.countDistinctProperty(alias, Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - public ShipmentRequest countDistinctVersion(){ - return countDistinctVersionAs("version_distinct_count"); - } - - public ShipmentRequest countDistinctVersionAs(String alias){ - super.countDistinctProperty(alias, Shipment.VERSION_PROPERTY); - return this; - } - - public ShipmentRequest groupById(){ - groupBy(Shipment.ID_PROPERTY); - return this; - } - - public ShipmentRequest groupByIdAs(String retName){ - groupBy(retName, Shipment.ID_PROPERTY); - return this; - } - - public ShipmentRequest groupByIdWithFunction(String retName, AggrFunction function){ - groupBy(retName, Shipment.ID_PROPERTY, function); - return this; - } - public ShipmentRequest groupByCustomerOrderWith(CustomerOrderRequest subRequest){ - groupBy(Shipment.CUSTOMER_ORDER_PROPERTY, subRequest, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "groupByCustomerOrderWith", null, "customer_order")); - return this; - } - public ShipmentRequest groupByCustomerOrder(){ - groupBy(Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public ShipmentRequest groupByCustomerOrderAs(String retName){ - groupBy(retName, Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public ShipmentRequest groupByCustomerOrderWithFunction(String retName, AggrFunction function){ - groupBy(retName, Shipment.CUSTOMER_ORDER_PROPERTY, function); - return this; - } - - public ShipmentRequest groupByReferenceCode(){ - groupBy(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - - public ShipmentRequest groupByReferenceCodeAs(String retName){ - groupBy(retName, Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - - public ShipmentRequest groupByReferenceCodeWithFunction(String retName, AggrFunction function){ - groupBy(retName, Shipment.REFERENCE_CODE_PROPERTY, function); - return this; - } - - public ShipmentRequest groupByVersion(){ - groupBy(Shipment.VERSION_PROPERTY); - return this; - } - - public ShipmentRequest groupByVersionAs(String retName){ - groupBy(retName, Shipment.VERSION_PROPERTY); - return this; - } - - public ShipmentRequest groupByVersionWithFunction(String retName, AggrFunction function){ - groupBy(retName, Shipment.VERSION_PROPERTY, function); - return this; - } - - - - public ShipmentRequest orderByIdAscending(){ - addOrderByAscending(Shipment.ID_PROPERTY); - return this; - } - - public ShipmentRequest orderByIdDescending(){ - addOrderByDescending(Shipment.ID_PROPERTY); - return this; - } - - public ShipmentRequest orderByCustomerOrderAscending(){ - addOrderByAscending(Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public ShipmentRequest orderByCustomerOrderDescending(){ - addOrderByDescending(Shipment.CUSTOMER_ORDER_PROPERTY); - return this; - } - - public ShipmentRequest orderByReferenceCodeAscending(){ - addOrderByAscending(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - - public ShipmentRequest orderByReferenceCodeDescending(){ - addOrderByDescending(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - public ShipmentRequest orderByReferenceCodeAscendingUsingGBK(){ - addOrderByAscendingUsingGBK(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - - public ShipmentRequest orderByReferenceCodeDescendingUsingGBK(){ - addOrderByDescendingUsingGBK(Shipment.REFERENCE_CODE_PROPERTY); - return this; - } - public ShipmentRequest orderByVersionAscending(){ - addOrderByAscending(Shipment.VERSION_PROPERTY); - return this; - } - - public ShipmentRequest orderByVersionDescending(){ - addOrderByDescending(Shipment.VERSION_PROPERTY); - return this; - } - - - public CustomerOrderRequest rollUpToCustomerOrder(){ - CustomerOrderRequest customerOrder = Q.customerOrders().unlimited(); - this.internalRollUpTo("customer_order", customerOrder, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.AGGREGATE, "rollUpToCustomerOrder", null, "customer_order")); - return customerOrder; - } - - - - - public ShipmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder){ - return facetByCustomerOrderAs(facetName, customerOrder, true); - } - - public ShipmentRequest facetByCustomerOrderAs(String facetName, CustomerOrderRequest customerOrder, boolean includeAllFacets){ - addFacet(facetName, Shipment.CUSTOMER_ORDER_PROPERTY, customerOrder, includeAllFacets, - io.teaql.core.QueryOperation.nativeMethod(io.teaql.core.QueryOperation.Kind.FACET, "facetByCustomerOrderAs", facetName, Shipment.CUSTOMER_ORDER_PROPERTY)); - return this; - } - - - /** - * get topN records - * @param topN records number - */ - public ShipmentRequest top(int topN) { - super.top(topN); - return this; - } - - /** Cross-runtime bounded-query alias. */ - public ShipmentRequest limit(int limit) { - return top(limit); - } - - /** - * get records from offset(inclusive) to offset+size(exclusive) - * @param offset record offset - * @param size records number - */ - public ShipmentRequest offset(int offset, int size) { - super.offset(offset, size); - return this; - } - - /** - * retrieve all records - */ - public ShipmentRequest unlimited() { - super.unlimited(); - return this; - } - - /** - * get records of one page - * @param pageNumber page number(1-based) - * @param pageSize page size - */ - public ShipmentRequest page(int pageNumber, int pageSize) { - int offset = (pageNumber - 1) * pageSize; - return offset(offset, pageSize); - } - - /** - * get records of one page, default page size is 10 - * @param pageNumber page number(1-based) - */ - public ShipmentRequest page(int pageNumber) { - return page(pageNumber, 10); - } -} \ No newline at end of file diff --git a/examples/trace-chain/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler b/examples/trace-chain/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler deleted file mode 100644 index ccb7914c4..000000000 --- a/examples/trace-chain/java-app-console/lib/src/main/resources/META-INF/services/io.teaql.core.meta.EntityMetaAssembler +++ /dev/null @@ -1,2 +0,0 @@ - -com.teaql.tracechainservice.EntityMetaRegistry \ No newline at end of file diff --git a/examples/trace-chain/showcase.json b/examples/trace-chain/showcase.json index 7f460b404..c4dd76d6a 100644 --- a/examples/trace-chain/showcase.json +++ b/examples/trace-chain/showcase.json @@ -45,6 +45,7 @@ ], "generatedFilesManifestSHA256": "9334c3c2f4c242922eed10f4dc1dbca1897c02add8118477e9ec6c3ac4d5034c", "root": "java-app-console", - "scope": "java-app-console" + "scope": "java-app-console", + "useSiblingMavenLibrary": true } } From cc7593411a9272817a0e5d15778ebe913667d52f Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 23:07:18 +0800 Subject: [PATCH 66/71] Build Java examples against the sibling Maven module from Make --- examples/business-id-runtime/java-app-console/Makefile | 4 ++-- examples/business-id-runtime/showcase.json | 3 ++- .../conformance/context-derived/java-app-console/Makefile | 4 ++-- examples/conformance/context-derived/showcase.json | 3 ++- .../conformance/natural-messages/java-app-console/Makefile | 4 ++-- examples/conformance/natural-messages/showcase.json | 3 ++- examples/exact-decimal/java-app-console/Makefile | 4 ++-- examples/exact-decimal/showcase.json | 3 ++- examples/fix-e-alignment/java-app-console/Makefile | 4 ++-- examples/fix-e-alignment/showcase.json | 3 ++- examples/http-resilience/java-app-console/Makefile | 4 ++-- examples/http-resilience/showcase.json | 3 ++- examples/inheritance-save/java-app-console/Makefile | 4 ++-- examples/inheritance-save/showcase.json | 3 ++- examples/object-storage/java-app-console/Makefile | 4 ++-- examples/object-storage/showcase.json | 3 ++- .../round-trip-reference-runtime/java-app-console/Makefile | 4 ++-- examples/round-trip-reference-runtime/showcase.json | 3 ++- examples/scalar-type-probe/java-app-console/Makefile | 4 ++-- examples/scalar-type-probe/showcase.json | 3 ++- examples/security-foundations/java-app-console/Makefile | 4 ++-- examples/security-foundations/showcase.json | 3 ++- examples/shared-load-state/java-app-console/Makefile | 4 ++-- examples/shared-load-state/showcase.json | 3 ++- examples/standard-order/java-app-console/Makefile | 4 ++-- examples/standard-order/showcase.json | 3 ++- examples/trace-chain/java-app-console/Makefile | 4 ++-- examples/trace-chain/showcase.json | 3 ++- 28 files changed, 56 insertions(+), 42 deletions(-) diff --git a/examples/business-id-runtime/java-app-console/Makefile b/examples/business-id-runtime/java-app-console/Makefile index 3165e8179..80a7574a4 100644 --- a/examples/business-id-runtime/java-app-console/Makefile +++ b/examples/business-id-runtime/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/business-id-runtime/showcase.json b/examples/business-id-runtime/showcase.json index c12300df4..c916c134f 100644 --- a/examples/business-id-runtime/showcase.json +++ b/examples/business-id-runtime/showcase.json @@ -38,7 +38,8 @@ "workspace": { "applicationOwnedFiles": [ "src/main/java/com/teaql/purchaseordernumbering/App.java", - "src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java" + "src/main/java/com/teaql/purchaseordernumbering/PurchaseOrderNumbering.java", + "Makefile" ], "generatedFilesManifestSHA256": "9ab05c103dd98dc0d7fc51f06cb2f7f8a4cef03524711b74101853c1dbbba719", "root": "java-app-console", diff --git a/examples/conformance/context-derived/java-app-console/Makefile b/examples/conformance/context-derived/java-app-console/Makefile index 5a619a025..d9a08b766 100644 --- a/examples/conformance/context-derived/java-app-console/Makefile +++ b/examples/conformance/context-derived/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/conformance/context-derived/showcase.json b/examples/conformance/context-derived/showcase.json index 41e5c16a1..d2e08fe70 100644 --- a/examples/conformance/context-derived/showcase.json +++ b/examples/conformance/context-derived/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "showcase-tests/io/teaql/examples/contextfix/GeneratedContextFixTest.java" + "showcase-tests/io/teaql/examples/contextfix/GeneratedContextFixTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "eb0ca431c33d68437fa9acf909d95825b07f9788f1b60597b1e7242dfe934383", "root": "java-app-console", diff --git a/examples/conformance/natural-messages/java-app-console/Makefile b/examples/conformance/natural-messages/java-app-console/Makefile index 23a481828..06a7ba2e8 100644 --- a/examples/conformance/natural-messages/java-app-console/Makefile +++ b/examples/conformance/natural-messages/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/conformance/natural-messages/showcase.json b/examples/conformance/natural-messages/showcase.json index 22eaf9119..6c61e0c6c 100644 --- a/examples/conformance/natural-messages/showcase.json +++ b/examples/conformance/natural-messages/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "showcase-tests/io/teaql/examples/naturalmessages/GeneratedNaturalMessagesTest.java" + "showcase-tests/io/teaql/examples/naturalmessages/GeneratedNaturalMessagesTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "4c158e97fa019cace80ded4119dcc0fa26c4dc397ac1e6f2d78ff32389bafa6a", "root": "java-app-console", diff --git a/examples/exact-decimal/java-app-console/Makefile b/examples/exact-decimal/java-app-console/Makefile index 48708e7f4..e3b06dac1 100644 --- a/examples/exact-decimal/java-app-console/Makefile +++ b/examples/exact-decimal/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/exact-decimal/showcase.json b/examples/exact-decimal/showcase.json index e2d6886da..9ede5b497 100644 --- a/examples/exact-decimal/showcase.json +++ b/examples/exact-decimal/showcase.json @@ -40,7 +40,8 @@ "applicationOwnedFiles": [ "src/main/java/com/example/exactdecimalservice/GeneratedExactDecimalProbe.java", "src/main/java/com/example/exactdecimalservice/GeneratedWorkspaceStartupProbe.java", - "src/main/java/com/example/exactdecimalservice/GeneratedMemoryAggregateProbe.java" + "src/main/java/com/example/exactdecimalservice/GeneratedMemoryAggregateProbe.java", + "Makefile" ], "generatedFilesManifestSHA256": "32b7b30df0b016e6ca704ec9fc7058a5554c3b4de03cf55e9d001c5319351eac", "root": "java-app-console", diff --git a/examples/fix-e-alignment/java-app-console/Makefile b/examples/fix-e-alignment/java-app-console/Makefile index d70154818..25a129162 100644 --- a/examples/fix-e-alignment/java-app-console/Makefile +++ b/examples/fix-e-alignment/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/fix-e-alignment/showcase.json b/examples/fix-e-alignment/showcase.json index b184e316d..b8cb23be0 100644 --- a/examples/fix-e-alignment/showcase.json +++ b/examples/fix-e-alignment/showcase.json @@ -56,7 +56,8 @@ "showcase-tests/io/teaql/examples/fixe/PostFixExampleTest.java", "showcase-tests/io/teaql/examples/fixe/RequestIntentExampleTest.java", "showcase-tests/io/teaql/examples/fixe/ReviewedPlanExampleTest.java", - "showcase-tests/io/teaql/examples/fixe/PartialAncestorExampleTest.java" + "showcase-tests/io/teaql/examples/fixe/PartialAncestorExampleTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "392d8007c9b153e118e0615ea854f9feebf073cd17ebbdd755ac925850e4d116", "root": "java-app-console", diff --git a/examples/http-resilience/java-app-console/Makefile b/examples/http-resilience/java-app-console/Makefile index f017cc0ce..c91e1464d 100644 --- a/examples/http-resilience/java-app-console/Makefile +++ b/examples/http-resilience/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/http-resilience/showcase.json b/examples/http-resilience/showcase.json index 92e08a974..27e1756bd 100644 --- a/examples/http-resilience/showcase.json +++ b/examples/http-resilience/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java" + "src/test/java/com/teaql/supplierordersyncservice/SupplierOrderSyncTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "e3eb258f2b8cdf6fec76425ed308d03b9f2193632ba785b1d558a80cf76b6dca", "root": "java-app-console", diff --git a/examples/inheritance-save/java-app-console/Makefile b/examples/inheritance-save/java-app-console/Makefile index c866d2733..f33449662 100644 --- a/examples/inheritance-save/java-app-console/Makefile +++ b/examples/inheritance-save/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/inheritance-save/showcase.json b/examples/inheritance-save/showcase.json index b331a9a84..3360e66c0 100644 --- a/examples/inheritance-save/showcase.json +++ b/examples/inheritance-save/showcase.json @@ -38,7 +38,8 @@ ], "workspace": { "applicationOwnedFiles": [ - "pom.xml" + "pom.xml", + "Makefile" ], "generatedFilesManifestSHA256": "c3cf5b1379d400f885c7926a1d849c3459bfdda20933cf97d4bbaab79babbb13", "root": "java-app-console", diff --git a/examples/object-storage/java-app-console/Makefile b/examples/object-storage/java-app-console/Makefile index 700007da4..a3c33a6ef 100644 --- a/examples/object-storage/java-app-console/Makefile +++ b/examples/object-storage/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/object-storage/showcase.json b/examples/object-storage/showcase.json index 8202584d5..4a27a5d4f 100644 --- a/examples/object-storage/showcase.json +++ b/examples/object-storage/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "src/main/java/com/teaql/orderattachmentservice/App.java" + "src/main/java/com/teaql/orderattachmentservice/App.java", + "Makefile" ], "generatedFilesManifestSHA256": "9b50d62f8a83f6cd23192b8ea0e03758ad109fb6a1692ef2ab090bc1ce278b9f", "root": "java-app-console", diff --git a/examples/round-trip-reference-runtime/java-app-console/Makefile b/examples/round-trip-reference-runtime/java-app-console/Makefile index 97f7c7adf..ea2494f93 100644 --- a/examples/round-trip-reference-runtime/java-app-console/Makefile +++ b/examples/round-trip-reference-runtime/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/round-trip-reference-runtime/showcase.json b/examples/round-trip-reference-runtime/showcase.json index 5790b5643..3b788743a 100644 --- a/examples/round-trip-reference-runtime/showcase.json +++ b/examples/round-trip-reference-runtime/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java" + "src/test/java/com/teaql/ordereditreference/OrderReferenceEditorTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "1a34d54140420df516ae53cca73e99dd5107187dddef4679221b36aabc883f73", "root": "java-app-console", diff --git a/examples/scalar-type-probe/java-app-console/Makefile b/examples/scalar-type-probe/java-app-console/Makefile index f74fb595d..bf699f4d1 100644 --- a/examples/scalar-type-probe/java-app-console/Makefile +++ b/examples/scalar-type-probe/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/scalar-type-probe/showcase.json b/examples/scalar-type-probe/showcase.json index 426b89e7d..d76380856 100644 --- a/examples/scalar-type-probe/showcase.json +++ b/examples/scalar-type-probe/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java" + "src/main/java/com/example/freightquotesettlement/FreightQuoteShowcase.java", + "Makefile" ], "generatedFilesManifestSHA256": "1157a515e32373a53a8284422c878f0e433e9d4870e4ca779ca7e88ba36384fa", "root": "java-app-console", diff --git a/examples/security-foundations/java-app-console/Makefile b/examples/security-foundations/java-app-console/Makefile index 8c479e405..e9d8069b1 100644 --- a/examples/security-foundations/java-app-console/Makefile +++ b/examples/security-foundations/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/security-foundations/showcase.json b/examples/security-foundations/showcase.json index eb604955e..138beb7ba 100644 --- a/examples/security-foundations/showcase.json +++ b/examples/security-foundations/showcase.json @@ -39,7 +39,8 @@ "workspace": { "applicationOwnedFiles": [ "pom.xml", - "src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java" + "src/test/java/com/teaql/merchantorderprivacyservice/MerchantOrderPrivacyTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "80da3356c9c341da63759603e86f6d6694bc1f974e0110bd3a298fa38553da82", "root": "java-app-console", diff --git a/examples/shared-load-state/java-app-console/Makefile b/examples/shared-load-state/java-app-console/Makefile index c47aac570..effb2e277 100644 --- a/examples/shared-load-state/java-app-console/Makefile +++ b/examples/shared-load-state/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/shared-load-state/showcase.json b/examples/shared-load-state/showcase.json index 5c48925b6..706848ab7 100644 --- a/examples/shared-load-state/showcase.json +++ b/examples/shared-load-state/showcase.json @@ -39,7 +39,8 @@ ], "workspace": { "applicationOwnedFiles": [ - "pom.xml" + "pom.xml", + "Makefile" ], "generatedFilesManifestSHA256": "d775132150c44c4ad87a568c69c62c71d9d4a8454e80977b020c9a9c1c761b4f", "root": "java-app-console", diff --git a/examples/standard-order/java-app-console/Makefile b/examples/standard-order/java-app-console/Makefile index 88045ce8b..5c93e2d8e 100644 --- a/examples/standard-order/java-app-console/Makefile +++ b/examples/standard-order/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/standard-order/showcase.json b/examples/standard-order/showcase.json index 2c82adbf7..b6a3ada30 100644 --- a/examples/standard-order/showcase.json +++ b/examples/standard-order/showcase.json @@ -40,7 +40,8 @@ "applicationOwnedFiles": [ "pom.xml", "src/test/java/com/example/requesttreeorderservice/StandardOrderGraphStreamTelemetryTest.java", - "src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java" + "src/test/java/com/example/requesttreeorderservice/StandardOrderTelemetryTest.java", + "Makefile" ], "generatedFilesManifestSHA256": "0f6b10bd4045061b0caf8f1434c305b3bac40e34cfb7a93463242c99a85b87cd", "root": "java-app-console", diff --git a/examples/trace-chain/java-app-console/Makefile b/examples/trace-chain/java-app-console/Makefile index c07be7789..893375e0f 100644 --- a/examples/trace-chain/java-app-console/Makefile +++ b/examples/trace-chain/java-app-console/Makefile @@ -18,11 +18,11 @@ generate-lib: ./gen-lib.sh || echo "Please ensure gen-lib.sh exists or run teaql code generator manually" build: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn clean package -DskipTests test: - mvn -f lib/pom.xml install -DskipTests + mvn -f ../java-lib-core/lib/pom.xml install -DskipTests mvn test run: build diff --git a/examples/trace-chain/showcase.json b/examples/trace-chain/showcase.json index c4dd76d6a..37af0d6a7 100644 --- a/examples/trace-chain/showcase.json +++ b/examples/trace-chain/showcase.json @@ -41,7 +41,8 @@ ], "workspace": { "applicationOwnedFiles": [ - "pom.xml" + "pom.xml", + "Makefile" ], "generatedFilesManifestSHA256": "9334c3c2f4c242922eed10f4dc1dbca1897c02add8118477e9ec6c3ac4d5034c", "root": "java-app-console", From d9525bcaeab4642d24f6a578a390091f0cae2f9c Mon Sep 17 00:00:00 2001 From: Philip Z Date: Fri, 20 Nov 2026 23:42:28 +0800 Subject: [PATCH 67/71] Verify the Java decimal workspace against its single domain module --- examples/exact-decimal/verify-local.cjs | 15 ++++++++++++++- scripts/verify-examples.sh | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/examples/exact-decimal/verify-local.cjs b/examples/exact-decimal/verify-local.cjs index 56e95dd83..73aaa4d54 100644 --- a/examples/exact-decimal/verify-local.cjs +++ b/examples/exact-decimal/verify-local.cjs @@ -82,12 +82,25 @@ try { function verifyScopes() { assert.deepEqual(generatedHashes(library), scopes['java-lib-core']); const observed = generatedHashes(app); + assert.equal(spec.workspace.useSiblingMavenLibrary, true); + assert(!fs.existsSync(path.join(app, 'lib')), 'Workspace must consume the sibling library'); for (const [name, digest] of Object.entries(scopes['java-app-console'])) { + if (name.startsWith('lib/')) { + if (name !== 'lib/pom.xml') assert.equal(scopes['java-lib-core'][name], digest, name); + continue; + } + if (name === 'Makefile') { + const installed = fs.readFileSync(path.join(app, name), 'utf8'); + const sibling = 'mvn -f ../java-lib-core/lib/pom.xml'; + assert.equal(installed.split(sibling).length, 3); + assert.equal(sha(installed.replaceAll(sibling, 'mvn -f lib/pom.xml')), digest, name); + continue; + } assert.equal(observed[name], digest, 'generated workspace file changed: ' + name); } } verifyScopes(); - generated = {modelSha256, producer: spec.producer, files: scopes}; + generated = {modelSha256, producer: spec.producer, files: scopes, workspaceUsesSiblingMavenLibrary: true}; fs.writeFileSync(path.join(evidence, "generated-manifest.json"), JSON.stringify(generated, null, 2) + "\n"); const reactor = path.join(scratch, "pom.xml"); fs.writeFileSync(reactor, '4.0.0io.teaql.testexact-decimal-source-reactor0.0.0pomruntimeruntime/examples/exact-decimal/java-lib-core/libruntime/examples/exact-decimal/java-app-console\n'); diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index 198ce6e77..e5c2b7cde 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash set -euo pipefail +mode="${1:-}" +if [[ "$#" -gt 1 || ( "$mode" != "" && "$mode" != "--after-shared-load-state" ) ]]; then + echo "Usage: bash scripts/verify-examples.sh [--after-shared-load-state]" >&2 + exit 2 +fi + repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" evidence_dir="${TEAQL_EXAMPLES_EVIDENCE_DIR:-$(mktemp -d -t teaql-java-examples-evidence.XXXXXXXX)}" verification_dir="$evidence_dir/runtime" @@ -22,6 +28,7 @@ if [[ "${actual[*]}" != "${expected[*]}" ]]; then fi cd "$repo" +if [[ -z "$mode" ]]; then # This verifier needs original Git provenance and already creates its own # disposable source-paired reactor. It never builds in the source repository. node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/fix-e-alignment/verify-local.cjs" @@ -56,10 +63,17 @@ TEAQL_JAVA_STANDARD_ORDER_EVIDENCE_DIR="$verification_dir/standard-order" bash e TEAQL_CODEGEN_DIR="$build_dir/generator" bash examples/shared-load-state/verify.sh --generate TEAQL_LOAD_STATE_EVIDENCE_DIR="$evidence_dir/shared-load-state" bash examples/shared-load-state/verify.sh --workspace TEAQL_MAINSTREAM_EVIDENCE_DIR="$evidence_dir/mainstream-reference" bash examples/shared-load-state/benchmark-mainstream.sh --workspace +else + mvn -q -DskipTests install +fi TEAQL_JAVA_EXACT_EVIDENCE_DIR="$evidence_dir/exact-decimal" \ bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/exact-decimal/verify.sh" TEAQL_FREIGHT_QUOTE_EVIDENCE_DIR="$evidence_dir/freight-quotes" bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-freight-quotes.sh" node "$repo/examples/conformance/context-derived/verify-local.cjs" TEAQL_NATURAL_MESSAGES_EVIDENCE_DIR="$evidence_dir/natural-messages" \ node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/conformance/natural-messages/verify-local.cjs" -echo "PASS: all Java examples" +if [[ -z "$mode" ]]; then + echo "PASS: all Java examples" +else + echo "PASS: Java examples after shared load state" +fi From c670c65b4d351a93a4d8a0f81e2db2c07ce44cbc Mon Sep 17 00:00:00 2001 From: Philip Z Date: Mon, 23 Nov 2026 21:27:36 +0800 Subject: [PATCH 68/71] Retain all main scalar regression gates during workspace migration (#290) --- scripts/verify-examples.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scripts/verify-examples.sh b/scripts/verify-examples.sh index e5c2b7cde..7ce31a5fc 100755 --- a/scripts/verify-examples.sh +++ b/scripts/verify-examples.sh @@ -69,6 +69,40 @@ fi TEAQL_JAVA_EXACT_EVIDENCE_DIR="$evidence_dir/exact-decimal" \ bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/exact-decimal/verify.sh" TEAQL_FREIGHT_QUOTE_EVIDENCE_DIR="$evidence_dir/freight-quotes" bash "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-freight-quotes.sh" +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/scalar-type-probe" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/scalar-finite" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --finite +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/restoration-views" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --restoration-views +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/outer-replay" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --outer-replay +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/jdbc-exact" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --jdbc-exact +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/sql-millisecond" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --sql-millis +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/empty-aggregates" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --empty +TEAQL_JAVA_SCALAR_EVIDENCE_DIR="$evidence_dir/memory-empty-aggregates" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-local.cjs" --memory-empty +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-profiles" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-lifecycle" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --lifecycle +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-numeric" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --numeric +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-temporal" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --temporal +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/json-local-datetime" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --local-datetime +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/rejected-mutation" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --rejected +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/explicit-null" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --explicit-null +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/loaded-revert" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --loaded-revert +TEAQL_JAVA_JSON_PROFILE_EVIDENCE_DIR="$evidence_dir/version-lifecycle" \ + node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/scalar-type-probe/verify-json-profiles.cjs" --version-lifecycle node "$repo/examples/conformance/context-derived/verify-local.cjs" TEAQL_NATURAL_MESSAGES_EVIDENCE_DIR="$evidence_dir/natural-messages" \ node "${TEAQL_JAVA_EXAMPLE_SOURCE_ROOT:-$repo}/examples/conformance/natural-messages/verify-local.cjs" From 2ab31da77cd2661395514ffd2bb69368f6a87cb2 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Mon, 23 Nov 2026 21:39:05 +0800 Subject: [PATCH 69/71] Prime standalone console dependencies before offline examples (#290) --- .github/workflows/example-gate.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/example-gate.yml b/.github/workflows/example-gate.yml index 92c19eea1..47c5c7ed7 100644 --- a/.github/workflows/example-gate.yml +++ b/.github/workflows/example-gate.yml @@ -73,6 +73,11 @@ jobs: # Keep its offline checks; prepare a fresh runner before they start. run: | mvn -B -ntp install + # These standalone console dependencies are absent from generated + # library manifests and are used by the offline workspace checks. + for artifact in com.zaxxer:HikariCP:6.3.0 org.mybatis:mybatis:3.5.19 org.codehaus.mojo:exec-maven-plugin:3.5.0; do + mvn -B -ntp org.apache.maven.plugins:maven-dependency-plugin:3.8.1:get "-Dartifact=$artifact" + done node <<'NODE' const fs = require('node:fs'), path = require('node:path'), os = require('node:os'), cp = require('node:child_process'); const runtime = process.cwd(), owned = fs.mkdtempSync(path.join(os.tmpdir(), 'teaql-ci-example-dependencies-')); From a8d9f2228329f130e74a8ed14bb1627d45737c7e Mon Sep 17 00:00:00 2001 From: Philip Z Date: Mon, 23 Nov 2026 21:51:41 +0800 Subject: [PATCH 70/71] Prime the standalone order attachment reactor before offline verification (#290) --- .github/workflows/example-gate.yml | 14 ++++++++++++++ examples/object-storage/verify.sh | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example-gate.yml b/.github/workflows/example-gate.yml index 47c5c7ed7..1a060507b 100644 --- a/.github/workflows/example-gate.yml +++ b/.github/workflows/example-gate.yml @@ -93,6 +93,20 @@ jobs: cp.execFileSync('mvn', ['-B', '-ntp', '-f', selected, 'org.apache.maven.plugins:maven-dependency-plugin:3.8.1:go-offline'], {stdio: 'inherit'}); } + // Resolve the standalone console reactor's actual mediated runtime + // dependencies. Dependency go-offline alone visits a different + // Netty version through this workspace's Spring/AWS dependency graph. + const attachmentSource = path.join(runtime, 'examples/object-storage'); + const attachment = path.join(owned, 'order-attachment-workspace'); + fs.mkdirSync(attachment); + fs.copyFileSync(path.join(attachmentSource, 'workspace-pom.xml'), path.join(attachment, 'pom.xml')); + for (const role of ['java-lib-core', 'java-app-console']) { + fs.cpSync(path.join(attachmentSource, role), path.join(attachment, role), { + recursive: true, filter: file => path.basename(file) !== 'target', + }); + } + cp.execFileSync('mvn', ['-B', '-ntp', '-f', path.join(attachment, 'pom.xml'), + '-DskipTests', 'install'], {stdio: 'inherit'}); } finally { fs.rmSync(owned, {recursive: true}); } diff --git a/examples/object-storage/verify.sh b/examples/object-storage/verify.sh index 4c3dadb0e..50c7f6fc6 100644 --- a/examples/object-storage/verify.sh +++ b/examples/object-storage/verify.sh @@ -30,7 +30,10 @@ mvn -o -B -pl examples/object-storage,teaql-sqlite,teaql-provider-jdbc -am -Dtea -Dsurefire.failIfNoSpecifiedTests=false install 2>&1 | tee "$evidence/s3-calibration.log" cp "$example/workspace-pom.xml" "$scratch/pom.xml" cp -R "$example/java-lib-core" "$example/java-app-console" "$scratch/" -mvn -o -f "$scratch/pom.xml" -DskipTests install > "$evidence/workspace-build.log" 2>&1 +if ! mvn -o -f "$scratch/pom.xml" -DskipTests install > "$evidence/workspace-build.log" 2>&1; then + tail -80 "$evidence/workspace-build.log" >&2 + exit 1 +fi jar="$scratch/java-lib-core/lib/target/order-attachment-service-core-0.0.1-SNAPSHOT.jar" installed="$TEAQL_MAVEN_DEPENDENCY_CACHE/com/teaql/order-attachment-service-core/0.0.1-SNAPSHOT/${jar##*/}" cmp "$jar" "$installed" From 026b934e6fd15ae5158e27431f13f8698c187551 Mon Sep 17 00:00:00 2001 From: Philip Z Date: Mon, 23 Nov 2026 22:01:58 +0800 Subject: [PATCH 71/71] Keep the current Hutool security pin in the moved Java workspaces (#290) --- examples/conformance/java-lib-core/lib/pom.xml | 2 +- examples/order-management/java-lib-core/lib/pom.xml | 2 +- examples/school-management/java-lib-core/lib/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/conformance/java-lib-core/lib/pom.xml b/examples/conformance/java-lib-core/lib/pom.xml index 45181c5ca..a32db6075 100644 --- a/examples/conformance/java-lib-core/lib/pom.xml +++ b/examples/conformance/java-lib-core/lib/pom.xml @@ -82,7 +82,7 @@ cn.hutool hutool-all - 5.8.20 + 5.8.47 diff --git a/examples/order-management/java-lib-core/lib/pom.xml b/examples/order-management/java-lib-core/lib/pom.xml index 3b3244119..6fd5fd306 100644 --- a/examples/order-management/java-lib-core/lib/pom.xml +++ b/examples/order-management/java-lib-core/lib/pom.xml @@ -82,7 +82,7 @@ cn.hutool hutool-all - 5.8.20 + 5.8.47 diff --git a/examples/school-management/java-lib-core/lib/pom.xml b/examples/school-management/java-lib-core/lib/pom.xml index ca269438a..ce38f19da 100644 --- a/examples/school-management/java-lib-core/lib/pom.xml +++ b/examples/school-management/java-lib-core/lib/pom.xml @@ -82,7 +82,7 @@ cn.hutool hutool-all - 5.8.20 + 5.8.47